Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/squid/squid3/src/Makefile.am,v
retrieving revision 1.33
diff -u -p -r1.33 Makefile.am
--- src/Makefile.am	16 Mar 2003 03:13:56 -0000	1.33
+++ src/Makefile.am	22 Apr 2003 12:26:34 -0000
@@ -426,7 +426,8 @@ noinst_HEADERS = MemBuf.cci \
 	Store.cci \
 	String.cci \
 	SquidString.h \
-	ufscommon.cci 
+	ufscommon.cci \
+	squid_windows.h
 
 nodist_squid_SOURCES = \
 	repl_modules.cc \
Index: src/dns_internal.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/dns_internal.cc,v
retrieving revision 1.10
diff -u -p -r1.10 dns_internal.cc
--- src/dns_internal.cc	10 Mar 2003 03:15:37 -0000	1.10
+++ src/dns_internal.cc	22 Apr 2003 12:26:34 -0000
@@ -43,7 +43,7 @@
  */
 #ifndef USE_DNSSERVERS
 #if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
-#include <windows.h>
+#include "squid_windows.h"
 #endif
 #ifndef _PATH_RESOLV_CONF
 #define _PATH_RESOLV_CONF "/etc/resolv.conf"
Index: src/globals.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/globals.h,v
retrieving revision 1.11
diff -u -p -r1.11 globals.h
--- src/globals.h	21 Apr 2003 02:13:59 -0000	1.11
+++ src/globals.h	22 Apr 2003 12:26:34 -0000
@@ -177,5 +177,6 @@ extern void *sbrk_start;	/* 0 */
 
 extern int ssl_ex_index_server;	/* -1 */
 extern int ssl_ctx_ex_index_dont_verify_domain; /* -1 */
+extern int opt_no_daemon; /* 0 */
 
 #endif /* SQUID_GLOBALS_H */
Index: src/main.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/main.cc,v
retrieving revision 1.18
diff -u -p -r1.18 main.cc
--- src/main.cc	22 Apr 2003 02:13:26 -0000	1.18
+++ src/main.cc	22 Apr 2003 12:26:34 -0000
@@ -42,11 +42,24 @@
 #include "ACLASN.h"
 #include "ACL.h"
 
+#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_))
+
+#include "squid_windows.h"
+#include <process.h>
+
+static int opt_install_service = FALSE;
+static int opt_remove_service = FALSE;
+static int opt_signal_service = FALSE;
+static int opt_command_line = FALSE;
+extern void WIN32_svcstatusupdate(DWORD, DWORD);
+void WINAPI WIN32_svcHandler(DWORD);
+
+#endif
+
 /* for error reporting from xmalloc and friends */
 SQUIDCEXTERN void (*failure_notify) (const char *);
 
 static int opt_send_signal = -1;
-static int opt_no_daemon = 0;
 static int opt_parse_cfg_only = 0;
 static int icpPortNumOverride = 1;	/* Want to detect "-u 0" */
 static int configured_once = 0;
@@ -282,6 +295,12 @@ mainParseOptions(int argc, char *argv[])
         case 'v':
             printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
 
+#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_))
+
+            printf("Compiled as Windows System Service.\n");
+
+#endif
+
             exit(0);
 
             /* NOTREACHED */
@@ -1269,9 +1288,9 @@ SquidShutdown(void *unused)
 #endif
 
     storeDirSync();		/* Flush log close */
+    storeFsDone();
 #if PURIFY || XMALLOC_TRACE
 
-    storeFsDone();
     configFreeMemory();
     storeFreeMemory();
     /*stmemFreeMemory(); */
Index: src/stat.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/stat.cc,v
retrieving revision 1.12
diff -u -p -r1.12 stat.cc
--- src/stat.cc	16 Mar 2003 03:14:04 -0000	1.12
+++ src/stat.cc	22 Apr 2003 12:26:35 -0000
@@ -455,6 +455,17 @@ info_get(StoreEntry * sentry)
     storeAppendPrintf(sentry, "Squid Object Cache: Version %s\n",
                       version_string);
 
+#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
+
+    if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
+        storeAppendPrintf(sentry,"\nRunning as %s Windows System Service on %s\n",
+                          WIN32_Service_name, WIN32_OS_string);
+        storeAppendPrintf(sentry,"Service command line is: %s\n", WIN32_Service_Command_Line);
+    } else
+        storeAppendPrintf(sentry,"Running on %s\n",WIN32_OS_string);
+
+#endif
+
     storeAppendPrintf(sentry, "Start Time:\t%s\n",
                       mkrfc1123(squid_start.tv_sec));
 
Index: src/unlinkd.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/unlinkd.cc,v
retrieving revision 1.7
diff -u -p -r1.7 unlinkd.cc
--- src/unlinkd.cc	22 Feb 2003 03:14:36 -0000	1.7
+++ src/unlinkd.cc	22 Apr 2003 12:26:35 -0000
@@ -189,6 +189,8 @@ unlinkdClose(void)
 void
 unlinkdInit(void)
 {
+#ifdef USE_UNLINKD
+
     int x;
     const char *args[2];
 
@@ -228,6 +230,11 @@ x = ipcCreate(IPC_FIFO,
     if (FD_PIPE == fd_table[unlinkd_wfd].type)
         commUnsetNonBlocking(unlinkd_wfd);
     debug(2, 1) ("Unlinkd pipe opened on FD %d\n", unlinkd_wfd);
+#else
+
+    debug(2, 1) ("Unlinkd is disabled\n");
+
+#endif /* def USE_UNLINKD */
 }
 
 #endif /* ndef UNLINK_DAEMON */
Index: src/win32.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/win32.cc,v
retrieving revision 1.5
diff -u -p -r1.5 win32.cc
--- src/win32.cc	22 Apr 2003 02:13:27 -0000	1.5
+++ src/win32.cc	22 Apr 2003 12:26:35 -0000
@@ -833,6 +833,7 @@ int main(int argc, char **argv)
 
     if ((argc == 2) && strstr(argv[1], _WIN_SQUID_SERVICE_OPTION)) {
         WIN32_run_mode = _WIN_SQUID_RUN_MODE_SERVICE;
+        opt_no_daemon = 1;
 
         if (!(c=strchr(argv[1],':'))) {
             fprintf(stderr, "Bad Service Parameter: %s\n", argv[1]);
