Changeset 40158 in vbox for trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
- Timestamp:
- Feb 16, 2012 5:06:35 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r39129 r40158 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; 85 86 /** 87 * Signals the event so that a re-enumeration of VM-specific 88 * information (like logged in users) can happen. 89 * 90 * @return IPRT status code. 91 */ 92 int VBoxServiceVMInfoSignal(void) 93 { 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 return RTSemEventMultiSignal(g_hVMInfoEvent); 98 99 return VINF_SUCCESS; 109 100 } 110 #endif /* RT_OS_WINDOWS */111 101 112 102 … … 182 172 VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/Net/Count", 183 173 VBOXSERVICEPROPCACHEFLAG_TEMPORARY | VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE, NULL /* Delete on exit */); 184 185 #ifdef RT_OS_WINDOWS186 # ifndef RT_OS_NT4187 /* 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 */195 174 } 196 175 return rc; … … 301 280 && RT_SUCCESS(rc)) 302 281 { 303 VBoxServiceVerbose(4, " VMInfo/Users:Found logged in user \"%s\"\n",282 VBoxServiceVerbose(4, "Found logged in user \"%s\"\n", 304 283 ut_user->ut_user); 305 284 if (cUsersInList > cListSize) … … 369 348 static int s_iVMInfoBitchedOOM = 0; 370 349 if (s_iVMInfoBitchedOOM++ < 3) 371 VBoxServiceVerbose(0, " VMInfo/Users:Warning: Not enough memory available to enumerate users! Keeping old value (%u)\n",350 VBoxServiceVerbose(0, "Warning: Not enough memory available to enumerate users! Keeping old value (%u)\n", 372 351 g_cVMInfoLoggedInUsers); 373 352 cUsersInList = g_cVMInfoLoggedInUsers; … … 377 356 } 378 357 379 VBoxServiceVerbose(4, " VMInfo/Users:cUsersInList: %u, pszUserList: %s, rc=%Rrc\n",358 VBoxServiceVerbose(4, "cUsersInList: %u, pszUserList: %s, rc=%Rrc\n", 380 359 cUsersInList, pszUserList ? pszUserList : "<NULL>", rc); 381 360 … … 878 857 static DECLCALLBACK(void) VBoxServiceVMInfoTerm(void) 879 858 { 880 int rc;881 882 #ifdef RT_OS_WINDOWS883 # ifndef RT_OS_NT4884 /* Uninstall 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 #endif892 893 859 if (g_hVMInfoEvent != NIL_RTSEMEVENTMULTI) 894 860 { … … 906 872 /* Delete the "../Net" branch. */ 907 873 const char *apszPat[1] = { "/VirtualBox/GuestInfo/Net/*" }; 908 rc = VbglR3GuestPropDelSet(g_uVMInfoGuestPropSvcClientID, &apszPat[0], RT_ELEMENTS(apszPat));874 int rc = VbglR3GuestPropDelSet(g_uVMInfoGuestPropSvcClientID, &apszPat[0], RT_ELEMENTS(apszPat)); 909 875 910 876 /* Destroy property cache. */
Note:
See TracChangeset
for help on using the changeset viewer.