Changeset 39106 in vbox for trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
- Timestamp:
- Oct 25, 2011 9:45:40 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r38224 r39106 83 83 84 84 85 #ifdef RT_OS_WINDOWS 86 static BOOL WINAPI VBoxServiceVMInfoConsoleControlHandler(DWORD dwCtrlType) 87 { 88 int rc = VINF_SUCCESS; 89 bool fEventHandled = FALSE; 90 switch (dwCtrlType) 91 { 92 case CTRL_LOGOFF_EVENT: 93 VBoxServiceVerbose(2, "VMInfo: Received logged-off event\n"); 94 /* Trigger a re-enumeration of all logged-in users by unblocking 95 * the multi event semaphore of the VMInfo thread. */ 96 if (g_hVMInfoEvent) 97 rc = RTSemEventMultiSignal(g_hVMInfoEvent); 98 fEventHandled = TRUE; 99 break; 100 default: 101 break; 102 /** @todo Add other events here. */ 103 } 104 105 if (RT_FAILURE(rc)) 106 VBoxServiceError("VMInfo: Event %ld handled with error rc=%Rrc\n", 107 dwCtrlType, rc); 108 return fEventHandled; 109 } 110 #endif /* RT_OS_WINDOWS */ 111 112 85 113 /** @copydoc VBOXSERVICE::pfnPreInit */ 86 114 static DECLCALLBACK(int) VBoxServiceVMInfoPreInit(void) … … 154 182 VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/Net/Count", 155 183 VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE, NULL /* Delete on exit */); 184 185 #ifdef RT_OS_WINDOWS 186 # ifndef RT_OS_NT4 187 /* Install console control handler. */ 188 if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)VBoxServiceVMInfoConsoleControlHandler, TRUE /* Add handler */)) 189 { 190 VBoxServiceError("VMInfo: Unable to add console control handler, error=%ld\n", GetLastError()); 191 /* Just skip this error, not critical. */ 192 } 193 # endif /* !RT_OS_NT4 */ 194 #endif /* RT_OS_WINDOWS */ 156 195 } 157 196 return rc; … … 812 851 break; 813 852 } 853 else if (RT_LIKELY(RT_SUCCESS(rc2))) 854 { 855 /* Reset event semaphore if it got triggered. */ 856 rc2 = RTSemEventMultiReset(g_hVMInfoEvent); 857 if (RT_FAILURE(rc2)) 858 rc2 = VBoxServiceError("VMInfo: RTSemEventMultiReset failed; rc2=%Rrc\n", rc2); 859 } 814 860 } 815 861 … … 833 879 { 834 880 int rc; 881 882 #ifdef RT_OS_WINDOWS 883 # ifndef RT_OS_NT4 884 /* Install console control handler. */ 885 if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)NULL, FALSE /* Remove handler */)) 886 { 887 VBoxServiceError("VMInfo: Unable to remove console control handler, error=%ld\n", GetLastError()); 888 /* Just skip this error, not critical. */ 889 } 890 # endif /* !RT_OS_NT4 */ 891 #endif 835 892 836 893 if (g_hVMInfoEvent != NIL_RTSEMEVENTMULTI)
Note:
See TracChangeset
for help on using the changeset viewer.