--------------------- PatchSet 3527 Date: 2001/12/28 15:55:23 Author: serassio Branch: cygwin-svc Tag: (none) Log: Fixed some WIN32 compile warning and moved some service startup code Members: src/win32.c:1.1.50.6.2.19->1.1.50.6.2.20 Index: squid/src/win32.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/win32.c,v retrieving revision 1.1.50.6.2.19 retrieving revision 1.1.50.6.2.20 diff -u -r1.1.50.6.2.19 -r1.1.50.6.2.20 --- squid/src/win32.c 8 Dec 2001 15:59:39 -0000 1.1.50.6.2.19 +++ squid/src/win32.c 28 Dec 2001 15:55:23 -0000 1.1.50.6.2.20 @@ -70,7 +70,7 @@ #define CHANGESERVICECONFIG2 "ChangeServiceConfig2A" #endif #define DATABASEPATH "DataBasePath" -static SC_ACTION Squid_SCAction[1]= { SC_ACTION_RESTART, 60000 }; +static SC_ACTION Squid_SCAction[] = { { SC_ACTION_RESTART, 60000 } }; static SERVICE_DESCRIPTION Squid_ServiceDescription = { SOFTWARENAME " " VERSION " WWW Proxy Server" }; static SERVICE_FAILURE_ACTIONS Squid_ServiceFailureActions = { 0, NULL, NULL, 1, Squid_SCAction }; static char REGKEY[256]="SOFTWARE\\"VENDOR"\\"SOFTWARENAME"\\"WIN32_VERSION"\\"; @@ -169,7 +169,7 @@ } } if (rv != ERROR_SUCCESS) { - debug(1, 1) ("RegOpenKeyEx HKLM\\%s, %d\n", REGKEY, rv); + debug(1, 1) ("RegOpenKeyEx HKLM\\%s, %d\n", REGKEY, (int) rv); return -4; } /* Now set the value and data */ @@ -180,7 +180,7 @@ (DWORD) value_size); /* for size of "value" */ retval = 0; /* Return value */ if (rv != ERROR_SUCCESS) { - debug(1, 1) ("RegQueryValueEx(key %s),%d\n", key, rv); + debug(1, 1) ("RegQueryValueEx(key %s),%d\n", key, (int) rv); retval = -4; } else { debug(1, 1) ("Registry stored HKLM\\%s\\%s value %s\n", @@ -193,7 +193,7 @@ */ rv = RegCloseKey(hKey); if (rv != ERROR_SUCCESS) { - debug(1, 1) ("RegCloseKey HKLM\\%s, %d\n", REGKEY, rv); + debug(1, 1) ("RegCloseKey HKLM\\%s, %d\n", REGKEY, (int) rv); if (retval == 0) { /* Keep error status from RegQueryValueEx, if any */ retval = -4; @@ -381,6 +381,16 @@ WIN32_svcHandler); if (svcHandle == 0) return 1; + /* Set Service Staus to SERVICE_START_PENDING */ + svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + svcStatus.dwCurrentState = SERVICE_START_PENDING; + svcStatus.dwControlsAccepted = + SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + svcStatus.dwWin32ExitCode = 0; + svcStatus.dwServiceSpecificExitCode = 0; + svcStatus.dwCheckPoint = 0; + svcStatus.dwWaitHint = 10000; + SetServiceStatus(svcHandle, &svcStatus); /* Set Process work dir to directory cointaining squid.exe */ GetModuleFileName(NULL, path, 512); WIN32_module_name=xstrdup(path); @@ -419,16 +429,6 @@ WIN32_build_argv(CommandLine); *argc = WIN32_argc; *argv = WIN32_argv; - /* Set Service Staus to SERVICE_START_PENDING */ - svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - svcStatus.dwCurrentState = SERVICE_START_PENDING; - svcStatus.dwControlsAccepted = - SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; - svcStatus.dwWin32ExitCode = 0; - svcStatus.dwServiceSpecificExitCode = 0; - svcStatus.dwCheckPoint = 0; - svcStatus.dwWaitHint = 10000; - SetServiceStatus(svcHandle, &svcStatus); } #endif #ifdef _SQUID_MSWIN_