home *** CD-ROM | disk | FTP | other *** search
-
- {*******************************************************}
- { }
- { MiTeC System Information Component }
- { Windows ADV API Interface Unit }
- { version 7.3 for Delphi 5,6 }
- { }
- { Copyright ⌐ 1997,2002 Michal Mutl }
- { }
- {*******************************************************}
-
- {$INCLUDE MITEC_DEF.INC}
-
- unit MiTeC_AdvAPI;
-
- {$ALIGN ON}
- {$MINENUMSIZE 4}
-
- interface
-
- uses Classes, Windows, SysUtils;
-
- //
- // Constants
- //
-
- const
-
- //
- // Service database names
- //
- SERVICES_ACTIVE_DATABASEA = 'ServicesActive';
- SERVICES_ACTIVE_DATABASEW = 'ServicesActive';
- SERVICES_ACTIVE_DATABASE = SERVICES_ACTIVE_DATABASEA;
- SERVICES_FAILED_DATABASEA = 'ServicesFailed';
- SERVICES_FAILED_DATABASEW = 'ServicesFailed';
- SERVICES_FAILED_DATABASE = SERVICES_FAILED_DATABASEA;
-
- //
- // Character to designate that a name is a group
- //
- SC_GROUP_IDENTIFIERA = '+';
- SC_GROUP_IDENTIFIERW = '+';
- SC_GROUP_IDENTIFIER = SC_GROUP_IDENTIFIERA;
-
- //
- // Value to indicate no change to an optional parameter
- //
- SERVICE_NO_CHANGE = $FFFFFFFF;
-
- //
- // Service State -- for Enum Requests (Bit Mask)
- //
- SERVICE_ACTIVE = $00000001;
- SERVICE_INACTIVE = $00000002;
- SERVICE_STATE_ALL = (SERVICE_ACTIVE or
- SERVICE_INACTIVE);
-
- //
- // Controls
- //
- SERVICE_CONTROL_STOP = $00000001;
- SERVICE_CONTROL_PAUSE = $00000002;
- SERVICE_CONTROL_CONTINUE = $00000003;
- SERVICE_CONTROL_INTERROGATE = $00000004;
- SERVICE_CONTROL_SHUTDOWN = $00000005;
-
- //
- // Service State -- for CurrentState
- //
- SERVICE_STOPPED = $00000001;
- SERVICE_START_PENDING = $00000002;
- SERVICE_STOP_PENDING = $00000003;
- SERVICE_RUNNING = $00000004;
- SERVICE_CONTINUE_PENDING = $00000005;
- SERVICE_PAUSE_PENDING = $00000006;
- SERVICE_PAUSED = $00000007;
-
- //
- // Controls Accepted (Bit Mask)
- //
- SERVICE_ACCEPT_STOP = $00000001;
- SERVICE_ACCEPT_PAUSE_CONTINUE = $00000002;
- SERVICE_ACCEPT_SHUTDOWN = $00000004;
-
- //
- // Service Control Manager object specific access types
- //
- SC_MANAGER_CONNECT = $0001;
- SC_MANAGER_CREATE_SERVICE = $0002;
- SC_MANAGER_ENUMERATE_SERVICE = $0004;
- SC_MANAGER_LOCK = $0008;
- SC_MANAGER_QUERY_LOCK_STATUS = $0010;
- SC_MANAGER_MODIFY_BOOT_CONFIG = $0020;
-
- SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or
- SC_MANAGER_CONNECT or
- SC_MANAGER_CREATE_SERVICE or
- SC_MANAGER_ENUMERATE_SERVICE or
- SC_MANAGER_LOCK or
- SC_MANAGER_QUERY_LOCK_STATUS or
- SC_MANAGER_MODIFY_BOOT_CONFIG);
-
- //
- // Service object specific access type
- //
- SERVICE_QUERY_CONFIG = $0001;
- SERVICE_CHANGE_CONFIG = $0002;
- SERVICE_QUERY_STATUS = $0004;
- SERVICE_ENUMERATE_DEPENDENTS = $0008;
- SERVICE_START = $0010;
- SERVICE_STOP = $0020;
- SERVICE_PAUSE_CONTINUE = $0040;
- SERVICE_INTERROGATE = $0080;
- SERVICE_USER_DEFINED_CONTROL = $0100;
-
- SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or
- SERVICE_QUERY_CONFIG or
- SERVICE_CHANGE_CONFIG or
- SERVICE_QUERY_STATUS or
- SERVICE_ENUMERATE_DEPENDENTS or
- SERVICE_START or
- SERVICE_STOP or
- SERVICE_PAUSE_CONTINUE or
- SERVICE_INTERROGATE or
- SERVICE_USER_DEFINED_CONTROL);
-
- 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);
-
- SERVICE_BOOT_START = 0;
- SERVICE_SYSTEM_START =1;
- SERVICE_AUTO_START = 2;
- SERVICE_DEMAND_START = 3;
- SERVICE_DISABLED = 4;
-
-
- type
-
- //
- // Handle Types
- //
-
- SC_HANDLE = THandle;
- LPSC_HANDLE = ^SC_HANDLE;
-
- SERVICE_STATUS_HANDLE = DWORD;
-
- //
- // pointer to string pointer
- //
-
- PLPSTRA = ^PAnsiChar;
- PLPSTRW = ^PWideChar;
- PLPSTR = PLPSTRA;
-
- //
- // Service Status Structure
- //
-
- PServiceStatus = ^TServiceStatus;
- TServiceStatus = record
- dwServiceType: DWORD;
- dwCurrentState: DWORD;
- dwControlsAccepted: DWORD;
- dwWin32ExitCode: DWORD;
- dwServiceSpecificExitCode: DWORD;
- dwCheckPoint: DWORD;
- dwWaitHint: DWORD;
- end;
-
- //
- // Service Status Enumeration Structure
- //
- PEnumServiceStatusA = ^TEnumServiceStatusA;
- PEnumServiceStatusW = ^TEnumServiceStatusW;
- PEnumServiceStatus = PEnumServiceStatusA;
- TEnumServiceStatusA = record
- lpServiceName: PAnsiChar;
- lpDisplayName: PAnsiChar;
- ServiceStatus: TServiceStatus;
- end;
- TEnumServiceStatusW = record
- lpServiceName: PWideChar;
- lpDisplayName: PWideChar;
- ServiceStatus: TServiceStatus;
- end;
- TEnumServiceStatus = TEnumServiceStatusA;
-
- //
- // Structures for the Lock API functions
- //
- SC_LOCK = Pointer;
- PQueryServiceLockStatusA = ^TQueryServiceLockStatusA;
- PQueryServiceLockStatusW = ^TQueryServiceLockStatusW;
- PQueryServiceLockStatus = PQueryServiceLockStatusA;
- TQueryServiceLockStatusA = record
- fIsLocked: DWORD;
- lpLockOwner: PAnsiChar;
- dwLockDuration: DWORD;
- end;
- TQueryServiceLockStatusW = record
- fIsLocked: DWORD;
- lpLockOwner: PWideChar;
- dwLockDuration: DWORD;
- end;
- TQueryServiceLockStatus = TQueryServiceLockStatusA;
-
- //
- // Query Service Configuration Structure
- //
- PQueryServiceConfigA = ^TQueryServiceConfigA;
- PQueryServiceConfigW = ^TQueryServiceConfigW;
- PQueryServiceConfig = PQueryServiceConfigA;
- TQueryServiceConfigA = record
- dwServiceType: DWORD;
- dwStartType: DWORD;
- dwErrorControl: DWORD;
- lpBinaryPathName: PAnsiChar;
- lpLoadOrderGroup: PAnsiChar;
- dwTagId: DWORD;
- lpDependencies: PAnsiChar;
- lpServiceStartName: PAnsiChar;
- lpDisplayName: PAnsiChar;
- end;
-
- TQueryServiceConfigW = record
- dwServiceType: DWORD;
- dwStartType: DWORD;
- dwErrorControl: DWORD;
- lpBinaryPathName: PWideChar;
- lpLoadOrderGroup: PWideChar;
- dwTagId: DWORD;
- lpDependencies: PWideChar;
- lpServiceStartName: PWideChar;
- lpDisplayName: PWideChar;
- end;
- TQueryServiceConfig = TQueryServiceConfigA;
-
- //
- // Function Prototype for the Service Main Function
- //
-
- TServiceMainFunctionA = TFarProc;
- TServiceMainFunctionW = TFarProc;
- TServiceMainFunction = TServiceMainFunctionA;
-
- //
- // Service Start Table
- //
- PServiceTableEntryA = ^TServiceTableEntryA;
- PServiceTableEntryW = ^TServiceTableEntryW;
- PServiceTableEntry = PServiceTableEntryA;
- TServiceTableEntryA = record
- lpServiceName: PAnsiChar;
- lpServiceProc: TServiceMainFunctionA;
- end;
- TServiceTableEntryW = record
- lpServiceName: PWideChar;
- lpServiceProc: TServiceMainFunctionW;
- end;
- TServiceTableEntry = TServiceTableEntryA;
-
- THandlerFunction = TFarProc;
-
- function InitADVAPI :boolean;
- function FreeADVAPI: Boolean;
- function ChangeServiceConfigA(hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PAnsiChar): BOOL; stdcall;
- function ChangeServiceConfigW(hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PWideChar): BOOL; stdcall;
- function ChangeServiceConfig(hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PChar): BOOL; stdcall;
- function CloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;
- function ControlService(hService: SC_HANDLE; dwControl: DWORD;
- var lpServiceStatus: TServiceStatus): BOOL; stdcall;
- function CreateServiceA(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PAnsiChar): SC_HANDLE; stdcall;
- function CreateServiceW(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PWideChar): SC_HANDLE; stdcall;
- function CreateService(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PChar): SC_HANDLE; stdcall;
- function DeleteService(hService: SC_HANDLE): BOOL; stdcall;
- function EnumDependentServicesA(hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- function EnumDependentServicesW(hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- function EnumDependentServices(hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- function EnumServicesStatusA(hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- function EnumServicesStatusW(hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- function EnumServicesStatus(hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- function GetServiceKeyNameA(hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function GetServiceKeyNameW(hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function GetServiceKeyName(hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function GetServiceDisplayNameA(hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function GetServiceDisplayNameW(hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function GetServiceDisplayName(hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- function LockServiceDatabase(hSCManager: SC_HANDLE): SC_LOCK; stdcall;
- function NotifyBootConfigStatus(BootAcceptable: BOOL): BOOL; stdcall;
- function OpenSCManagerA(lpMachineName, lpDatabaseName: PAnsiChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function OpenSCManagerW(lpMachineName, lpDatabaseName: PWideChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function OpenSCManager(lpMachineName, lpDatabaseName: PChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function OpenServiceA(hSCManager: SC_HANDLE; lpServiceName: PAnsiChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function OpenServiceW(hSCManager: SC_HANDLE; lpServiceName: PWideChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function OpenService(hSCManager: SC_HANDLE; lpServiceName: PChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- function QueryServiceConfigA(hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfigA; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceConfigW(hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfigW; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceConfig(hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfig; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceLockStatusA(hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatusA; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceLockStatusW(hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatusW; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceLockStatus(hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatus; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceObjectSecurity(hService: SC_HANDLE;
- dwSecurityInformation: SECURITY_INFORMATION;
- lpSecurityDescriptor: PSECURITY_DESCRIPTOR; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- function QueryServiceStatus(hService: SC_HANDLE; var
- lpServiceStatus: TServiceStatus): BOOL; stdcall;
- function RegisterServiceCtrlHandlerA(lpServiceName: PAnsiChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- function RegisterServiceCtrlHandlerW(lpServiceName: PWideChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- function RegisterServiceCtrlHandler(lpServiceName: PChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- function SetServiceObjectSecurity(hService: SC_HANDLE;
- dwSecurityInformation: SECURITY_INFORMATION;
- lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall;
- function SetServiceStatus(hServiceStatus: SERVICE_STATUS_HANDLE;
- var lpServiceStatus: TServiceStatus): BOOL; stdcall;
- function StartServiceCtrlDispatcherA(
- var lpServiceStartTable: TServiceTableEntryA): BOOL; stdcall;
- function StartServiceCtrlDispatcherW(
- var lpServiceStartTable: TServiceTableEntryW): BOOL; stdcall;
- function StartServiceCtrlDispatcher(
- var lpServiceStartTable: TServiceTableEntry): BOOL; stdcall;
- function StartServiceA(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PAnsiChar): BOOL; stdcall;
- function StartServiceW(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PWideChar): BOOL; stdcall;
- function StartService(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PChar): BOOL; stdcall;
- function UnlockServiceDatabase(ScLock: SC_LOCK): BOOL; stdcall;
-
- type
- TChangeServiceConfigA = function (hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PAnsiChar): BOOL; stdcall;
- TChangeServiceConfigW = function (hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PWideChar): BOOL; stdcall;
- TChangeServiceConfig = function (hService: SC_HANDLE; dwServiceType, dwStartType,
- dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PChar;
- lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
- lpDisplayName: PChar): BOOL; stdcall;
- TCloseServiceHandle = function (hSCObject: SC_HANDLE): BOOL; stdcall;
- TControlService = function (hService: SC_HANDLE; dwControl: DWORD;
- var lpServiceStatus: TServiceStatus): BOOL; stdcall;
- TCreateServiceA = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PAnsiChar): SC_HANDLE; stdcall;
- TCreateServiceW = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PWideChar): SC_HANDLE; stdcall;
- TCreateService = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PChar;
- dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
- lpBinaryPathName, lpLoadOrderGroup: PChar; lpdwTagId: LPDWORD; lpDependencies,
- lpServiceStartName, lpPassword: PChar): SC_HANDLE; stdcall;
- TDeleteService = function (hService: SC_HANDLE): BOOL; stdcall;
- TEnumDependentServicesA = function (hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- TEnumDependentServicesW = function (hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- TEnumDependentServices = function (hService: SC_HANDLE; dwServiceState: DWORD;
- var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded,
- lpServicesReturned : DWORD): BOOL; stdcall;
- TEnumServicesStatusA = function (hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- TEnumServicesStatusW = function (hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- TEnumServicesStatus = function (hSCManager: SC_HANDLE; dwServiceType,
- dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD;
- var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
- TGetServiceKeyNameA = function (hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TGetServiceKeyNameW = function (hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TGetServiceKeyName = function (hSCManager: SC_HANDLE; lpDisplayName,
- lpServiceName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TGetServiceDisplayNameA = function (hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TGetServiceDisplayNameW = function (hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TGetServiceDisplayName = function (hSCManager: SC_HANDLE; lpServiceName,
- lpDisplayName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;
- TLockServiceDatabase = function (hSCManager: SC_HANDLE): SC_LOCK; stdcall;
- TNotifyBootConfigStatus = function (BootAcceptable: BOOL): BOOL; stdcall;
- TOpenSCManagerA = function (lpMachineName, lpDatabaseName: PAnsiChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TOpenSCManagerW = function (lpMachineName, lpDatabaseName: PWideChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TOpenSCManager = function (lpMachineName, lpDatabaseName: PChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TOpenServiceA = function (hSCManager: SC_HANDLE; lpServiceName: PAnsiChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TOpenServiceW = function (hSCManager: SC_HANDLE; lpServiceName: PWideChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TOpenService = function (hSCManager: SC_HANDLE; lpServiceName: PChar;
- dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
- TfQueryServiceConfigA = function (hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfigA; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TfQueryServiceConfigW = function (hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfigW; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TfQueryServiceConfig = function (hService: SC_HANDLE;
- var lpServiceConfig: TQueryServiceConfig; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TfQueryServiceLockStatusA = function (hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatusA; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TfQueryServiceLockStatusW = function (hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatusW; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TfQueryServiceLockStatus = function (hSCManager: SC_HANDLE;
- var lpLockStatus: TQueryServiceLockStatus; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TQueryServiceObjectSecurity = function (hService: SC_HANDLE;
- dwSecurityInformation: SECURITY_INFORMATION;
- lpSecurityDescriptor: PSECURITY_DESCRIPTOR; cbBufSize: DWORD;
- var pcbBytesNeeded: DWORD): BOOL; stdcall;
- TQueryServiceStatus = function (hService: SC_HANDLE; var
- lpServiceStatus: TServiceStatus): BOOL; stdcall;
- TRegisterServiceCtrlHandlerA = function (lpServiceName: PAnsiChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- TRegisterServiceCtrlHandlerW = function (lpServiceName: PWideChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- TRegisterServiceCtrlHandler = function (lpServiceName: PChar;
- lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;
- TSetServiceObjectSecurity = function (hService: SC_HANDLE;
- dwSecurityInformation: SECURITY_INFORMATION;
- lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall;
- TSetServiceStatus = function (hServiceStatus: SERVICE_STATUS_HANDLE;
- var lpServiceStatus: TServiceStatus): BOOL; stdcall;
- TStartServiceCtrlDispatcherA = function (
- var lpServiceStartTable: TServiceTableEntryA): BOOL; stdcall;
- TStartServiceCtrlDispatcherW = function (
- var lpServiceStartTable: TServiceTableEntryW): BOOL; stdcall;
- TStartServiceCtrlDispatcher = function (
- var lpServiceStartTable: TServiceTableEntry): BOOL; stdcall;
- TStartServiceA = function (hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PAnsiChar): BOOL; stdcall;
- TStartServiceW = function (hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PWideChar): BOOL; stdcall;
- TStartService = function (hService: SC_HANDLE; dwNumServiceArgs: DWORD;
- var lpServiceArgVectors: PChar): BOOL; stdcall;
- TUnlockServiceDatabase = function (ScLock: SC_LOCK): BOOL; stdcall;
-
- function ServiceGetErrCtrlStr(nID :integer) :string;
- function ServiceGetStatStr(nID :integer) :string;
- function ServiceGetStartStr(nID :integer) :string;
- function ServiceGetTypeStr(nID :integer) :string;
-
- function ServiceGetStatus(sMachine,sService :string ) :DWord;
- function ServiceRunning(sMachine,sService :string ) :boolean;
- function ServiceStopped(sMachine,sService :string ) :boolean;
- function ServiceStart(sMachine,sService,sArgs :string ) :boolean;
- function ServiceStop(sMachine,sService :string ) :boolean;
- function ServicePause(sMachine,sService :string ) :boolean;
- function ServiceContinue(sMachine,sService :string ) :Boolean;
- function ServiceGetKeyName(sMachine,sServiceDispName :string ) :string;
- function ServiceGetDisplayName(sMachine,sServiceKeyName :string ) :string;
-
- function ServiceGetList(sMachine :string; dwServiceType,dwServiceState :DWord; slServicesList :TStrings ) :boolean;
- function ServiceGetConfig(sMachine,sService :string; var QSC: TQueryServiceConfig) :boolean;
-
- implementation
-
-
-
-