Changeset 107860 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jan 20, 2025 5:53:12 PM (4 months ago)
- svn:sync-xref-src-repo-rev:
- 167062
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/Loader/VBoxWindowsAdditions.cpp
r107083 r107860 51 51 #endif 52 52 53 54 53 #ifdef VBOX_SIGNING_MODE 55 54 # if 1 /* Whether to use IPRT or Windows to verify the executable signatures. */ … … 63 62 # include <iprt/crypto/pkcs7.h> 64 63 # include <iprt/crypto/store.h> 64 #endif 65 66 67 /********************************************************************************************************************************* 68 * Structures and Typedefs * 69 *********************************************************************************************************************************/ 70 typedef BOOL (WINAPI *PFNISWOW64PROCESS)(HANDLE, PBOOL); 71 typedef BOOL (WINAPI *PFNISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); 72 73 74 #ifdef VBOX_SIGNING_MODE 65 75 66 76 class CryptoStore … … 897 907 } 898 908 909 /** 910 * Detects the native host platform and returns the appropriate installer 911 * executable suffix for it. 912 * 913 * @returns Architecture stuff string. 914 */ 915 static const wchar_t *GetNativeArchInstallerSuffix(void) 916 { 917 HMODULE const hModKernel32 = GetModuleHandleW(L"kernel32.dll"); 918 PFNISWOW64PROCESS2 pfnIsWow64Process2 = (PFNISWOW64PROCESS2)GetProcAddress(hModKernel32, "IsWow64Process2"); 919 if (pfnIsWow64Process2) 920 { 921 USHORT usWowMachine = IMAGE_FILE_MACHINE_UNKNOWN; 922 USHORT usHostMachine = IMAGE_FILE_MACHINE_UNKNOWN; 923 if (pfnIsWow64Process2(GetCurrentProcess(), &usWowMachine, &usHostMachine)) 924 { 925 if (usHostMachine == IMAGE_FILE_MACHINE_AMD64) 926 return L"-amd64.exe"; 927 if (usHostMachine == IMAGE_FILE_MACHINE_ARM64) 928 return L"-arm64.exe"; 929 if (usHostMachine == IMAGE_FILE_MACHINE_I386) 930 return L"-x86.exe"; 931 ErrorMsgSU("IsWow64Process2 return unknown host machine value: ", usHostMachine); 932 } 933 else 934 ErrorMsgLastErr("Unable to determine the process type! (#2)"); 935 } 936 else 937 { 938 PFNISWOW64PROCESS pfnIsWow64Process = (PFNISWOW64PROCESS)GetProcAddress(hModKernel32, "IsWow64Process"); 939 if (pfnIsWow64Process) 940 { 941 BOOL fIsWow64 = TRUE; 942 if (pfnIsWow64Process(GetCurrentProcess(), &fIsWow64)) 943 { 944 if (fIsWow64) 945 return L"-amd64.exe"; 946 } 947 else 948 ErrorMsgLastErr("Unable to determine the process type!"); 949 } 950 } 951 952 #ifdef RT_ARCH_X86 953 return L"-x86.exe"; 954 #elif defined(RT_ARCH_AMD64) 955 return L"-amd64.exe"; 956 #elif defined(RT_ARCH_ARM64) 957 return L"-arm64.exe"; 958 #else 959 # error "port me" 960 #endif 961 } 962 899 963 static int WaitForProcess2(HANDLE hProcess) 900 964 { … … 995 1059 } 996 1060 997 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 998 WCHAR const *pwszSuff = IsWow64() ? L"-amd64.exe" : L"-x86.exe"; 999 #elif defined(RT_ARCH_ARM64) 1000 WCHAR const *pwszSuff = L"-arm64.exe"; 1001 #else 1002 # error "Port me!" 1003 #endif 1004 1061 WCHAR const * const pwszSuff = GetNativeArchInstallerSuffix(); 1005 1062 int rc = RTUtf16Copy(&wszExePath[cwcExePath], RT_ELEMENTS(wszExePath) - cwcExePath, pwszSuff); 1006 1063 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.