RawDisk.CreateFile method
Filter:
Pascal C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NETOverview
Opens raw access to the file being locked by other process or inaccessible in other way due to security constraints
Declaration
[Pascal]
class function CreateFile(
FileName : WideString;
DesiredAccess : DWORD;
CreationDisposition : DWORD;
FlagsAndAttributes : DWORD;
LicenseKey : WideString) : THandle;
[C++ (DLL/Lib)]
static HANDLE CreateFile(
unsigned short* FileName,
unsigned long DesiredAccess,
unsigned long CreationDisposition
unsigned long FlagsAndAttributes,
unsigned short* LicenseKey);
[C++ (VCL)]
static THandle __fastcall CreateFile(
WideString FileName,
unsigned long DesiredAccess,
unsigned long CreationDisposition,
unsigned long FlagsAndAttributes,
WideString LicenseKey);
[C++ (.NET)]
static HANDLE CreateFile(
String^ FileName,
long DesiredAccess,
long CreationDisposition,
long FlagsAndAttributes,
String^ LicenseKey);
[C#]
static HANDLE CreateFile(
string FileName,
int DesiredAccess,
int CreationDisposition,
int FlagsAndAttributes,
string LicenseKey)
[VB.NET]
Shared Function CreateFile(
ByVal FileName As String,
ByVal DesiredAccess As Integer,
ByVal CreationDisposition As Integer,
ByVal FlagsAndAttributes As Integer,
ByVal LicenseKey As String) As HANDLE
Parameters
- FileName - 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
- CreationDisposition - Any set of constants, used in dwCreationDisposition parameter of CreateFile() function in Windows API.
- FlagsAndAttributes - Any set of constants, used in dwFlagsAndAttributes parameter of CreateFile() function 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 file and obtain it's handle. The function is useful when the file is exclusively opened by some other process or when your code doesn't have enough security rights or permissions to access this file in a standard way (using CreateFile() function in Windows API). The obtained handle must be used with ReadFile() and WriteFile() functions of Windows API.
Once you finished using the direct access to the file, call CloseHandle() Windows API function to release the resources.
The constants for DesiredAccess, CreationDisposition and FlagsAndAttributes parameters can be found in the description of CreateFile() function of Windows API in MSDN Library.
