Changeset 44114 in vbox
- Timestamp:
- Dec 13, 2012 9:21:40 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp
r40158 r44114 22 22 #include <iprt/assert.h> 23 23 #include <iprt/err.h> 24 #include <iprt/system.h> /* For querying OS version. */ 24 25 #include <VBox/VBoxGuestLib.h> 25 26 #include "VBoxServiceInternal.h" … … 133 134 134 135 SERVICE_STATUS ss; 136 RT_ZERO(ss); 137 135 138 ss.dwServiceType = SERVICE_WIN32_OWN_PROCESS; 136 139 ss.dwCurrentState = dwStatus; 137 ss.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; 140 /* Don't accept controls when in start pending state. */ 141 if (ss.dwCurrentState != SERVICE_START_PENDING) 142 { 143 ss.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; 138 144 #ifndef TARGET_NT4 139 ss.dwControlsAccepted |= SERVICE_ACCEPT_SESSIONCHANGE; 140 #endif 145 /* Don't use SERVICE_ACCEPT_SESSIONCHANGE on Windows 2000. 146 * This makes SCM angry. */ 147 char szOSVersion[32]; 148 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, 149 szOSVersion, sizeof(szOSVersion)); 150 if (RT_SUCCESS(rc)) 151 { 152 if (RTStrVersionCompare(szOSVersion, "5.1") >= 0) 153 ss.dwControlsAccepted |= SERVICE_ACCEPT_SESSIONCHANGE; 154 } 155 else 156 VBoxServiceError("Error determining OS version, rc=%Rrc\n", rc); 157 #endif 158 } 159 141 160 ss.dwWin32ExitCode = NO_ERROR; 142 161 ss.dwServiceSpecificExitCode = 0; /* Not used */ … … 144 163 ss.dwWaitHint = 3000; 145 164 146 return SetServiceStatus(g_hWinServiceStatus, &ss); 165 BOOL fStatusSet = SetServiceStatus(g_hWinServiceStatus, &ss); 166 if (!fStatusSet) 167 VBoxServiceError("Error reporting service status=%ld (controls=%x, checkpoint=%ld) to SCM: %ld\n", 168 dwStatus, ss.dwControlsAccepted, dwCheckPoint, GetLastError()); 169 return fStatusSet; 147 170 } 148 171 … … 340 363 if (RT_SUCCESS(rc)) 341 364 { 365 vboxServiceWinSetStatus(SERVICE_START_PENDING, 0); 366 342 367 rc = VBoxServiceStartServices(); 343 368 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.