tribe25
14th April 2004 21:21 UTC
Version Checker Help
Below is a little script that I am trying to get to work. I keep getting... install function "GetWindowsVersion" not referenced - zeroing code (3-48) out
I am new to this and don't really understand what that is telling me. Any help would be great. If this does get the Windows version, how would I then tell the installer where to install the files based on the OS. Thanks in advance.
; Asks the user if they really want to install and register the files.
Function .onInit
MessageBox MB_YESNO "This will install Safari Remote. Do you wish to continue?" IDYES gogogo
Abort
gogogo:
FunctionEnd
OutFile "Testing.exe"
Function GetWindowsVersion
Push $R0
Push $R1
ClearErrors
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors 0 lbl_winnt
; we are not NT
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error
StrCpy $R1 $R0 3
StrCmp $R1 '4.0' lbl_win32_95
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:
StrCpy $R0 '95'
Goto lbl_done
lbl_win32_98:
;;beginning of additions to support win 98 SE
push $R0
push "."
; call strstr
pop $R0
StrCpy $R0 $R0 "" 1
StrCmp $R0 "10.2222" lbl_win32_98SE
StrCpy $R0 '98' ;;this line was not added
Goto lbl_done ;;this line was not added either
lbl_win32_98SE:
StrCpy $R0 '98 SE'
Goto lbl_done
;;end of additions to support win 98 SE
lbl_win32_ME:
StrCpy $R0 'ME'
Goto lbl_done
lbl_winnt:
StrCpy $R1 $R0 1
StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x
StrCpy $R1 $R0 3
StrCmp $R1 '5.0' lbl_winnt_2000
StrCmp $R1 '5.1' lbl_winnt_XP
StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
lbl_winnt_x:
StrCpy $R0 "NT $R0" 6
Goto lbl_done
lbl_winnt_2000:
Strcpy $R0 '2000'
Goto lbl_done
lbl_winnt_XP:
Strcpy $R0 'XP'
Goto lbl_done
lbl_winnt_2003:
Strcpy $R0 '2003'
Goto lbl_done
lbl_error:
Strcpy $R0 ''
lbl_done:
Pop $R1
Exch $R0
FunctionEnd
Section "New"
SetShellVarContext ALL
; This section adds mainly DLL files to the Windows\system folder and need to be registered
SetOutPath C:\Test
File ..\actbar.oca
SectionEnd
scully13
14th April 2004 21:34 UTC
You never Call the function so it zeros it out.
You need to add this to your section:
Call GetWindowsVersion
Pop $R0
tribe25
14th April 2004 22:01 UTC
Ok, got the Windows version, thanks. Now, if the version is Windows XP I need it to install to a certain directory, like Windows\System(32) and if WinNT then WinNT\System32. I got all the files installed correctly, just need to read the version and then install based off answer. Thanks again for the help.
!define VERSION "1.0.0"
Function .onInit
MessageBox MB_YESNO "This will install Safari Remote. Do you wish to continue?" IDYES gogogo
Abort
gogogo:
Call "GetWin"
MessageBox MB_OK|MB_ICONINFORMATION $0
FunctionEnd
Function "GetWIN"
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" ProductName
StrCmp $0 "" +1 +2
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" ProductName
FunctionEnd
scully13
14th April 2004 22:08 UTC
posted twice see below
Joost Verburg
14th April 2004 22:08 UTC
If you want to check the value of a variable, use StrCmp.
However, you don't need any version detection in this case.
scully13
14th April 2004 22:09 UTC
You could just use the variable $SYSDIR and it will give you the correct directory and skip the windows detection completely. You can also use $WINDIR if all you want is the directory where Windows is installed. Detecting which version of windows they are running and then installing into that directory doesn't solve your problem because the user can install Windows into whichever directory he wants. It could be c:\mywindir for all you know. So, use the variables above just to make sure you get the right directory.
tribe25
14th April 2004 22:24 UTC
Ok, I have files going to Windows\System32...I can use $SYSDIR for that.
I have files going to Windows\System...what would I use for that?
And any files that go into Windows...I use $WINDIR
Am I catching on? Thanks again for the help!!
scully13
14th April 2004 22:39 UTC
It's always been my understanding that the OS only uses one or the other. So, $SYSDIR will get you Windows\System if that is what that machine uses. I could be wrong about that though. I don't see another variable for just plain system so I have to assume that's right.