BpcWin32Service

From RiskWiki
Jump to: navigation, search

Win32 Service Management

Language: Delphi 7 - 2007


Win32 service control - start, stop, status check, keyname enquiry, displayname enquiry, and listing.


uses Types, Classes;

function bpcWin32ServiceStart( sMachine, sService : string ) : boolean;
function bpcWin32ServiceStop( sMachine, sService : string ) : boolean;
function bpcWin32ServiceGetStatus( sMachine, sService : string ) : DWord;
function bpcWin32ServiceStopped( sMachine, sService : string ) : boolean;
function bpcWin32ServiceRunning( sMachine, sService : string ) : boolean;
function bpcWin32ServiceGetKeyName( sMachine, sServiceDispName : string ) : string;
function bpcWin32ServiceGetDisplayName( sMachine,  sServiceKeyName : string ) : string;
function bpcWn32ServiceGetList( sMachine : string; dwServiceType, dwServiceState : DWord; slServicesList : TStrings ) : boolean;

const
  //
  // Service Types
  //
  SERVICE_KERNEL_DRIVER       = $00000001;
  SERVICE_FILE_SYSTEM_DRIVER  = $00000002;
  SERVICE_ADAPTER             = $00000004;
  SERVICE_RECOGNIZER_DRIVER   = $00000008;

  SERVICE_DRIVER              =
    (SERVICE_KERNEL_DRIVER or
     SERVICE_FILE_SYSTEM_DRIVER or
     SERVICE_RECOGNIZER_DRIVER);

  SERVICE_WIN32_OWN_PROCESS   = $00000010;
  SERVICE_WIN32_SHARE_PROCESS = $00000020;
  SERVICE_WIN32               =
    (SERVICE_WIN32_OWN_PROCESS or
     SERVICE_WIN32_SHARE_PROCESS);

  SERVICE_INTERACTIVE_PROCESS = $00000100;

  SERVICE_TYPE_ALL            =
    (SERVICE_WIN32 or
     SERVICE_ADAPTER or
     SERVICE_DRIVER  or
     SERVICE_INTERACTIVE_PROCESS);

BackLinks