Archive: Win2k SP3 and up


Win2k SP3 and up
Hi all,

My app should be installed only on Win2000 ServicePack 3 and up, so at the beginning I have to check for this. How can I check this?

Thx,
Viv


You can use a plug-in or some functions.


if you require a specific Win32 API function you can call LoadLibrary and GetProcAddress with the system plugin on the .dll containing the func


Hi all,

Thanks for your answers.

1) I can't use the plugin as one of my requirements is that my script needs to be compilable by anybody who downloads the version of the NSIS specified in some docu. So I can't ask those to download a dll and to put it somewhere.
2) so I used the other functions in order to accomplish what I need
3) I'll post here the code I wrote to check if it's Win2000 ServicePack 3 and up


; check that we have the correct OS and ServicePack otherwise abort. We need Win2000 SP3 and up
Function checkCorrectOSandServicePack
# read the registry entry SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
# - if it doesn't exists, we are on Win9x systems, so not OK
# - if it starts with 3 or 4 we are on WinNT system, so not OK
# - 5.0, 5.1, 5.2 mean Win2k, XP, 2003, so are OK for us.
ReadRegStr $OSVer HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IntCmp $OSVer 5 IS_Win2000_OrMore Not_OK_OS_Or_ServicePack OK_OS_And_ServicePack ; IntCmp compares only integers, so we can't compare with 5.0, but here we don't need to, but to keep in mind that if the result is equal, means it's 5.x so Win2k and up
IS_Win2000_OrMore:
; check in case of Win2000 if also Service Pack is correct (for Win2000 it should be SP3 or up)
StrCmp $OSVer "5.0" 0 OK_OS_And_ServicePack ; it's Win2000 or it's more?
call GetServicePack ; http://nsis.sourceforge.net/wiki/Get...e_pack_version
Pop $ServicePack
Pop $MinorServicePack ; just to clean the stack
IntCmp $ServicePack 3 OK_OS_And_ServicePack Not_OK_OS_Or_ServicePack OK_OS_And_ServicePack
Not_OK_OS_Or_ServicePack:
MessageBox MB_ICONEXCLAMATION|MB_OK "You need Win2000 with ServicePack 3 and up"
Quit ; quit the whole installer
OK_OS_And_ServicePack:
FunctionEnd


Seems to be working, but if smbd sees a problem with this method pls tell me about it.

4) one more issue: I used the function to get the windows service pack from here: http://nsis.sourceforge.net/wiki/Get...e_pack_version but I noticed that in the post from here http://forums.winamp.com/showthread....ght=CSDVersion cjs says that "CSD Version outputs "SERVICE PACK (NUMBER)"". This is weird as the function from wiki uses the implementation like there will always be only a number, so no "service pack" string in front of the number. Anybody knowing more about this issue?

Thx,
Viv