一台机器硬件序列号哪些在格式化后始终不变化的?(1分)

  • 主题发起人 主题发起人 foxgirl
  • 开始时间 开始时间
F

foxgirl

Unregistered / Unconfirmed
GUEST, unregistred user!
用哪个API取得啊,请举个例子,谢了。
 
我也不知道。<br>但是我想知道
 
bios序列号,无api,用asm吧
 
网卡MAC号,是不会变的。
 
每台机器bios是唯一的吗?
 
网卡号是全球唯一的。<br>//uses Windows, SysUtils, NB30, 以下为类型定义及函数代码 <br>const sNetBiosError = "NetBIOS错误%d"; <br>type TMACAddress = packed array[0..5] of Byte; <br>ENetBiosError = class( Exception ); <br>TAStat = record Adapt : TAdapterStatus;<br>NameBuff : array[0..30] of TNameBuffer; <br>end;<br>function GetMacAddress( AdapterNum : Integer ) : TMACAddress; <br>var<br>Ncb : TNCB; uRetCode : Char; <br> J : Integer; Adapter : TAStat; <br>begin <br>FillChar( NCB, SizeOf(NCB), 0 ); <br> with NCB do begin <br> ncb_command := Char(NCBRESET);<br> ncb_lana_num := Char( AdapterNum ); <br>end; <br> uRetCode := Netbios( @Ncb ); <br> if uRetCode &lt;&gt; #0 then raise Exception.CreateFmt( sNetBIOSError, [Ord(uRetCode)] ); <br>  FillChar( NCB, SizeOf(NCB), 0 ); <br>  with NCB do begin<br>  ncb_command := Char(NCBASTAT);<br>  ncb_lana_num := Char( AdapterNum ); <br>  StrCopy( ncb_callname, "* " );<br>  ncb_buffer := @Adapter; <br>  ncb_length := sizeof(Adapter); <br>end; <br> uRetCode := Netbios( @Ncb ); <br> if uRetCode &lt;&gt; #0 then raise Exception.CreateFmt( sNetBIOSError, [Ord(uRetCode)] ); <br> for J := 0 to 5 do <br>  Result[J] := Ord( Adapter.Adapt.Adapter_address[J] );<br>end;
 
如果没有网卡怎么办??
 
对啊,如果没有网卡呢?
 
硬盘序列号可以得到;
 
unit Idesn;<br><br>interface<br><br>uses Windows, SysUtils;<br><br>function GetIdeDiskSerialNumber(): string;<br>function GetIdeSN(num: integer): string;<br><br>implementation<br><br>uses SEShare;<br><br>function GetIdeDiskSerialNumber() : String;<br>type<br>&nbsp; TSrbIoControl = packed record<br>&nbsp; &nbsp; HeaderLength : ULONG;<br>&nbsp; &nbsp; Signature : Array[0..7] of Char;<br>&nbsp; &nbsp; Timeout : ULONG;<br>&nbsp; &nbsp; ControlCode : ULONG;<br>&nbsp; &nbsp; ReturnCode : ULONG;<br>&nbsp; &nbsp; Length : ULONG;<br>&nbsp; end;<br>&nbsp; SRB_IO_CONTROL = TSrbIoControl;<br>&nbsp; PSrbIoControl = ^TSrbIoControl;<br><br>&nbsp; TIDERegs = packed record<br>&nbsp; &nbsp; bFeaturesReg : Byte; // Used for specifying SMART "commands".<br>&nbsp; &nbsp; bSectorCountReg : Byte; // IDE sector count register<br>&nbsp; &nbsp; bSectorNumberReg : Byte; // IDE sector number register<br>&nbsp; &nbsp; bCylLowReg : Byte; // IDE low order cylinder value<br>&nbsp; &nbsp; bCylHighReg : Byte; // IDE high order cylinder value<br>&nbsp; &nbsp; bDriveHeadReg : Byte; // IDE drive/head register<br>&nbsp; &nbsp; bCommandReg : Byte; // Actual IDE command.<br>&nbsp; &nbsp; bReserved : Byte; // reserved. Must be zero.<br>&nbsp; end;<br>&nbsp; IDEREGS = TIDERegs;<br>&nbsp; PIDERegs = ^TIDERegs;<br><br>&nbsp; TSendCmdInParams = packed record<br>&nbsp; &nbsp; cBufferSize : DWORD;<br>&nbsp; &nbsp; irDriveRegs : TIDERegs;<br>&nbsp; &nbsp; bDriveNumber : Byte;<br>&nbsp; &nbsp; bReserved : Array[0..2] of Byte;<br>&nbsp; &nbsp; dwReserved : Array[0..3] of DWORD;<br>&nbsp; &nbsp; bBuffer : Array[0..0] of Byte;<br>&nbsp; end;<br>&nbsp; SENDCMDINPARAMS = TSendCmdInParams;<br>&nbsp; PSendCmdInParams = ^TSendCmdInParams;<br><br>&nbsp; TIdSector = packed record<br>&nbsp; &nbsp; wGenConfig : Word;<br>&nbsp; &nbsp; wNumCyls : Word;<br>&nbsp; &nbsp; wReserved : Word;<br>&nbsp; &nbsp; wNumHeads : Word;<br>&nbsp; &nbsp; wBytesPerTrack : Word;<br>&nbsp; &nbsp; wBytesPerSector : Word;<br>&nbsp; &nbsp; wSectorsPerTrack : Word;<br>&nbsp; &nbsp; wVendorUnique : Array[0..2] of Word;<br>&nbsp; &nbsp; sSerialNumber : Array[0..19] of Char;<br>&nbsp; &nbsp; wBufferType : Word;<br>&nbsp; &nbsp; wBufferSize : Word;<br>&nbsp; &nbsp; wECCSize : Word;<br>&nbsp; &nbsp; sFirmwareRev : Array[0..7] of Char;<br>&nbsp; &nbsp; sModelNumber : Array[0..39] of Char;<br>&nbsp; &nbsp; wMoreVendorUnique : Word;<br>&nbsp; &nbsp; wDoubleWordIO : Word;<br>&nbsp; &nbsp; wCapabilities : Word;<br>&nbsp; &nbsp; wReserved1 : Word;<br>&nbsp; &nbsp; wPIOTiming : Word;<br>&nbsp; &nbsp; wDMATiming : Word;<br>&nbsp; &nbsp; wBS : Word;<br>&nbsp; &nbsp; wNumCurrentCyls : Word;<br>&nbsp; &nbsp; wNumCurrentHeads : Word;<br>&nbsp; &nbsp; wNumCurrentSectorsPerTrack : Word;<br>&nbsp; &nbsp; ulCurrentSectorCapacity : ULONG;<br>&nbsp; &nbsp; wMultSectorStuff : Word;<br>&nbsp; &nbsp; ulTotalAddressableSectors : ULONG;<br>&nbsp; &nbsp; wSingleWordDMA : Word;<br>&nbsp; &nbsp; wMultiWordDMA : Word;<br>&nbsp; &nbsp; bReserved : Array[0..127] of Byte;<br>&nbsp; end;<br>&nbsp; PIdSector = ^TIdSector;<br><br>const<br>&nbsp; IDE_ID_FUNCTION = $EC;<br>&nbsp; IDENTIFY_BUFFER_SIZE = 512;<br>&nbsp; DFP_RECEIVE_DRIVE_DATA = $0007c088;<br>&nbsp; IOCTL_SCSI_MINIPORT = $0004d008;<br>&nbsp; IOCTL_SCSI_MINIPORT_IDENTIFY = $001b0501;<br>&nbsp; DataSize = sizeof(TSendCmdInParams)-1+IDENTIFY_BUFFER_SIZE;<br>&nbsp; BufferSize = SizeOf(SRB_IO_CONTROL)+DataSize;<br>&nbsp; W9xBufferSize = IDENTIFY_BUFFER_SIZE+16;<br>var<br>&nbsp; hDevice : THandle;<br>&nbsp; cbBytesReturned : DWORD;<br>&nbsp; pInData : PSendCmdInParams;<br>&nbsp; pOutData : Pointer; // PSendCmdOutParams<br>&nbsp; Buffer : Array[0..BufferSize-1] of Byte;<br>&nbsp; srbControl : TSrbIoControl absolute Buffer;<br><br>procedure ChangeByteOrder( var Data; Size : Integer );<br>var ptr : PChar;<br>&nbsp; i : Integer;<br>&nbsp; c : Char;<br>begin<br>&nbsp; ptr := @Data;<br>&nbsp; for i := 0 to (Size shr 1)-1 do<br>&nbsp; begin<br>&nbsp; &nbsp; c := ptr^;<br>&nbsp; &nbsp; ptr^ := (ptr+1)^;<br>&nbsp; &nbsp; (ptr+1)^ := c;<br>&nbsp; &nbsp; Inc(ptr,2);<br>&nbsp; end;<br>end;<br><br>begin<br>&nbsp; Result := '';<br>&nbsp; FillChar(Buffer,BufferSize,#0);<br>&nbsp; if Win32Platform=VER_PLATFORM_WIN32_NT then<br>&nbsp; begin // Windows NT, Windows 2000<br>// Get SCSI port handle<br>&nbsp; &nbsp; hDevice := CreateFile( '//./Scsi0:', GENERIC_READ or GENERIC_WRITE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0 );<br>&nbsp; &nbsp; if hDevice=INVALID_HANDLE_VALUE then Exit;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; srbControl.HeaderLength := SizeOf(SRB_IO_CONTROL);<br>&nbsp; &nbsp; &nbsp; System.Move('SCSIDISK',srbControl.Signature,8);<br>&nbsp; &nbsp; &nbsp; srbControl.Timeout := 2;<br>&nbsp; &nbsp; &nbsp; srbControl.Length := DataSize;<br>&nbsp; &nbsp; &nbsp; srbControl.ControlCode := IOCTL_SCSI_MINIPORT_IDENTIFY;<br>&nbsp; &nbsp; &nbsp; pInData := PSendCmdInParams(PChar(@Buffer)<br>&nbsp; &nbsp; &nbsp; +SizeOf(SRB_IO_CONTROL));<br>&nbsp; &nbsp; &nbsp; pOutData := pInData;<br>&nbsp; &nbsp; &nbsp; with pInData^ do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; cBufferSize := IDENTIFY_BUFFER_SIZE;<br>&nbsp; &nbsp; &nbsp; &nbsp; bDriveNumber := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; with irDriveRegs do<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFeaturesReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSectorCountReg := 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSectorNumberReg := 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCylLowReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCylHighReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bDriveHeadReg := $A0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCommandReg := IDE_ID_FUNCTION;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; if not DeviceIoControl( hDevice, IOCTL_SCSI_MINIPORT,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Buffer, BufferSize, @Buffer, BufferSize,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cbBytesReturned, nil ) then<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; CloseHandle(hDevice);<br>&nbsp; &nbsp; end;<br>&nbsp; end<br>&nbsp; else<br>&nbsp; begin // Windows 95 OSR2, Windows 98<br>&nbsp; &nbsp; hDevice := CreateFile( '//./SMARTVSD', 0, 0, nil, CREATE_NEW, 0, 0 );<br>&nbsp; &nbsp; if hDevice=INVALID_HANDLE_VALUE then Exit;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; pInData := PSendCmdInParams(@Buffer);<br>&nbsp; &nbsp; &nbsp; pOutData := @pInData^.bBuffer;<br>&nbsp; &nbsp; &nbsp; with pInData^ do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; cBufferSize := IDENTIFY_BUFFER_SIZE;<br>&nbsp; &nbsp; &nbsp; &nbsp; bDriveNumber := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; with irDriveRegs do<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bFeaturesReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSectorCountReg := 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSectorNumberReg := 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCylLowReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCylHighReg := 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bDriveHeadReg := $A0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bCommandReg := IDE_ID_FUNCTION;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; if not DeviceIoControl( hDevice, DFP_RECEIVE_DRIVE_DATA,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pInData, SizeOf(TSendCmdInParams)-1, pOutData,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; W9xBufferSize, cbBytesReturned, nil ) then<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; CloseHandle(hDevice);<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; with PIdSector(PChar(pOutData)+16)^ do<br>&nbsp; begin<br>&nbsp; &nbsp; ChangeByteOrder(sSerialNumber,Sizeof(sSerialNumber));<br>&nbsp; &nbsp; SetString(Result,sSerialNumber,Sizeof(sSerialNumber));<br>&nbsp; &nbsp; Result := Trim(Result);<br>&nbsp; end;<br>end;<br><br>end.<br><br>//===================================<br><br>调用 SN := GetIdeDiskSerialNumber();<br>
 
谢楼上的朋友,请问为什么有的CPU没有序列号呢?比如我的赛扬466,用一些提取硬件序列号的控件提取时,bios与cpu的序列号为空白?
 
上面的硬盘序列号不准确的。虽然格式化后保持不变,但重新分区的话还是会重新生成的。<br>再一个,CPU只有Intel的PIII以后系列才有序列号。如果对方的CPU是PII或更老的就不行了,而且还有很多AMD的CPU也没有序列号。<br>
 
shine_wy:<br>你代码中用到的单元文件 uses SEShare;在哪儿啊?<br>
 
上面的硬盘序列号不准确的。虽然格式化后保持不变,但重新分区的话还是会重新生成的。"<br><br>好象很多硬盘序列号一格式化就变了,如果能做到格式化后不变,只分区变的话,倒还可以用,毕竟用户不会经常分区啊<br><br>wr960204:为什么我的bios也没序列号啊<br><br>
 
好像网卡的序号在WINDOWS注册表中有,是不是在进行网络传输时WINDOWS不是总读取网卡的物理序号,而是读注册表?
 
硬盘的大小不会变的。
 
给历史遗留问题结贴
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部