Fossil

Changes On Branch berner-nt
Login

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 fa6311a507 to b8919a557a

2013-06-10
07:07
A typo in help screen (reported by Sergei Gavrikov) check-in: b894afad3d user: jan.nijtmans tags: trunk
2013-06-08
02:37
Merge updates from trunk. Closed-Leaf check-in: b8919a557a user: edward tags: berner-nt
01:34
Merge updates from trunk. Closed-Leaf check-in: 7872db8516 user: edward tags: long-double-bug
2013-06-06
12:16
merge trunk check-in: cf3d716e2f user: jan.nijtmans tags: cleanX-no-clean-glob
06:31
Teach config.h to recognize Sun's C compiler. Closed-Leaf check-in: 57b585276b user: edward tags: sun-compiler
2013-06-05
08:12
make "fossil rm FOO" work as expected on case-insensitive file systems, where committed files "foo/*" exist. check-in: fa6311a507 user: jan.nijtmans tags: trunk
2013-05-31
17:41
Avoid SQL errors when the "fossil ticket" command is misused to try to append icomment text. Ticket [d4378c258d9fc6b] check-in: 878f7008ab user: drh tags: trunk
2013-01-29
09:06
Patch from Edward Berner for Windows NT 4.0 check-in: e19ee02d39 user: jan.nijtmans tags: berner-nt

Changes to src/winhttp.c.
460
461
462
463
464
465
466









467
468
469
470
471
472
473
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482







+
+
+
+
+
+
+
+
+







    }else{
      fossil_fatal("error from StartServiceCtrlDispatcher()");
    }
  }
  return 0;
}

/*
** The ChangeServiceConfig2W and QueryServiceConfig2W functions are
** loaded at run time in the cmd_win32_service function.  These
** typedefs provide proper types for the function pointers.
*/
typedef BOOL (WINAPI *CHANGESERVICECONFIG2W)(SC_HANDLE, DWORD, LPVOID);
typedef BOOL (WINAPI *QUERYSERVICECONFIG2W)(SC_HANDLE, DWORD, LPBYTE,
                                            DWORD, LPDWORD);

/* dupe ifdef needed for mkindex
** COMMAND: winsrv*
** Usage: fossil winsrv METHOD ?SERVICE-NAME? ?OPTIONS?
**
** Where METHOD is one of: create delete show start stop.
**
** The winsrv command manages Fossil as a Windows service.  This allows
567
568
569
570
571
572
573















574
575
576
577
578
579
580
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







**       requires administrative rights on the machine executed.
**
*/
void cmd_win32_service(void){
  int n;
  const char *zMethod;
  const char *zSvcName = "Fossil-DSCM";    /* Default service name */
  HINSTANCE hinstLib = NULL;
  CHANGESERVICECONFIG2W ChangeServiceConfig2WAddr = NULL;
  QUERYSERVICECONFIG2W QueryServiceConfig2WAddr = NULL;

  /* The ChangeServiceConfig2W and QueryServiceConfig2W functions are
  ** not supported on Windows NT 4.0, so we load them at run time with
  ** GetProcAddress and only call them if they exist.
  */
  hinstLib = LoadLibrary(TEXT("advapi32.dll"));
  if( NULL != hinstLib ){
    ChangeServiceConfig2WAddr =
      (CHANGESERVICECONFIG2W) GetProcAddress(hinstLib, "ChangeServiceConfig2W");
    QueryServiceConfig2WAddr =
      (QUERYSERVICECONFIG2W) GetProcAddress(hinstLib, "QueryServiceConfig2W");
  }

  if( g.argc<3 ){
    usage("create|delete|show|start|stop ...");
  }
  zMethod = g.argv[2];
  n = strlen(zMethod);

654
655
656
657
658
659
660

661


662
663
664
665
666
667
668
678
679
680
681
682
683
684
685

686
687
688
689
690
691
692
693
694







+
-
+
+







             NULL,                                    /* Tag value */
             NULL,                                    /* Service dependencies */
             fossil_utf8_to_unicode(zUsername),       /* Service account */
             fossil_utf8_to_unicode(zPassword)        /* Account password */
           );
    if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
    /* Set the service description. */
    if( ChangeServiceConfig2WAddr ){
    ChangeServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
      ChangeServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
    }
    fossil_print("Service '%s' successfully created.\n", zSvcName);
    CloseServiceHandle(hSvc);
    CloseServiceHandle(hScm);
  }else
  if( strncmp(zMethod, "delete", n)==0 ){
    SC_HANDLE hScm;
    SC_HANDLE hSvc;
769
770
771
772
773
774
775

776
777
778
779
780
781
782
783
784













785
786
787
788
789
790
791
795
796
797
798
799
800
801
802









803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822







+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+







      case SERVICE_BOOT_START:    zSvcStartType = zSvcStartTypes[0]; break;
      case SERVICE_SYSTEM_START:  zSvcStartType = zSvcStartTypes[1]; break;
      case SERVICE_AUTO_START:    zSvcStartType = zSvcStartTypes[2]; break;
      case SERVICE_DEMAND_START:  zSvcStartType = zSvcStartTypes[3]; break;
      case SERVICE_DISABLED:      zSvcStartType = zSvcStartTypes[4]; break;
    }
    /* Get the service description. */
    if( QueryServiceConfig2WAddr ){
    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
                                  NULL, 0, &nRequired);
    if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
      fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
    }
    pSvcDescr = fossil_malloc(nRequired);
    bStatus = QueryServiceConfig2W(hSvc, SERVICE_CONFIG_DESCRIPTION,
                                  (LPBYTE)pSvcDescr, nRequired, &nRequired);
    if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
      bStatus = QueryServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION,
                                        NULL, 0, &nRequired);
      if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
        fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
      }
      pSvcDescr = fossil_malloc(nRequired);
      bStatus = QueryServiceConfig2WAddr(hSvc, SERVICE_CONFIG_DESCRIPTION,
                                    (LPBYTE)pSvcDescr, nRequired, &nRequired);
      if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
    }else{
      pSvcDescr = fossil_malloc(sizeof(SERVICE_DESCRIPTIONW));
      pSvcDescr->lpDescription = L"";
    }
    /* Retrieves the current status of the specified service. */
    bStatus = QueryServiceStatus(hSvc, &sstat);
    if( !bStatus ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
    /* Translate the current state. */
    switch( sstat.dwCurrentState ){
      case SERVICE_STOPPED:          zSvcState = zSvcStates[0]; break;
      case SERVICE_START_PENDING:    zSvcState = zSvcStates[1]; break;
888
889
890
891
892
893
894



895
896
897
919
920
921
922
923
924
925
926
927
928
929
930
931







+
+
+



    CloseServiceHandle(hSvc);
    CloseServiceHandle(hScm);
  }else
  {
    fossil_fatal("METHOD should be one of:"
                 " create delete show start stop");
  }
  if( NULL != hinstLib ){
    FreeLibrary(hinstLib);
  }
  return;
}
#endif /* _WIN32  -- This code is for win32 only */