Filter:Pascal C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NET
Opens raw access to the file being locked by other process or inaccessible in other way due to security constraints
Shared Function CreateFile( ByVal FileName As String, ByVal DesiredAccess As Integer, ByVal CreationDisposition As Integer, ByVal FlagsAndAttributes As Integer, ByVal LicenseKey As String) As IntPtr
- FileName - The name of the file to be created or opened.
- 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.
The handle of the device.
Use this method to open the file and obtain it's handle. The method 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.
If the method fails for whatever reason, an exception with Windows-defined error code is thrown.