How to use DeviceIOControl with FSCTL_GET_VOLUME_BITMAP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I need to check if there is the volume large enough to accept the entire
file, I need to save my file on continuous clusters.

So, I decide to use DeviceIOControl with FSCTL_GET_VOLUME_BITMAP, however, I
always get AccessViolation when printing GetLastError(), also I cannot get
the BITMAP.

Generally, I use the following:

hVolume = CreateFile("\\\\.\\f:",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);

stStartLCN.StartingLcn.QuadPart = 0;

bResult = DeviceIoControl(hVolume,
FSCTL_GET_VOLUME_BITMAP,
&stStartLCN,
sizeof(stStartLCN),
vbb,
sizeof(*vbb) + (512 * sizeof VOLUME_BITMAP_BUFFER)),

&junk,
(LPOVERLAPPED) NULL);

Also, how do I use vbb to check a continuous cluster space?

Any help will be highly appreciated. Thank you in advance for your time.

Sincerely,

bbdd
 
Back
Top