Changeset 78937 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp
- Timestamp:
- Jun 3, 2019 1:52:06 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp
r78809 r78937 142 142 HWND g_hwndToolWindow; 143 143 NOTIFYICONDATA g_NotifyIconData; 144 DWORD g_dwMajorVersion;145 144 146 145 uint32_t g_fGuestDisplaysChanged = 0; … … 685 684 static int vboxTraySetupSeamless(void) 686 685 { 687 OSVERSIONINFO info;688 g_dwMajorVersion = 5; /* Default to Windows XP. */689 info.dwOSVersionInfoSize = sizeof(info);690 if (GetVersionEx(&info))691 {692 Log(("Windows version %ld.%ld\n", info.dwMajorVersion, info.dwMinorVersion));693 g_dwMajorVersion = info.dwMajorVersion;694 }695 696 686 /* We need to setup a security descriptor to allow other processes modify access to the seamless notification event semaphore. */ 697 687 SECURITY_ATTRIBUTES SecAttr; … … 713 703 { 714 704 /* For Vista and up we need to change the integrity of the security descriptor, too. */ 715 if (g_dwMajorVersion >= 6) 705 uint64_t const uNtVersion = RTSystemGetNtVersion(); 706 if (uNtVersion >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0)) 716 707 { 717 708 BOOL (WINAPI * pfnConvertStringSecurityDescriptorToSecurityDescriptorA)(LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize); … … 755 746 756 747 if ( dwErr == ERROR_SUCCESS 757 && g_dwMajorVersion >= 5) /* Only for W2K and up ... */748 && uNtVersion >= RTSYSTEM_MAKE_NT_VERSION(5, 0, 0)) /* Only for W2K and up ... */ 758 749 { 759 750 g_hSeamlessWtNotifyEvent = CreateEvent(&SecAttr, FALSE, FALSE, VBOXHOOK_GLOBAL_WT_EVENT_NAME); … … 837 828 else 838 829 { 830 uint64_t const uNtVersion = RTSystemGetNtVersion(); 839 831 rc = vboxTrayCreateTrayIcon(); 840 832 if ( RT_SUCCESS(rc) 841 && g_dwMajorVersion >= 5) /* Only for W2K and up ... */833 && uNtVersion >= RTSYSTEM_MAKE_NT_VERSION(5, 0, 0)) /* Only for W2K and up ... */ 842 834 { 843 835 /* We're ready to create the tooltip balloon. … … 998 990 if (RT_SUCCESS(rc)) 999 991 { 992 /* Log the major windows NT version: */ 993 uint64_t const uNtVersion = RTSystemGetNtVersion(); 994 LogRel(("Windows version %u.%u build %u (uNtVersion=%#RX64)\n", RTSYSTEM_NT_VERSION_GET_MAJOR(uNtVersion), 995 RTSYSTEM_NT_VERSION_GET_MINOR(uNtVersion), RTSYSTEM_NT_VERSION_GET_BUILD(uNtVersion), uNtVersion )); 996 1000 997 /* Save instance handle. */ 1001 998 g_hInstance = hInstance; … … 1465 1462 static int vboxDtInit() 1466 1463 { 1467 int rc = VINF_SUCCESS;1468 OSVERSIONINFO info;1469 g_dwMajorVersion = 5; /* Default to Windows XP. */1470 info.dwOSVersionInfoSize = sizeof(info);1471 if (GetVersionEx(&info))1472 {1473 LogRel(("Windows version %ld.%ld\n", info.dwMajorVersion, info.dwMinorVersion));1474 g_dwMajorVersion = info.dwMajorVersion;1475 }1476 1477 1464 RT_ZERO(gVBoxDt); 1478 1465 1466 int rc; 1479 1467 gVBoxDt.hNotifyEvent = CreateEvent(NULL, FALSE, FALSE, VBOXHOOK_GLOBAL_DT_EVENT_NAME); 1480 1468 if (gVBoxDt.hNotifyEvent != NULL) … … 1523 1511 BOOL fRc = FALSE; 1524 1512 /* For Vista and up we need to change the integrity of the security descriptor, too. */ 1525 if (g_dwMajorVersion >= 6) 1513 uint64_t const uNtVersion = RTSystemGetNtVersion(); 1514 if (uNtVersion >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0)) 1526 1515 { 1527 1516 HMODULE hModHook = (HMODULE)RTLdrGetNativeHandle(gVBoxDt.hLdrModHook);
Note:
See TracChangeset
for help on using the changeset viewer.