DeviceIoControl() function is working differently in Windows 7 and Windows 8

1.2k Views Asked by At

I am trying to get the Hard Disk Serial using DeviceIoControl function. And calling it with same parameters it gives different value in output buffer.

I am caliing it as

  if ( DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_STORAGE_QUERY_PROPERTY,
                    & query,
                    sizeof (query),
                    & buffer,
                    sizeof (buffer),
                    & cbBytesReturned, NULL) )

where hPhysicalDriveIOCTL = CreateFile (TEXT(deviceName), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

0

There are 0 best solutions below