VIAddVersionKey "ProductVersion" ${AFS_VERSION}
VIAddVersionKey "FileVersion" ${AFS_VERSION}
VIAddVersionKey "FileDescription" "OpenAFS for Windows Installer"
-VIAddVersionKey "LegalCopyright" "(C)2003"
+VIAddVersionKey "LegalCopyright" "(C)2000-2004"
!ifdef DEBUG
VIAddVersionKey "PrivateBuild" "Checked/Debug"
!endif ; End DEBUG
Section "AFS Client" secClient
SetShellVarContext all
+
+ ; Check for bad previous installation (if we are doing a new install)
+ Call IsAnyAFSInstalled
+ Pop $R0
+ StrCmp $R0 "0" +1 skipCheck
+ Call CheckPathForAFS
+ skipCheck:
+
; Stop any running services or we can't replace the files
; Stop the running processes
GetTempFileName $R0
File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe" ; Might not have the MSVCR71.DLL file to run
nsExec::Exec '$R0 afscreds.exe'
- nsExec::Exec "afscreds.exe -z"
+ Exec "afscreds.exe -z"
+ ; in case we are upgrading an old version that does not support -z
+ nsExec::Exec '$R0 afscreds.exe'
!IFDEF INSTALL_KFW
;nsExec::Exec '$R0 krbcc32s.exe'
!ENDIF
WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "VersionString" ${AFS_VERSION}
WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Title" "AFS Client"
WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Description" "AFS Client"
- WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName" "$INSTDIR\Client\Program"
+ WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PathName" "$INSTDIR\Client"
WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "Software Type" "File System"
WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion" ${AFS_MAJORVERSION}
WriteRegDWORD HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion" ${AFS_MINORVERSION}
CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" "-A -M -N -Q"
Push "$INSTDIR\Client\Program"
- Call AddToPath
+ Call AddToUniquePath
Push "$INSTDIR\Common"
- Call AddToPath
+ Call AddToUniquePath
!ifdef INSTALL_KFW
; Add kfw to path too
Push "$INSTDIR\kfw\bin"
- Call AddToPath
+ Call AddToUniquePath
!endif
; Create the AFS service
;IMPORTANT! If we are not refreshing the config files, do NOT remove the service
;Don't re-install because it must be present or we wouldn't have passed the Reg check
- ReadRegStr $R2 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "Cell"
+ ReadRegStr $R2 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell"
StrCmp $R2 "" +1 skipremove
nsExec::Exec '$INSTDIR\Common\Service.exe u TransarcAFSDaemon'
nsExec::Exec '$INSTDIR\Common\Service.exe TransarcAFSDaemon "$INSTDIR\Client\Program\afsd_service.exe" "OpenAFS Client Service"'
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "VerboseLogging" 10
+
+ ; Must also add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\HwOrder
+ ; and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
+ ; to also include the service name.
+ Call AddProvider
ReadINIStr $R0 $1 "Field 7" "State"
ReadINIStr $R1 $1 "Field 9" "State"
; Complicated way to do $R1 = ($R1 *2) + $R0
ReadINIStr $R0 $1 "Field 2" "State"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "Cell" $R0
ReadINIStr $R0 $1 "Field 3" "State"
- WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "ShowTrayIcon" 1
+ WriteRegDWORD HKLM "SOFTWARE\OpenAFS\Client" "ShowTrayIcon" 1
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" $R0
ReadINIStr $R0 $1 "Field 5" "State"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient" $R0
- WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" 1
+ ReadINIStr $R0 $1 "Field 11" "State"
+ WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" $R0
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "NetbiosName" "AFS"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "MountRoot" "/afs"
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "RxMaxMTU" 1260
strcpy $REG_VALUE "DependOnService"
strcpy $REG_DATA_1 "Tcpip"
strcpy $REG_DATA_2 "NETBIOS"
- strcpy $REG_DATA_3 "NetBT"
+ strcpy $REG_DATA_3 "RpcSs"
Call RegWriteMultiStr
SetRebootFlag true
Section "AFS Server" secServer
SetShellVarContext all
+
+ ; Check for bad previous installation (if we are doing a new install)
+ Call IsAnyAFSInstalled
+ Pop $R0
+ StrCmp $R0 "0" +1 skipCheck
+ Call CheckPathForAFS
+skipCheck:
+
; Stop any running services or we can't replace the files
; Stop the running processes
GetTempFileName $R0
File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe" ; Might not have the MSVCR71.DLL file to run
nsExec::Exec '$R0 afscreds.exe'
- nsExec::Exec "afscreds.exe -z"
+ Exec "afscreds.exe -z"
+ ; in case we are upgrading an old version that does not support -z
+ Sleep 2000
+ nsExec::Exec '$R0 afscreds.exe'
!IFDEF INSTALL_KFW
;nsExec::Exec '$R0 krbcc32s.exe'
!ENDIF
Call ShouldClientInstall
Pop $R2
+ ; Check if it was an IBM/Transarc version
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "DisplayName"
+ StrCmp $R0 "IBM AFS Client" DoIBM
+ StrCmp $R0 "Transarc AFS Client" DoIBM
+NotIBM:
+ StrCpy $R9 ""
StrCmp $R2 "0" NoClient
StrCmp $R2 "1" ReinstallClient
StrCmp $R2 "2" UpgradeClient
StrCmp $R2 "3" DowngradeClient
-
+ goto Continue
+DoIBM:
+ ReadRegDWORD $R0 HKLM "Software\TransarcCorporation\AFS Client\CurrentVersion" "MajorVersion"
+ StrCmp $R0 "3" +1 NotIBM
+ StrCpy $R9 "IBM"
+ goto UpgradeClient
+
+Continue:
SectionGetFlags ${secClient} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${secClient} $0
SectionGetFlags ${secDocs} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${secDocs} $0
- goto end
+ goto CheckSDK
NoDocs:
SectionGetFlags ${secDocs} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${secDocs} $0
- goto end
+ goto CheckSDK
; To check the SDK, we simply look to see if the files exist. If they do,
; the SDK is installed. If not, we don't need to push it on the user.
StrCmp $R0 "" TryServer
Push $R0
Call GetParent
- Call GetParent
+
+ ; Work around bug in 1.3.5000, 1.3.5100, 1.3.5200, 1.3.5201, 1.3.5299 installers...
+ ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MajorVersion"
+ StrCmp $R0 "1" +1 SkipParent
+ ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "MinorVersion"
+ StrCmp $R0 "3" +1 SkipParent
+ ReadRegStr $R0 HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" "PatchLevel"
+ StrCmp $R0 "5000" UpParent
+ StrCmp $R0 "5100" UpParent
+ StrCmp $R0 "5200" UpParent
+ StrCmp $R0 "5201" UpParent
+ StrCmp $R0 "5299" UpParent
+ goto SkipParent
+
+UpParent:
+ Call GetParent
+
+SkipParent:
Pop $R0
StrCpy $INSTDIR $R0
goto Nope
GetTempFileName $R0
File /oname=$R0 "${AFS_WININSTALL_DIR}\Killer.exe"
nsExec::Exec '$R0 afscreds.exe'
- nsExec::Exec "afscreds.exe -z"
+ Exec "afscreds.exe -z"
+ ; in case we are upgrading an old version that does not support -z
+ Sleep 2000
+ nsExec::Exec '$R0 afscreds.exe'
!IFDEF INSTALL_KFW
nsExec::Exec '$R0 krbcc32s.exe'
!ENDIF
nsExec::Exec '$R0 u TransarcAFSServer'
Delete $R0
+ Call un.RemoveProvider
+
Push "$INSTDIR\Client\Program"
Call un.RemoveFromPath
Push "$INSTDIR\Common"
ReadINIStr $R0 $0 "Field 2" "State"
StrCmp $R0 "1" done
+ReadINIStr $R0 $0 "Field 6" "State"
+StrCmp $R0 "1" CheckOther
+
ReadINIStr $R0 $0 "Field 3" "State"
StrCmp $R0 "1" UsePackaged
; If none of these, grab file from other location
-goto CheckOther
+goto UsePackaged
DoDownload:
ReadINIStr $R0 $0 "Field 5" "State"
CheckOther:
ReadINIStr $R0 $0 "Field 7" "State"
- StrCmp $R0 "1" +1 done
+ StrCmp $R0 "" done
CopyFiles $R0 "$WINDIR\afsdcell.ini"
done:
FunctionEnd
+Function AddProvider
+ Push $R0
+ Push $R1
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 DoOther
+ ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder"
+ StrCpy $R0 "$R1,TransarcAFSDaemon"
+ WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder" "ProviderOrder" $R0
+DoOther:
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 End
+ ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder"
+ StrCpy $R0 "$R1,TransarcAFSDaemon"
+ WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" "ProviderOrder" $R0
+End:
+ Pop $R1
+ Pop $R0
+FunctionEnd
+
+Function un.RemoveProvider
+ Push $R0
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder"
+ Call un.RemoveFromProvider
+ StrCpy $R0 "TransarcAFSDaemon"
+ Push $R0
+ StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order"
+ Call un.RemoveFromProvider
+ Pop $R0
+FunctionEnd
+
+Function un.RemoveFromProvider
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ ReadRegStr $1 HKLM "$R0" "ProviderOrder"
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 "," +2 # if last char != ,
+ StrCpy $1 "$1," # append ,
+ Push $1
+ Push "$0,"
+ Call un.StrStr ; Find `$0,` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0,"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 "," 0 +2 # if last char == ,
+ StrCpy $3 $3 -1 # remove last char
+
+ WriteRegStr HKLM "$R0" "ProviderOrder" $3
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+Function CheckPathForAFS
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+ ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ StrCpy $1 "$1;"
+loop:
+ Push $1
+ Push ";"
+ Call StrStr
+ Pop $0
+ StrLen $2 $0
+ StrCpy $3 $1 -$2
+ IfFileExists "$3\afsd_service.exe" Error
+ StrCpy $1 $0 32768 1
+ StrLen $2 $1
+ IntCmp $2 0 Done Done loop
+ goto Done
+Error:
+ MessageBox MB_ICONSTOP|MB_OK|MB_TOPMOST "This installer is unable to upgrade the previous version of AFS. Please uninstall the current AFS version before continuing."
+ Abort "Unable to install OpenAFS"
+Done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+Function AddToUniquePath
+ Pop $R0
+ Push $R0
+ Push "$R0;"
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
+ Push "$R0;"
+ Call StrStr
+ Pop $R0
+ StrCmp $R0 "" +1 Done
+ Call AddToPath
+Done:
+FunctionEnd
;-------------------------------
StrCmp $R0 "" NotInstalled
; Now we see if it's an older or newer version
-
+
Call GetInstalledVersionMajor
Pop $R0
IntCmpU $R0 ${AFS_MAJORVERSION} +1 Upgrade Downgrade
Exch $R0
goto end
-
NotInstalled:
StrCpy $R0 "0"
Exch $R0
!define RegCloseKey "Advapi32::RegCloseKeyA(i) i"
Exch $R0
- Push $R1
- Push $R2
- Push $R9
+ Push $1
+ Push $2
+ Push $9
SetPluginUnload alwaysoff
; Create a buffer for the multi_sz value
; Open/create the registry key
System::Call "${RegCreateKey}(${HKEY_LOCAL_MACHINE}, '$REG_SUB_KEY', .r0) .r9"
; Failed?
- IntCmp $R9 0 write
+ IntCmp $9 0 write
MessageBox MB_OK|MB_ICONSTOP "Can't create registry key! ($9)"
Goto noClose
write:
; Fill in the buffer with our strings
- StrCpy $R2 $R1 ; Initial position
+ StrCpy $2 $1 ; Initial position
- StrLen $R9 '$REG_DATA_1' ; Length of first string
- IntOp $R9 $R9 + 1 ; Plus null
- System::Call "*$R2(&t$R9 '$REG_DATA_1')" ; Place the string
- IntOp $R2 $R2 + $R9 ; Advance to the next position
+ StrLen $9 '$REG_DATA_1' ; Length of first string
+ IntOp $9 $9 + 1 ; Plus null
+ System::Call "*$2(&t$9 '$REG_DATA_1')" ; Place the string
+ IntOp $2 $2 + $9 ; Advance to the next position
StrCmp '$REG_DATA_2' "" terminate
- StrLen $R9 '$REG_DATA_2' ; Length of second string
- IntOp $R9 $R9 + 1 ; Plus null
- System::Call "*$R2(&t$R9 '$REG_DATA_2')" ; Place the string
- IntOp $R2 $R2 + $R9 ; Advance to the next position
+ StrLen $9 '$REG_DATA_2' ; Length of second string
+ IntOp $9 $9 + 1 ; Plus null
+ System::Call "*$2(&t$9 '$REG_DATA_2')" ; Place the string
+ IntOp $2 $2 + $9 ; Advance to the next position
StrCmp '$REG_DATA_3' "" terminate
- StrLen $R9 '$REG_DATA_3' ; Length of third string
- IntOp $R9 $R9 + 1 ; Plus null
- System::Call "*$R2(&t$R9 '$REG_DATA_3')" ; Place the string
- IntOp $R2 $R2 + $9 ; Advance to the next position
+ StrLen $9 '$REG_DATA_3' ; Length of third string
+ IntOp $9 $9 + 1 ; Plus null
+ System::Call "*$2(&t$9 '$REG_DATA_3')" ; Place the string
+ IntOp $2 $2 + $9 ; Advance to the next position
terminate:
- System::Call "*$R2(&t1 '')" ; Place the terminating null
- IntOp $R2 $R2 + 1 ; Advance to the next position
+ System::Call "*$2(&t1 '')" ; Place the terminating null
+ IntOp $2 $2 + 1 ; Advance to the next position
; Create/write the value
- IntOp $R2 $R2 - $R1 ; Total length
+ IntOp $2 $2 - $1 ; Total length
System::Call "${RegSetValueEx}(r0, '$REG_VALUE', 0, ${REG_MULTI_SZ}, r1, r2) .r9"
; Failed?
- IntCmp $R9 0 done
- MessageBox MB_OK|MB_ICONSTOP "Can't set key value! ($R9)"
+ IntCmp $9 0 done
+ MessageBox MB_OK|MB_ICONSTOP "Can't set key value! ($9)"
Goto done
done:
noClose:
; Clear the buffer
SetPluginUnload manual
- System::Free $R1
+ System::Free $1
- Pop $R9
- Pop $R2
- Pop $R1
+ Pop $9
+ Pop $2
+ Pop $1
Exch $R0
FunctionEnd
\ No newline at end of file