2

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);

Drew McGowen
  • 11,471
  • 1
  • 31
  • 57
dmittal
  • 59
  • 1
  • 4
  • And what is different? Do you get an error? – Sergey Podobry Jan 23 '14 at 12:59
  • @SergeyPodobry I am not getting any error. The value retuned by DeviceIoControl() in "buffer" is different in win7 and win8 (I am passing same arguments in both cases). And using this value of "buffer" I have to retrieve Hard Disk Serial, so it is getting different values of same Hard Disk in win7 and wind8. – dmittal Jan 24 '14 at 04:45
  • What is `deviceName`? Show us full code and output. – Rohan Jan 25 '14 at 07:12
  • @Rohan deviename is "\\\\.\\PhysicalDrive0" – dmittal Jan 31 '14 at 06:50

0 Answers0