Filter:Pascal C++ (DLL/Lib) C++ (VCL) C++ (.NET) C# VB.NET
Opens raw access to the volume, unmounts the volume and returns the volume handle
- 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.
- ForceUnmount - This parameter specifies whether the device should be unmounted even when there are open files on this device.
- UnmountFailed - On return the parameter specifies whether the device has been actually unmounted.
The handle of the device.
Use this method to unmount and open the device. The obtained handle must be used with ReadFile(), WriteFile() and DeviceIoControl() functions of Windows API. Unmounting is strongly advised if you are going to to change the file system metadata (FAT, MFT tables etc) which can be accessed by the file system at the time of change.
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.
It can happen that unmounting fails (for example, if the disk contains pagefile or system files). If you have set ForceUnmount parameter to false and unmounting fails, then the function will return error. If you have set ForceUnmount to true and unmounting fails, the device is opened anyway, but UnmountFailed is set to true. It's recommended not to change any information on the device if unmounting failed, as such changes can corrupt the file system or just be lost.
If you don't plan to access file system metadata, it's recommended that you use Open method instead.
If the method fails for whatever reason, an exception with Windows-defined error code is thrown.