VirtualBox

Changeset 44484 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jan 31, 2013 11:36:25 AM (12 years ago)
Author:
vboxsync
Message:

Windows Guest Additions installer: Relative jump bugfixes, simplified OS detection, logging.

Location:
trunk/src/VBox/Additions/WINNT/Installer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditions.nsi

    r44459 r44484  
    402402        ; Prevent popping up usage message on (yet) unknown parameters
    403403        ; in silent mode, just skip
    404         IfSilent 0 +2
     404        IfSilent +1 +2
    405405          ${Break}
    406406        goto usage
     
    473473begin:
    474474
     475  ${LogVerbose} "Checking for old Guest Additions ..."
     476
    475477sun_check:
    476478
     
    587589  ${EndIf}
    588590
     591  IfSilent +1 +2
     592    StrCpy $g_bLogEnable "true" ; Force logging in silent mode
     593
     594  ${LogEnable} "$g_bLogEnable"
     595  IfSilent +1 +2 ; NSIS will expand ${LogVerbose} before doing relative jumps!
     596    LogText "Installer runs in silent mode"
     597
    589598  SetOutPath "$INSTDIR"
    590599  SetOverwrite on
     
    598607    ${LogVerbose} "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
    599608  ${Else}
    600     ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected."
     609    ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected"
    601610  ${EndIf}
    602611!if $%BUILD_TARGET_ARCH% == "amd64"
     
    610619  ${LogVerbose} "Installer runs in debug mode"
    611620!endif
     621
     622  ; Retrieve capabilities
     623  Call CheckForCapabilities
    612624
    613625  ;
     
    10491061FunctionEnd
    10501062
    1051 ; This function is called when a critical error occurred
     1063; This function is called when a critical error occurred, caused by
     1064; the Abort command
    10521065Function .onInstFailed
    10531066
     1067  ${LogVerbose} "$(VBOX_ERROR_INST_FAILED)"
    10541068  MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
    10551069
     
    10661080Function .onInstSuccess
    10671081
     1082  ${LogVerbose} "${PRODUCT_NAME} successfully installed"
     1083
    10681084  ${If} $g_bPostInstallStatus == "true"
    10691085    ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
    10701086  ${EndIf}
     1087
     1088  SetErrorLevel 0
    10711089
    10721090FunctionEnd
     
    11391157  ${EndIf}
    11401158
    1141   IfSilent 0 +2
    1142     StrCpy $g_bLogEnable "true" ; Force logging in silent mode
    1143 
    1144   ${LogEnable} "$g_bLogEnable"
    1145   IfSilent 0 +2
    1146     ${LogVerbose} "Installer runs in silent mode"
    1147 
    11481159  ; Retrieve Windows version and store result in $g_strWinVersion
    1149   Call GetWindowsVer
    1150 
    1151   ; Retrieve capabilities
    1152   Call CheckForCapabilities
     1160  Call GetWindowsVersionEx
     1161  Pop $g_strWinVersion
    11531162
    11541163  ; Get user Name
    11551164  AccessControl::GetCurrentUserName
    11561165  Pop $g_strCurUser
    1157   ${LogVerbose} "Current user is: $g_strCurUser"
     1166  ${LogVerbose} "Current user: $g_strCurUser"
    11581167
    11591168  ; Only extract files? This action can be called even from non-Admin users
     
    11741183    MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
    11751184!endif
    1176     Abort
     1185    Abort "$(VBOX_NOTICE_ARCH_AMD64)"
    11771186  ${EndIf}
    11781187
     
    12741283
    12751284  ; Retrieve Windows version we're running on and store it in $g_strWinVersion
    1276   Call un.GetWindowsVer
     1285  Call un.GetWindowsVersionEx
     1286  Pop $g_strWinVersion
    12771287
    12781288  ; Retrieve capabilities
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsCommon.nsh

    r44459 r44484  
    137137    !endif ; $%VBOX_WITH_CROGL% == "1"
    138138  !endif ; $%BUILD_TARGET_ARCH% == "amd64"
    139  
     139
    140140  !if $%VBOX_WITH_WDDM_W8% == "1"
    141141  ; WDDM Video driver for Win8
     
    277277!insertmacro CheckArchitecture "un."
    278278
    279 !macro GetWindowsVer un
    280 Function ${un}GetWindowsVer
    281 
    282   ; Check if we are running on w2k or above
    283   ; For other windows versions (>XP) it may be necessary to change winver.nsh
     279;
     280; Macro for retrieving the Windows version this installer is running on.
     281;
     282; @return  Stack: Windows version string. Empty on error /
     283;                 if not able to identify.
     284;
     285!macro GetWindowsVersionEx un
     286Function ${un}GetWindowsVersionEx
     287
     288  Push $0
     289  Push $1
     290
     291  ; Check if we are running on Windows 2000 or above
     292  ; For other windows versions (> XP) it may be necessary to change winver.nsh
    284293  Call ${un}GetWindowsVersion
    285   Pop $R3     ; Windows Version
    286 
    287   Push $R3    ; The windows version string
    288   Push "NT"   ; String to search for. Win 2k family returns no string containing 'NT'
     294  Pop $0         ; Windows Version
     295
     296  Push $0        ; The windows version string
     297  Push "NT"      ; String to search for. W2K+ returns no string containing "NT"
    289298  Call ${un}StrStr
    290   Pop $R0
    291   StrCmp $R0 '' nt5plus       ; Not NT 3.XX or 4.XX
    292 
    293   ; Ok we know it is NT. Must be a string like NT X.XX
    294   Push $R3    ; The windows version string
    295   Push "4."   ; String to search for
    296   Call ${un}StrStr
    297   Pop $R0
    298   StrCmp $R0 "" nt5plus nt4   ; If empty -> not NT 4
    299 
    300 nt5plus:    ; Windows 2000+ (XP, Vista, ...)
    301 
    302   StrCpy $g_strWinVersion $R3
    303   goto exit
    304 
    305 nt4:        ; NT 4.0
    306 
    307   StrCpy $g_strWinVersion "NT4"
    308   goto exit
    309 
    310 exit:
    311 
    312 FunctionEnd
    313 !macroend
    314 !insertmacro GetWindowsVer ""
    315 !insertmacro GetWindowsVer "un."
     299  Pop $1
     300
     301  ${If} $1 == "" ; If empty -> not NT 3.XX or 4.XX
     302    StrCpy $g_strWinVersion $0 ; Use original version string
     303  ${Else}
     304    ; Ok we know it is NT. Must be a string like NT X.XX
     305    Push $0        ; The windows version string
     306    Push "4."      ; String to search for
     307    Call ${un}StrStr
     308    Pop $1
     309    ${If} $1 == "" ; If empty -> not NT 4
     310      ;; @todo NT <= 3.x ?
     311      StrCpy $g_strWinVersion $0 ; Use original version string
     312    ${Else}
     313      StrCpy $g_strWinVersion "NT4"
     314    ${EndIf}
     315  ${EndIf}
     316
     317  Pop $1
     318  Exch $0
     319
     320FunctionEnd
     321!macroend
     322!insertmacro GetWindowsVersionEx ""
     323!insertmacro GetWindowsVersionEx "un."
    316324
    317325!macro GetAdditionsVersion un
     
    415423  ${LogVerbose} "Stopping attempt #$3"
    416424!endif
    417  
     425
    418426  ${If} $g_strWinVersion == "NT4"
    419427    StrCpy $2 "VBoxServiceNT.exe"
     
    748756
    749757;
    750 ; Macro for copying a file only if the source file is verified 
     758; Macro for copying a file only if the source file is verified
    751759; to be from a certain vendor and architecture.
    752760; @return  Stack: "0" if copied, "1" if not, "2" on error / not found.
     
    761769  Push "${Architecture}"
    762770  Push "${Vendor}"
    763   Push "${FileSrc}" 
     771  Push "${FileSrc}"
    764772  Call ${un}VerifyFile
    765773  Pop $0
     
    837845  ; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
    838846  ;       it simply is not present there.
    839  
    840   ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones 
     847
     848  ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones
    841849  ;         in SysWOW64 (or in system32 on 32-bit systems).
    842850
     
    848856  ${EndIf}
    849857!endif
    850  
     858
    851859  ${VerifyFileEx} "${un}" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    852860  Pop $0
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh

    r44459 r44484  
    11; $Id$
    22;; @file
    3 ; VBoxGuestAdditionExternal.nsh - Utility function for invoking external 
     3; VBoxGuestAdditionExternal.nsh - Utility function for invoking external
    44;                                 applications.
    55;
     
    3232  Push $0
    3333  Push $1
    34  
     34
    3535  !define _macroLoc ${__LINE__}
    36  
     36
    3737  ${LogVerbose} "Executing: ${cmdline}"
    38   IfSilent 0 +6
    39     nsExec::ExecToStack "${cmdline}"
     38  IfSilent silent_${_macroLoc} +1
     39    nsExec::ExecToLog "${cmdline}"
    4040    Pop $0 ; Return value (exit code)
    41     Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
    42     ${LogVerbose} "$1"
    4341    goto done_${_macroLoc}
    44    
    45   nsExec::ExecToLog "${cmdline}"
     42
     43silent_${_macroLoc}:
     44
     45  nsExec::ExecToStack "${cmdline}"
    4646  Pop $0 ; Return value (exit code)
     47  Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
     48  ${LogVerbose} "$1"
    4749  goto done_${_macroLoc}
    48    
     50
    4951done_${_macroLoc}:
    5052
    51   ${LogVerbose} "Execution returned: $0"
     53  ${LogVerbose} "Execution returned exit code: $0"
    5254  IntCmp $0 0 +1 error_${_macroLoc} error_${_macroLoc} ; Check ret value (0=OK, 1=Error)
    5355  goto return_${_macroLoc}
    54  
     56
    5557error_${_macroLoc}:
    56  
     58
    5759  ${If} ${optional} == "false"
    58     ${LogVerbose} "Error excuting $\"${cmdline}$\" (Return value: $0) -- aborting installation" 
    59     Abort
     60    ${LogVerbose} "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
     61    Abort "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
    6062  ${Else}
    6163    ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
    6264  ${EndIf}
    6365  goto return_${_macroLoc}
    64  
     66
    6567return_${_macroLoc}:
    66  
     68
    6769  Pop $1
    6870  Pop $0
    69  
     71
    7072  !undef _macroLoc
    7173
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsLog.nsh

    r44352 r44484  
    3939!macro _logVerbose text
    4040
    41   LogText  "${text}"
     41  LogText "${text}"
    4242  IfSilent +2
    4343    DetailPrint "${text}"
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette