//取CPU序号Function kbGetCpuID():string;type TCPUID = array[1..4] of Longint;var CPUIDinfo : TCPUID; function IsCPUID_Available : Boolean; asm PUSHFD {direct access to flags no possible, only via stack} POP EAX {flags to EAX} MOV EDX,EAX {save current flags} XOR EAX,$200000; {not ID bit} PUSH EAX {onto stack} POPFD {from stack to flags, with not ID bit} PUSHFD {back to stack} POP EAX {get back to EAX} XOR EAX,EDX {check if ID bit affected} JZ @exit {no, CPUID not availavle} MOV AL,True {Result=True} @exit: end; function GetCPUIDSN : TCPUID; assembler; asm PUSH EBX {Save affected register} PUSH EDI MOV EDI,EAX {@Resukt} MOV EAX,1 DW $A20F {CPUID Command} STOSD {CPUID[1]} MOV EAX,EBX STOSD {CPUID[2]} MOV EAX,ECX STOSD {CPUID[3]} MOV EAX,EDX STOSD {CPUID[4]} POP EDI {Restore registers} POP EBX end;begin if IsCPUID_Available then begin CPUIDinfo:=GetCPUIDSN; end else begin //早期cpu无ID CPUIDinfo[1] := 0136; CPUIDinfo[4] := 66263155; Result := ''; end; result:=IntToHex((CPUIDinfo[1]+CPUIDinfo[2]+CPUIDinfo[3]+CPUIDinfo[4]),8);end;