CreateFileMapping() fails for Volume

I'm having problem with mapping part of volume to memory. Volume is opened successfully, I can read from it, but CreateFileMapping() fails. GetLastError() returns 87, which has following meaning: "The parameter is incorrect." I've created image of the volume and it is handled correctly. This is how I open file and create mapping:

/* open function */
fd->handle = CreateFile(name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/* mapping function */
LARGE_INTEGER li;
li.QuadPart = offset;
handle = CreateFileMapping(fd->handle, NULL, PAGE_READONLY, li.u.HighPart, li.u.LowPart, NULL);

I'm working on Windows XP SP3 (but code should also work on newer versions), administrator account.

Answers


CreateFileMapping only supports mapping files. It's returning the "The parameter is incorrect" because the handle isn't for a file.


Need Your Help

Recover Magento checkout details where customer goes to Paypal and never returns

php magento paypal checkout

When using Paypal Standard or Paypal Express, customers are directed to the Paypal website to either complete the sale, or sign in to their Paypal accounts to verify payment, respectively. There i...