Changes On Branch berner-nt
Not logged in

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

Changes In Branch berner-nt Excluding Merge-Ins

This is equivalent to a diff from c5ed222748 to e19ee02d39

2013-01-29
09:15
Rename "unicode-glob" setting to "encoding-glob". Mention the existance of the *-glob settings in the "fossil commit" warnings. Alphabetize the settings list. check-in: 7d237c49f3 user: jan.nijtmans tags: trunk
09:06
Patch from Edward Berner for Windows NT 4.0 Leaf check-in: e19ee02d39 user: jan.nijtmans tags: berner-nt
2013-01-28
06:05
очередное слияние check-in: fa517ef5d9 user: orefkov tags: orefkovs-change
2013-01-27
21:31
merge trunk check-in: 8df9d37834 user: jan.nijtmans tags: ticket-d17d6e5b17
21:06
issue [cd201d69bb]: For completeness, let's add .dot and .dotx too. check-in: c5ed222748 user: jan.nijtmans tags: trunk
20:51
Fix issue [cd201d69bb] check-in: 2a74733cbc user: jan.nijtmans tags: trunk

Changes to src/winhttp.c.

   453    453       }else{
   454    454         fossil_fatal("error from StartServiceCtrlDispatcher()");
   455    455       }
   456    456     }
   457    457     return 0;
   458    458   }
   459    459   
          460  +/*
          461  +** The ChangeServiceConfig2W and QueryServiceConfig2W functions are
          462  +** loaded at run time in the cmd_win32_service function.  These
          463  +** typedefs provide proper types for the function pointers.
          464  +*/
          465  +typedef BOOL (WINAPI *CHANGESERVICECONFIG2W)(SC_HANDLE, DWORD, LPVOID);
          466  +typedef BOOL (WINAPI *QUERYSERVICECONFIG2W)(SC_HANDLE, DWORD, LPBYTE,
          467  +                                            DWORD, LPDWORD);
          468  +
   460    469   /* dupe ifdef needed for mkindex
   461    470   ** COMMAND: winsrv*
   462    471   ** Usage: fossil winsrv METHOD ?SERVICE-NAME? ?OPTIONS?
   463    472   **
   464    473   ** Where METHOD is one of: create delete show start stop.
   465    474   **
   466    475   ** The winsrv command manages Fossil as a Windows service.  This allows
................................................................................
   560    569   **       requires administrative rights on the machine executed.
   561    570   **
   562    571   */
   563    572   void cmd_win32_service(void){
   564    573     int n;
   565    574     const char *zMethod;
   566    575     const char *zSvcName = "Fossil-DSCM";    /* Default service name */
          576  +  HINSTANCE hinstLib = NULL;
          577  +  CHANGESERVICECONFIG2W ChangeServiceConfig2WAddr = NULL;
          578  +  QUERYSERVICECONFIG2W QueryServiceConfig2WAddr = NULL;
          579  +
          580  +  /* The ChangeServiceConfig2W and QueryServiceConfig2W functions are
          581  +  ** not supported on Windows NT 4.0, so we load them at run time with
          582  +  ** GetProcAddress and only call them if they exist.
          583  +  */
          584  +  hinstLib = LoadLibrary(TEXT("advapi32.dll"));
          585  +  if( NULL != hinstLib ){
          586  +    ChangeServiceConfig2WAddr =
          587  +      (CHANGESERVICECONFIG2W) GetProcAddress(hinstLib, "ChangeServiceConfig2W");
          588  +    QueryServiceConfig2WAddr =
          589  +      (QUERYSERVICECONFIG2W) GetProcAddress(hinstLib, "QueryServiceConfig2W");
          590  +  }
   567    591   
   568    592     if( g.argc<3 ){
   569    593       usage("create|delete|show|start|stop ...");
   570    594     }
   571    595     zMethod = g.argv[2];
   572    596     n = strlen(zMethod);
   573    597   
................................................................................
   647    671                NULL,                                    /* Tag value */
   648    672                NULL,                                    /* Service dependencies */
   649    673                fossil_utf8_to_unicode(zUsername),       /* Service account */
   650    674                fossil_utf8_to_unicode(zPassword)        /* Account password */
   651    675              );
   652    676       if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   653    677       /* Set the service description. */
   654         -    ChangeServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
          678  +    if( ChangeServiceConfig2WAddr ){
          679  +      ChangeServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
          680  +    }
   655    681       fossil_print("Service '%s' successfully created.\n", zSvcName);
   656    682       CloseServiceHandle(hSvc);
   657    683       CloseServiceHandle(hScm);
   658    684     }else
   659    685     if( strncmp(zMethod, "delete", n)==0 ){
   660    686       SC_HANDLE hScm;
   661    687       SC_HANDLE hSvc;
................................................................................
   762    788         case SERVICE_BOOT_START:    zSvcStartType = zSvcStartTypes[0]; break;
   763    789         case SERVICE_SYSTEM_START:  zSvcStartType = zSvcStartTypes[1]; break;
   764    790         case SERVICE_AUTO_START:    zSvcStartType = zSvcStartTypes[2]; break;
   765    791         case SERVICE_DEMAND_START:  zSvcStartType = zSvcStartTypes[3]; break;
   766    792         case SERVICE_DISABLED:      zSvcStartType = zSvcStartTypes[4]; break;
   767    793       }
   768    794       /* Get the service description. */
   769         -    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
   770         -                                  NULL, 0, &nRequired);
   771         -    if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
   772         -      fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
          795  +    if( QueryServiceConfig2WAddr ){
          796  +      bStatus = QueryServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION,
          797  +                                        NULL, 0, &nRequired);
          798  +      if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
          799  +        fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
          800  +      }
          801  +      pSvcDescr = fossil_malloc(nRequired);
          802  +      bStatus = QueryServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION,
          803  +                                    (LPBYTE)pSvcDescr, nRequired, &nRequired);
          804  +      if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
          805  +    }else{
          806  +      pSvcDescr = fossil_malloc(sizeof(SERVICE_DESCRIPTIONW));
          807  +      pSvcDescr->lpDescription = L"";
   773    808       }
   774         -    pSvcDescr = fossil_malloc(nRequired);
   775         -    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
   776         -                                  (LPBYTE)pSvcDescr, nRequired, &nRequired);
   777         -    if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   778    809       /* Retrieves the current status of the specified service. */
   779    810       bStatus = QueryServiceStatus(hSvc, &sstat);
   780    811       if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
   781    812       /* Translate the current state. */
   782    813       switch( sstat.dwCurrentState ){
   783    814         case SERVICE_STOPPED:          zSvcState = zSvcStates[0]; break;
   784    815         case SERVICE_START_PENDING:    zSvcState = zSvcStates[1]; break;
................................................................................
   881    912       CloseServiceHandle(hSvc);
   882    913       CloseServiceHandle(hScm);
   883    914     }else
   884    915     {
   885    916       fossil_fatal("METHOD should be one of:"
   886    917                    " create delete show start stop");
   887    918     }
          919  +  if( NULL != hinstLib ){
          920  +    FreeLibrary(hinstLib);
          921  +  }
   888    922     return;
   889    923   }
   890    924   #endif /* _WIN32  -- This code is for win32 only */