How to debug a windows service with Delphi?

后端 未结 6 1330
轻奢々
轻奢々 2020-12-05 02:48

Is there a way to debug completely a windows service with Delphi?

6条回答
  •  广开言路
    2020-12-05 03:25

    You can use unitDebugService.pas from Colin Wilson's NT Low Level Utilities (page is gone, available in the wayback machine)

    and then in the DPR:

    begin
      if (paramCount > 0) and (SameText(ParamStr(1), '-DEBUG')) then
      begin
        FreeAndNil (Application);
        Application := TDebugServiceApplication.Create(nil);
      end;
    
      //... the rest of the normal DPR code
    end.
    

    This way you can run from within Delphi with debugging (by setting the project Debugger Parameters), use the EXE as a service, or run from the commandline with the -DEBUG switch, and .

提交回复
热议问题