In Windows it's possible to open devices and volumes via CreateFile()
. I've used this successfully before to ReadFile()
from devices, but now I want to switch to memory-mapping. In the following code, I receive INVALID_HANDLE_VALUE
for the value of b
, and c
is set to 87
, ERROR_INVALID_PARAMETER
.
HANDLE a = ::CreateFileA("\\\\.\\h:", GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_NO_BUFFERING, NULL);
HANDLE b = ::CreateFileMappingA(a, NULL, PAGE_READONLY, 0, 0, NULL);
DWORD c = ::GetLastError();
How can I get this to work?