VirtualBox

Changeset 50421 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Feb 12, 2014 11:12:01 AM (11 years ago)
Author:
vboxsync
Message:

Windows Guest Additions installer: Remove Windows Resource Protection (WRP) before restoring D3D system files.

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

Legend:

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

    r50401 r50421  
    787787SectionEnd
    788788
    789 ; Prepares the access rights for replacing
    790 ; a WRP (Windows Resource Protection) protected file
    791 Function PrepareWRPFile
    792 
    793   Pop $0
    794 
    795   ${IfNot} ${FileExists} "$0"
    796     ${LogVerbose} "WRP: File $0 does not exist, skipping"
    797     Return
    798   ${EndIf}
    799 
    800   ${If} ${FileExists} "$g_strSystemDir\takeown.exe"
    801     ${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
    802   ${Else}
    803     ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
    804   ${EndIf}
    805 
    806   AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
    807   Pop $1
    808   ${LogVerbose} "WRP: Setting file owner for $0 returned: $1"
    809 
    810   AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
    811   Pop $1
    812   ${LogVerbose} "WRP: Setting access rights for $0 returned: $1"
    813 
    814 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
    815   !ifdef WFP_FILE_EXCEPTION
    816     VBoxGuestInstallHelper::DisableWFP "$0"
    817     Pop $1 ; Get return value (ignored for now)
    818     ${LogVerbose} "WRP: Setting WFP exception for $0 returned: $1"
    819   !endif
    820 !endif
    821 
    822 FunctionEnd
    823 
    824789; Direct3D support
    825790Section /o $(VBOX_COMPONENT_D3D) SEC03
     
    827792!if $%VBOX_WITH_WDDM% == "1"
    828793  ${If} $g_bWithWDDM == "true"
     794    ${LogVerbose} "Installing WDDM Direct3D support ..."
     795
    829796    ; Do we need to restore the original d3d8.dll/d3d9.dll files because the guest
    830797    ; installation was upgraded from XPDM to WDDM driver? In a XPDM installation
     
    835802!endif
    836803
     804  Call SetAppMode64
    837805  SetOverwrite on
    838806
     
    842810
    843811  SetOutPath $g_strSystemDir
    844   ${LogVerbose} "Installing Direct3D support ..."
     812  ${LogVerbose} "Installing XPDM Direct3D support ..."
    845813  FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
    846814  FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
     
    856824      ${CopyFileEx} "" "$g_strSystemDir\dllcache\d3d9.dll" "$g_strSystemDir\dllcache\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    857825
    858       Push "$g_strSystemDir\dllcache\d3d8.dll"
    859       Call PrepareWRPFile
    860 
    861       Push "$g_strSystemDir\dllcache\d3d9.dll"
    862       Call PrepareWRPFile
    863 
    864826      ; Exchange DLLs
     827      ${PrepareWRPFileEx} "" "$g_strSystemDir\dllcache\d3d8.dll"
    865828      ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
     829      ${PrepareWRPFileEx} "" "$g_strSystemDir\dllcache\d3d9.dll"
    866830      ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
    867831    ${Else}
     
    877841  ${CopyFileEx} "" "$g_strSystemDir\d3d9.dll" "$g_strSystemDir\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    878842
    879   Push "$g_strSystemDir\d3d8.dll"
    880   Call PrepareWRPFile
    881 
    882   Push "$g_strSystemDir\d3d9.dll"
    883   Call PrepareWRPFile
    884 
    885843  ; Exchange DLLs
     844  ${PrepareWRPFileEx} "" "$g_strSystemDir\d3d8.dll"
    886845  ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
     846  ${PrepareWRPFileEx} "" "$g_strSystemDir\d3d9.dll"
    887847  ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
    888848
     
    905865        ${CopyFileEx} "" "$g_strSysWow64\dllcache\d3d9.dll" "$g_strSysWow64\dllcache\msd3d9.dll" "Microsoft Corporation" "x86"
    906866
    907         Push "$g_strSysWow64\dllcache\d3d8.dll"
    908         Call PrepareWRPFile
    909 
    910         Push "$g_strSysWow64\dllcache\d3d9.dll"
    911         Call PrepareWRPFile
    912 
    913867        ; Exchange DLLs
     868        ${PrepareWRPFileEx} "" "$g_strSysWow64\dllcache\d3d8.dll"
    914869        ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP"
     870        ${PrepareWRPFileEx} "" "$g_strSysWow64\dllcache\d3d9.dll"
    915871        ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP"
    916872      ${Else}
     
    927883    ${CopyFileEx} "" "$g_strSysWow64\d3d9.dll" "$g_strSysWow64\msd3d9.dll" "Microsoft Corporation" "x86"
    928884
    929     Push "$g_strSysWow64\d3d8.dll"
    930     Call PrepareWRPFile
    931 
    932     Push "$g_strSysWow64\d3d9.dll"
    933     Call PrepareWRPFile
    934 
    935     ; Exchange DLLs
     885    ${PrepareWRPFileEx} "" "$g_strSysWow64\d3d8.dll"
    936886    ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP"
     887    ${PrepareWRPFileEx} "" "$g_strSysWow64\d3d9.dll"
    937888    ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP"
    938889
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsCommon.nsh

    r50414 r50421  
    823823; @return  Stack: "0" if copied, "1" if not, "2" on error / not found.
    824824; @param   Un/Installer prefix; either "" or "un".
    825 ; @param   Name of lib/DLL to verify and copy to destination.
    826 ; @param   Destination name to copy verified file to.
     825; @param   Name of lib/DLL to copy to destination.
     826; @param   Destination name to copy the source file to.
    827827; @param   Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
    828828;
     
    10411041  ;         in SysWOW64 (or in system32 on 32-bit systems).
    10421042
     1043  ${LogVerbose} "Restoring original D3D files ..."
    10431044!if $%BUILD_TARGET_ARCH% == "x86"
     1045  $PrepareWRPFileEx} "${un}" "$SYSDIR\d3d8.dll"
    10441046  ${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    10451047!endif
     1048  $PrepareWRPFileEx} "${un}" "$SYSDIR\d3d9.dll"
    10461049  ${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    10471050
    10481051  ${If} $g_bCapDllCache == "true"
    10491052!if $%BUILD_TARGET_ARCH% == "x86"
     1053    $PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll"
    10501054    ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    10511055!endif
     1056    $PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll"
    10521057    ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
    10531058  ${EndIf}
    10541059
    10551060!if $%BUILD_TARGET_ARCH% == "amd64"
     1061  $PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d8.dll"
    10561062  ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
     1063  $PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d9.dll"
    10571064  ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
    10581065
    10591066  ${If} $g_bCapDllCache == "true"
     1067    $PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll"
    10601068    ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
     1069    $PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll"
    10611070    ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
    10621071  ${EndIf}
     
    10771086!insertmacro RestoreFilesDirect3D ""
    10781087!insertmacro RestoreFilesDirect3D "un."
     1088
     1089; Prepares the access rights for replacing
     1090; a WRP (Windows Resource Protection) protected file
     1091!macro PrepareWRPFile un
     1092Function ${un}PrepareWRPFile
     1093
     1094  Pop $0
     1095  Push $1
     1096
     1097  ${IfNot} ${FileExists} "$0"
     1098    ${LogVerbose} "WRP: File $\"$0$\" does not exist, skipping"
     1099    Return
     1100  ${EndIf}
     1101
     1102  ${If} ${FileExists} "$g_strSystemDir\takeown.exe"
     1103    ${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
     1104  ${Else}
     1105    ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
     1106  ${EndIf}
     1107
     1108  AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
     1109  Pop $1
     1110  ${LogVerbose} "WRP: Setting file owner for $\"$0$\" returned: $1"
     1111
     1112  AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
     1113  Pop $1
     1114  ${LogVerbose} "WRP: Setting access rights for $\"$0$\" returned: $1"
     1115
     1116!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
     1117  !ifdef WFP_FILE_EXCEPTION
     1118    VBoxGuestInstallHelper::DisableWFP "$0"
     1119    Pop $1 ; Get return value (ignored for now)
     1120    ${LogVerbose} "WRP: Setting WFP exception for $\"$0$\" returned: $1"
     1121  !endif
     1122!endif
     1123
     1124  Pop $1
     1125
     1126FunctionEnd
     1127!macroend
     1128!insertmacro PrepareWRPFile ""
     1129!insertmacro PrepareWRPFile "un."
     1130
     1131;
     1132; Macro for preparing the access rights for replacing
     1133; a WRP (Windows Resource Protection) protected file.
     1134; @return  None.
     1135; @param   Path of file to prepare.
     1136;
     1137!macro PrepareWRPFileEx un FileSrc
     1138  Push $0
     1139  Push "${FileSrc}"
     1140  Call ${un}PrepareWRPFile
     1141  Pop $0
     1142!macroend
     1143!define PrepareWRPFileEx "!insertmacro PrepareWRPFileEx"
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