Index: src/file.c
==================================================================
--- src/file.c
+++ src/file.c
@@ -1125,16 +1125,11 @@
 */
 int fossil_utf8_to_console(const char *zUtf8, int nByte, int toStdErr){
 #ifdef _WIN32
   int nChar;
   wchar_t *zUnicode; /* Unicode version of zUtf8 */
-#ifdef UNICODE
   DWORD dummy;
-#else
-  char *zConsole;    /* Console version of zUtf8 */
-  int codepage;      /* Console code page */
-#endif
 
   static int istty[2] = { -1, -1 };
   if( istty[toStdErr] == -1 ){
     istty[toStdErr] = _isatty(toStdErr + 1) != 0;
   }
@@ -1152,31 +1147,11 @@
   if( nChar==0 ){
     free(zUnicode);
     return 0;
   }
   zUnicode[nChar] = '\0';
-#ifdef UNICODE
   WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
-#else /* !UNICODE */
-  codepage = GetConsoleCP();
-  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, 0, 0, 0, 0);
-  zConsole = malloc( nByte + 1);
-  if( zConsole==0 ){
-    free(zUnicode);
-    return 0;
-  }
-  nByte = WideCharToMultiByte(codepage, 0, zUnicode, nChar, zConsole, nByte, 0, 0);
-  zConsole[nByte] = '\0';
-  free(zUnicode);
-  if( nByte == 0 ){
-    free(zConsole);
-    zConsole = 0;
-    return 0;
-  }
-  fwrite(zConsole, 1, nByte, toStdErr ? stderr : stdout);
-  fflush(toStdErr ? stderr : stdout);
-#endif /* UNICODE */
   return nChar;
 #else
   return -1;  /* No-op on unix */
 #endif
 }

Index: src/main.c
==================================================================
--- src/main.c
+++ src/main.c
@@ -197,10 +197,13 @@
   const char *azAuxVal[MX_AUX];  /* Value of each aux() or option() value */
   const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
   int anAuxCols[MX_AUX];         /* Number of columns for option() values */
 
   int allowSymlinks;             /* Cached "allow-symlinks" option */
+#ifdef _WIN32
+  int isNT;
+#endif
 
 #ifdef FOSSIL_ENABLE_JSON
   struct FossilJsonBits {
     int isJsonMode;            /* True if running in JSON mode, else
                                   false. This changes how errors are
@@ -470,24 +473,20 @@
   char **newArgv;           /* New expanded g.argv under construction */
   char const * zFileName;   /* input file name */
   FILE * zInFile;           /* input FILE */
   int foundBom = -1;        /* -1= not searched yet, 0 = no; 1=yes */
 #ifdef _WIN32
-  wchar_t buf[MAX_PATH];
+  TCHAR buf[MAX_PATH];
 #endif
 
   g.argc = argc;
   g.argv = argv;
 #ifdef _WIN32
   parse_windows_command_line(&g.argc, &g.argv);
-  GetModuleFileNameW(NULL, buf, MAX_PATH);
+  GetModuleFileName(NULL, buf, MAX_PATH);
   g.argv[0] = fossil_unicode_to_utf8(buf);
-#ifdef UNICODE
   for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
-#else
-  for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
-#endif
 #endif
   for(i=1; i<g.argc-1; i++){
     z = g.argv[i];
     if( z[0]!='-' ) continue;
     z++;
@@ -557,13 +556,21 @@
 int main(int argc, char **argv)
 {
   const char *zCmdName = "unknown";
   int idx;
   int rc;
+#ifdef _WIN32
+  OSVERSIONINFOA sInfo;
+#endif
 
   sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
   memset(&g, 0, sizeof(g));
+#ifdef _WIN32
+  sInfo.dwOSVersionInfoSize = sizeof(sInfo);
+  GetVersionExA(&sInfo);
+  g.isNT = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT;
+#endif
   g.now = time(0);
 #ifdef FOSSIL_ENABLE_JSON
 #if defined(NDEBUG)
   g.json.errorDetailParanoia = 2 /* FIXME: make configurable
                                     One problem we have here is that this
@@ -834,20 +841,27 @@
   int rc;
 #if defined(_WIN32)
   /* On windows, we have to put double-quotes around the entire command.
   ** Who knows why - this is just the way windows works.
   */
-  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
-  wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
+  char *zNewCmd;
+  TCHAR *zUnicode;
+
+  if (g.isNT) {
+    zNewCmd = mprintf("\"%s\"", zOrigCmd);
+  } else {
+    zNewCmd = mprintf("%s", zOrigCmd);
+  }
+  zUnicode = fossil_utf8_to_unicode(zNewCmd);
   if( g.fSystemTrace ) {
     char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
     fossil_puts(zOut, 1);
     fossil_free(zOut);
   }
-  rc = _wsystem(zUnicode);
+  rc = _tsystem(zUnicode);
   fossil_mbcs_free(zUnicode);
-  free(zNewCmd);
+  fossil_free(zNewCmd);
 #else
   /* On unix, evaluate the command directly.
   */
   if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
   rc = system(zOrigCmd);

Index: src/winhttp.c
==================================================================
--- src/winhttp.c
+++ src/winhttp.c
@@ -129,15 +129,10 @@
   file_delete(zRequestFName);
   file_delete(zReplyFName);
   free(p);
 }
 
-#if !defined(UNICODE)
-#  define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
-#  define fossil_utf8_to_unicode fossil_utf8_to_mbcs
-#endif
-
 /*
 ** Start a listening socket and process incoming HTTP requests on
 ** that socket.
 */
 void win32_http_server(
@@ -561,10 +556,15 @@
 void cmd_win32_service(void){
   int n;
   const char *zMethod;
   const char *zSvcName = "Fossil-DSCM";    /* Default service name */
 
+#ifdef _WIN32
+  if( !g.isNT ) {
+    fossil_fatal("%s command not support on Windows 9x", g.argv[1]);
+  }
+#endif
   if( g.argc<3 ){
     usage("create|delete|show|start|stop ...");
   }
   zMethod = g.argv[2];
   n = strlen(zMethod);

Index: win/Makefile.mingw
==================================================================
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -149,11 +149,11 @@
 endif
 
 #### We add the -static option here so that we can build a static
 #    executable that will run in a chroot jail.
 #
-LIB = -static
+LIB = -municows -static
 
 # OpenSSL: Add the necessary libraries required, if enabled.
 ifdef FOSSIL_ENABLE_SSL
 LIB += -lssl -lcrypto -lgdi32
 endif