How to get hard drive id in 64 bit window 8.1 using c # .net

I use:

private String HDDId()
{            
  String serialNo = string.Empty;
  DriveListEx diskInfo = new DriveListEx();
  diskInfo.Load();            
  return serialNo = diskInfo[0].SerialNumber;
} 

      

But it doesn't work on 64-bit Windows 8.1 and it talks about the wrong format. I don't know how to fix this.

+3


source to share


1 answer


I am assuming you are using an external DLL (probably from here, although you did not list it: http://www.codeproject.com/Articles/16941/Get-Physical-HDD-Serial-Number-without-WMI ) which uses own code.

The released DLL on this page is for 32-bit only. If you want to use it on the 64-bit version (as noted in the article in the article), you need to compile it for the 64-bit version with the necessary include / lib folders.



Quoting the page:

This assembly is for Windows XP 32-bit systems. If you need it for Vista or 64-bit systems, you must select the correct include and lib folders when building and should not use additional DLLs from the release.zip archive, as they are 32-bit for Windows XP.

0


source







All Articles