Changeset 39549 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Dec 7, 2011 3:43:14 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Installer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditions.nsi
r39516 r39549 205 205 Var g_iSystemMode ; Current system mode (0 = Normal boot, 1 = Fail-safe boot, 2 = Fail-safe with network boot) 206 206 Var g_strSystemDir ; Windows system directory 207 Var g_strSysWow64 ; The SysWow64 directory on 64-bit systems 207 208 Var g_strCurUser ; Current user using the system 208 209 Var g_strAddVerMaj ; Installed Guest Additions: Major version … … 835 836 836 837 !if $%BUILD_TARGET_ARCH% == "amd64" 837 ; We need a special directory set to SysWOW64 because some838 ; shell operations don't support file redirection (yet)839 Var /GLOBAL SYSWOW64DIR840 StrCpy $SYSWOW64DIR "$WINDIR\SysWOW64"841 838 ; Only 64-bit installer: 842 839 ; Also copy 32-bit DLLs on 64-bit Windows in SysWOW64 node 843 SetOutPath $ SYSWOW64DIR844 DetailPrint "Installing Direct3D support (SysWOW64: $ SYSWOW64DIR) ..."840 SetOutPath $g_strSysWow64 841 DetailPrint "Installing Direct3D support (SysWOW64: $g_strSysWow64) ..." 845 842 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll" 846 843 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll" … … 853 850 854 851 ; Save original DLLs (only if msd3d*.dll does not exist) ... 855 SetOutPath "$ SYSWOW64DIR\dllcache"856 IfFileExists "$ SYSWOW64DIR\dllcache\msd3d8.dll" +2857 CopyFiles /SILENT "$ SYSWOW64DIR\dllcache\d3d8.dll" "$SYSWOW64DIR\dllcache\msd3d8.dll"858 IfFileExists "$ SYSWOW64DIR\dllcache\msd3d9.dll" +2859 CopyFiles /SILENT "$ SYSWOW64DIR\dllcache\d3d9.dll" "$SYSWOW64DIR\dllcache\msd3d9.dll"860 861 Push "$ SYSWOW64DIR\dllcache\d3d8.dll"852 SetOutPath "$g_strSysWow64\dllcache" 853 IfFileExists "$g_strSysWow64\dllcache\msd3d8.dll" +2 854 CopyFiles /SILENT "$g_strSysWow64\dllcache\d3d8.dll" "$g_strSysWow64\dllcache\msd3d8.dll" 855 IfFileExists "$g_strSysWow64\dllcache\msd3d9.dll" +2 856 CopyFiles /SILENT "$g_strSysWow64\dllcache\d3d9.dll" "$g_strSysWow64\dllcache\msd3d9.dll" 857 858 Push "$g_strSysWow64\dllcache\d3d8.dll" 862 859 Call PrepareWRPFile 863 860 864 Push "$ SYSWOW64DIR\dllcache\d3d9.dll"861 Push "$g_strSysWow64\dllcache\d3d9.dll" 865 862 Call PrepareWRPFile 866 863 867 864 ; Exchange DLLs 868 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$ SYSWOW64DIR\dllcache\d3d8.dll" "$TEMP"869 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$ SYSWOW64DIR\dllcache\d3d9.dll" "$TEMP"865 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP" 866 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP" 870 867 871 868 ; If exchange above failed, do it on reboot 872 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$ SYSWOW64DIR\dllcache\d3d8.dll" "$TEMP"873 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$ SYSWOW64DIR\dllcache\d3d9.dll" "$TEMP"869 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP" 870 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP" 874 871 875 872 ; … … 878 875 879 876 ; Save original DLLs (only if msd3d*.dll does not exist) ... 880 IfFileExists "$ SYSWOW64DIR\msd3d8.dll" +2881 CopyFiles /SILENT "$ SYSWOW64DIR\d3d8.dll" "$SYSWOW64DIR\msd3d8.dll"882 IfFileExists "$ SYSWOW64DIR\msd3d9.dll" +2883 CopyFiles /SILENT "$ SYSWOW64DIR\d3d9.dll" "$SYSWOW64DIR\msd3d9.dll"884 885 Push "$ SYSWOW64DIR\d3d8.dll"877 IfFileExists "$g_strSysWow64\msd3d8.dll" +2 878 CopyFiles /SILENT "$g_strSysWow64\d3d8.dll" "$g_strSysWow64\msd3d8.dll" 879 IfFileExists "$g_strSysWow64\msd3d9.dll" +2 880 CopyFiles /SILENT "$g_strSysWow64\d3d9.dll" "$g_strSysWow64\msd3d9.dll" 881 882 Push "$g_strSysWow64\d3d8.dll" 886 883 Call PrepareWRPFile 887 884 888 Push "$ SYSWOW64DIR\d3d9.dll"885 Push "$g_strSysWow64\d3d9.dll" 889 886 Call PrepareWRPFile 890 887 891 888 ; Exchange DLLs 892 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$ SYSWOW64DIR\d3d8.dll" "$TEMP"893 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$ SYSWOW64DIR\d3d9.dll" "$TEMP"889 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP" 890 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP" 894 891 895 892 ; If exchange above failed, do it on reboot 896 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$ SYSWOW64DIR\d3d8.dll" "$TEMP"897 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$ SYSWOW64DIR\d3d9.dll" "$TEMP"893 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP" 894 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP" 898 895 899 896 !endif ; amd64 … … 1018 1015 ${EndIf} 1019 1016 ${EndIf} 1017 1018 ; Validate D3D files 1019 Call ValidateD3DFiles 1020 Pop $0 1021 ${If} $0 == "1" 1022 MessageBox MB_ICONINFORMATION|MB_OK "D3D files invalid!" /SD IDOK 1023 Goto d3d_disable 1024 ${EndIf} 1025 1020 1026 ${Else} ; D3D unselected again 1021 1027 ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory … … 1096 1102 StrCpy $g_bPostInstallStatus "false" 1097 1103 1104 ; We need a special directory set to SysWOW64 because some 1105 ; shell operations don't support file redirection (yet) 1106 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64" 1107 1098 1108 SetErrorLevel 0 1099 1109 ClearErrors -
trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsCommon.nsh
r38935 r39549 575 575 !insertmacro SetAppMode64 "un." 576 576 577 ; 578 ; Retrieves the vendor ("CompanyName" of FILEINFO structure) 579 ; of a given file. 580 ; @return Stack: Company name, or "" on error/if not found. 581 ; @param Stack: File name to retrieve vendor for. 582 ; 583 !macro GetFileVendor un 584 Function ${un}GetFileVendor 585 586 ; Preserve values 587 Exch $0 ; Stack: $0 <filename> (Get file name into $0) 588 Push $1 589 590 IfFileExists "$0" found 591 Goto not_found 592 593 found: 594 595 VBoxGuestInstallHelper::FileGetVendor "$0" 596 ; Stack: <vendor> $1 $0 597 Pop $0 ; Get vendor 598 Pop $1 ; Restore $1 599 Exch $0 ; Restore $0, push vendor on top of stack 600 Goto end 601 602 not_found: 603 604 Pop $1 605 Pop $0 606 Push "File not found" 607 Goto end 608 609 end: 610 611 FunctionEnd 612 !macroend 613 !insertmacro GetFileVendor "" 614 !insertmacro GetFileVendor "un." 615 616 ; 617 ; Retrieves the architecture of a given file. 618 ; @return Stack: Architecture ("x86", "amd64") or error message. 619 ; @param Stack: File name to retrieve architecture for. 620 ; 621 !macro GetFileArchitecture un 622 Function ${un}GetFileArchitecture 623 624 ; Preserve values 625 Exch $0 ; Stack: $0 <filename> (Get file name into $0) 626 Push $1 627 628 IfFileExists "$0" found 629 Goto not_found 630 631 found: 632 633 VBoxGuestInstallHelper::FileGetArchitecture "$0" 634 ; Stack: <architecture> $1 $0 635 Pop $0 ; Get architecture string 636 Pop $1 ; Restore $1 637 Exch $0 ; Restore $0, push vendor on top of stack 638 Goto end 639 640 not_found: 641 642 Pop $1 643 Pop $0 644 Push "File not found" 645 Goto end 646 647 end: 648 649 FunctionEnd 650 !macroend 651 !insertmacro GetFileArchitecture "" 652 !insertmacro GetFileArchitecture "un." 653 654 ; 655 ; Verifies a given file by checking its file vendor and target 656 ; architecture. 657 ; @return Stack: "0" if verify, "1" if not, "2" on error / not found. 658 ; @param Stack: Architecture ("x86" or "amd64"). 659 ; @param Stack: Vendor. 660 ; @param Stack: File name to verify. 661 ; 662 !macro VerifyFile un 663 Function ${un}VerifyFile 664 665 ; Preserve values 666 Exch $0 ; File; S: old$0 vendor arch 667 Exch ; S: vendor old$0 arch 668 Exch $1 ; Vendor; S: old$1 old$0 arch 669 Exch ; S: old$0 old$1 arch 670 Exch 2 ; S: arch old$1 old$0 671 Exch $2 ; Architecture; S: old$2 old$1 old$0 672 Push $3 ; S: old$3 old$2 old$1 old$0 673 674 MessageBox MB_ICONSTOP "Vendor $1" /SD IDOK 675 IfFileExists "$0" check_vendor 676 Goto not_found 677 678 check_vendor: 679 680 Push $0 681 Call ${un}GetFileVendor 682 Pop $3 683 MessageBox MB_ICONSTOP "$3 vs. $1" /SD IDOK 684 ${If} $3 == $1 685 Goto check_arch 686 ${EndIf} 687 StrCpy $3 "1" ; Invalid 688 Goto end 689 690 check_arch: 691 692 Push $0 693 Call ${un}GetFileArchitecture 694 Pop $3 695 MessageBox MB_ICONSTOP "$3 vs. $2" /SD IDOK 696 ${If} $3 == $2 697 StrCpy $3 "0" ; Valid 698 ${Else} 699 StrCpy $3 "1" ; Invalid 700 ${EndIf} 701 Goto end 702 703 not_found: 704 705 StrCpy $3 "2" ; Not found 706 Goto end 707 708 end: 709 MessageBox MB_ICONSTOP "Res: $3" /SD IDOK 710 ; S: old$3 old$2 old$1 old$0 711 Exch $3 ; S: $3 old$2 old$1 old$0 712 Exch ; S: old$2 $3 old$1 713 Pop $2 ; S: $3 old$1 old$0 714 Exch ; S: old$1 $3 old$0 715 Pop $1 ; S: $3 old$0 716 Exch ; S: old$0 $3 717 Pop $0 ; S: $3 718 719 FunctionEnd 720 !macroend 721 !insertmacro VerifyFile "" 722 !insertmacro VerifyFile "un." 723 724 !macro VerifyFileEx un File Vendor Architecture 725 Push "${Architecture}" 726 Push "${Vendor}" 727 Push "${File}" 728 Call ${un}VerifyFile 729 !macroend 730 !define VerifyFileEx "!insertmacro VerifyFileEx" 731 732 ; 733 ; Validates backed up original Direct3D files. 734 ; @return Stack: "0" if files are valid; otherwise "1". 735 ; 736 !macro ValidateFilesDirect3D un 737 Function ${un}ValidateD3DFiles 738 739 ; TODO: Here comes the check 740 ${VerifyFileEx} "${un}" "$SYSDIR\foo.dll" "Microsoft Corporation" "x86" 741 742 end: 743 744 FunctionEnd 745 !macroend 746 !insertmacro ValidateFilesDirect3D "" 747 !insertmacro ValidateFilesDirect3D "un."
Note:
See TracChangeset
for help on using the changeset viewer.