Page 1 of 1

Posted: Wed Apr 11, 2007 12:12 pm
by ts-soft
PB wrote:It's "safe place", not "savely place". (No offense intended).
Sorry, i have some problems with other languages :oops:

Code: Select all

Procedure.s GetCPUName()
  Protected sBuffer.s
  Protected Zeiger1.l, Zeiger2.l, Zeiger3.l, Zeiger4.l
 
  !MOV eax, $80000002
  !CPUID
  ; the CPU-Name is now stored in EAX-EBX-ECX-EDX
  !MOV [p.v_Zeiger1], EAX ; move eax to the buffer
  !MOV [p.v_Zeiger2], EBX ; move ebx to the buffer
  !MOV [p.v_Zeiger3], ECX ; move ecx to the buffer
  !MOV [p.v_Zeiger4], EDX ; move edx to the buffer
 
  ;Now move the content of Zeiger (4*4=16 Bytes to a string
  sBuffer = PeekS(@Zeiger1, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger2, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger3, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger4, 4, #PB_Ascii)
 
  ;Second Part of the Name
  !MOV eax, $80000003
  !CPUID
  ; the CPU-Name is now stored in EAX-EBX-ECX-EDX
  !MOV [p.v_Zeiger1], EAX ; move eax to the buffer
  !MOV [p.v_Zeiger2], EBX ; move ebx to the buffer
  !MOV [p.v_Zeiger3], ECX ; move ecx to the buffer
  !MOV [p.v_Zeiger4], EDX ; move edx to the buffer
 
  ;Now move the content of Zeiger (4*4=16 Bytes to a string
  sBuffer + PeekS(@Zeiger1, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger2, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger3, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger4, 4, #PB_Ascii)
 
 
  ;Third Part of the Name
  !MOV eax, $80000004
  !CPUID
  ; the CPU-Name is now stored in EAX-EBX-ECX-EDX
  !MOV [p.v_Zeiger1], EAX ; move eax to the buffer
  !MOV [p.v_Zeiger2], EBX ; move ebx to the buffer
  !MOV [p.v_Zeiger3], ECX ; move ecx to the buffer
  !MOV [p.v_Zeiger4], EDX ; move edx to the buffer
 
  ;Now move the content of Zeiger (4*4=16 Bytes to a string
  sBuffer + PeekS(@Zeiger1, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger2, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger3, 4, #PB_Ascii)
  sBuffer + PeekS(@Zeiger4, 4, #PB_Ascii)
 
  ProcedureReturn sBuffer
EndProcedure

Debug GetCPUName()
edit: changed to directasm

Posted: Wed Apr 11, 2007 2:17 pm
by Konne
What is

!CPUID

doing?

Posted: Wed Apr 11, 2007 2:40 pm
by ts-soft

Posted: Wed Apr 11, 2007 3:15 pm
by bingo
8) interesting ...

but is possible to read the standard level 0000_0001h ? :lol:

processor type/family/model/stepping

Posted: Thu Apr 12, 2007 11:05 am
by Konne
Is there any Win API Function to do the same thing without using ASM, or any other possiblity to get the CPU Name?
And I don't really get what

Code: Select all

!Mov EAX,4
!CPUID
is doing.

Posted: Thu Apr 12, 2007 11:14 am
by PB

Code: Select all

Procedure.s RegReadString(section,path$,key$)
  value.s=Space(9999) : datasize.l=255
  If RegOpenKeyEx_(section,path$,0,#KEY_READ,@tmp)=#ERROR_SUCCESS
    If RegQueryValueEx_(tmp,key$,0,0,@value,@datasize)<>#ERROR_SUCCESS : value="-1" : EndIf
    RegCloseKey_(tmp)
  EndIf
  ProcedureReturn value
EndProcedure

Debug Trim(RegReadString(#HKEY_LOCAL_MACHINE,"HARDWARE\DESCRIPTION\System\CentralProcessor\0","ProcessorNameString"))
Debug Trim(RegReadString(#HKEY_LOCAL_MACHINE,"HARDWARE\DESCRIPTION\System\CentralProcessor\0","VendorIdentifier"))

Posted: Thu Apr 12, 2007 1:24 pm
by ts-soft
@PB
The result is the CPU at Windows-Installtime, but if you change the CPU, this
Registry-Entry was not updated

@Konne
CPUID is the only save one for this information