Changeset 96597 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Sep 4, 2022 10:12:04 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153474
- Location:
- trunk/src/VBox/Runtime/r3/win
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r96573 r96597 324 324 /* 325 325 * Use the NT version of RtlGetVersion (since w2k) so we don't get fooled 326 * by compatability shims. 326 * by the standard compatibility shims. (Sandboxes may still fool us.) 327 * 328 * Note! This API was added in windows 2000 together with the extended 329 * version info structure (OSVERSIONINFOEXW), so there is no need 330 * to retry with the smaller version (OSVERSIONINFOW). 327 331 */ 328 332 RT_ZERO(g_WinOsInfoEx); … … 338 342 /* 339 343 * Couldn't find it or it failed, try the windows version of the API. 340 * The GetVersionExW API was added in NT 3.51. 344 * The GetVersionExW API was added in NT 3.51, however only the small 345 * structure version existed till windows 2000. We'll try the larger 346 * structure version first, anyway, just in case. 341 347 */ 342 348 RT_ZERO(g_WinOsInfoEx); … … 353 359 RT_ZERO(g_WinOsInfoEx); 354 360 g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); 355 if (!pfnGetVersionExW || !pfnGetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx))361 if (!pfnGetVersionExW && pfnGetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx)) 356 362 Assert(g_WinOsInfoEx.dwPlatformId != VER_PLATFORM_WIN32_NT || g_WinOsInfoEx.dwMajorVersion < 5); 357 363 else … … 359 365 /* 360 366 * Okay, nothing worked, so use GetVersion. 367 * 361 368 * This should only happen if we're on NT 3.1 or NT 3.50. 362 369 * It should never happen for 64-bit builds. … … 367 374 368 375 /* Common fields: */ 369 g_WinOsInfoEx.dwMajorVersion = dwVersion & 0xff;370 g_WinOsInfoEx.dwMinorVersion = (dwVersion >> 8) & 0xff;376 g_WinOsInfoEx.dwMajorVersion = dwVersion & 0xff; 377 g_WinOsInfoEx.dwMinorVersion = (dwVersion >> 8) & 0xff; 371 378 if (!(dwVersion & RT_BIT_32(31))) 372 g_WinOsInfoEx.dwBuildNumber = dwVersion >> 16;379 g_WinOsInfoEx.dwBuildNumber = dwVersion >> 16; 373 380 else 374 g_WinOsInfoEx.dwBuildNumber = 511; 375 g_WinOsInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT; 376 g_WinOsInfoEx.wProductType = VER_NT_WORKSTATION; 381 g_WinOsInfoEx.dwBuildNumber = 511; 382 g_WinOsInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT; 377 383 /** @todo get CSD from registry. */ 378 384 #else … … 381 387 #endif 382 388 } 389 390 #ifdef RT_ARCH_X86 391 /* 392 * Fill in some of the extended info too. 393 */ 394 g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); /* Pretend. */ 395 g_WinOsInfoEx.wProductType = VER_NT_WORKSTATION; 396 NT_PRODUCT_TYPE enmProdType = NtProductWinNt; 397 if (RtlGetNtProductType(&enmProdType)) 398 g_WinOsInfoEx.wProductType = (BYTE)enmProdType; 399 /** @todo parse the CSD string to figure that version. */ 400 #endif 383 401 } 384 402 } -
trunk/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
r96505 r96597 148 148 RtlGetLastWin32Error ;;= _RtlGetLastWin32Error@0 149 149 RtlGetVersion ;;= _RtlGetVersion@4 150 RtlGetNtProductType ;;= _RtlGetNtProductType@4 150 151 RtlInitializeSid ;;= _RtlInitializeSid@12 151 152 RtlNtStatusToDosError ;;= _RtlNtStatusToDosError@4
Note:
See TracChangeset
for help on using the changeset viewer.