- NSIS Discussion
- Help: Try this code, please
Archive: Help: Try this code, please
Joel
18th March 2003 22:12 UTC
Help: Try this code, please
Hi please try this code in your PC, it's suppose to read
the version of your windows installed
Function "GetWIN"
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" ProductName
StrCmp $R0 " " +1 +2
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" ProductName
MessageBox MB_OK $R0
FunctionEnd
thanks :D
kichik
18th March 2003 22:44 UTC
Are you sure the third line should contain a space between the quotes? As it seems now it will only get the NT name if the non NT name is a space which is not the case on my NT.
Joel
18th March 2003 22:57 UTC
So you recommend like this:
StrCmp $R0 "" +1 +2
Joost Verburg
19th March 2003 13:44 UTC
Why not use the GetWindowsVersion function? I'm sure the results will be more reliable.
Joel
19th March 2003 19:24 UTC
mmm, yeah ... but to many line code... it's not that I'm lazzy :)
but if I can get two or three line code the same result, why not?
After all, the Windows version "x.x.x.x" is in the same folder in
the registry.
viper0179
20th March 2003 14:12 UTC
By the time you figure it out you could have typed the entire code to the GetWindowsVersion function :)
Joel
20th March 2003 20:11 UTC
Now works fine :) to me
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" ProductName
StrCmp $R0 "" +1 +2
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" ProductName
MessageBox MB_OK|MB_ICONSTOP $R0
Joost Verburg
20th March 2003 21:21 UTC
But is the output the same for every Windows version, or different for Server/Workstation etc.?
And what are the outputs for all versions?
Without this info, you cannot detect the version.
Joel
20th March 2003 21:35 UTC
Well...I din't try with those versions of Windows. :(
But in Win95/98/Me/2000/XP, my target OS's, works fine.
I'm write this code for my custom Page with info, of the user-machine.
If any Nsis users have Windows Server, or another Windows version, please
try this code...
DOCa Cola
21st March 2003 05:52 UTC
i tried it with win server 2003 enterprise edition and $R0 is Microsoft Windows Server 2003
Joel
21st March 2003 20:27 UTC
Thanks DOCa Cola, seems to be working :up:
DOCa Cola
21st March 2003 21:17 UTC
np :)
Jacob Metro
22nd March 2003 20:12 UTC
Info
I don't remember who I stole this from but it is virtually identical and has been in operation in the field for almost 6 months now. It's worked on every Windows platform it's been tried on. I thought it was in the official examples but I couldn't find it when I went back to look for it.
FUNCTION GETWINDOWSVERSION
PUSH $0
PUSH $9
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 label2000
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
StrCpy $9 $0 1
StrCmp $9 '4' 0 LABELEND
Goto Label95
Label95:
call FUNCTION95
quit
LABELEND:
MESSAGEBOX MB_OK "This installation can not continue. Please contact BLAH......."
call .onuserabort
quit
label2000:
call FUNCTION2000
quit
FunctionEnd
And secondly,
I tried your code on a Windows 2000 Advanced Data Server and it worked perfectly. (If I wasn't sure my code would work perfectly, I would first check the registry to see if the key queried does indeed contain the data for which I'm seeking.)
Joel
22nd March 2003 20:49 UTC
Jacob Metro:
If you think that I stole code, dude your wrong :).
I been here at least 3 months and I've never seen that code.
Well, at least didn't dig in the search :rolleyes:
I dive in the registry to see if is it possible to grab the
"string of the Windows name".
I'm only use it has part of my IO final Page. So I use this threat
to kindly ask the nsis users to try the code to see if it work.
If this code, have been writting before, I'd like to be informed by
the creators of Nsis so I retract the *authoring* of the code.
:)
deguix
22nd March 2003 21:00 UTC
I prefer the Dark Boy code. Is much simpler and give the right result (Microsoft Windows 98). And this code that you posted Jacob Metro, require other functions.
Jacob Metro
24th March 2003 15:49 UTC
Sorry
Dark Boy,
I was not saying the you stole any code. I was saying that I stole the bulk of the above code from some source.
deguix,
I guess I didn't read the thread as thoroughly as I should have because I thought we were just distinguishing between a Windows NT/XP/2000 operating system and a Windows 95/98/ME one. The previous process will distinguish between the two types based on the location of registry data in each key. (I.E. in Windows 98 a \Windows NT\ key will not exist, and vise-a-versa.)
Sincerely,
Jacob Metro
Joel
24th March 2003 21:11 UTC
No problem dude, :D
though welcome to the discussion :p