1、C#读硬盘序列号的原代码Postedon2006-01-2700:09似水无痕阅读(230)评论(0) 编辑收藏所属分类:.net技术public class IDE { [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)] internal struct IDSECTOR { public ushort wGenConfig; public ushort wNumCyls; public ushort wReserved; public ushort wNumHeads; p
2、ublic ushort wBytesPerTrack; public ushort wBytesPerSector; public ushort wSectorsPerTrack; [ MarshalAs( UnmanagedType.ByValArray, SizeConst=3)] public ushort [] wVendorUnique; [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=20)] public string sSerialNumber; public ushort w
3、BufferType; public ushort wBufferSize; public ushort wECCSize; [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=8)] public string sFirmwareRev; [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=40)] public string sModelNumber; public ushort wMoreVendorUnique; public ushort wDo
4、ubleWordIO; public ushort wCapabilities; public ushort wReserved1; public ushort wPIOTiming; public ushort wDMATiming; public ushort wBS; public ushort wNumCurrentCyls; public ushort wNumCurrentHeads; public ushort wNumCurrentSectorsPerTrack; public uint ulCurrentSectorCapa
5、city; public ushort wMultSectorStuff; public uint ulTotalAddressableSectors; public ushort wSingleWordDMA; public ushort wMultiWordDMA; [ MarshalAs( UnmanagedType.ByValArray, SizeConst=128 )] public byte [] bReserved; } [StructLayout(LayoutKind.Sequential)] internal struct
6、DRIVERSTATUS { public byte bDriverError; public byte bIDEStatus; [ MarshalAs( UnmanagedType.ByValArray, SizeConst=2 )] public byte [] bReserved; [ MarshalAs( UnmanagedType.ByValArray, SizeConst=2 )] public uint [] dwReserved; } [StructLayout(LayoutKind.Sequential)] internal
7、 struct SENDCMDOUTPARAMS { public uint cBufferSize; public DRIVERSTATUS DriverStatus; [ MarshalAs( UnmanagedType.ByValArray, SizeConst=513 )] public byte [] bBuffer; } [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)] internal struct SRB_IO_CONTROL { public uint H
8、eaderLength; [ MarshalAs( UnmanagedType.ByValTStr, SizeConst=8 )] public string Si