VirtualBox

Ignore:
Timestamp:
Jan 24, 2013 12:05:12 PM (12 years ago)
Author:
vboxsync
Message:

Windows Guest Additions installer: Fixed updating auto-logon modules when not specified explicitly, implemented new logging facility to also support proper unattended logging.

File:
1 edited

Legend:

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

    r44341 r44352  
    55
    66;
    7 ; Copyright (C) 2012 Oracle Corporation
     7; Copyright (C) 2012-2013 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
     
    240240
    241241; Platform parts of this installer
     242!include "VBoxGuestAdditionsLog.nsh"
    242243!include "VBoxGuestAdditionsCommon.nsh"
    243244!if $%BUILD_TARGET_ARCH% == "x86"       ; 32-bit only
    244 !include "VBoxGuestAdditionsNT4.nsh"
     245  !include "VBoxGuestAdditionsNT4.nsh"
    245246!endif
    246247!include "VBoxGuestAdditionsW2KXP.nsh"
     
    445446done:
    446447
    447   IfSilent 0 +2
    448     LogText "Installer is in silent mode!"
    449 
    450   LogText "Property: XRes: $g_iScreenX"
    451   LogText "Property: YRes: $g_iScreenY"
    452   LogText "Property: BPP: $g_iScreenBpp"
    453   LogText "Property: Logging enabled: $g_bLogEnable"
    454 
     448!ifdef _DEBUG
     449  ${LogVerbose} "Property: XRes: $g_iScreenX"
     450  ${LogVerbose} "Property: YRes: $g_iScreenY"
     451  ${LogVerbose} "Property: BPP: $g_iScreenBpp"
     452  ${LogVerbose} "Property: Logging enabled: $g_bLogEnable"
     453!endif
     454 
    455455exit:
    456456
     
    545545  Push $1
    546546
    547   DetailPrint "Checking for installed components ..."
    548 
     547  ${LogVerbose} "Checking for installed components ..."
     548  StrCpy $1 ""
     549 
    549550  Call SetAppMode64
    550551
     
    553554  ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
    554555  ${If} $0 == "VBoxGINA.dll"
    555     StrCpy $g_bWithAutoLogon "true"
    556     StrCpy $1 "1"
    557   ${EndIf}
    558 
    559   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" ""
    560   ${If} $0 == "VBoxCredProv.dll"
    561     StrCpy $g_bWithAutoLogon "true"
    562     StrCpy $1 "1"
    563   ${EndIf}
    564 
    565   ${If} $1 == "1"
    566     DetailPrint "Auto-logon support was not installed previously"
    567   ${EndIf}
    568 
    569   ${If} $g_bWithAutoLogon == "true"
    570     DetailPrint "Found already installed auto-logon support ..."
     556    StrCpy $1 "GINA"
     557  ${Else}
     558    ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" ""
     559    ${If} $0 == "VBoxCredProv"
     560      StrCpy $1 "Credential Provider"
     561    ${EndIf}
     562  ${EndIf}
     563
     564!ifdef _DEBUG
     565  ${LogVerbose} "Auto-logon module: $0"
     566!endif
     567 
     568  ${IfNot} $1 == ""
     569    ${LogVerbose} "Auto-logon support ($1) was installed previously"
     570    StrCpy $g_bWithAutoLogon "true" ; Force update
     571  ${Else}
     572    ${LogVerbose} "Auto-logon support was not installed previously"
    571573  ${EndIf}
    572574
     
    580582
    581583  SectionIn RO ; Section cannot be unselected (read-only)
    582 
    583   Push "${PRODUCT_NAME} update started, please wait ..."
    584   Push 0 ; Message type = info
    585   Call WriteLogVBoxTray
     584  ${If} $g_bPostInstallStatus == "true"
     585    ${LogToVBoxTray} "0" "${PRODUCT_NAME} update started, please wait ..."
     586  ${EndIf}
    586587
    587588  SetOutPath "$INSTDIR"
     
    592593  StrCpy $g_strSystemDir "$SYSDIR"
    593594
    594   Call EnableLog
    595 
    596   DetailPrint "Version: $%VBOX_VERSION_STRING% (Rev $%VBOX_SVN_REV%)"
     595  ${LogVerbose}  "$g_bLogEnable"
     596
     597  ${LogVerbose} "Version: $%VBOX_VERSION_STRING% (Rev $%VBOX_SVN_REV%)"
    597598  ${If} $g_strAddVerMaj != ""
    598     DetailPrint "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
     599    ${LogVerbose} "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
    599600  ${Else}
    600     DetailPrint "No previous version of ${PRODUCT_NAME} detected."
     601    ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected."
    601602  ${EndIf}
    602603!if $%BUILD_TARGET_ARCH% == "amd64"
    603   DetailPrint "Detected OS: Windows $g_strWinVersion (64-bit)"
     604  ${LogVerbose} "Detected OS: Windows $g_strWinVersion (64-bit)"
    604605!else
    605   DetailPrint "Detected OS: Windows $g_strWinVersion (32-bit)"
    606 !endif
    607   DetailPrint "System Directory: $g_strSystemDir"
     606  ${LogVerbose} "Detected OS: Windows $g_strWinVersion (32-bit)"
     607!endif
     608  ${LogVerbose} "System Directory: $g_strSystemDir"
    608609
    609610!ifdef _DEBUG
    610   DetailPrint "Debug!"
     611  ${LogVerbose} "Installer runs in debug mode"
    611612!endif
    612613
     
    691692exit:
    692693
    693   Call WriteLogUI
    694 
    695694SectionEnd
    696695
     
    703702  Pop $R0 ; Windows Version
    704703
    705   DetailPrint "Installing auto-logon support ..."
     704  ${LogVerbose} "Installing auto-logon support ..."
    706705
    707706  ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
     
    710709  ${If} $0 != ""
    711710    ${If} $0 != "VBoxGINA.dll"
    712       DetailPrint "Found another already installed GINA module: $0"
     711      ${LogVerbose} "Found another already installed GINA module: $0"
    713712      MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
    714       DetailPrint "Skipping GINA installation, keeping: $0"
     713      ${LogVerbose} "Skipping GINA installation, keeping: $0"
    715714      goto skip
    716715    ${EndIf}
     
    724723  ${OrIf} $R0 == '8'     ; Windows 8.
    725724    ; Use VBoxCredProv on Vista and up.
    726     DetailPrint "Installing VirtualBox credential provider ..."
     725    ${LogVerbose} "Installing VirtualBox credential provider ..."
    727726    !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
    728727    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
     
    731730    WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
    732731  ${Else} ; Use VBoxGINA on older Windows OSes (< Vista)
    733     DetailPrint "Installing VirtualBox GINA ..."
     732    ${LogVerbose} "Installing VirtualBox GINA ..."
    734733    !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
    735734    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
     
    755754
    756755  ${IfNot} ${FileExists} "$0"
    757     LogText "WRP: File $0 does not exist, skipping"
     756    ${LogVerbose} "WRP: File $0 does not exist, skipping"
    758757    Return
    759758  ${EndIf}
     
    762761    nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"'
    763762    Pop $1 ; Ret value
    764     LogText "WRP: Taking ownership for $0 returned: $1"
     763    ${LogVerbose} "WRP: Taking ownership for $0 returned: $1"
    765764  ${Else}
    766     LogText "WRP: Warning: takeown.exe not found, skipping"
     765    ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
    767766  ${EndIf}
    768767
    769768  AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
    770769  Pop $1
    771   DetailPrint "WRP: Setting file owner for $0 returned: $1"
     770  ${LogVerbose} "WRP: Setting file owner for $0 returned: $1"
    772771
    773772  AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
    774773  Pop $1
    775   DetailPrint "WRP: Setting access rights for $0 returned: $1"
     774  ${LogVerbose} "WRP: Setting access rights for $0 returned: $1"
    776775
    777776!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
     
    779778    VBoxGuestInstallHelper::DisableWFP "$0"
    780779    Pop $1 ; Get return value (ignored for now)
    781     DetailPrint "WRP: Setting WFP exception for $0 returned: $1"
     780    ${LogVerbose} "WRP: Setting WFP exception for $0 returned: $1"
    782781  !endif
    783782!endif
     
    802801
    803802  SetOutPath $g_strSystemDir
    804   DetailPrint "Installing Direct3D support ..."
     803  ${LogVerbose} "Installing Direct3D support ..."
    805804  FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
    806805  FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
     
    826825      ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
    827826    ${Else}
    828         DetailPrint "DLL cache does not exist, skipping"
     827        ${LogVerbose} "DLL cache does not exist, skipping"
    829828    ${EndIf}
    830829  ${EndIf}
     
    851850    ; Also copy 32-bit DLLs on 64-bit Windows in SysWOW64 node
    852851    SetOutPath $g_strSysWow64
    853     DetailPrint "Installing Direct3D support for 32-bit applications (SysWOW64: $g_strSysWow64) ..."
     852    ${LogVerbose} "Installing Direct3D support for 32-bit applications (SysWOW64: $g_strSysWow64) ..."
    854853    FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
    855854    FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
     
    875874        ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP"
    876875      ${Else}
    877         DetailPrint "DLL cache does not exist, skipping"
     876        ${LogVerbose} "DLL cache does not exist, skipping"
    878877      ${EndIf}
    879878    ${EndIf}
     
    944943
    945944!ifdef _DEBUG
    946   DetailPrint "Doing post install ..."
     945  ${LogVerbose} "Doing post install ..."
    947946!endif
    948947
     
    974973!endif
    975974
    976   DetailPrint "Installation completed."
     975  ${LogVerbose} "Installation completed."
    977976
    978977SectionEnd
     
    10581057  MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
    10591058
    1060   Push "Error while installing ${PRODUCT_NAME}!"
    1061   Push 2 ; Message type = error
    1062   Call WriteLogVBoxTray
    1063 
    1064   StrCpy $g_bLogEnable "true"
    1065   Call WriteLogUI
     1059  ${If} $g_bPostInstallStatus == "true"
     1060    ${LogToVBoxTray} "2" "Error while installing ${PRODUCT_NAME}!"
     1061  ${EndIf}
     1062
     1063  ; Set overall exit code
    10661064  SetErrorLevel 1
    10671065
     
    10711069Function .onInstSuccess
    10721070
    1073   Push "${PRODUCT_NAME} successfully updated!"
    1074   Push 0 ; Message type = info
    1075   Call WriteLogVBoxTray
     1071  ${If} $g_bPostInstallStatus == "true"
     1072    ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
     1073  ${EndIf}
    10761074
    10771075FunctionEnd
     
    11441142  ${EndIf}
    11451143
     1144  IfSilent 0 +3
     1145    ${LogEnable} "true" ; Force logging in silent mode
     1146    ${LogVerbose} "Installer runs in silent mode"
     1147
    11461148  ; Retrieve Windows version and store result in $g_strWinVersion
    11471149  Call GetWindowsVer
     
    11531155  AccessControl::GetCurrentUserName
    11541156  Pop $g_strCurUser
    1155   DetailPrint "Current user: $g_strCurUser"
     1157  ${LogVerbose} "Current user is: $g_strCurUser"
    11561158
    11571159  ; Only extract files? This action can be called even from non-Admin users
     
    12821284
    12831285!ifdef _DEBUG
    1284   ; Enable logging
    1285   Call un.EnableLog
     1286  ${LogEnable} "true"
    12861287!endif
    12871288
     
    13041305restart:
    13051306
    1306   DetailPrint "Rebooting ..."
     1307  ${LogVerbose} "Rebooting ..."
    13071308  Reboot
    13081309
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