/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
if (svcHandle == 0)
return 1;
- /* Set Process work dir to directory cointaining squid.exe */
+ /* Set Process work dir to directory containing squid.exe */
GetModuleFileName(NULL, path, 512);
WIN32_module_name=xstrdup(path);
ConfigFile = static_cast<char *>(xmalloc(Size));
RegQueryValueEx(hndKey, CONFIGFILE, NULL, &Type, (unsigned char *)ConfigFile, &Size);
} else
- ConfigFile = xstrdup(DefaultConfigFile);
+ ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
Size = 0;
RegCloseKey(hndKey);
} else {
- ConfigFile = xstrdup(DefaultConfigFile);
+ ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
WIN32_Service_Command_Line = xstrdup("");
}
if ((lenpath = GetModuleFileName(NULL, ServicePath, 512)) == 0) {
fprintf(stderr, "Can't get executable path\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
snprintf(szPath, sizeof(szPath), "%s %s:" SQUIDSBUFPH, ServicePath, _WIN_SQUID_SERVICE_OPTION, SQUIDSBUFPRINT(service_name));
if (!schSCManager) {
fprintf(stderr, "OpenSCManager failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
} else {
schService = CreateService(schSCManager, /* SCManager database */
service, /* name of service */
/* Now store the config file location in the registry */
if (!ConfigFile)
- ConfigFile = xstrdup(DefaultConfigFile);
+ ConfigFile = xstrdup(DEFAULT_CONFIG_FILE);
WIN32_StoreKey(CONFIGFILE, REG_SZ, (unsigned char *) ConfigFile, strlen(ConfigFile) + 1);
printf("Don't forget to edit squid.conf before starting it.\n\n");
} else {
fprintf(stderr, "CreateService failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
CloseServiceHandle(schSCManager);
if (!schSCManager) {
fprintf(stderr, "OpenSCManager failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* The required service object access depends on the control. */
break;
default:
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Open a handle to the service. */
if (schService == NULL) {
fprintf(stderr, "%s: ERROR: Could not open Service " SQUIDSBUFPH "\n", APP_SHORTNAME, SQUIDSBUFPRINT(service_name));
- exit(1);
+ exit(EXIT_FAILURE);
} else {
/* Send a control value to the service. */
&ssStatus)) { /* address of status info */
fprintf(stderr, "%s: ERROR: Could not Control Service " SQUIDSBUFPH "\n",
APP_SHORTNAME, SQUIDSBUFPRINT(service_name));
- exit(1);
+ exit(EXIT_FAILURE);
} else {
/* Print the service status. */
printf("\nStatus of " SQUIDSBUFPH " Service:\n", SQUIDSBUFPRINT(service_name));
} else if (s_iInitCount < 0)
return (s_iInitCount);
- /* s_iInitCount == 0. Do the initailization */
+ /* s_iInitCount == 0. Do the initialization */
iVersionRequested = MAKEWORD(2, 0);
err = WSAStartup((WORD) iVersionRequested, &wsaData);