Skip to content

Commit

Permalink
fix xp support again
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Jul 26, 2024
1 parent a4c1ad5 commit f63cb16
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions CscdCfg/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ VOID WINAPI DoDeleteSvc()
BOOL WINAPI DoStartSvc()
{
SERVICE_STATUS_PROCESS ssStatus;
ULONGLONG ullOldCheckPoint;
ULONGLONG ullStartTickCount;
DWORD dwOldCheckPoint;
DWORD dwStartTickCount;
DWORD dwWaitTime;
DWORD dwBytesNeeded;

Expand Down Expand Up @@ -583,8 +583,8 @@ BOOL WINAPI DoStartSvc()

// Save the tick count and initial checkpoint.

ullStartTickCount = GetTickCount64();
ullOldCheckPoint = ssStatus.dwCheckPoint;
dwOldCheckPoint = GetTickCount();
dwStartTickCount = ssStatus.dwCheckPoint;

// Wait for the service to stop before attempting to start it.

Expand Down Expand Up @@ -618,16 +618,16 @@ BOOL WINAPI DoStartSvc()
return FALSE;
}

if (ssStatus.dwCheckPoint > ullOldCheckPoint)
if (ssStatus.dwCheckPoint > dwOldCheckPoint)
{
// Continue to wait and check.

ullStartTickCount = GetTickCount64();
ullOldCheckPoint = ssStatus.dwCheckPoint;
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;
}
else
{
if (GetTickCount64() - ullStartTickCount > ssStatus.dwWaitHint)
if (GetTickCount() - dwStartTickCount > ssStatus.dwWaitHint)
{
printf("Timeout waiting for service to stop\n");
CloseServiceHandle(schService);
Expand Down Expand Up @@ -668,8 +668,8 @@ BOOL WINAPI DoStartSvc()

// Save the tick count and initial checkpoint.

ullStartTickCount = GetTickCount64();
ullOldCheckPoint = ssStatus.dwCheckPoint;
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;

while (ssStatus.dwCurrentState == SERVICE_START_PENDING)
{
Expand Down Expand Up @@ -699,16 +699,16 @@ BOOL WINAPI DoStartSvc()
break;
}

if (ssStatus.dwCheckPoint > ullOldCheckPoint)
if (ssStatus.dwCheckPoint > dwOldCheckPoint)
{
// Continue to wait and check.

ullStartTickCount = GetTickCount64();
ullOldCheckPoint = ssStatus.dwCheckPoint;
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;
}
else
{
if (GetTickCount64() - ullStartTickCount > ssStatus.dwWaitHint)
if (GetTickCount() - dwStartTickCount > ssStatus.dwWaitHint)
{
// No progress made within the wait hint.
break;
Expand Down Expand Up @@ -900,7 +900,7 @@ VOID WINAPI DoUpdateSvcDacl()
BOOL WINAPI DoStopSvc()
{
SERVICE_STATUS_PROCESS ssp;
ULONGLONG ullStartTime = GetTickCount64();
DWORD dwStartTime = GetTickCount();
DWORD dwBytesNeeded;
DWORD dwTimeout = 30000; // 30-second time-out
DWORD dwWaitTime;
Expand Down Expand Up @@ -998,7 +998,7 @@ BOOL WINAPI DoStopSvc()
goto stop_cleanup;
}

if (GetTickCount64() - ullStartTime > dwTimeout)
if (GetTickCount() - dwStartTime > dwTimeout)
{
printf("Service stop timed out.\n");
bRet = FALSE;
Expand Down Expand Up @@ -1045,7 +1045,7 @@ BOOL WINAPI DoStopSvc()
if (ssp.dwCurrentState == SERVICE_STOPPED)
break;

if (GetTickCount64() - ullStartTime > dwTimeout)
if (GetTickCount() - dwStartTime > dwTimeout)
{
printf("Wait timed out\n");
bRet = FALSE;
Expand Down Expand Up @@ -1075,8 +1075,8 @@ BOOL WINAPI StopDependentServices()
SC_HANDLE hDepService;
SERVICE_STATUS_PROCESS ssp;

ULONGLONG ullStartTime = GetTickCount64();
ULONGLONG ullTimeout = 30000; // 30-second time-out
DWORD dwStartTime = GetTickCount();
DWORD dwTimeout = 30000; // 30-second time-out

// Pass a zero-length buffer to get the required buffer size.
if (EnumDependentServices(schService, SERVICE_ACTIVE,
Expand Down Expand Up @@ -1138,7 +1138,7 @@ BOOL WINAPI StopDependentServices()
if (ssp.dwCurrentState == SERVICE_STOPPED)
break;

if (GetTickCount64() - ullStartTime > ullTimeout)
if (GetTickCount() - dwStartTime > dwTimeout)
return FALSE;
}
}
Expand Down

0 comments on commit f63cb16

Please sign in to comment.