Considerando
solo el caso, entre c2d, c2d movil, c2q, c2q movil, Extreme, Xeon, modelo 17h contra los Pentium III-; debemos
reconocer que el
Model Number de los
Intel Core 2 TM … es el máximo posible (15 ~1111b).
Es difícil que un programa pueda reconocer a los
futuros microprocesadores, mucho más si consideramos que entre las dos empresas lideres actualmente sobrepasamos las 200 firmas de microprocesadores. Ahora imaginemos con el resto; (Intel, AMD), Centaur, Cyrix, Transmeta, National Semiconductor, NexGen, Rise, SiS, UMC, VIA,…
Para poder obtener dicha
firma se debe utilizar la instrucción CPUID que obtiene información directamente del microprocesador. Entre las funciones que soporta dicha instrucción tenemos un grupo "extendido" que debería simplificarnos el problema expuesto;
Cita:
Empezado por Intel
Functions 8000_0002h, 8000_0003h, and 8000_0004h each return up to 16 ASCII bytes of the processor name in the EAX, EBX, ECX, and EDX registers. The processor name is constructed by concatenating each 16-byte ASCII string returned by the three functions. The processor name is right justified with leading space characters. It is returned in little-endian format and NULL terminated. The processor name can be a maximum of 48 bytes including the NULL terminator character. In addition to the processor name, these functions return the maximum supported speed of the processor in ASCII.
|
Codifiquemos;
Código Delphi
[-]function ProcessorName: PChar;
const Buffer: array [0..47] of Char = '';
asm
push esi
push edi
mov esi, 80000001h
lea edi, Buffer
push ebx
push edi
@next: inc esi
mov eax, esi
cmp al, 5
je @done
cpuid
stosd
xchg eax, ebx
stosd
xchg eax, ecx
stosd
xchg eax, edx
stosd
jmp @next
@done:
pop eax
pop ebx
pop edi
pop esi
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := ProcessorName;
end;
Con seguridad, el anterior código será suficiente porque ha sido creado con "ese" objetivo. Aunque también podemos obtener la misma información desde el registro del SO;
Código Delphi
[-]procedure TForm1.Button1Click(Sender: TObject);
var
hKey: Windows.HKEY;
ProcessorNameString: array [0..47] of Char;
cbData: Cardinal;
begin
cbData := SizeOf(ProcessorNameString);
RegOpenKey(HKEY_LOCAL_MACHINE, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', hKey);
RegQueryValueEx(hKey, 'ProcessorNameString', nil, nil, @ProcessorNameString, @cbData);
RegCloseKey(hKey);
ProcessorNameString[cbData] := #0;
Label1.Caption := ProcessorNameString;
end;
Es más complicado obtener las capacidades de los módulos DIMM (u otros) instalados en el ordenador, pero podemos apoyarnos en una API para obtener la cantidad de memoria física (por ahora hasta aqui llego
);
Código Delphi
[-]procedure TForm1.Button1Click(Sender: TObject);
var MemoryStatus: TMemoryStatus;
begin
MemoryStatus.dwLength := SizeOf(MemoryStatus);
GlobalMemoryStatus(MemoryStatus);
Label1.Caption := IntToStr(MemoryStatus.dwTotalPhys div (1024 * 1024)) + ' Mb.';
end;
Saludos