void CService::StopServer()
{
SC_HANDLE schSCManager;
SC_HANDLE schService;
SERVICE_STATUS_PROCESS ssp;
DWORD dwStartTime = GetTickCount();
DWORD dwBytesNeeded;
DWORD dwTimeout = 30000; // Get a handle to the SCM database.
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (NULL == schSCManager)
{
printf("OpenSCManager failed (%d)\n", GetLastError());
return;
} // Get a handle to the service.
schService = OpenService(schSCManager, name, SERVICE_STOP | SERVICE_QUERY_STATUS |SERVICE_ENUMERATE_DEPENDENTS);
if (NULL == schService)
{
printf("OpenService failed (%d)\n", GetLastError());
CloseServiceHandle(schSCManager);
return;
} // Make sure the service is not already stopped.
if (!QueryServiceStatusEx(schService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssp, 
sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded))
{
printf("QueryServiceStatusEx failed (%d)\n", GetLastError());
goto stop_clieanup;
} if (ssp.dwCurrentState == SERVICE_STOPPED)
{
printf("Service is already stopped.\n");
return;
} // If a stop is pending, wait for it.
while (ssp.dwCurrentState == SERVICE_STOP_PENDING)
{
printf("Service stop pending...\n");
Sleep(ssp.dwWaitHint);
if (!QueryServiceStatusEx(schService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssp,
sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded))
{
printf("QueryServiceStatusEx failed (%d)\n", GetLastError());
goto stop_cleanup;
} if (ssp.dwCurrentState == SERVICE_STOPPED)
{
printf("Service stopped sucessfully.\n");
goto stop_cleanup;
} if (GetTickCount()-dwStartTime > dwTimeout)
{
printf("Service stop timed out.\n");
goto stop_cleanup;
}
} // If the service is running, dependencies must be stopped first.
StopDependentServices(); // Send a stop code to the service
if (!ControlService(schService, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS)&ssp))
{
printf("ControlService failed (%d)\n", GetLastError());
goto stop_cleanup;
} // Wait for the service to stop.
while (ssp.dwCurrentState != SERVICE_STOPPED)
{
Sleep(ssp.dwWaitHint);
if (!QueryServiceStatusEx(schService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssp,
sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded))
{
printf("QueryServiceStatusEx failed (%d)\n", GetLastError());
goto stop_cleanup;
} if (ssp.dwCurrentState == SERVICE_STOPPED)
{
break;
}

if (GetTickCount() - dwStartTime > dwTimeout)
{
printf("Wait timed out\n");
goto stop_cleanup;
}
}
printf("Service stopped successfully\n");stop_cleanup:
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
}    ------>编译器说这有错,费解??vs2008  goto