RawDisk.Open method
Filter:
Pascal C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
Opens raw access to the volume and returns the volume handle
Declaration
[Pascal]
class function Open(
DeviceName : WideString;
DesiredAccess : DWORD;
LicenseKey : WideString) : THandle;
[C++ (DLL/Lib)]
static HANDLE Open(
unsigned short* DeviceName,
unsigned long DesiredAccess,
unsigned short* LicenseKey);
[C++ (VCL)]
static THandle __fastcall Open(
WideString DeviceName,
unsigned long DesiredAccess,
WideString LicenseKey);
[C++ (.NET)]
static HANDLE Open(
String^ DeviceName,
long DesiredAccess,
String^ LicenseKey);
[C#]
static HANDLE Open(
string DeviceName,
int DesiredAccess,
string LicenseKey)
[VB.NET]
Shared Function Open(
ByVal DeviceName As String,
ByVal DesiredAccess As Integer,
ByVal LicenseKey As String) As HANDLE
Parameters
- DeviceName - Required device name to open (with full path in the windows object namespace). Eg: "\??\C:" or "\??\PhysicalDrive0".
- DesiredAccess - Desired access, eg. GENERIC_READ | GENERIC_WRITE. The constants are defined in Windows API
- LicenseKey - The license key. RawDisk doesn't work without the license key (either production or evaluation). You can request the evaluation license key via request form.
[DLL] Return values
The handle of the device or 0 if the device could not be opened.
Description
Use this function to open the device and obtain it's handle. The obtained handle must be used with ReadFile(), WriteFile() and DeviceIoControl() functions of Windows API.
Once you finished using the direct access to the device, call CloseHandle() Windows API function to release the resources.
The name of the device can be obtained using an utility, offered by Microsoft.
The constants for DesiredAccess parameter can be found in the description of CreateFile() function of Windows API in MSDN Library.
This method doesn't unmount the volume and if you plan to make modifications to raw disk structure, you can corrupt the data (or your changes can be overwritten). Use OpenEx method to unmount the volume before accessing it.
Þ