CPUDesc plug-in: Difference between revisions
mNo edit summary |
(Update to reflect fields for MHZ and RAM. Expand example.) |
||
Line 10: | Line 10: | ||
It's uses one function called tell(). This DLL function returns a string giving some information about the CPU on the computer where your setup program's being run. This info string always has the same fields in exactly the same place, so it's easy to pull it apart. The info string looks like this: | It's uses one function called tell(). This DLL function returns a string giving some information about the CPU on the computer where your setup program's being run. This info string always has the same fields in exactly the same place, so it's easy to pull it apart. The info string looks like this: | ||
INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd | INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd MHZ=ddddd RAM=dddd | ||
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889 | |||
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 | |||
In case the above line 'wraps, note that MHZ is at the 81st character at offset 80, and | |||
RAM is at the 91st character at offset 90 | |||
"d" means a decimal digit (0..9), "a" means a letter (A..Z), and "b" means a boolean digit (0 or 1). | "d" means a decimal digit (0..9), "a" means a letter (A..Z), and "b" means a boolean digit (0 or 1). | ||
== Usage == | == Usage == | ||
(e.g. in your Install section): | (e.g. in your Install section): unzip file and put cpudesc.dll in plugin directory | ||
<highlight-nsis> | <highlight-nsis> | ||
Line 20: | Line 26: | ||
cpudesc::tell | cpudesc::tell | ||
Pop $0 ;full identification string in $0 | Pop $0 ;full identification string in $0 | ||
StrCpy $1 $0 4, 90 ;pull out four characters after RAM= | |||
IntFmt $3 "%u" $1 ; and turn it into a number in $3 | |||
MessageBox MB_OKCANCEL "Ram (megs): '$3'" | |||
StrCpy $1 $0 1, 22 ;pull out one character after PPRO= | StrCpy $1 $0 1, 22 ;pull out one character after PPRO= |
Revision as of 09:55, 28 August 2006
Author: menakkis (talk, contrib) |
Links
Cpudesc.zip (12 KB)
Description
Version: 1.2.
A plugin by Peter Mason (menakkis) that can tell you quite a lot about the cpu in the system your installer is running on.
It's uses one function called tell(). This DLL function returns a string giving some information about the CPU on the computer where your setup program's being run. This info string always has the same fields in exactly the same place, so it's easy to pull it apart. The info string looks like this:
INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd MHZ=ddddd RAM=dddd 0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
In case the above line 'wraps, note that MHZ is at the 81st character at offset 80, and RAM is at the 91st character at offset 90
"d" means a decimal digit (0..9), "a" means a letter (A..Z), and "b" means a boolean digit (0 or 1).
Usage
(e.g. in your Install section): unzip file and put cpudesc.dll in plugin directory
; ... cpudesc::tell Pop $0 ;full identification string in $0 StrCpy $1 $0 4, 90 ;pull out four characters after RAM= IntFmt $3 "%u" $1 ; and turn it into a number in $3 MessageBox MB_OKCANCEL "Ram (megs): '$3'" StrCpy $1 $0 1, 22 ;pull out one character after PPRO= IntFmt $2 "%u" $1 ; and turn it into a number IntCmpU $2 1 +1 +3 +3 ;pick a BLOG dep on PPro compatibility File /oname=blog.exe "blog_source_directory\blog_gen.exe" Goto +2 File /oname=blog.exe "blog_source_directory\blog_pro.exe" ; ... the rest of your Install section
See cpudesc.txt for more info.