- Timestamp:
- Nov 13, 2024 12:54:01 PM (2 weeks ago)
- Location:
- trunk/src/VBox/Installer/win
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
r106798 r106984 61 61 #endif 62 62 63 #include "VBoxStub.h"64 63 #include "../StubBld/VBoxStubBld.h" 65 64 #include "resource.h" … … 74 73 * Defined Constants And Macros * 75 74 *********************************************************************************************************************************/ 75 #define VBOX_STUB_TITLE "VirtualBox Installer" 76 76 77 #define MY_UNICODE_SUB(str) L ##str 77 78 #define MY_UNICODE(str) MY_UNICODE_SUB(str) … … 110 111 /** Pointer to a cleanup record. */ 111 112 typedef STUBCLEANUPREC *PSTUBCLEANUPREC; 113 114 typedef BOOL (WINAPI *PFNISWOW64PROCESS)(HANDLE, PBOOL); 115 typedef BOOL (WINAPI *PFNISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); 112 116 113 117 … … 472 476 * Detects whether we're running on a 32- or 64-bit platform and returns the result. 473 477 * 474 * @returns TRUE if we're running on a 64-bit OS, FALSE if not. 475 */ 476 static BOOL IsWow64(void) 477 { 478 BOOL fIsWow64 = TRUE; 479 fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); 480 if (NULL != fnIsWow64Process) 481 { 482 if (!fnIsWow64Process(GetCurrentProcess(), &fIsWow64)) 478 * @returns Returns the native package architecture. 479 */ 480 static VBOXSTUBPKGARCH GetNativePackageArch(void) 481 { 482 HMODULE const hModKernel32 = GetModuleHandleW(L"kernel32.dll"); 483 PFNISWOW64PROCESS2 pfnIsWow64Process2 = (PFNISWOW64PROCESS2)GetProcAddress(hModKernel32, "IsWow64Process2"); 484 if (pfnIsWow64Process2) 485 { 486 USHORT usWowMachine = IMAGE_FILE_MACHINE_UNKNOWN; 487 USHORT usHostMachine = IMAGE_FILE_MACHINE_UNKNOWN; 488 if (pfnIsWow64Process2(GetCurrentProcess(), &usWowMachine, &usHostMachine)) 483 489 { 484 /* Error in retrieving process type - assume that we're running on 32bit. */ 485 return FALSE; 490 if (usHostMachine == IMAGE_FILE_MACHINE_AMD64) 491 return VBOXSTUBPKGARCH_AMD64; 492 if (usHostMachine == IMAGE_FILE_MACHINE_ARM64) 493 return VBOXSTUBPKGARCH_ARM64; 494 if (usHostMachine == IMAGE_FILE_MACHINE_I386) 495 return VBOXSTUBPKGARCH_X86; 496 LogError("IsWow64Process2 return unknown host machine value: %#x (wow machine %#x)", usHostMachine, usWowMachine); 486 497 } 487 } 488 return fIsWow64; 498 else 499 LogError("IsWow64Process2 failed: %u", GetLastError()); 500 } 501 else 502 { 503 PFNISWOW64PROCESS pfnIsWow64Process = (PFNISWOW64PROCESS)GetProcAddress(hModKernel32, "IsWow64Process"); 504 if (pfnIsWow64Process) 505 { 506 BOOL fIsWow64 = TRUE; 507 if (pfnIsWow64Process(GetCurrentProcess(), &fIsWow64)) 508 { 509 if (fIsWow64) 510 return VBOXSTUBPKGARCH_AMD64; 511 } 512 else 513 LogError("IsWow64Process failed: %u\n", GetLastError()); 514 } 515 else 516 LogError("Neither IsWow64Process nor IsWow64Process2 was found!"); 517 } 518 519 #ifdef RT_ARCH_X86 520 return VBOXSTUBPKGARCH_X86; 521 #elif defined(RT_ARCH_AMD64) 522 return VBOXSTUBPKGARCH_AMD64; 523 #elif defined(RT_ARCH_ARM64) 524 return VBOXSTUBPKGARCH_ARM64; 525 #else 526 # error "port me" 527 #endif 489 528 } 490 529 … … 501 540 if (pPackage->enmArch == VBOXSTUBPKGARCH_ALL) 502 541 return true; 503 VBOXSTUBPKGARCH enmArch = IsWow64() ? VBOXSTUBPKGARCH_AMD64 : VBOXSTUBPKGARCH_X86;542 VBOXSTUBPKGARCH enmArch = GetNativePackageArch(); 504 543 return pPackage->enmArch == enmArch; 505 544 } … … 1427 1466 if ( !fExtractOnly 1428 1467 && !g_fSilent 1429 && !IsWow64())1468 && GetNativePackageArch() == VBOXSTUBPKGARCH_X86) 1430 1469 rcExit = ShowError("32-bit Windows hosts are not supported by this VirtualBox release."); 1431 1470 else -
trunk/src/VBox/Installer/win/StubBld/VBoxStubBld.cpp
r106061 r106984 181 181 && strcmp(pszArg, "-target-all") 182 182 && strcmp(pszArg, "-target-x86") 183 && strcmp(pszArg, "-target-amd64")) 183 && strcmp(pszArg, "-target-amd64") 184 && strcmp(pszArg, "-target-arm64")) 184 185 { 185 186 fprintf(stderr, "syntax error: Invalid parameter: %s\n", argv[i]); … … 212 213 else if (strcmp(pszArg, "-target-amd64") == 0) 213 214 aBuildPkgs[StubHdr.cPackages].enmArch = VBOXSTUBPKGARCH_AMD64; 215 else if (strcmp(pszArg, "-target-arm64") == 0) 216 aBuildPkgs[StubHdr.cPackages].enmArch = VBOXSTUBPKGARCH_ARM64; 214 217 else if (strcmp(pszArg, "-target-x86") == 0) 215 218 aBuildPkgs[StubHdr.cPackages].enmArch = VBOXSTUBPKGARCH_X86; -
trunk/src/VBox/Installer/win/StubBld/VBoxStubBld.h
r106061 r106984 63 63 VBOXSTUBPKGARCH_X86, 64 64 /** Extract on AMD64 hosts. */ 65 VBOXSTUBPKGARCH_AMD64 65 VBOXSTUBPKGARCH_AMD64, 66 /** Extract on ARM64 hosts. */ 67 VBOXSTUBPKGARCH_ARM64 66 68 } VBOXSTUBPKGARCH; 67 69
Note:
See TracChangeset
for help on using the changeset viewer.