Index: trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp	(revision 25158)
+++ trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp	(revision 25159)
@@ -69,5 +69,5 @@
                                  DACL_SECURITY_INFORMATION,
                                  NULL, NULL, &pOldDACL, NULL, &pSD);
-    if (ERROR_SUCCESS != dwRes) 
+    if (ERROR_SUCCESS != dwRes)
     {
         if (dwRes == ERROR_FILE_NOT_FOUND)
@@ -88,5 +88,5 @@
     /* Create a new ACL that merges the new ACE into the existing DACL. */
     dwRes = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL);
-    if (ERROR_SUCCESS != dwRes)  
+    if (ERROR_SUCCESS != dwRes)
     {
         VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetEntriesInAcl: Error %u\n", dwRes);
@@ -98,5 +98,5 @@
                                  DACL_SECURITY_INFORMATION,
                                  NULL, NULL, pNewDACL, NULL);
-    if (ERROR_SUCCESS != dwRes)  
+    if (ERROR_SUCCESS != dwRes)
     {
         VBoxServiceError("AddAceToObjectsSecurityDescriptor: SetNamedSecurityInfo: Error %u\n", dwRes);
@@ -115,11 +115,11 @@
 }
 
-BOOL VBoxServiceWinSetStatus (DWORD a_dwStatus)
+BOOL VBoxServiceWinSetStatus (DWORD dwStatus, DWORD dwCheckPoint /*= 0 */)
 {
     if (NULL == g_hWinServiceStatus) /* Program could be in testing mode, so no service environment available. */
         return FALSE;
 
-    VBoxServiceVerbose(2, "Setting service status to: %ld\n", a_dwStatus);
-    g_rcWinService  = a_dwStatus;
+    VBoxServiceVerbose(2, "Setting service status to: %ld\n", dwStatus);
+    g_rcWinService  = dwStatus;
 
     SERVICE_STATUS ss;
@@ -127,7 +127,7 @@
     ss.dwCurrentState             = g_rcWinService;
     ss.dwControlsAccepted	      = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
-    ss.dwWin32ExitCode            = NOERROR;
-    ss.dwServiceSpecificExitCode  = NOERROR;
-    ss.dwCheckPoint               = 0;
+    ss.dwWin32ExitCode            = NO_ERROR;
+    ss.dwServiceSpecificExitCode  = 0; /* Not used */
+    ss.dwCheckPoint               = dwCheckPoint;
     ss.dwWaitHint                 = 3000;
 
Index: trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp	(revision 25158)
+++ trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp	(revision 25159)
@@ -283,5 +283,4 @@
         if (g_aServices[j].fEnabled)
         {
-
             rc = g_aServices[j].pDesc->pfnInit();
             if (RT_FAILURE(rc))
@@ -317,5 +316,8 @@
         RTThreadUserWait(g_aServices[j].Thread, 60 * 1000);
         if (g_aServices[j].fShutdown)
+        {
+            VBoxServiceError("Service '%s' failed to start!\n", g_aServices[j].pDesc->pszName);
             rc = VERR_GENERAL_FAILURE;
+        }
     }
     if (RT_SUCCESS(rc))
@@ -329,6 +331,4 @@
         }
     }
-
-    /* Should never get here. */
     return rc;
 }
@@ -355,8 +355,20 @@
             if (g_aServices[j].Thread != NIL_RTTHREAD)
             {
-                int rc = RTThreadWait(g_aServices[j].Thread, 30*1000, NULL);
+                int rc;
+                VBoxServiceVerbose(2, "Waiting for service '%s' to stop ...\n", g_aServices[j].pDesc->pszName);
+                for (int i=0; i<30; i++) /* Wait 30 seconds in total */
+                {
+                    rc = RTThreadWait(g_aServices[j].Thread, 1000 /* Wait 1 second */, NULL);
+                    if (RT_SUCCESS(rc))
+                        break;
+#ifdef RT_OS_WINDOWS
+                    /* Notify SCM that it takes a bit longer ... */
+                    VBoxServiceWinSetStatus(SERVICE_STOP_PENDING, i);
+#endif
+                }
                 if (RT_FAILURE(rc))
                     VBoxServiceError("Service '%s' failed to stop. (%Rrc)\n", g_aServices[j].pDesc->pszName, rc);
             }
+            VBoxServiceVerbose(3, "Terminating service '%s' (%d) ...\n", g_aServices[j].pDesc->pszName, j);
             g_aServices[j].pDesc->pfnTerm();
         }
Index: trunk/src/VBox/Additions/common/VBoxService/VBoxServiceExec.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxService/VBoxServiceExec.cpp	(revision 25158)
+++ trunk/src/VBox/Additions/common/VBoxService/VBoxServiceExec.cpp	(revision 25159)
@@ -347,5 +347,5 @@
             OSVERSIONINFOEX OSInfoEx;
             RT_ZERO(OSInfoEx);
-            OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+            OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
             if (    GetVersionEx((LPOSVERSIONINFO) &OSInfoEx)
                 &&  OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT
@@ -505,6 +505,9 @@
     g_uExecGuestPropSvcClientID = 0;
 
-    RTSemEventMultiDestroy(g_hExecEvent);
-    g_hExecEvent = NIL_RTSEMEVENTMULTI;
+    if (g_hExecEvent != NIL_RTSEMEVENTMULTI)
+    {
+        RTSemEventMultiDestroy(g_hExecEvent);
+        g_hExecEvent = NIL_RTSEMEVENTMULTI;
+    }
 }
 
Index: trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
===================================================================
--- trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h	(revision 25158)
+++ trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h	(revision 25159)
@@ -146,4 +146,6 @@
 /** Uninstalls the service from the registry. */
 extern int VBoxServiceWinUninstall(void);
+/** Reports our current status to the SCM. */
+extern BOOL VBoxServiceWinSetStatus (DWORD dwStatus, DWORD dwCheckPoint = 0);
 #ifdef VBOX_WITH_GUEST_PROPS
 /** Detects wheter a user is logged on based on the enumerated processes. */
Index: trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp	(revision 25158)
+++ trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp	(revision 25159)
@@ -271,4 +271,7 @@
 #ifdef RT_OS_WINDOWS
 /** @todo r=bird: NT4 doesn't have GetSystemTimeAdjustment. */
+    if (g_hTokenProcess == NULL) /* Is the token already closed when shutting down? */
+        return false;
+
     DWORD dwWinTimeAdjustment, dwWinNewTimeAdjustment, dwWinTimeIncrement;
     BOOL  fWinTimeAdjustmentDisabled;
