示例#1
0
        private static HardDiskInfo GetHardDiskInfo(IdSector phdinfo)
        {
            HardDiskInfo hddInfo = new HardDiskInfo();

            ChangeByteOrder(phdinfo.sModelNumber);
            hddInfo.ModuleNumber = Encoding.ASCII.GetString(phdinfo.sModelNumber).Trim();

            ChangeByteOrder(phdinfo.sFirmwareRev);
            hddInfo.Firmware = Encoding.ASCII.GetString(phdinfo.sFirmwareRev).Trim();

            ChangeByteOrder(phdinfo.sSerialNumber);
            hddInfo.SerialNumber = Encoding.ASCII.GetString(phdinfo.sSerialNumber).Trim();

            hddInfo.Capacity = phdinfo.ulTotalAddressableSectors / 2 / 1024;

            return(hddInfo);
        }
示例#2
0
        /// <summary>
        /// 第一块硬盘序列号
        /// </summary>
        public string GetDiskSN()
        {
            HardDiskInfo disk = new HardDiskInfo();

            disk.Capacity     = 0;
            disk.Firmware     = "";
            disk.ModuleNumber = "";
            disk.SerialNumber = "";
            string ret = "";

            try
            {
                disk = AtapiDevice.GetHddInfo(0);
                ret  = disk.SerialNumber.Trim();
            }
            catch
            {
            }
            return(ret);
        }