Archive: Processor, Memory, OS, Graphics Info?


Processor, Memory, OS, Graphics Info?
  Hi,
I am trying to create an installer that checks to see if the current hardware meets minimum system requirements.
In order to do this I need to check the speed of the processor, total physical RAM, operating system version and also preferably info about the graphics card such as graphics memory.

I have searched the forums and the documentation but i haven't found a function that will give me this information.

Does anyone have any idea how i might accomplish this?

Thanks
Psych


You have plugin call "system.dll" in ${NSISDIR}\Plugins".
Check this web archive to see more examples.


Ok so I looked at the examples at the link you showed me. I'm a beginer as far as programming in win32 is concerned so is there somewhere i can look to find the relevant functions that i need to call?
I need to know the:
Processor Type: (AMD/INTEL)
Process Speed: MHz
RAM: MB
OS: NT/98/ME/2000/XP

and preferably
Video Memory: MB

Thanks


You can get the full Windows version - look here
No-one has written a plug-in to determin how much video card memory a pc has, but somone is currently writing one - look at this post here
As far as I can see, the plugin is really only 5% done!

I'm not sure how to get the processor, mhz, and ram, but I'm sure Kichik could write you something which uses the system plugin.

There is a way to detext the version of Directx nstalled, and to update it in this topic: here

Hope some of them help!

-Stu


You could also search for a windows specific value in the registry, incase you find where windows may put some useful values.

-Stu


Check out the cpudesc plugin here, that can get you the cpu information you require.


Ok so I have the OS and the RAM now. I noticed a script that would read an entry of the registy but only of type REG_MULTI_SZ. The system MHz is of type REG_DWORD.
I've tried to modify the file but with no success. Does anyone know how i might acccess this information?

Thanks

The file that I was trying to work off of is located in the plugin's folder in the System Plugins Examples.


You don't need a special script to read from REG_DWORD, just use ReadRegDWORD. Make sure that value is always true, on Windows 98 too. I think I have heard about this value somewhere and if I remember correctly it doesn't hold the right value on Windows 98 and is off by a little on other systems.


To find out the CPU speed you can use a variant of this program:
http://www.codeproject.com/system/cp...asp#xx372884xx


Thanks!
That worked.
All i needed was:
ReadRegDWORD $0 HKLM "HARDWARE\DESCRIPTION\System\CentralProcessor\0\" "~MHz"
MessageBox MB_OK "Processor Speed: $0MHz"

I've tested it on NT4, 2000 & XP so far and it works.


I have just checked it on Windows 98 and it doesn't work. The key isn't there.


Latest CPUDesc gets CPU speed too:
http://nsis.sourceforge.net/archive/...instances=0,32

The page hasn't updated yet but the download has.


I was trying out this plugin to get the cpu speed. It is a modification of the Examples\System\System.nsi code

With an AMD64-3700 (single CPU) with 2.4 clock speed, I'm getting a mhz result of 1283. The results from the NCPU and RAM are correct. Am I doing something wrong? (Note that I have the cpu running at full-speed, without the energy saving AMD Cool'n'Quiet in effect.)

; This is just an example of cpudesc Plugin

>; To have this work, cpudesc.dll should be in 'plugin' subdirectory
>; As of 2006-Aug-27, here is a link to cpudesc:
; ***91;url***93;http://nsis.sourceforge.net/mediawiki/images/8/87/Cpudesc.zip***91;/url***93;
>;
; (c) l_d_allan (modified from system.nsi by brainsucker)

>Name "CheckMhz Plugin Example"
>OutFile "CheckMhz.exe"
>SetPluginUnload alwaysoff

Section "ThisNameIsIgnoredSoWhyBother?"
SetOutPath $TEMP

; ----- Sample 3a ----- Direct proc definition -----
;0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999
;01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
;INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd MHZ=ddddd RAM=dddd

; Direct specification demo
cpudesc::tell
Pop$0

StrCpy$1 $0 2, 73 ;pull out two characters after NCPU=
IntFmt $4 "%u" $1 ; and turn it into a number in $4
StrCpy$1 $0 5, 80 ;pull out five characters after MHZ=
IntFmt $2 "%u" $1 ; and turn it into a number in $2
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 "NCPU: '$4' Mhz: '$2' Ram (megs): '$3'"

; last plugin call must not have /NOUNLOAD so NSIS will be able to delete the temporary DLL
SetPluginUnload manual
; do nothing
System::Free 0

SectionEnd
>

The leading zeros cause NSIS to think it's an octal number. You can add another leading number and later remove it.

StrCpy $1 $0 5 80
IntOp $2 1$1 - 100000

Thanks ... you're good!

Like so?


  cpudesc::tell

Pop$0

StrCpy$1 $0 2, 73 ;pull out two characters
; (that may have leading
; zero) after NCPU=
StrCpy $1 1$1 ;$1 now has leading 1 in
; front of 0 to keep from
; being octal
IntOp $2 $1 - 100 ;remove leading one

StrCpy$1 $0 5, 80 ;pull out five characters
; that may have leading 0
; after MHZ=
StrCpy $1 1$1 ;$1 now has leading 1 in
; front of 0 to keep from
; being octal
IntOp $3 $1 - 100000 ;remove leading one

StrCpy$1 $0 4, 90 ;pull out four characters
; after RAM=
StrCpy $1 1$1 ;$1 now has leading 1 in
; front of 0 to keep from
; being octal
IntOp $4 $1 - 10000 ;remove leading one

MessageBox MB_OKCANCEL "NCPU: '$2' Mhz: '$3' Ram (megs): '$4'"
Perhaps it would be appropriate to modify the cpudesc.c code. I took a look at it, and there is this line:

wsprintf( ostr, "INTELP=%1d AMD=%c%2.2d PPRO=%1d MMX=%1d SSE=%1d SSE2=%1d 3DNOW=%1d ARCH=%2.2d LEVEL=%2.2d NCPU=%2.2d MHZ=%5.5d RAM=%4.4d",
intelpentium, amdlet, amd, pprocompat, hasmmx, hassse, hassse2, has3dnow, arch, level, ncpu, mhz, ram );

I'm not familiar with the %5.5d format, but perhaps it should be %5d to maintain spacing. The existing code seems to be equivalent to %05d to put a leading zero (or maybe cpudesc.dll is "out of sync" with cpudesc.c?)

But that might mess up StrCpy $1 $0 5, 80?

I suppose the same "padding" with leading 1 applies to NCPU and RAM ... if you had less than 1 gig of memory?

Using %-5d in the plug-in should do the trick as the padding will go on the right. But changing that would break backwards compatibility with scripts using StrCmp.

The same padding applies to RAM, but doesn't bother NCPU because it's only two digits.