Changes On Branch noTCHAR
Not logged in

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

Changes In Branch noTCHAR Excluding Merge-Ins

This is equivalent to a diff from ad91647ea7 to 4abd4c5d38

2012-09-23
04:41
Merge the remaining Win32 TCHAR cleanup to trunk. check-in: 33fb889137 user: mistachkin tags: trunk
2012-09-21
11:24
eliminate the need for <tchar.h> check-in: 1bfa3a0bbf user: jan.nijtmans tags: trunk
09:27
Eliminate usage of TCHAR and the associated Win32 API macros. Closed-Leaf check-in: 4abd4c5d38 user: mistachkin tags: noTCHAR
2012-09-20
20:33
eliminate all #ifdef UNICODE, assuming everthing is compiled with -DUNICODE -D_UNICODE check-in: ad91647ea7 user: jan.nijtmans tags: trunk
2012-09-19
14:48
Updates to the script that generates the "download.html" page. check-in: 9d2216a1f8 user: drh tags: trunk

Changes to src/cgi.c.

    22     22   ** decode strings in HTML or HTTP.
    23     23   */
    24     24   #include "config.h"
    25     25   #ifdef _WIN32
    26     26   #  if defined(__MINGW32__)
    27     27   #    include <ws2tcpip.h>
    28     28   #  endif
    29         -#  include <windows.h>           /* for Sleep once server works again */
    30         -#  define sleep Sleep            /* windows does not have sleep, but Sleep */
    31     29   #else
    32     30   # include <sys/socket.h>
    33     31   # include <netinet/in.h>
    34     32   # include <arpa/inet.h>
    35     33   # include <sys/times.h>
    36     34   # include <sys/time.h>
    37     35   # include <sys/wait.h>

Changes to src/file.c.

  1145   1145     }
  1146   1146     nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, nByte, zUnicode, nChar);
  1147   1147     if( nChar==0 ){
  1148   1148       free(zUnicode);
  1149   1149       return 0;
  1150   1150     }
  1151   1151     zUnicode[nChar] = '\0';
  1152         -  WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
         1152  +  WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE - toStdErr), zUnicode, nChar, &dummy, 0);
  1153   1153     return nChar;
  1154   1154   #else
  1155   1155     return -1;  /* No-op on unix */
  1156   1156   #endif
  1157   1157   }
  1158   1158   
  1159   1159   /*

Changes to src/http_socket.c.

    28     28   
    29     29   #include "config.h"
    30     30   #include "http_socket.h"
    31     31   #if defined(_WIN32)
    32     32   #  if defined(__MINGW32__)
    33     33   #    include <ws2tcpip.h>          
    34     34   #  endif
    35         -#  include <windows.h>           /* for Sleep once server works again */
    36         -#  define sleep Sleep            /* windows does not have sleep, but Sleep */
           35  +#  include <windows.h>
    37     36   #else
    38     37   #  include <netinet/in.h>
    39     38   #  include <arpa/inet.h>
    40     39   #  include <sys/socket.h>
    41     40   #  include <netdb.h>
    42     41   #endif
    43     42   #include <assert.h>

Changes to src/main.c.

   357    357   ** quote + quote not in quoted string -> empty string
   358    358   ** quote -> begin quoted string
   359    359   **
   360    360   ** Results:
   361    361   ** Fills argcPtr with the number of arguments and argvPtr with the array
   362    362   ** of arguments.
   363    363   */
   364         -#include <tchar.h>
   365         -#define tchar_isspace(X)  ((X)==TEXT(' ') || (X)==TEXT('\t'))
          364  +#define wchar_isspace(X)  ((X)==L' ' || (X)==L'\t')
   366    365   static void parse_windows_command_line(
   367    366     int *argcPtr,   /* Filled with number of argument strings. */
   368    367     void *argvPtr   /* Filled with argument strings (malloc'd). */
   369    368   ){
   370         -  TCHAR *cmdLine, *p, *arg, *argSpace;
   371         -  TCHAR **argv;
          369  +  WCHAR *cmdLine, *p, *arg, *argSpace;
          370  +  WCHAR **argv;
   372    371     int argc, size, inquote, copy, slashes;
   373    372   
   374         -  cmdLine = GetCommandLine();
          373  +  cmdLine = GetCommandLineW();
   375    374   
   376    375     /*
   377    376     ** Precompute an overly pessimistic guess at the number of arguments in
   378    377     ** the command line by counting non-space spans.
   379    378     */
   380    379     size = 2;
   381         -  for(p=cmdLine; *p!=TEXT('\0'); p++){
   382         -    if( tchar_isspace(*p) ){
          380  +  for(p=cmdLine; *p!=L'\0'; p++){
          381  +    if( wchar_isspace(*p) ){
   383    382         size++;
   384         -      while( tchar_isspace(*p) ){
          383  +      while( wchar_isspace(*p) ){
   385    384           p++;
   386    385         }
   387         -      if( *p==TEXT('\0') ){
          386  +      if( *p==L'\0' ){
   388    387           break;
   389    388         }
   390    389       }
   391    390     }
   392    391   
   393    392     argSpace = fossil_malloc(size * sizeof(char*)
   394         -    + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR));
   395         -  argv = (TCHAR**)argSpace;
   396         -  argSpace += size*(sizeof(char*)/sizeof(TCHAR));
          393  +    + (wcslen(cmdLine) * sizeof(WCHAR)) + sizeof(WCHAR));
          394  +  argv = (WCHAR**)argSpace;
          395  +  argSpace += size*(sizeof(char*)/sizeof(WCHAR));
   397    396     size--;
   398    397   
   399    398     p = cmdLine;
   400    399     for(argc=0; argc<size; argc++){
   401    400       argv[argc] = arg = argSpace;
   402         -    while( tchar_isspace(*p) ){
          401  +    while( wchar_isspace(*p) ){
   403    402         p++;
   404    403       }
   405         -    if (*p == TEXT('\0')) {
          404  +    if (*p == L'\0') {
   406    405         break;
   407    406       }
   408    407       inquote = 0;
   409    408       slashes = 0;
   410    409       while(1){
   411    410         copy = 1;
   412         -      while( *p==TEXT('\\') ){
          411  +      while( *p==L'\\' ){
   413    412           slashes++;
   414    413           p++;
   415    414         }
   416         -      if( *p==TEXT('"') ){
          415  +      if( *p==L'"' ){
   417    416           if( (slashes&1)==0 ){
   418    417             copy = 0;
   419         -          if( inquote && p[1]==TEXT('"') ){
          418  +          if( inquote && p[1]==L'"' ){
   420    419               p++;
   421    420               copy = 1;
   422    421             }else{
   423    422               inquote = !inquote;
   424    423             }
   425    424           }
   426    425           slashes >>= 1;
   427    426         }
   428    427         while( slashes ){
   429         -        *arg = TEXT('\\');
          428  +        *arg = L'\\';
   430    429           arg++;
   431    430           slashes--;
   432    431         }
   433         -      if( *p==TEXT('\0') || (!inquote && tchar_isspace(*p)) ){
          432  +      if( *p==L'\0' || (!inquote && wchar_isspace(*p)) ){
   434    433           break;
   435    434         }
   436    435         if( copy!=0 ){
   437    436           *arg = *p;
   438    437           arg++;
   439    438         }
   440    439         p++;
   441    440       }
   442    441       *arg = '\0';
   443    442       argSpace = arg + 1;
   444    443     }
   445    444     argv[argc] = NULL;
   446    445     *argcPtr = argc;
   447         -  *((TCHAR ***)argvPtr) = argv;
          446  +  *((WCHAR ***)argvPtr) = argv;
   448    447   }
   449    448   #endif /* defined(_WIN32) */
   450    449   
   451    450   
   452    451   /*
   453    452   ** Convert all arguments from mbcs (or unicode) to UTF-8. Then
   454    453   ** search g.argv for arguments "--args FILENAME". If found, then

Changes to src/makemake.tcl.

   430    430   
   431    431   #### C Compile and options for use in building executables that
   432    432   #    will run on the target platform.  This is usually the same
   433    433   #    as BCC, unless you are cross-compiling.  This C compiler builds
   434    434   #    the finished binary for fossil.  The BCC compiler above is used
   435    435   #    for building intermediate code-generator tools.
   436    436   #
   437         -TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
          437  +TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
   438    438   
   439    439   #### Compile resources for use in building executables that will run
   440    440   #    on the target platform.
   441    441   #
   442    442   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   443    443   
   444    444   # With HTTPS support
................................................................................
   901    901   ZLIBDIR = $(MSCDIR)\extra\lib
   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         -TCC    = $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE $(MSCDEF) $(SSL) $(INCL)
          908  +TCC    = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
   909    909   LIBS   = $(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] {

Changes to src/winhttp.c.

   144    144   ){
   145    145     WSADATA wd;
   146    146     SOCKET s = INVALID_SOCKET;
   147    147     SOCKADDR_IN addr;
   148    148     int idCnt = 0;
   149    149     int iPort = mnPort;
   150    150     Blob options;
   151         -  TCHAR zTmpPath[MAX_PATH];
          151  +  WCHAR zTmpPath[MAX_PATH];
   152    152   
   153    153     if( zStopper ) file_delete(zStopper);
   154    154     blob_zero(&options);
   155    155     if( zNotFound ){
   156    156       blob_appendf(&options, " --notfound %s", zNotFound);
   157    157     }
   158    158     if( g.useLocalauth ){
................................................................................
   189    189       if( mnPort==mxPort ){
   190    190         fossil_fatal("unable to open listening socket on ports %d", mnPort);
   191    191       }else{
   192    192         fossil_fatal("unable to open listening socket on any"
   193    193                      " port in the range %d..%d", mnPort, mxPort);
   194    194       }
   195    195     }
   196         -  if( !GetTempPath(MAX_PATH, zTmpPath) ){
          196  +  if( !GetTempPathW(MAX_PATH, zTmpPath) ){
   197    197       fossil_fatal("unable to get path to the temporary directory.");
   198    198     }
   199    199     zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_unicode_to_utf8(zTmpPath), iPort);
   200    200     fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
   201    201     if( zBrowser ){
   202    202       zBrowser = mprintf(zBrowser, iPort);
   203    203       fossil_print("Launch webbrowser: %s\n", zBrowser);
................................................................................
   247    247   */
   248    248   typedef struct HttpService HttpService;
   249    249   struct HttpService {
   250    250     int port;                 /* Port on which the http server should run */
   251    251     const char *zNotFound;    /* The --notfound option, or NULL */
   252    252     int flags;                /* One or more HTTP_SERVER_ flags */
   253    253     int isRunningAsService;   /* Are we running as a service ? */
   254         -  const TCHAR *zServiceName;/* Name of the service */
          254  +  const WCHAR *zServiceName;/* Name of the service */
   255    255     SOCKET s;                 /* Socket on which the http server listens */
   256    256   };
   257    257   
   258    258   /*
   259    259   ** Variables used for running as windows service.
   260    260   */
   261    261   static HttpService hsData = {8080, NULL, 0, 0, NULL, INVALID_SOCKET};
................................................................................
   266    266   ** Get message string of the last system error. Return a pointer to the
   267    267   ** message string. Call fossil_mbcs_free() to deallocate any memory used
   268    268   ** to store the message string when done.
   269    269   */
   270    270   static char *win32_get_last_errmsg(void){
   271    271     DWORD nMsg;
   272    272     DWORD nErr = GetLastError();
   273         -  LPTSTR tmp = NULL;
          273  +  LPWSTR tmp = NULL;
   274    274     char *zMsg = NULL;
   275    275   
   276    276     /* Try first to get the error text in english. */
   277         -  nMsg = FormatMessage(
          277  +  nMsg = FormatMessageW(
   278    278              FORMAT_MESSAGE_ALLOCATE_BUFFER |
   279    279              FORMAT_MESSAGE_FROM_SYSTEM     |
   280    280              FORMAT_MESSAGE_IGNORE_INSERTS,
   281    281              NULL,
   282    282              nErr,
   283    283              MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   284         -           (LPTSTR) &tmp,
          284  +           (LPWSTR) &tmp,
   285    285              0,
   286    286              NULL
   287    287            );
   288    288     if( !nMsg ){
   289    289       /* No english, get what the system has available. */
   290         -    nMsg = FormatMessage(
          290  +    nMsg = FormatMessageW(
   291    291                FORMAT_MESSAGE_ALLOCATE_BUFFER |
   292    292                FORMAT_MESSAGE_FROM_SYSTEM     |
   293    293                FORMAT_MESSAGE_IGNORE_INSERTS,
   294    294                NULL,
   295    295                nErr,
   296    296                0,
   297         -             (LPTSTR) &tmp,
          297  +             (LPWSTR) &tmp,
   298    298                0,
   299    299                NULL
   300    300              );
   301    301     }
   302    302     if( nMsg ){
   303    303       zMsg = fossil_unicode_to_utf8(tmp);
   304    304     }else{
................................................................................
   372    372   ** Then the service control manager sends a start request to the service
   373    373   ** control dispatcher for this service process. The service control dispatcher
   374    374   ** creates a new thread to execute the ServiceMain function (this function)
   375    375   ** of the service being started.
   376    376   */
   377    377   static void WINAPI win32_http_service_main(
   378    378     DWORD argc,              /* Number of arguments in argv */
   379         -  LPTSTR *argv             /* Arguments passed */
          379  +  LPWSTR *argv             /* Arguments passed */
   380    380   ){
   381    381   
   382    382     /* Update the service information. */
   383    383     hsData.isRunningAsService = 1;
   384    384     if( argc>0 ){
   385    385       hsData.zServiceName = argv[0];
   386    386     }
   387    387   
   388    388     /* Register the service control handler function */
   389         -  sshStatusHandle = RegisterServiceCtrlHandler(TEXT(""), win32_http_service_ctrl);
          389  +  sshStatusHandle = RegisterServiceCtrlHandlerW(L"", win32_http_service_ctrl);
   390    390     if( !sshStatusHandle ){
   391    391       win32_report_service_status(SERVICE_STOPPED, NO_ERROR, 0);
   392    392       return;
   393    393     }
   394    394   
   395    395     /* Set service specific data and report that the service is starting. */
   396    396     ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
................................................................................
   426    426   */
   427    427   int win32_http_service(
   428    428     int nPort,                /* TCP port number */
   429    429     const char *zNotFound,    /* The --notfound option, or NULL */
   430    430     int flags                 /* One or more HTTP_SERVER_ flags */
   431    431   ){
   432    432     /* Define the service table. */
   433         -  SERVICE_TABLE_ENTRY ServiceTable[] =
   434         -    {{TEXT(""), (LPSERVICE_MAIN_FUNCTION)win32_http_service_main}, {NULL, NULL}};
          433  +  SERVICE_TABLE_ENTRYW ServiceTable[] =
          434  +    {{L"", (LPSERVICE_MAIN_FUNCTIONW)win32_http_service_main}, {NULL, NULL}};
   435    435   
   436    436     /* Initialize the HttpService structure. */
   437    437     hsData.port = nPort;
   438    438     hsData.zNotFound = zNotFound;
   439    439     hsData.flags = flags;
   440    440   
   441    441     /* Try to start the control dispatcher thread for the service. */
   442         -  if( !StartServiceCtrlDispatcher(ServiceTable) ){
          442  +  if( !StartServiceCtrlDispatcherW(ServiceTable) ){
   443    443       if( GetLastError()==ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ){
   444    444         return 1;
   445    445       }else{
   446    446         fossil_fatal("error from StartServiceCtrlDispatcher()");
   447    447       }
   448    448     }
   449    449     return 0;
   450    450   }
   451    451   
   452         -#ifdef _WIN32
   453    452   /* dupe ifdef needed for mkindex
   454    453   ** COMMAND: winsrv*
   455    454   ** Usage: fossil winsrv METHOD ?SERVICE-NAME? ?OPTIONS?
   456    455   **
   457    456   ** Where METHOD is one of: create delete show start stop.
   458    457   **
   459    458   ** The winsrv command manages Fossil as a Windows service.  This allows
................................................................................
   563    562     }
   564    563     zMethod = g.argv[2];
   565    564     n = strlen(zMethod);
   566    565   
   567    566     if( strncmp(zMethod, "create", n)==0 ){
   568    567       SC_HANDLE hScm;
   569    568       SC_HANDLE hSvc;
   570         -    SERVICE_DESCRIPTION
   571         -      svcDescr = {TEXT("Fossil - Distributed Software Configuration Management")};
          569  +    SERVICE_DESCRIPTIONW
          570  +      svcDescr = {L"Fossil - Distributed Software Configuration Management"};
   572    571       char *zErrFmt = "unable to create service '%s': %s";
   573    572       DWORD dwStartType = SERVICE_DEMAND_START;
   574    573       const char *zDisplay    = find_option("display", "D", 1);
   575    574       const char *zStart      = find_option("start", "S", 1);
   576    575       const char *zUsername   = find_option("username", "U", 1);
   577    576       const char *zPassword   = find_option("password", "W", 1);
   578    577       const char *zPort       = find_option("port", "P", 1);
................................................................................
   619    618       blob_zero(&binPath);
   620    619       blob_appendf(&binPath, "\"%s\" server", fossil_nameofexe());
   621    620       if( zPort ) blob_appendf(&binPath, " --port %s", zPort);
   622    621       if( zNotFound ) blob_appendf(&binPath, " --notfound \"%s\"", zNotFound);
   623    622       if( zLocalAuth ) blob_append(&binPath, " --localauth", -1);
   624    623       blob_appendf(&binPath, " \"%s\"", g.zRepositoryName);
   625    624       /* Create the service. */
   626         -    hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
          625  +    hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   627    626       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   628         -    hSvc = CreateService(
          627  +    hSvc = CreateServiceW(
   629    628                hScm,                                    /* Handle to the SCM */
   630    629                fossil_utf8_to_unicode(zSvcName),           /* Name of the service */
   631    630                fossil_utf8_to_unicode(zDisplay),           /* Display name */
   632    631                SERVICE_ALL_ACCESS,                      /* Desired access */
   633    632                SERVICE_WIN32_OWN_PROCESS,               /* Service type */
   634    633                dwStartType,                             /* Start type */
   635    634                SERVICE_ERROR_NORMAL,                    /* Error control */
................................................................................
   638    637                NULL,                                    /* Tag value */
   639    638                NULL,                                    /* Service dependencies */
   640    639                fossil_utf8_to_unicode(zUsername),          /* Service account */
   641    640                fossil_utf8_to_unicode(zPassword)           /* Account password */
   642    641              );
   643    642       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   644    643       /* Set the service description. */
   645         -    ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
          644  +    ChangeServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
   646    645       fossil_print("Service '%s' successfully created.\n", zSvcName);
   647    646       CloseServiceHandle(hSvc);
   648    647       CloseServiceHandle(hScm);
   649    648     }else
   650    649     if( strncmp(zMethod, "delete", n)==0 ){
   651    650       SC_HANDLE hScm;
   652    651       SC_HANDLE hSvc;
................................................................................
   655    654   
   656    655       verify_all_options();
   657    656       if( g.argc==4 ){
   658    657         zSvcName = g.argv[3];
   659    658       }else if( g.argc>4 ){
   660    659         fossil_fatal("to much arguments for delete method.");
   661    660       }
   662         -    hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
          661  +    hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   663    662       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   664         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          663  +    hSvc = OpenServiceW(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   665    664       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   666    665       QueryServiceStatus(hSvc, &sstat);
   667    666       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   668    667         fossil_print("Stopping service '%s'", zSvcName);
   669    668         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   670    669           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   671    670             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   690    689       CloseServiceHandle(hSvc);
   691    690       CloseServiceHandle(hScm);
   692    691     }else
   693    692     if( strncmp(zMethod, "show", n)==0 ){
   694    693       SC_HANDLE hScm;
   695    694       SC_HANDLE hSvc;
   696    695       SERVICE_STATUS sstat;
   697         -    LPQUERY_SERVICE_CONFIG pSvcConfig;
   698         -    LPSERVICE_DESCRIPTION pSvcDescr;
          696  +    LPQUERY_SERVICE_CONFIGW pSvcConfig;
          697  +    LPSERVICE_DESCRIPTIONW pSvcDescr;
   699    698       BOOL bStatus;
   700    699       DWORD nRequired;
   701    700       const char *zErrFmt = "unable to show service '%s': %s";
   702    701       static const char *const zSvcTypes[] = {
   703    702         "Driver service",
   704    703         "File system driver service",
   705    704         "Service runs in its own process",
................................................................................
   723    722   
   724    723       verify_all_options();
   725    724       if( g.argc==4 ){
   726    725         zSvcName = g.argv[3];
   727    726       }else if( g.argc>4 ){
   728    727         fossil_fatal("to much arguments for show method.");
   729    728       }
   730         -    hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
          729  +    hScm = OpenSCManagerW(NULL, NULL, GENERIC_READ);
   731    730       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   732         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
          731  +    hSvc = OpenServiceW(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
   733    732       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   734    733       /* Get the service configuration */
   735         -    bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
          734  +    bStatus = QueryServiceConfigW(hSvc, NULL, 0, &nRequired);
   736    735       if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
   737    736         fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   738    737       }
   739    738       pSvcConfig = fossil_malloc(nRequired);
   740         -    bStatus = QueryServiceConfig(hSvc, pSvcConfig, nRequired, &nRequired);
          739  +    bStatus = QueryServiceConfigW(hSvc, pSvcConfig, nRequired, &nRequired);
   741    740       if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   742    741       /* Translate the service type */
   743    742       switch( pSvcConfig->dwServiceType ){
   744    743         case SERVICE_KERNEL_DRIVER:       zSvcType = zSvcTypes[0]; break;
   745    744         case SERVICE_FILE_SYSTEM_DRIVER:  zSvcType = zSvcTypes[1]; break;
   746    745         case SERVICE_WIN32_OWN_PROCESS:   zSvcType = zSvcTypes[2]; break;
   747    746         case SERVICE_WIN32_SHARE_PROCESS: zSvcType = zSvcTypes[3]; break;
................................................................................
   752    751         case SERVICE_BOOT_START:    zSvcStartType = zSvcStartTypes[0]; break;
   753    752         case SERVICE_SYSTEM_START:  zSvcStartType = zSvcStartTypes[1]; break;
   754    753         case SERVICE_AUTO_START:    zSvcStartType = zSvcStartTypes[2]; break;
   755    754         case SERVICE_DEMAND_START:  zSvcStartType = zSvcStartTypes[3]; break;
   756    755         case SERVICE_DISABLED:      zSvcStartType = zSvcStartTypes[4]; break;
   757    756       }
   758    757       /* Get the service description. */
   759         -    bStatus = QueryServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION,
          758  +    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
   760    759                                     NULL, 0, &nRequired);
   761    760       if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
   762    761         fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   763    762       }
   764    763       pSvcDescr = fossil_malloc(nRequired);
   765         -    bStatus = QueryServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION,
          764  +    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
   766    765                                     (LPBYTE)pSvcDescr, nRequired, &nRequired);
   767    766       if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   768    767       /* Retrieves the current status of the specified service. */
   769    768       bStatus = QueryServiceStatus(hSvc, &sstat);
   770    769       if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   771    770       /* Translate the current state. */
   772    771       switch( sstat.dwCurrentState ){
................................................................................
   805    804   
   806    805       verify_all_options();
   807    806       if( g.argc==4 ){
   808    807         zSvcName = g.argv[3];
   809    808       }else if( g.argc>4 ){
   810    809         fossil_fatal("to much arguments for start method.");
   811    810       }
   812         -    hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
          811  +    hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   813    812       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   814         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          813  +    hSvc = OpenServiceW(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   815    814       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   816    815       QueryServiceStatus(hSvc, &sstat);
   817    816       if( sstat.dwCurrentState!=SERVICE_RUNNING ){
   818    817         fossil_print("Starting service '%s'", zSvcName);
   819    818         if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
   820         -        if( !StartService(hSvc, 0, NULL) ){
          819  +        if( !StartServiceW(hSvc, 0, NULL) ){
   821    820             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   822    821           }
   823    822         }
   824    823         while( sstat.dwCurrentState!=SERVICE_RUNNING ){
   825    824           Sleep(100);
   826    825           fossil_print(".");
   827    826           QueryServiceStatus(hSvc, &sstat);
................................................................................
   841    840   
   842    841       verify_all_options();
   843    842       if( g.argc==4 ){
   844    843         zSvcName = g.argv[3];
   845    844       }else if( g.argc>4 ){
   846    845         fossil_fatal("to much arguments for stop method.");
   847    846       }
   848         -    hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
          847  +    hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_ALL_ACCESS);
   849    848       if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   850         -    hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
          849  +    hSvc = OpenServiceW(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
   851    850       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   852    851       QueryServiceStatus(hSvc, &sstat);
   853    852       if( sstat.dwCurrentState!=SERVICE_STOPPED ){
   854    853         fossil_print("Stopping service '%s'", zSvcName);
   855    854         if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
   856    855           if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
   857    856             fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
................................................................................
   871    870     }else
   872    871     {
   873    872       fossil_fatal("METHOD should be one of:"
   874    873                    " create delete show start stop");
   875    874     }
   876    875     return;
   877    876   }
   878         -#endif /* _WIN32 */
   879         -
   880    877   #endif /* _WIN32  -- This code is for win32 only */

Changes to win/Makefile.mingw.

   102    102   
   103    103   #### C Compile and options for use in building executables that
   104    104   #    will run on the target platform.  This is usually the same
   105    105   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    106   #    the finished binary for fossil.  The BCC compiler above is used
   107    107   #    for building intermediate code-generator tools.
   108    108   #
   109         -TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
          109  +TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
   110    110   
   111    111   #### Compile resources for use in building executables that will run
   112    112   #    on the target platform.
   113    113   #
   114    114   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   115    115   
   116    116   # With HTTPS support

Changes to win/Makefile.mingw.mistachkin.

   102    102   
   103    103   #### C Compile and options for use in building executables that
   104    104   #    will run on the target platform.  This is usually the same
   105    105   #    as BCC, unless you are cross-compiling.  This C compiler builds
   106    106   #    the finished binary for fossil.  The BCC compiler above is used
   107    107   #    for building intermediate code-generator tools.
   108    108   #
   109         -TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
          109  +TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
   110    110   
   111    111   #### Compile resources for use in building executables that will run
   112    112   #    on the target platform.
   113    113   #
   114    114   RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
   115    115   
   116    116   # With HTTPS support

Changes to win/Makefile.msc.

    32     32   ZLIBDIR = $(MSCDIR)\extra\lib
    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         -TCC    = $(CC) -c $(CFLAGS) -DUNICODE -D_UNICODE $(MSCDEF) $(SSL) $(INCL)
           39  +TCC    = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
    40     40   LIBS   = $(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