Changes On Branch restore-win95
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch restore-win95 Excluding Merge-Ins

This is equivalent to a diff from 71d46aba2e to bf0fede2ee

2012-09-18
00:03
Fix the <base> tag in the default header. check-in: eb1513b7a9 user: drh tags: trunk
2012-09-17
07:34
fix [ce73fc2173] Restore Win9x, using unicows eliminate all #ifdef UNICODE Closed-Leaf check-in: 9cf5056af9 user: jan.nijtmans tags: win95-unicows
2012-09-14
10:31
Experimental version for Win9x, using unicows Closed-Leaf check-in: bf0fede2ee user: jan.nijtmans tags: restore-win95
2012-09-13
07:17
merge trunk check-in: 0930ed2085 user: jan.nijtmans tags: restore-win95
07:12
re-enable unicode commandline for MSVC build (previous commit accidently removed that) New version of dirent.h, which supports both MBCS and UNICODE check-in: 71d46aba2e user: jan.nijtmans tags: trunk
2012-09-11
18:49
enable unicode commandline for MinGW/MinGW-w64 as well remove unused MINGW_BROKEN_MAINARGS check-in: 274d8a1dcd user: jan.nijtmans tags: trunk

Changes to src/checkin.c.

   505    505       }
   506    506       blob_reset(&text);
   507    507       blob_read_from_file(&text, zFile);
   508    508     }else{
   509    509       char zIn[300];
   510    510       blob_reset(&text);
   511    511       while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
   512         -      char *zUtf8 = fossil_mbcs_to_utf8(zIn);
          512  +      char *zUtf8 = fossil_console_to_utf8(zIn);
   513    513         if( zUtf8[0]=='.' && (zUtf8[1]==0 || zUtf8[1]=='\r' || zUtf8[1]=='\n') ){
   514    514           fossil_mbcs_free(zUtf8);
   515    515           break;
   516    516         }
   517    517         blob_append(&text, zIn, -1);
   518    518         fossil_mbcs_free(zUtf8);
   519    519       }

Changes to src/file.c.

    32     32   
    33     33   /*
    34     34   ** On Windows, include the Platform SDK header file.
    35     35   */
    36     36   #ifdef _WIN32
    37     37   # include <direct.h>
    38     38   # include <windows.h>
           39  +# include <tchar.h>
    39     40   #endif
    40     41   
    41     42   /*
    42     43   ** The file status information from the most recent stat() call.
    43     44   **
    44     45   ** Use _stati64 rather than stat on windows, in order to handle files
    45     46   ** larger than 2GB.
................................................................................
    67     68     if( isWd && g.allowSymlinks ){
    68     69       return lstat(zFilename, buf);
    69     70     }else{
    70     71       return stat(zFilename, buf);
    71     72     }
    72     73   #else
    73     74     int rc = 0;
    74         -  wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
    75         -  rc = _wstati64(zMbcs, buf);
           75  +  TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
           76  +  rc = _tstati64(zMbcs, buf);
    76     77     fossil_mbcs_free(zMbcs);
    77     78     return rc;
    78     79   #endif
    79     80   }
    80     81   
    81     82   /*
    82     83   ** Fill in the fileStat variable for the file named zFilename.
................................................................................
   298    299   
   299    300   
   300    301   /*
   301    302   ** Wrapper around the access() system call.
   302    303   */
   303    304   int file_access(const char *zFilename, int flags){
   304    305   #ifdef _WIN32
   305         -  wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
   306         -  int rc = _waccess(zMbcs, flags);
          306  +  TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
          307  +  int rc = _taccess(zMbcs, flags);
   307    308     fossil_mbcs_free(zMbcs);
   308    309   #else
   309    310     int rc = access(zFilename, flags);
   310    311   #endif
   311    312     return rc;
   312    313   }
   313    314   
................................................................................
   393    394   }
   394    395   
   395    396   /*
   396    397   ** Delete a file.
   397    398   */
   398    399   void file_delete(const char *zFilename){
   399    400   #ifdef _WIN32
   400         -  wchar_t *z = fossil_utf8_to_unicode(zFilename);
   401         -  _wunlink(z);
          401  +  TCHAR *z = fossil_utf8_to_mbcs(zFilename);
          402  +  _tunlink(z);
   402    403     fossil_mbcs_free(z);
   403    404   #else
   404    405     unlink(zFilename);
   405    406   #endif
   406    407   }
   407    408   
   408    409   /*
................................................................................
   417    418     if( rc==2 ){
   418    419       if( !forceFlag ) return 1;
   419    420       file_delete(zName);
   420    421     }
   421    422     if( rc!=1 ){
   422    423   #if defined(_WIN32)
   423    424       int rc;
   424         -    wchar_t *zMbcs = fossil_utf8_to_unicode(zName);
   425         -    rc = _wmkdir(zMbcs);
          425  +    TCHAR *zMbcs = fossil_utf8_to_mbcs(zName);
          426  +    rc = _tmkdir(zMbcs);
   426    427       fossil_mbcs_free(zMbcs);
   427    428       return rc;
   428    429   #else
   429    430       return mkdir(zName, 0755);
   430    431   #endif
   431    432     }
   432    433     return 0;
................................................................................
   577    578   ** unix.
   578    579   */
   579    580   void file_getcwd(char *zBuf, int nBuf){
   580    581   #ifdef _WIN32
   581    582     char *zPwdUtf8;
   582    583     int nPwd;
   583    584     int i;
   584         -  wchar_t zPwd[2000];
   585         -  if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
          585  +  TCHAR zPwd[2000];
          586  +  if( _tgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
   586    587       fossil_fatal("cannot find the current working directory.");
   587    588     }
   588         -  zPwdUtf8 = fossil_unicode_to_utf8(zPwd);
          589  +  zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
   589    590     nPwd = strlen(zPwdUtf8);
   590    591     if( nPwd > nBuf-1 ){
   591    592       fossil_fatal("pwd too big: max %d\n", nBuf-1);
   592    593     }
   593    594     for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
   594    595     memcpy(zBuf, zPwdUtf8, nPwd+1);
   595    596     fossil_mbcs_free(zPwdUtf8);
................................................................................
   935    936       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   936    937       "0123456789";
   937    938     unsigned int i, j;
   938    939     const char *zDir = ".";
   939    940     int cnt = 0;
   940    941   
   941    942   #if defined(_WIN32)
   942         -  wchar_t zTmpPath[MAX_PATH];
          943  +  TCHAR zTmpPath[MAX_PATH];
   943    944   
   944         -  if( GetTempPathW(MAX_PATH, zTmpPath) ){
   945         -    azDirs[0] = fossil_unicode_to_utf8(zTmpPath);
          945  +  if( GetTempPath(MAX_PATH, zTmpPath) ){
          946  +    azDirs[0] = fossil_mbcs_to_utf8(zTmpPath);
   946    947     }
   947    948   
   948    949     azDirs[1] = fossil_getenv("TEMP");
   949    950     azDirs[2] = fossil_getenv("TMP");
   950    951   #endif
   951    952   
   952    953   
................................................................................
  1002   1003     }
  1003   1004     rc = blob_compare(&onDisk, pContent);
  1004   1005     blob_reset(&onDisk);
  1005   1006     return rc==0;
  1006   1007   }
  1007   1008   
  1008   1009   /*
  1009         -** Portable unicode implementation of opendir()
         1010  +** Portable unicode implementation of opendir() for win32
  1010   1011   */
  1011   1012   #if INTERFACE
  1012   1013   
  1013         -#if defined(_WIN32)
  1014         -# include <dirent.h>
  1015         -# define FOSSIL_DIR _WDIR
  1016         -# define fossil_dirent _wdirent
  1017         -# define fossil_opendir _wopendir
  1018         -# define fossil_readdir _wreaddir
  1019         -# define fossil_closedir _wclosedir
  1020         -#else
  1021         -# include <dirent.h>
  1022         -# define FOSSIL_DIR DIR
  1023         -# define fossil_dirent dirent
  1024         -# define fossil_opendir opendir
  1025         -# define fossil_readdir readdir
  1026         -# define fossil_closedir closedir
         1014  +#include <dirent.h>
         1015  +#if defined(_WIN32) && defined(UNICODE)
         1016  +#  define dirent _wdirent
         1017  +#  define opendir _wopendir
         1018  +#  define readdir _wreaddir
         1019  +#  define closedir _wclosedir
         1020  +#  define DIR _WDIR
  1027   1021   #endif
  1028   1022   
  1029   1023   #endif /* INTERFACE */
  1030         -
  1031         -
  1032   1024   
  1033   1025   /**************************************************************************
  1034   1026   ** The following routines translate between MBCS and UTF8 on windows.
  1035   1027   ** Since everything is always UTF8 on unix, these routines are no-ops
  1036   1028   ** there.
  1037   1029   */
  1038   1030   
  1039   1031   /*
  1040         -** Translate MBCS to UTF8.  Return a pointer to the translated text.
  1041         -** Call fossil_mbcs_free() to deallocate any memory used to store the
  1042         -** returned pointer when done.
         1032  +** Translate unicode/mbcs to UTF8.  Return a pointer to the translated
         1033  +** text. Call fossil_mbcs_free() to deallocate any memory used to store
         1034  +** the returned pointer when done.
         1035  +*/
         1036  +char *fossil_mbcs_to_utf8(const void *zMbcs){
         1037  +#ifdef _WIN32
         1038  +#ifdef UNICODE
         1039  +  int nByte = WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, 0, 0, 0, 0);
         1040  +  char *zUtf = sqlite3_malloc( nByte );
         1041  +  if( zUtf==0 ){
         1042  +    return 0;
         1043  +  }
         1044  +  WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, zUtf, nByte, 0, 0);
         1045  +  return zUtf;
         1046  +#else
         1047  +  extern char *sqlite3_win32_mbcs_to_utf8(const char*);
         1048  +  return sqlite3_win32_mbcs_to_utf8(zMbcs);
         1049  +#endif
         1050  +#else
         1051  +  return (char*)zMbcs;  /* No-op on unix */
         1052  +#endif
         1053  +}
         1054  +
         1055  +/*
         1056  +** Translate mbcs to UTF8.  Return a pointer to the translated text.
         1057  +** Call fossil_mbcs_free() to deallocate any memory used to store
         1058  +** the returned pointer when done.
  1043   1059   */
  1044         -char *fossil_mbcs_to_utf8(const char *zMbcs){
         1060  +char *fossil_console_to_utf8(const void *zMbcs){
  1045   1061   #ifdef _WIN32
  1046   1062     extern char *sqlite3_win32_mbcs_to_utf8(const char*);
  1047   1063     return sqlite3_win32_mbcs_to_utf8(zMbcs);
  1048   1064   #else
  1049   1065     return (char*)zMbcs;  /* No-op on unix */
  1050   1066   #endif
  1051   1067   }
  1052   1068   
  1053   1069   /*
  1054         -** Translate Unicode to UTF8.  Return a pointer to the translated text.
  1055         -** Call fossil_mbcs_free() to deallocate any memory used to store the
  1056         -** returned pointer when done.
         1070  +** Translate UTF8 to unicode/mbcs for use in system calls.  Return a
         1071  +** pointer to the translated text..  Call fossil_mbcs_free() to
         1072  +** deallocate any memory used to store the returned pointer when done.
  1057   1073   */
  1058         -char *fossil_unicode_to_utf8(const void *zUnicode){
         1074  +void *fossil_utf8_to_mbcs(const char *zUtf8){
  1059   1075   #ifdef _WIN32
  1060         -  int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
  1061         -  char *zUtf = sqlite3_malloc( nByte );
  1062         -  if( zUtf==0 ){
  1063         -    return 0;
  1064         -  }
  1065         -  WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
  1066         -  return zUtf;
  1067         -#else
  1068         -  return (char *)zUnicode;  /* No-op on unix */
  1069         -#endif
  1070         -}
  1071         -
  1072         -/*
  1073         -** Translate UTF8 to MBCS for use in system calls.  Return a pointer to the
  1074         -** translated text..  Call fossil_mbcs_free() to deallocate any memory
  1075         -** used to store the returned pointer when done.
  1076         -*/
  1077         -char *fossil_utf8_to_mbcs(const char *zUtf8){
  1078         -#ifdef _WIN32
  1079         -  extern char *sqlite3_win32_utf8_to_mbcs(const char*);
  1080         -  return sqlite3_win32_utf8_to_mbcs(zUtf8);
  1081         -#else
  1082         -  return (char*)zUtf8;  /* No-op on unix */
  1083         -#endif
  1084         -}
  1085         -
  1086         -/*
  1087         -** Translate UTF8 to unicode for use in system calls.  Return a pointer to the
  1088         -** translated text..  Call fossil_mbcs_free() to deallocate any memory
  1089         -** used to store the returned pointer when done.
  1090         -*/
  1091         -void *fossil_utf8_to_unicode(const char *zUtf8){
  1092         -#ifdef _WIN32
         1076  +#ifdef UNICODE
  1093   1077     int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
  1094   1078     wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
  1095   1079     if( zUnicode==0 ){
  1096   1080       return 0;
  1097   1081     }
  1098   1082     MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
  1099   1083     return zUnicode;
  1100   1084   #else
  1101         -  return (void *)zUtf8;  /* No-op on unix */
         1085  +  extern char *sqlite3_win32_utf8_to_mbcs(const char*);
         1086  +  return sqlite3_win32_utf8_to_mbcs(zUtf8);
         1087  +#endif
         1088  +#else
         1089  +  return (char*)zUtf8;  /* No-op on unix */
  1102   1090   #endif
  1103   1091   }
  1104   1092   
  1105   1093   /*
  1106   1094   ** Return the value of an environment variable as UTF8.
  1107   1095   */
  1108   1096   char *fossil_getenv(const char *zName){
  1109   1097   #ifdef _WIN32
  1110         -  wchar_t *uName = fossil_utf8_to_unicode(zName);
  1111         -  void *zValue = _wgetenv(uName);
         1098  +  TCHAR *uName = fossil_utf8_to_mbcs(zName);
         1099  +  void *zValue = _tgetenv(uName);
  1112   1100     fossil_mbcs_free(uName);
  1113         -  if( zValue ) zValue = fossil_unicode_to_utf8(zValue);
         1101  +  if( zValue ) zValue = fossil_mbcs_to_utf8(zValue);
  1114   1102   #else
  1115   1103     char *zValue = getenv(zName);
  1116   1104   #endif
  1117   1105     return zValue;
  1118   1106   }
  1119   1107   
  1120   1108   /*
................................................................................
  1195   1183   }
  1196   1184   
  1197   1185   /*
  1198   1186   ** Like fopen() but always takes a UTF8 argument.
  1199   1187   */
  1200   1188   FILE *fossil_fopen(const char *zName, const char *zMode){
  1201   1189   #ifdef _WIN32
  1202         -  wchar_t *uMode = fossil_utf8_to_unicode(zMode);
  1203         -  wchar_t *uName = fossil_utf8_to_unicode(zName);
  1204         -  FILE *f = _wfopen(uName, uMode);
         1190  +  TCHAR *uMode = fossil_utf8_to_mbcs(zMode);
         1191  +  TCHAR *uName = fossil_utf8_to_mbcs(zName);
         1192  +  FILE *f = _tfopen(uName, uMode);
  1205   1193     fossil_mbcs_free(uName);
  1206   1194     fossil_mbcs_free(uMode);
  1207   1195   #else
  1208   1196     FILE *f = fopen(zName, zMode);
  1209   1197   #endif
  1210   1198     return f;
  1211   1199   }

Changes to src/main.c.

   195    195     const char *azAuxName[MX_AUX]; /* Name of each aux() or option() value */
   196    196     char *azAuxParam[MX_AUX];      /* Param of each aux() or option() value */
   197    197     const char *azAuxVal[MX_AUX];  /* Value of each aux() or option() value */
   198    198     const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
   199    199     int anAuxCols[MX_AUX];         /* Number of columns for option() values */
   200    200   
   201    201     int allowSymlinks;             /* Cached "allow-symlinks" option */
          202  +#ifdef _WIN32
          203  +  int isNT;
          204  +#endif
   202    205   
   203    206   #ifdef FOSSIL_ENABLE_JSON
   204    207     struct FossilJsonBits {
   205    208       int isJsonMode;            /* True if running in JSON mode, else
   206    209                                     false. This changes how errors are
   207    210                                     reported. In JSON mode we try to
   208    211                                     always output JSON-form error
................................................................................
   468    471     int n;                    /* Number of bytes in one line */
   469    472     char *z;                  /* General use string pointer */
   470    473     char **newArgv;           /* New expanded g.argv under construction */
   471    474     char const * zFileName;   /* input file name */
   472    475     FILE * zInFile;           /* input FILE */
   473    476     int foundBom = -1;        /* -1= not searched yet, 0 = no; 1=yes */
   474    477   #ifdef _WIN32
   475         -  wchar_t buf[MAX_PATH];
          478  +  TCHAR buf[MAX_PATH];
   476    479   #endif
   477    480   
   478    481     g.argc = argc;
   479    482     g.argv = argv;
   480    483   #ifdef _WIN32
   481    484     parse_windows_command_line(&g.argc, &g.argv);
   482         -  GetModuleFileNameW(NULL, buf, MAX_PATH);
   483         -  g.argv[0] = fossil_unicode_to_utf8(buf);
   484         -#ifdef UNICODE
   485         -  for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
   486         -#else
          485  +  GetModuleFileName(NULL, buf, MAX_PATH);
          486  +  g.argv[0] = fossil_mbcs_to_utf8(buf);
   487    487     for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
   488         -#endif
   489    488   #endif
   490    489     for(i=1; i<g.argc-1; i++){
   491    490       z = g.argv[i];
   492    491       if( z[0]!='-' ) continue;
   493    492       z++;
   494    493       if( z[0]=='-' ) z++;
   495    494       if( z[0]==0 ) return;   /* Stop searching at "--" */
................................................................................
   528    527         }
   529    528       }
   530    529       if((n>1) && ('\r'==z[n-2])){
   531    530         if(n==2) continue /*empty line*/;
   532    531         z[n-2] = 0;
   533    532       }
   534    533       if (!foundBom) {
   535         -      z = fossil_mbcs_to_utf8(z);
          534  +      z = fossil_console_to_utf8(z);
   536    535       }
   537    536       newArgv[j++] = z;
   538    537       if( z[0]=='-' ){
   539    538         for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
   540    539         if( z[k] ){
   541    540           z[k] = 0;
   542    541           k++;
................................................................................
   555    554   ** This procedure runs first.
   556    555   */
   557    556   int main(int argc, char **argv)
   558    557   {
   559    558     const char *zCmdName = "unknown";
   560    559     int idx;
   561    560     int rc;
          561  +#ifdef _WIN32
          562  +  OSVERSIONINFOA sInfo;
          563  +#endif
   562    564   
   563    565     sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
   564    566     memset(&g, 0, sizeof(g));
          567  +#ifdef _WIN32
          568  +  sInfo.dwOSVersionInfoSize = sizeof(sInfo);
          569  +  GetVersionExA(&sInfo);
          570  +  g.isNT = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT;
          571  +#endif
   565    572     g.now = time(0);
   566    573   #ifdef FOSSIL_ENABLE_JSON
   567    574   #if defined(NDEBUG)
   568    575     g.json.errorDetailParanoia = 2 /* FIXME: make configurable
   569    576                                       One problem we have here is that this
   570    577                                       code is needed before the db is opened,
   571    578                                       so we can't sql for it.*/;
................................................................................
   829    836   
   830    837   /*
   831    838   ** This function implements a cross-platform "system()" interface.
   832    839   */
   833    840   int fossil_system(const char *zOrigCmd){
   834    841     int rc;
   835    842   #if defined(_WIN32)
   836         -  /* On windows, we have to put double-quotes around the entire command.
          843  +  /* On windows NT, we have to put double-quotes around the entire command.
   837    844     ** Who knows why - this is just the way windows works.
   838    845     */
   839         -  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
   840         -  wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
          846  +  char *zNewCmd;
          847  +  TCHAR *zMbcs;
          848  +
          849  +  if (g.isNT) {
          850  +    zNewCmd = mprintf("\"%s\"", zOrigCmd);
          851  +  } else {
          852  +    zNewCmd = mprintf("%s", zOrigCmd);
          853  +  }
          854  +  zMbcs = fossil_utf8_to_mbcs(zNewCmd);
   841    855     if( g.fSystemTrace ) {
   842    856       char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
   843    857       fossil_puts(zOut, 1);
   844    858       fossil_free(zOut);
   845    859     }
   846         -  rc = _wsystem(zUnicode);
   847         -  fossil_mbcs_free(zUnicode);
   848         -  free(zNewCmd);
          860  +  rc = _tsystem(zMbcs);
          861  +  fossil_mbcs_free(zMbcs);
          862  +  fossil_free(zNewCmd);
   849    863   #else
   850    864     /* On unix, evaluate the command directly.
   851    865     */
   852    866     if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
   853    867     rc = system(zOrigCmd);
   854    868   #endif
   855    869     return rc;

Changes to src/makemake.tcl.

   475    475   TCC += -DFOSSIL_ENABLE_JSON=1
   476    476   RCC += -DFOSSIL_ENABLE_JSON=1
   477    477   endif
   478    478   
   479    479   #### We add the -static option here so that we can build a static
   480    480   #    executable that will run in a chroot jail.
   481    481   #
   482         -LIB = -static
          482  +LIB = -lunicows -static
   483    483   
   484    484   # OpenSSL: Add the necessary libraries required, if enabled.
   485    485   ifdef FOSSIL_ENABLE_SSL
   486    486   LIB += -lssl -lcrypto -lgdi32
   487    487   endif
   488    488   
   489    489   # Tcl: Add the necessary libraries required, if enabled.
................................................................................
   902    902   ZLIB    = zlib.lib
   903    903   
   904    904   INCL   = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
   905    905   
   906    906   CFLAGS = -nologo -MT -O2
   907    907   BCC    = $(CC) $(CFLAGS)
   908    908   TCC    = $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE $(MSCDEF) $(SSL) $(INCL)
   909         -LIBS   = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
          909  +LIBS   = unicows.lib $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
   910    910   LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
   911    911   }
   912    912   regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS
   913    913   writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n"
   914    914   writeln -nonewline "SRC   = "
   915    915   foreach s [lsort $src] {
   916    916     writeln -nonewline "${s}_.c "

Changes to src/popen.c.

    63     63   /*
    64     64   ** On windows, create a child process and specify the stdin, stdout,
    65     65   ** and stderr channels for that process to use.
    66     66   **
    67     67   ** Return the number of errors.
    68     68   */
    69     69   static int win32_create_child_process(
    70         -  wchar_t *zCmd,       /* The command that the child process will run */
           70  +  TCHAR *zCmd,         /* The command that the child process will run */
    71     71     HANDLE hIn,          /* Standard input */
    72     72     HANDLE hOut,         /* Standard output */
    73     73     HANDLE hErr,         /* Standard error */
    74     74     DWORD *pChildPid     /* OUT: Child process handle */
    75     75   ){
    76         -  STARTUPINFOW si;
           76  +  STARTUPINFO si;
    77     77     PROCESS_INFORMATION pi;
    78     78     BOOL rc;
    79     79   
    80     80     memset(&si, 0, sizeof(si));
    81     81     si.cb = sizeof(si);
    82     82     si.dwFlags = STARTF_USESTDHANDLES;
    83     83     SetHandleInformation(hIn, HANDLE_FLAG_INHERIT, TRUE);
    84     84     si.hStdInput  = hIn;
    85     85     SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, TRUE);
    86     86     si.hStdOutput = hOut;
    87     87     SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, TRUE);
    88     88     si.hStdError  = hErr;
    89         -  rc = CreateProcessW(
           89  +  rc = CreateProcess(
    90     90        NULL,  /* Application Name */
    91     91        zCmd,  /* Command-line */
    92     92        NULL,  /* Process attributes */
    93     93        NULL,  /* Thread attributes */
    94     94        TRUE,  /* Inherit Handles */
    95     95        0,     /* Create flags  */
    96     96        NULL,  /* Environment */
................................................................................
   137    137     SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE);
   138    138   
   139    139     if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
   140    140       win32_fatal_error("cannot create pipe for stdin");
   141    141     }
   142    142     SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
   143    143     
   144         -  win32_create_child_process(fossil_utf8_to_unicode(zCmd),
          144  +  win32_create_child_process(fossil_utf8_to_mbcs(zCmd),
   145    145                                hStdinRd, hStdoutWr, hStderr,&childPid);
   146    146     *pChildPid = childPid;
   147    147     *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0);
   148    148     fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0);
   149    149     *ppOut = _fdopen(fd, "w");
   150    150     CloseHandle(hStdinRd); 
   151    151     CloseHandle(hStdoutWr);

Changes to src/rebuild.c.

   606    606         fossil_print("done\n");
   607    607       }
   608    608       if( activateWal ){
   609    609         db_multi_exec("PRAGMA journal_mode=WAL;");
   610    610       }
   611    611     }
   612    612     if( showStats ){
   613         -    static struct { int idx; const char *zLabel; } aStat[] = {
          613  +    static const struct { int idx; const char *zLabel; } aStat[] = {
   614    614          { CFTYPE_ANY,       "Artifacts:" },
   615    615          { CFTYPE_MANIFEST,  "Manifests:" },
   616    616          { CFTYPE_CLUSTER,   "Clusters:" },
   617    617          { CFTYPE_CONTROL,   "Tags:" },
   618    618          { CFTYPE_WIKI,      "Wikis:" },
   619    619          { CFTYPE_TICKET,    "Tickets:" },
   620    620          { CFTYPE_ATTACHMENT,"Attachments:" },
................................................................................
   815    815   }
   816    816   
   817    817   /*
   818    818   ** Recursively read all files from the directory zPath and install
   819    819   ** every file read as a new artifact in the repository.
   820    820   */
   821    821   void recon_read_dir(char *zPath){
   822         -  FOSSIL_DIR *d;
   823         -  struct fossil_dirent *pEntry;
          822  +  DIR *d;
          823  +  struct dirent *pEntry;
   824    824     Blob aContent; /* content of the just read artifact */
   825    825     static int nFileRead = 0;
   826         -  void *zUnicodePath;
          826  +  void *zMbcsPath;
   827    827     char *zUtf8Name;
   828    828   
   829         -  zUnicodePath = fossil_utf8_to_unicode(zPath);
   830         -  d = fossil_opendir(zUnicodePath);
          829  +  zMbcsPath = fossil_utf8_to_mbcs(zPath);
          830  +  d = opendir(zMbcsPath);
   831    831     if( d ){
   832         -    while( (pEntry=fossil_readdir(d))!=0 ){
          832  +    while( (pEntry=readdir(d))!=0 ){
   833    833         Blob path;
   834    834         char *zSubpath;
   835    835   
   836    836         if( pEntry->d_name[0]=='.' ){
   837    837           continue;
   838    838         }
   839         -      zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
          839  +      zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
   840    840         zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
   841    841         fossil_mbcs_free(zUtf8Name);
   842    842         if( file_isdir(zSubpath)==1 ){
   843    843           recon_read_dir(zSubpath);
   844    844         }
   845    845         blob_init(&path, 0, 0);
   846    846         blob_appendf(&path, "%s", zSubpath);
................................................................................
   851    851         content_put(&aContent);
   852    852         blob_reset(&path);
   853    853         blob_reset(&aContent);
   854    854         free(zSubpath);
   855    855         fossil_print("\r%d", ++nFileRead);
   856    856         fflush(stdout);
   857    857       }
   858         -    fossil_closedir(d);
          858  +    closedir(d);
   859    859     }else {
   860    860       fossil_panic("encountered error %d while trying to open \"%s\".",
   861    861                     errno, g.argv[3]);
   862    862     }
   863         -  fossil_mbcs_free(zUnicodePath);
          863  +  fossil_mbcs_free(zMbcsPath);
   864    864   }
   865    865   
   866    866   /*
   867    867   ** COMMAND: reconstruct*
   868    868   **
   869    869   ** Usage: %fossil reconstruct FILENAME DIRECTORY
   870    870   **

Changes to src/sqlite3.c.

 30842  30842   ** Here is an interesting observation:  Win95, Win98, and WinME lack
 30843  30843   ** the LockFileEx() API.  But we can still statically link against that
 30844  30844   ** API as long as we don't call it when running Win95/98/ME.  A call to
 30845  30845   ** this routine is used to determine if the host is Win95/98/ME or
 30846  30846   ** WinNT/2K/XP so that we will know whether or not we can safely call
 30847  30847   ** the LockFileEx() API.
 30848  30848   */
 30849         -#if SQLITE_OS_WINCE || SQLITE_OS_WINRT
        30849  +#if !defined(SQLITE_WIN32_HAS_ANSI)
 30850  30850   # define isNT()  (1)
        30851  +#elif !defined(SQLITE_WIN32_HAS_WIDE)
        30852  +# define isNT()  (0)
 30851  30853   #else
 30852  30854     static int isNT(void){
 30853  30855       if( sqlite3_os_type==0 ){
 30854  30856         OSVERSIONINFOA sInfo;
 30855  30857         sInfo.dwOSVersionInfoSize = sizeof(sInfo);
 30856  30858         osGetVersionExA(&sInfo);
 30857  30859         sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;

Changes to src/vfile.c.

   374    374   ** Files whose names begin with "." are omitted unless allFlag is true.
   375    375   **
   376    376   ** Any files or directories that match the glob pattern pIgnore are 
   377    377   ** excluded from the scan.  Name matching occurs after the first
   378    378   ** nPrefix characters are elided from the filename.
   379    379   */
   380    380   void vfile_scan(Blob *pPath, int nPrefix, int allFlag, Glob *pIgnore){
   381         -  FOSSIL_DIR *d;
          381  +  DIR *d;
   382    382     int origSize;
   383    383     const char *zDir;
   384         -  struct fossil_dirent *pEntry;
          384  +  struct dirent *pEntry;
   385    385     int skipAll = 0;
   386    386     static Stmt ins;
   387    387     static int depth = 0;
   388    388     void *zMbcs;
   389    389   
   390    390     origSize = blob_size(pPath);
   391    391     if( pIgnore ){
................................................................................
   400    400          "INSERT OR IGNORE INTO sfile(x) SELECT :file"
   401    401          "  WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
   402    402       );
   403    403     }
   404    404     depth++;
   405    405   
   406    406     zDir = blob_str(pPath);
   407         -  zMbcs = fossil_utf8_to_unicode(zDir);
   408         -  d = fossil_opendir(zMbcs);
          407  +  zMbcs = fossil_utf8_to_mbcs(zDir);
          408  +  d = opendir(zMbcs);
   409    409     if( d ){
   410         -    while( (pEntry=fossil_readdir(d))!=0 ){
          410  +    while( (pEntry=readdir(d))!=0 ){
   411    411         char *zPath;
   412    412         char *zUtf8;
   413    413         if( pEntry->d_name[0]=='.' ){
   414    414           if( !allFlag ) continue;
   415    415           if( pEntry->d_name[1]==0 ) continue;
   416    416           if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
   417    417         }
   418         -      zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
          418  +      zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
   419    419         blob_appendf(pPath, "/%s", zUtf8);
   420    420         fossil_mbcs_free(zUtf8);
   421    421         zPath = blob_str(pPath);
   422    422         if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
   423    423           /* do nothing */
   424    424         }else if( file_wd_isdir(zPath)==1 ){
   425    425           if( !vfile_top_of_checkout(zPath) ){
................................................................................
   428    428         }else if( file_wd_isfile_or_link(zPath) ){
   429    429           db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
   430    430           db_step(&ins);
   431    431           db_reset(&ins);
   432    432         }
   433    433         blob_resize(pPath, origSize);
   434    434       }
   435         -    fossil_closedir(d);
          435  +    closedir(d);
   436    436     }
   437    437     fossil_mbcs_free(zMbcs);
   438    438   
   439    439     depth--;
   440    440     if( depth==0 ){
   441    441       db_finalize(&ins);
   442    442     }

Changes to src/winhttp.c.

    17     17   **
    18     18   ** This file implements a very simple (and low-performance) HTTP server
    19     19   ** for windows. It also implements a Windows Service which allows the HTTP
    20     20   ** server to be run without any user logged on.
    21     21   */
    22     22   #include "config.h"
    23     23   #ifdef _WIN32
    24         -/* This code is for win32 only */
           24  +/* This code is for win32/unicode only */
    25     25   #include <windows.h>
    26     26   #include "winhttp.h"
    27     27   
    28     28   /*
    29     29   ** The HttpRequest structure holds information about each incoming
    30     30   ** HTTP request.
    31     31   */
................................................................................
   127    127     if( in ) fclose(in);
   128    128     closesocket(p->s);
   129    129     file_delete(zRequestFName);
   130    130     file_delete(zReplyFName);
   131    131     free(p);
   132    132   }
   133    133   
   134         -#if !defined(UNICODE)
   135         -#  define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
   136         -#  define fossil_utf8_to_unicode fossil_utf8_to_mbcs
   137         -#endif
   138         -
   139    134   /*
   140    135   ** Start a listening socket and process incoming HTTP requests on
   141    136   ** that socket.
   142    137   */
   143    138   void win32_http_server(
   144    139     int mnPort, int mxPort,   /* Range of allowed TCP port numbers */
   145    140     const char *zBrowser,     /* Command to launch browser.  (Or NULL) */
................................................................................
   197    192         fossil_fatal("unable to open listening socket on any"
   198    193                      " port in the range %d..%d", mnPort, mxPort);
   199    194       }
   200    195     }
   201    196     if( !GetTempPath(MAX_PATH, zTmpPath) ){
   202    197       fossil_fatal("unable to get path to the temporary directory.");
   203    198     }
   204         -  zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_unicode_to_utf8(zTmpPath), iPort);
          199  +  zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort);
   205    200     fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
   206    201     if( zBrowser ){
   207    202       zBrowser = mprintf(zBrowser, iPort);
   208    203       fossil_print("Launch webbrowser: %s\n", zBrowser);
   209    204       fossil_system(zBrowser);
   210    205     }
   211    206     fossil_print("Type Ctrl-C to stop the HTTP server\n");
................................................................................
   301    296                0,
   302    297                (LPTSTR) &tmp,
   303    298                0,
   304    299                NULL
   305    300              );
   306    301     }
   307    302     if( nMsg ){
   308         -    zMsg = fossil_unicode_to_utf8(tmp);
          303  +    zMsg = fossil_mbcs_to_utf8(tmp);
   309    304     }else{
   310    305       fossil_fatal("unable to get system error message.");
   311    306     }
   312    307     if( tmp ){
   313    308       LocalFree((HLOCAL) tmp);
   314    309     }
   315    310     return zMsg;
................................................................................
   559    554   **
   560    555   */
   561    556   void cmd_win32_service(void){
   562    557     int n;
   563    558     const char *zMethod;
   564    559     const char *zSvcName = "Fossil-DSCM";    /* Default service name */
   565    560   
          561  +#ifdef _WIN32
          562  +  if( !g.isNT ) {
          563  +    fossil_fatal("%s command not support on Windows 9x", g.argv[1]);
          564  +  }
          565  +#endif
   566    566     if( g.argc<3 ){
   567    567       usage("create|delete|show|start|stop ...");
   568    568     }
   569    569     zMethod = g.argv[2];
   570    570     n = strlen(zMethod);
   571    571   
   572    572     if( strncmp(zMethod, "create", n)==0 ){
................................................................................
   628    628       if( zLocalAuth ) blob_append(&binPath, " --localauth", -1);
   629    629       blob_appendf(&binPath, " \"%s\"", g.zRepositoryName);
   630    630       /* Create the service. */
   631    631       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   632    632       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   633    633       hSvc = CreateService(
   634    634                hScm,                                    /* Handle to the SCM */
   635         -             fossil_utf8_to_unicode(zSvcName),           /* Name of the service */
   636         -             fossil_utf8_to_unicode(zDisplay),           /* Display name */
          635  +             fossil_utf8_to_mbcs(zSvcName),           /* Name of the service */
          636  +             fossil_utf8_to_mbcs(zDisplay),           /* Display name */
   637    637                SERVICE_ALL_ACCESS,                      /* Desired access */
   638    638                SERVICE_WIN32_OWN_PROCESS,               /* Service type */
   639    639                dwStartType,                             /* Start type */
   640    640                SERVICE_ERROR_NORMAL,                    /* Error control */
   641         -             fossil_utf8_to_unicode(blob_str(&binPath)), /* Binary path */
          641  +             fossil_utf8_to_mbcs(blob_str(&binPath)), /* Binary path */
   642    642                NULL,                                    /* Load ordering group */
   643    643                NULL,                                    /* Tag value */
   644    644                NULL,                                    /* Service dependencies */
   645         -             fossil_utf8_to_unicode(zUsername),          /* Service account */
   646         -             fossil_utf8_to_unicode(zPassword)           /* Account password */
          645  +             fossil_utf8_to_mbcs(zUsername),          /* Service account */
          646  +             fossil_utf8_to_mbcs(zPassword)           /* Account password */
   647    647              );
   648    648       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   649    649       /* Set the service description. */
   650    650       ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
   651    651       fossil_print("Service '%s' successfully created.\n", zSvcName);
   652    652       CloseServiceHandle(hSvc);
   653    653       CloseServiceHandle(hScm);
................................................................................
   662    662       if( g.argc==4 ){
   663    663         zSvcName = g.argv[3];
   664    664       }else if( g.argc>4 ){
   665    665         fossil_fatal("to much arguments for delete method.");
   666    666       }
   667    667       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   668    668       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   669         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          669  +    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
   670    670       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   671    671       QueryServiceStatus(hSvc, &sstat);
   672    672       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   673    673         fossil_print("Stopping service '%s'", zSvcName);
   674    674         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   675    675           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   676    676             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   730    730       if( g.argc==4 ){
   731    731         zSvcName = g.argv[3];
   732    732       }else if( g.argc>4 ){
   733    733         fossil_fatal("to much arguments for show method.");
   734    734       }
   735    735       hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
   736    736       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   737         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
          737  +    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), GENERIC_READ);
   738    738       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   739    739       /* Get the service configuration */
   740    740       bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
   741    741       if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
   742    742         fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   743    743       }
   744    744       pSvcConfig = fossil_malloc(nRequired);
................................................................................
   782    782         case SERVICE_CONTINUE_PENDING: zSvcState = zSvcStates[4]; break;
   783    783         case SERVICE_PAUSE_PENDING:    zSvcState = zSvcStates[5]; break;
   784    784         case SERVICE_PAUSED:           zSvcState = zSvcStates[6]; break;
   785    785       }
   786    786       /* Print service information to terminal */
   787    787       fossil_print("Service name .......: %s\n", zSvcName);
   788    788       fossil_print("Display name .......: %s\n",
   789         -                 fossil_unicode_to_utf8(pSvcConfig->lpDisplayName));
          789  +                 fossil_mbcs_to_utf8(pSvcConfig->lpDisplayName));
   790    790       fossil_print("Service description : %s\n",
   791         -                 fossil_unicode_to_utf8(pSvcDescr->lpDescription));
          791  +                 fossil_mbcs_to_utf8(pSvcDescr->lpDescription));
   792    792       fossil_print("Service type .......: %s.\n", zSvcType);
   793    793       fossil_print("Service start type .: %s.\n", zSvcStartType);
   794    794       fossil_print("Binary path name ...: %s\n",
   795         -                 fossil_unicode_to_utf8(pSvcConfig->lpBinaryPathName));
          795  +                 fossil_mbcs_to_utf8(pSvcConfig->lpBinaryPathName));
   796    796       fossil_print("Service username ...: %s\n",
   797         -                 fossil_unicode_to_utf8(pSvcConfig->lpServiceStartName));
          797  +                 fossil_mbcs_to_utf8(pSvcConfig->lpServiceStartName));
   798    798       fossil_print("Current state ......: %s.\n", zSvcState);
   799    799       /* Cleanup */
   800    800       fossil_free(pSvcConfig);
   801    801       fossil_free(pSvcDescr);
   802    802       CloseServiceHandle(hSvc);
   803    803       CloseServiceHandle(hScm);
   804    804     }else
................................................................................
   812    812       if( g.argc==4 ){
   813    813         zSvcName = g.argv[3];
   814    814       }else if( g.argc>4 ){
   815    815         fossil_fatal("to much arguments for start method.");
   816    816       }
   817    817       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   818    818       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   819         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          819  +    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
   820    820       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   821    821       QueryServiceStatus(hSvc, &sstat);
   822    822       if( sstat.dwCurrentState!=SERVICE_RUNNING ){
   823    823         fossil_print("Starting service '%s'", zSvcName);
   824    824         if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
   825    825           if( !StartService(hSvc, 0, NULL) ){
   826    826             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   848    848       if( g.argc==4 ){
   849    849         zSvcName = g.argv[3];
   850    850       }else if( g.argc>4 ){
   851    851         fossil_fatal("to much arguments for stop method.");
   852    852       }
   853    853       hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   854    854       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   855         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          855  +    hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
   856    856       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   857    857       QueryServiceStatus(hSvc, &sstat);
   858    858       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   859    859         fossil_print("Stopping service '%s'", zSvcName);
   860    860         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   861    861           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   862    862             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());

Changes to win/Makefile.mingw.

   147    147   TCC += -DFOSSIL_ENABLE_JSON=1
   148    148   RCC += -DFOSSIL_ENABLE_JSON=1
   149    149   endif
   150    150   
   151    151   #### We add the -static option here so that we can build a static
   152    152   #    executable that will run in a chroot jail.
   153    153   #
   154         -LIB = -static
          154  +LIB = -lunicows -static
   155    155   
   156    156   # OpenSSL: Add the necessary libraries required, if enabled.
   157    157   ifdef FOSSIL_ENABLE_SSL
   158    158   LIB += -lssl -lcrypto -lgdi32
   159    159   endif
   160    160   
   161    161   # Tcl: Add the necessary libraries required, if enabled.

Changes to win/Makefile.msc.

    33     33   ZLIB    = zlib.lib
    34     34   
    35     35   INCL   = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
    36     36   
    37     37   CFLAGS = -nologo -MT -O2
    38     38   BCC    = $(CC) $(CFLAGS)
    39     39   TCC    = $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE $(MSCDEF) $(SSL) $(INCL)
    40         -LIBS   = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
           40  +LIBS   = unicows.lib $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
    41     41   LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
    42     42   
    43     43   SQLITE_OPTIONS = /DSQLITE_OMIT_LOAD_EXTENSION=1 /DSQLITE_THREADSAFE=0 /DSQLITE_DEFAULT_FILE_FORMAT=4 /DSQLITE_ENABLE_STAT3 /Dlocaltime=fossil_localtime /DSQLITE_ENABLE_LOCKING_STYLE=0
    44     44   
    45     45   SRC   = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c login_.c main_.c manifest_.c md5_.c merge_.c merge3_.c name_.c path_.c pivot_.c popen_.c pqueue_.c printf_.c rebuild_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c sqlcmd_.c stash_.c stat_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c update_.c url_.c user_.c verify_.c vfile_.c wiki_.c wikiformat_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c 
    46     46   
    47     47   OBJ   = $(OX)\add$O $(OX)\allrepo$O $(OX)\attach$O $(OX)\bag$O $(OX)\bisect$O $(OX)\blob$O $(OX)\branch$O $(OX)\browse$O $(OX)\captcha$O $(OX)\cgi$O $(OX)\checkin$O $(OX)\checkout$O $(OX)\clearsign$O $(OX)\clone$O $(OX)\comformat$O $(OX)\configure$O $(OX)\content$O $(OX)\db$O $(OX)\delta$O $(OX)\deltacmd$O $(OX)\descendants$O $(OX)\diff$O $(OX)\diffcmd$O $(OX)\doc$O $(OX)\encode$O $(OX)\event$O $(OX)\export$O $(OX)\file$O $(OX)\finfo$O $(OX)\glob$O $(OX)\graph$O $(OX)\gzip$O $(OX)\http$O $(OX)\http_socket$O $(OX)\http_ssl$O $(OX)\http_transport$O $(OX)\import$O $(OX)\info$O $(OX)\json$O $(OX)\json_artifact$O $(OX)\json_branch$O $(OX)\json_config$O $(OX)\json_diff$O $(OX)\json_dir$O $(OX)\json_finfo$O $(OX)\json_login$O $(OX)\json_query$O $(OX)\json_report$O $(OX)\json_tag$O $(OX)\json_timeline$O $(OX)\json_user$O $(OX)\json_wiki$O $(OX)\leaf$O $(OX)\login$O $(OX)\main$O $(OX)\manifest$O $(OX)\md5$O $(OX)\merge$O $(OX)\merge3$O $(OX)\name$O $(OX)\path$O $(OX)\pivot$O $(OX)\popen$O $(OX)\pqueue$O $(OX)\printf$O $(OX)\rebuild$O $(OX)\report$O $(OX)\rss$O $(OX)\schema$O $(OX)\search$O $(OX)\setup$O $(OX)\sha1$O $(OX)\shun$O $(OX)\skins$O $(OX)\sqlcmd$O $(OX)\stash$O $(OX)\stat$O $(OX)\style$O $(OX)\sync$O $(OX)\tag$O $(OX)\tar$O $(OX)\th_main$O $(OX)\timeline$O $(OX)\tkt$O $(OX)\tktsetup$O $(OX)\undo$O $(OX)\update$O $(OX)\url$O $(OX)\user$O $(OX)\verify$O $(OX)\vfile$O $(OX)\wiki$O $(OX)\wikiformat$O $(OX)\winhttp$O $(OX)\wysiwyg$O $(OX)\xfer$O $(OX)\xfersetup$O $(OX)\zip$O $(OX)\shell$O $(OX)\sqlite3$O $(OX)\th$O $(OX)\th_lang$O 

Changes to win/include/dirent.h.

   377    377   }
   378    378   
   379    379   #ifdef UNICODE
   380    380   #  undef dirent
   381    381   #  undef opendir
   382    382   #  undef readdir
   383    383   #  undef closedir
          384  +#  undef rewinddir
   384    385   #  undef DIR
   385    386   #endif
   386    387   
   387    388   #ifdef __cplusplus
   388    389   }
   389    390   #endif
   390    391   #endif /*DIRENT_H*/