Changeset 25159 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Dec 3, 2009 10:49:02 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp
r23139 r25159 69 69 DACL_SECURITY_INFORMATION, 70 70 NULL, NULL, &pOldDACL, NULL, &pSD); 71 if (ERROR_SUCCESS != dwRes) 71 if (ERROR_SUCCESS != dwRes) 72 72 { 73 73 if (dwRes == ERROR_FILE_NOT_FOUND) … … 88 88 /* Create a new ACL that merges the new ACE into the existing DACL. */ 89 89 dwRes = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL); 90 if (ERROR_SUCCESS != dwRes) 90 if (ERROR_SUCCESS != dwRes) 91 91 { 92 92 VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetEntriesInAcl: Error %u\n", dwRes); … … 98 98 DACL_SECURITY_INFORMATION, 99 99 NULL, NULL, pNewDACL, NULL); 100 if (ERROR_SUCCESS != dwRes) 100 if (ERROR_SUCCESS != dwRes) 101 101 { 102 102 VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetNamedSecurityInfo: Error %u\n", dwRes); … … 115 115 } 116 116 117 BOOL VBoxServiceWinSetStatus (DWORD a_dwStatus)117 BOOL VBoxServiceWinSetStatus (DWORD dwStatus, DWORD dwCheckPoint /*= 0 */) 118 118 { 119 119 if (NULL == g_hWinServiceStatus) /* Program could be in testing mode, so no service environment available. */ 120 120 return FALSE; 121 121 122 VBoxServiceVerbose(2, "Setting service status to: %ld\n", a_dwStatus);123 g_rcWinService = a_dwStatus;122 VBoxServiceVerbose(2, "Setting service status to: %ld\n", dwStatus); 123 g_rcWinService = dwStatus; 124 124 125 125 SERVICE_STATUS ss; … … 127 127 ss.dwCurrentState = g_rcWinService; 128 128 ss.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; 129 ss.dwWin32ExitCode = NO ERROR;130 ss.dwServiceSpecificExitCode = NOERROR;131 ss.dwCheckPoint = 0;129 ss.dwWin32ExitCode = NO_ERROR; 130 ss.dwServiceSpecificExitCode = 0; /* Not used */ 131 ss.dwCheckPoint = dwCheckPoint; 132 132 ss.dwWaitHint = 3000; 133 133 -
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r23029 r25159 283 283 if (g_aServices[j].fEnabled) 284 284 { 285 286 285 rc = g_aServices[j].pDesc->pfnInit(); 287 286 if (RT_FAILURE(rc)) … … 317 316 RTThreadUserWait(g_aServices[j].Thread, 60 * 1000); 318 317 if (g_aServices[j].fShutdown) 318 { 319 VBoxServiceError("Service '%s' failed to start!\n", g_aServices[j].pDesc->pszName); 319 320 rc = VERR_GENERAL_FAILURE; 321 } 320 322 } 321 323 if (RT_SUCCESS(rc)) … … 329 331 } 330 332 } 331 332 /* Should never get here. */333 333 return rc; 334 334 } … … 355 355 if (g_aServices[j].Thread != NIL_RTTHREAD) 356 356 { 357 int rc = RTThreadWait(g_aServices[j].Thread, 30*1000, NULL); 357 int rc; 358 VBoxServiceVerbose(2, "Waiting for service '%s' to stop ...\n", g_aServices[j].pDesc->pszName); 359 for (int i=0; i<30; i++) /* Wait 30 seconds in total */ 360 { 361 rc = RTThreadWait(g_aServices[j].Thread, 1000 /* Wait 1 second */, NULL); 362 if (RT_SUCCESS(rc)) 363 break; 364 #ifdef RT_OS_WINDOWS 365 /* Notify SCM that it takes a bit longer ... */ 366 VBoxServiceWinSetStatus(SERVICE_STOP_PENDING, i); 367 #endif 368 } 358 369 if (RT_FAILURE(rc)) 359 370 VBoxServiceError("Service '%s' failed to stop. (%Rrc)\n", g_aServices[j].pDesc->pszName, rc); 360 371 } 372 VBoxServiceVerbose(3, "Terminating service '%s' (%d) ...\n", g_aServices[j].pDesc->pszName, j); 361 373 g_aServices[j].pDesc->pfnTerm(); 362 374 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceExec.cpp
r23653 r25159 347 347 OSVERSIONINFOEX OSInfoEx; 348 348 RT_ZERO(OSInfoEx); 349 OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO );349 OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 350 350 if ( GetVersionEx((LPOSVERSIONINFO) &OSInfoEx) 351 351 && OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT … … 505 505 g_uExecGuestPropSvcClientID = 0; 506 506 507 RTSemEventMultiDestroy(g_hExecEvent); 508 g_hExecEvent = NIL_RTSEMEVENTMULTI; 507 if (g_hExecEvent != NIL_RTSEMEVENTMULTI) 508 { 509 RTSemEventMultiDestroy(g_hExecEvent); 510 g_hExecEvent = NIL_RTSEMEVENTMULTI; 511 } 509 512 } 510 513 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r23575 r25159 146 146 /** Uninstalls the service from the registry. */ 147 147 extern int VBoxServiceWinUninstall(void); 148 /** Reports our current status to the SCM. */ 149 extern BOOL VBoxServiceWinSetStatus (DWORD dwStatus, DWORD dwCheckPoint = 0); 148 150 #ifdef VBOX_WITH_GUEST_PROPS 149 151 /** Detects wheter a user is logged on based on the enumerated processes. */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp
r24540 r25159 271 271 #ifdef RT_OS_WINDOWS 272 272 /** @todo r=bird: NT4 doesn't have GetSystemTimeAdjustment. */ 273 if (g_hTokenProcess == NULL) /* Is the token already closed when shutting down? */ 274 return false; 275 273 276 DWORD dwWinTimeAdjustment, dwWinNewTimeAdjustment, dwWinTimeIncrement; 274 277 BOOL fWinTimeAdjustmentDisabled;
Note:
See TracChangeset
for help on using the changeset viewer.