Getting CPU Name
Getting CPU Name
CPUZ is able to get my Processor name so it must be possible.
Does someone know what API Command I need to use to get the CPU name?
(In my case it is AMD Athlon XP)
Does someone know what API Command I need to use to get the CPU name?
(In my case it is AMD Athlon XP)
Apart from that Mrs Lincoln, how was the show?
Code: Select all
Procedure.s GetCPUVendor()
Protected sBuffer.s
Protected Zeiger1.l, Zeiger2.l, Zeiger3.l
! MOV EAX, 0
! CPUID
; the VendorID is now stored in EBX-EDX-ECX
; very important, first move all results to a save place.
! MOV [p.v_Zeiger1], EBX ; move ebx to the buffer
! MOV [p.v_Zeiger2], EDX ; move edx to the buffer
! MOV [p.v_Zeiger3], ECX ; move ecx to the buffer
sBuffer = PeekS(@Zeiger1, 4, #PB_Ascii)
sBuffer + PeekS(@Zeiger2, 4, #PB_Ascii)
sBuffer + PeekS(@Zeiger3, 4, #PB_Ascii)
ProcedureReturn sBuffer
EndProcedure
Debug GetCPUVendor()
Last edited by ts-soft on Wed Apr 11, 2007 1:09 pm, edited 4 times in total.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Sorry, i have some problems with other languagesPB wrote:It's "safe place", not "savely place". (No offense intended).

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()
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

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
is doing.
And I don't really get what
Code: Select all
!Mov EAX,4
!CPUID
Apart from that Mrs Lincoln, how was the show?
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"))
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
@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
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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
