tags:

views:

1432

answers:

2

I can get the HDD serial number using ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia"), and for each ManagementObject from the result set I can read the serial number.

I am interested in another way of obtaining this information (without WMI) for IDE and SATA HDD, since I get mixed results with my current approach.

Edit - It seems that the only alternative is using DeviceIoControl. Can anyone point me to a full example of C# code invoking DeviceIoControl? I have no experience using P/Invoke.

Environment: C# 2.0, Windows 2000 or newer.

+3  A: 

http://www.winsim.com/diskid32/

Windows programmer
+3  A: 

@ Windows programmer: thank you.

I have found an article which includes a downloadable C# project using diskid32 at Code Project.

alexandrul