title image


Smiley einen Haken hat die Sache noch...
Da die Referenzen der Funktionen mit in der IAT stehen,kann man das Programm unter 9x so-oder-so nicht starten,da diese nicht gefunden werden...um aber doch ein Programm mit einem NT Service unter 9xstarten zu können muß man die Funktionen dynamisch laden.Am besten geht das, wenn man die WinSvc.pas von Borlandals Vorlage nimmt, und die Funktionen dynamisch lädt...Da das aber über 1200 Zeilen Code sind nehme ich euchgerne die Arbeit ab... (komplette WinSvc - nur dynamisch ;)unit WinSvcX;{$ALIGN ON}{$MINENUMSIZE 4}interfaceuses Windows;const//// Service database names// {$EXTERNALSYM SERVICES_ACTIVE_DATABASEA} SERVICES_ACTIVE_DATABASEA = 'ServicesActive'; {$EXTERNALSYM SERVICES_ACTIVE_DATABASEW} SERVICES_ACTIVE_DATABASEW = 'ServicesActive'; {$EXTERNALSYM SERVICES_ACTIVE_DATABASE} SERVICES_ACTIVE_DATABASE = SERVICES_ACTIVE_DATABASEA; {$EXTERNALSYM SERVICES_FAILED_DATABASEA} SERVICES_FAILED_DATABASEA = 'ServicesFailed'; {$EXTERNALSYM SERVICES_FAILED_DATABASEW} SERVICES_FAILED_DATABASEW = 'ServicesFailed'; {$EXTERNALSYM SERVICES_FAILED_DATABASE} SERVICES_FAILED_DATABASE = SERVICES_FAILED_DATABASEA;//// Character to designate that a name is a group// {$EXTERNALSYM SC_GROUP_IDENTIFIERA} SC_GROUP_IDENTIFIERA = '+'; {$EXTERNALSYM SC_GROUP_IDENTIFIERW} SC_GROUP_IDENTIFIERW = '+'; {$EXTERNALSYM SC_GROUP_IDENTIFIER} SC_GROUP_IDENTIFIER = SC_GROUP_IDENTIFIERA;//// Value to indicate no change to an optional parameter// {$EXTERNALSYM SERVICE_NO_CHANGE} SERVICE_NO_CHANGE = $FFFFFFFF;//// Service State -- for Enum Requests (Bit Mask)// {$EXTERNALSYM SERVICE_ACTIVE} SERVICE_ACTIVE = $00000001; {$EXTERNALSYM SERVICE_INACTIVE} SERVICE_INACTIVE = $00000002; {$EXTERNALSYM SERVICE_STATE_ALL} SERVICE_STATE_ALL = (SERVICE_ACTIVE or SERVICE_INACTIVE);//// Controls// {$EXTERNALSYM SERVICE_CONTROL_STOP} SERVICE_CONTROL_STOP = $00000001; {$EXTERNALSYM SERVICE_CONTROL_PAUSE} SERVICE_CONTROL_PAUSE = $00000002; {$EXTERNALSYM SERVICE_CONTROL_CONTINUE} SERVICE_CONTROL_CONTINUE = $00000003; {$EXTERNALSYM SERVICE_CONTROL_INTERROGATE} SERVICE_CONTROL_INTERROGATE = $00000004; {$EXTERNALSYM SERVICE_CONTROL_SHUTDOWN} SERVICE_CONTROL_SHUTDOWN = $00000005;//// Service State -- for CurrentState// {$EXTERNALSYM SERVICE_STOPPED} SERVICE_STOPPED = $00000001; {$EXTERNALSYM SERVICE_START_PENDING} SERVICE_START_PENDING = $00000002; {$EXTERNALSYM SERVICE_STOP_PENDING} SERVICE_STOP_PENDING = $00000003; {$EXTERNALSYM SERVICE_RUNNING} SERVICE_RUNNING = $00000004; {$EXTERNALSYM SERVICE_CONTINUE_PENDING} SERVICE_CONTINUE_PENDING = $00000005; {$EXTERNALSYM SERVICE_PAUSE_PENDING} SERVICE_PAUSE_PENDING = $00000006; {$EXTERNALSYM SERVICE_PAUSED} SERVICE_PAUSED = $00000007;//// Controls Accepted (Bit Mask)// {$EXTERNALSYM SERVICE_ACCEPT_STOP} SERVICE_ACCEPT_STOP = $00000001; {$EXTERNALSYM SERVICE_ACCEPT_PAUSE_CONTINUE} SERVICE_ACCEPT_PAUSE_CONTINUE = $00000002; {$EXTERNALSYM SERVICE_ACCEPT_SHUTDOWN} SERVICE_ACCEPT_SHUTDOWN = $00000004;//// Service Control Manager object specific access types// {$EXTERNALSYM SC_MANAGER_CONNECT} SC_MANAGER_CONNECT = $0001; {$EXTERNALSYM SC_MANAGER_CREATE_SERVICE} SC_MANAGER_CREATE_SERVICE = $0002; {$EXTERNALSYM SC_MANAGER_ENUMERATE_SERVICE} SC_MANAGER_ENUMERATE_SERVICE = $0004; {$EXTERNALSYM SC_MANAGER_LOCK} SC_MANAGER_LOCK = $0008; {$EXTERNALSYM SC_MANAGER_QUERY_LOCK_STATUS} SC_MANAGER_QUERY_LOCK_STATUS = $0010; {$EXTERNALSYM SC_MANAGER_MODIFY_BOOT_CONFIG} SC_MANAGER_MODIFY_BOOT_CONFIG = $0020; {$EXTERNALSYM SC_MANAGER_ALL_ACCESS} 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// {$EXTERNALSYM SERVICE_QUERY_CONFIG} SERVICE_QUERY_CONFIG = $0001; {$EXTERNALSYM SERVICE_CHANGE_CONFIG} SERVICE_CHANGE_CONFIG = $0002; {$EXTERNALSYM SERVICE_QUERY_STATUS} SERVICE_QUERY_STATUS = $0004; {$EXTERNALSYM SERVICE_ENUMERATE_DEPENDENTS} SERVICE_ENUMERATE_DEPENDENTS = $0008; {$EXTERNALSYM SERVICE_START} SERVICE_START = $0010; {$EXTERNALSYM SERVICE_STOP} SERVICE_STOP = $0020; {$EXTERNALSYM SERVICE_PAUSE_CONTINUE} SERVICE_PAUSE_CONTINUE = $0040; {$EXTERNALSYM SERVICE_INTERROGATE} SERVICE_INTERROGATE = $0080; {$EXTERNALSYM SERVICE_USER_DEFINED_CONTROL} SERVICE_USER_DEFINED_CONTROL = $0100; {$EXTERNALSYM SERVICE_ALL_ACCESS} 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 Types (Bit Mask)// {$EXTERNALSYM SERVICE_KERNEL_DRIVER} SERVICE_KERNEL_DRIVER = $00000001; {$EXTERNALSYM SERVICE_FILE_SYSTEM_DRIVER} SERVICE_FILE_SYSTEM_DRIVER = $00000002; {$EXTERNALSYM SERVICE_ADAPTER} SERVICE_ADAPTER = $00000004; {$EXTERNALSYM SERVICE_RECOGNIZER_DRIVER} SERVICE_RECOGNIZER_DRIVER = $00000008; {$EXTERNALSYM SERVICE_DRIVER} SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER or SERVICE_RECOGNIZER_DRIVER); {$EXTERNALSYM SERVICE_WIN32_OWN_PROCESS} SERVICE_WIN32_OWN_PROCESS = $00000010; {$EXTERNALSYM SERVICE_WIN32_SHARE_PROCESS} SERVICE_WIN32_SHARE_PROCESS = $00000020; {$EXTERNALSYM SERVICE_WIN32} SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS); {$EXTERNALSYM SERVICE_INTERACTIVE_PROCESS} SERVICE_INTERACTIVE_PROCESS = $00000100; {$EXTERNALSYM SERVICE_TYPE_ALL} SERVICE_TYPE_ALL = (SERVICE_WIN32 or SERVICE_ADAPTER or SERVICE_DRIVER or SERVICE_INTERACTIVE_PROCESS);//// Start Type// {$EXTERNALSYM SERVICE_BOOT_START} SERVICE_BOOT_START = $00000000; {$EXTERNALSYM SERVICE_SYSTEM_START} SERVICE_SYSTEM_START = $00000001; {$EXTERNALSYM SERVICE_AUTO_START} SERVICE_AUTO_START = $00000002; {$EXTERNALSYM SERVICE_DEMAND_START} SERVICE_DEMAND_START = $00000003; {$EXTERNALSYM SERVICE_DISABLED} SERVICE_DISABLED = $00000004;//// Error control type// {$EXTERNALSYM SERVICE_ERROR_IGNORE} SERVICE_ERROR_IGNORE = $00000000; {$EXTERNALSYM SERVICE_ERROR_NORMAL} SERVICE_ERROR_NORMAL = $00000001; {$EXTERNALSYM SERVICE_ERROR_SEVERE} SERVICE_ERROR_SEVERE = $00000002; {$EXTERNALSYM SERVICE_ERROR_CRITICAL} SERVICE_ERROR_CRITICAL = $00000003;type//// Handle Types// {$EXTERNALSYM SC_HANDLE} SC_HANDLE = THandle; {$EXTERNALSYM LPSC_HANDLE} LPSC_HANDLE = ^SC_HANDLE; {$EXTERNALSYM SERVICE_STATUS_HANDLE} SERVICE_STATUS_HANDLE = DWORD;//// pointer to string pointer// PLPSTRA = ^PAnsiChar; PLPWSTRW = ^PWideChar; PLPSTR = PLPSTRA;//// Service Status Structure// PServiceStatus = ^TServiceStatus; {$EXTERNALSYM _SERVICE_STATUS} _SERVICE_STATUS = record dwServiceType: DWORD; dwCurrentState: DWORD; dwControlsAccepted: DWORD; dwWin32ExitCode: DWORD; dwServiceSpecificExitCode: DWORD; dwCheckPoint: DWORD; dwWaitHint: DWORD; end; {$EXTERNALSYM SERVICE_STATUS} SERVICE_STATUS = _SERVICE_STATUS; TServiceStatus = _SERVICE_STATUS;//// Service Status Enumeration Structure// PEnumServiceStatusA = ^TEnumServiceStatusA; PEnumServiceStatusW = ^TEnumServiceStatusW; PEnumServiceStatus = PEnumServiceStatusA; {$EXTERNALSYM _ENUM_SERVICE_STATUSA} _ENUM_SERVICE_STATUSA = record lpServiceName: PAnsiChar; lpDisplayName: PAnsiChar; ServiceStatus: TServiceStatus; end;{#BEGIN} {$EXTERNALSYM ENUM_SERVICE_STATUSA} ENUM_SERVICE_STATUSA = _ENUM_SERVICE_STATUSA; {$EXTERNALSYM _ENUM_SERVICE_STATUSW} _ENUM_SERVICE_STATUSW = record lpServiceName: PWideChar; lpDisplayName: PWideChar; ServiceStatus: TServiceStatus; end;{#BEGIN} {$EXTERNALSYM ENUM_SERVICE_STATUSW} ENUM_SERVICE_STATUSW = _ENUM_SERVICE_STATUSW; {$EXTERNALSYM _ENUM_SERVICE_STATUS} _ENUM_SERVICE_STATUS = _ENUM_SERVICE_STATUSA; TEnumServiceStatusA = _ENUM_SERVICE_STATUSA; TEnumServiceStatusW = _ENUM_SERVICE_STATUSW; TEnumServiceStatus = TEnumServiceStatusA;//// Structures for the Lock API functions// SC_LOCK = Pointer; {$EXTERNALSYM SC_LOCK} PQueryServiceLockStatusA = ^TQueryServiceLockStatusA; PQueryServiceLockStatusW = ^TQueryServiceLockStatusW; PQueryServiceLockStatus = PQueryServiceLockStatusA; {$EXTERNALSYM _QUERY_SERVICE_LOCK_STATUSA} _QUERY_SERVICE_LOCK_STATUSA = record fIsLocked: DWORD; lpLockOwner: PAnsiChar; dwLockDuration: DWORD; end; {$EXTERNALSYM _QUERY_SERVICE_LOCK_STATUSW} _QUERY_SERVICE_LOCK_STATUSW = record fIsLocked: DWORD; lpLockOwner: PWideChar; dwLockDuration: DWORD; end; {$EXTERNALSYM _QUERY_SERVICE_LOCK_STATUS} _QUERY_SERVICE_LOCK_STATUS = _QUERY_SERVICE_LOCK_STATUSA; {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUSA} QUERY_SERVICE_LOCK_STATUSA = _QUERY_SERVICE_LOCK_STATUSA; {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUSW} QUERY_SERVICE_LOCK_STATUSW = _QUERY_SERVICE_LOCK_STATUSW; {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUS} QUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUSA; TQueryServiceLockStatusA = _QUERY_SERVICE_LOCK_STATUSA; TQueryServiceLockStatusW = _QUERY_SERVICE_LOCK_STATUSW; TQueryServiceLockStatus = TQueryServiceLockStatusA;//// Query Service Configuration Structure// PQueryServiceConfigA = ^TQueryServiceConfigA; PQueryServiceConfigW = ^TQueryServiceConfigW; PQueryServiceConfig = PQueryServiceConfigA; {$EXTERNALSYM _QUERY_SERVICE_CONFIGA} _QUERY_SERVICE_CONFIGA = record dwServiceType: DWORD; dwStartType: DWORD; dwErrorControl: DWORD; lpBinaryPathName: PAnsiChar; lpLoadOrderGroup: PAnsiChar; dwTagId: DWORD; lpDependencies: PAnsiChar; lpServiceStartName: PAnsiChar; lpDisplayName: PAnsiChar; end; {$EXTERNALSYM _QUERY_SERVICE_CONFIGW} _QUERY_SERVICE_CONFIGW = record dwServiceType: DWORD; dwStartType: DWORD; dwErrorControl: DWORD; lpBinaryPathName: PWideChar; lpLoadOrderGroup: PWideChar; dwTagId: DWORD; lpDependencies: PWideChar; lpServiceStartName: PWideChar; lpDisplayName: PWideChar; end; {$EXTERNALSYM _QUERY_SERVICE_CONFIG} _QUERY_SERVICE_CONFIG = _QUERY_SERVICE_CONFIGA; {$EXTERNALSYM QUERY_SERVICE_CONFIGA} QUERY_SERVICE_CONFIGA = _QUERY_SERVICE_CONFIGA; {$EXTERNALSYM QUERY_SERVICE_CONFIGW} QUERY_SERVICE_CONFIGW = _QUERY_SERVICE_CONFIGW; {$EXTERNALSYM QUERY_SERVICE_CONFIG} QUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIGA; TQueryServiceConfigA = _QUERY_SERVICE_CONFIGA; TQueryServiceConfigW = _QUERY_SERVICE_CONFIGW; TQueryServiceConfig = TQueryServiceConfigA;//// Function Prototype for the Service Main Function// {$EXTERNALSYM LPSERVICE_MAIN_FUNCTIONA} LPSERVICE_MAIN_FUNCTIONA = TFarProc; {$EXTERNALSYM LPSERVICE_MAIN_FUNCTIONW} LPSERVICE_MAIN_FUNCTIONW = TFarProc; {$EXTERNALSYM LPSERVICE_MAIN_FUNCTION} LPSERVICE_MAIN_FUNCTION = LPSERVICE_MAIN_FUNCTIONA; TServiceMainFunctionA = LPSERVICE_MAIN_FUNCTIONA; TServiceMainFunctionW = LPSERVICE_MAIN_FUNCTIONW; TServiceMainFunction = TServiceMainFunctionA;//// Service Start Table// PServiceTableEntryA = ^TServiceTableEntryA; PServiceTableEntryW = ^TServiceTableEntryW; PServiceTableEntry = PServiceTableEntryA; {$EXTERNALSYM _SERVICE_TABLE_ENTRYA} _SERVICE_TABLE_ENTRYA = record lpServiceName: PAnsiChar; lpServiceProc: TServiceMainFunctionA; end; {$EXTERNALSYM _SERVICE_TABLE_ENTRYW} _SERVICE_TABLE_ENTRYW = record lpServiceName: PWideChar; lpServiceProc: TServiceMainFunctionW; end; {$EXTERNALSYM _SERVICE_TABLE_ENTRY} _SERVICE_TABLE_ENTRY = _SERVICE_TABLE_ENTRYA; {$EXTERNALSYM SERVICE_TABLE_ENTRYA} SERVICE_TABLE_ENTRYA = _SERVICE_TABLE_ENTRYA; {$EXTERNALSYM SERVICE_TABLE_ENTRYW} SERVICE_TABLE_ENTRYW = _SERVICE_TABLE_ENTRYW; {$EXTERNALSYM SERVICE_TABLE_ENTRY} SERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRYA; TServiceTableEntryA = _SERVICE_TABLE_ENTRYA; TServiceTableEntryW = _SERVICE_TABLE_ENTRYW; TServiceTableEntry = TServiceTableEntryA;//// Prototype for the Service Control Handler Function// {$EXTERNALSYM LPHANDLER_FUNCTION} LPHANDLER_FUNCTION = TFarProc; THandlerFunction = LPHANDLER_FUNCTION;///////////////////////////////////////////////////////////////////////////// API Function Prototypes/////////////////////////////////////////////////////////////////////////// TfnChangeServiceConfigA = function (hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PAnsiChar): BOOL; stdcall; TfnChangeServiceConfigW = function (hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PWideChar): BOOL; stdcall; TfnChangeServiceConfig = TfnChangeServiceConfigA; TfnCloseServiceHandle = function (hSCObject: SC_HANDLE): BOOL; stdcall; TfnControlService = function (hService: SC_HANDLE; dwControl: DWORD; var lpServiceStatus: TServiceStatus): BOOL; stdcall; TfnCreateServiceA = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar; dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword: PAnsiChar): SC_HANDLE; stdcall; TfnCreateServiceW = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar; dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword: PWideChar): SC_HANDLE; stdcall; TfnCreateService = TfnCreateServiceA; TfnDeleteService = function (hService: SC_HANDLE): BOOL; stdcall; TfnEnumDependentServicesA = function (hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall; TfnEnumDependentServicesW = function (hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall; TfnEnumDependentServices = TfnEnumDependentServicesA; TfnEnumServicesStatusA = function (hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall; TfnEnumServicesStatusW = function (hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall; TfnEnumServicesStatus = TfnEnumServicesStatusA; TfnGetServiceKeyNameA = function (hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall; TfnGetServiceKeyNameW = function (hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall; TfnGetServiceKeyName = TfnGetServiceKeyNameA; TfnGetServiceDisplayNameA = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall; TfnGetServiceDisplayNameW = function (hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall; TfnGetServiceDisplayName = TfnGetServiceDisplayNameA; TfnLockServiceDatabase = function (hSCManager: SC_HANDLE): SC_LOCK; stdcall; TfnNotifyBootConfigStatus = function (BootAcceptable: BOOL): BOOL; stdcall; TfnOpenSCManagerA = function (lpMachineName, lpDatabaseName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall; TfnOpenSCManagerW = function (lpMachineName, lpDatabaseName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall; TfnOpenSCManager = TfnOpenSCManagerA; TfnOpenServiceA = function (hSCManager: SC_HANDLE; lpServiceName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall; TfnOpenServiceW = function (hSCManager: SC_HANDLE; lpServiceName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall; TfnOpenService = TfnOpenServiceA; TfnQueryServiceConfigA = function (hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall; TfnQueryServiceConfigW = function (hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall; TfnQueryServiceConfig = TfnQueryServiceConfigA; TfnQueryServiceLockStatusA = function (hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall; TfnQueryServiceLockStatusW = function (hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall; TfnQueryServiceLockStatus = TfnQueryServiceLockStatusA; TfnQueryServiceObjectSecurity = function (hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall; TfnQueryServiceStatus = function (hService: SC_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall; TfnRegisterServiceCtrlHandlerA = function (lpServiceName: PAnsiChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall; TfnRegisterServiceCtrlHandlerW = function (lpServiceName: PWideChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall; TfnRegisterServiceCtrlHandler = TfnRegisterServiceCtrlHandlerA; TfnSetServiceObjectSecurity = function (hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall; TfnSetServiceStatus = function (hServiceStatus: SERVICE_STATUS_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall; TfnStartServiceCtrlDispatcherA = function ( var lpServiceStartTable: TServiceTableEntryA): BOOL; stdcall; TfnStartServiceCtrlDispatcherW = function ( var lpServiceStartTable: TServiceTableEntryW): BOOL; stdcall; TfnStartServiceCtrlDispatcher = TfnStartServiceCtrlDispatcherA; TfnStartServiceA = function (hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PAnsiChar): BOOL; stdcall; TfnStartServiceW = function (hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PWideChar): BOOL; stdcall; TfnStartService = TfnStartServiceA; TfnUnlockServiceDatabase = function (ScLock: SC_LOCK): BOOL; stdcall;{$EXTERNALSYM ChangeServiceConfigA}function ChangeServiceConfigA(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PAnsiChar): BOOL; stdcall;{$EXTERNALSYM ChangeServiceConfigW}function ChangeServiceConfigW(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PWideChar): BOOL; stdcall;{$EXTERNALSYM ChangeServiceConfig}function ChangeServiceConfig(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PChar): BOOL; stdcall;{$EXTERNALSYM CloseServiceHandle}function CloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;{$EXTERNALSYM ControlService}function ControlService(hService: SC_HANDLE; dwControl: DWORD; var lpServiceStatus: TServiceStatus): BOOL; stdcall;{$EXTERNALSYM CreateServiceA}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;{$EXTERNALSYM CreateServiceW}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;{$EXTERNALSYM CreateService}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;{$EXTERNALSYM DeleteService}function DeleteService(hService: SC_HANDLE): BOOL; stdcall;{$EXTERNALSYM EnumDependentServicesA}function EnumDependentServicesA(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;{$EXTERNALSYM EnumDependentServicesW}function EnumDependentServicesW(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;{$EXTERNALSYM EnumDependentServices}function EnumDependentServices(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;{$EXTERNALSYM EnumServicesStatusA}function EnumServicesStatusA(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;{$EXTERNALSYM EnumServicesStatusW}function EnumServicesStatusW(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;{$EXTERNALSYM EnumServicesStatus}function EnumServicesStatus(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceKeyNameA}function GetServiceKeyNameA(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceKeyNameW}function GetServiceKeyNameW(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceKeyName}function GetServiceKeyName(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceDisplayNameA}function GetServiceDisplayNameA(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceDisplayNameW}function GetServiceDisplayNameW(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM GetServiceDisplayName}function GetServiceDisplayName(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;{$EXTERNALSYM LockServiceDatabase}function LockServiceDatabase(hSCManager: SC_HANDLE): SC_LOCK; stdcall;{$EXTERNALSYM NotifyBootConfigStatus}function NotifyBootConfigStatus(BootAcceptable: BOOL): BOOL; stdcall;{$EXTERNALSYM OpenSCManagerA}function OpenSCManagerA(lpMachineName, lpDatabaseName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM OpenSCManagerW}function OpenSCManagerW(lpMachineName, lpDatabaseName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM OpenSCManager}function OpenSCManager(lpMachineName, lpDatabaseName: PChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM OpenServiceA}function OpenServiceA(hSCManager: SC_HANDLE; lpServiceName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM OpenServiceW}function OpenServiceW(hSCManager: SC_HANDLE; lpServiceName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM OpenService}function OpenService(hSCManager: SC_HANDLE; lpServiceName: PChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;{$EXTERNALSYM QueryServiceConfigA}function QueryServiceConfigA(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceConfigW}function QueryServiceConfigW(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceConfig}function QueryServiceConfig(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfig; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceLockStatusA}function QueryServiceLockStatusA(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceLockStatusW}function QueryServiceLockStatusW(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceLockStatus}function QueryServiceLockStatus(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatus; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceObjectSecurity}function QueryServiceObjectSecurity(hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;{$EXTERNALSYM QueryServiceStatus}function QueryServiceStatus(hService: SC_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall;{$EXTERNALSYM RegisterServiceCtrlHandlerA}function RegisterServiceCtrlHandlerA(lpServiceName: PAnsiChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;{$EXTERNALSYM RegisterServiceCtrlHandlerW}function RegisterServiceCtrlHandlerW(lpServiceName: PWideChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;{$EXTERNALSYM RegisterServiceCtrlHandler}function RegisterServiceCtrlHandler(lpServiceName: PChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;{$EXTERNALSYM SetServiceObjectSecurity}function SetServiceObjectSecurity(hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall;{$EXTERNALSYM SetServiceStatus}function SetServiceStatus(hServiceStatus: SERVICE_STATUS_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall;{$EXTERNALSYM StartServiceCtrlDispatcherA}function StartServiceCtrlDispatcherA( var lpServiceStartTable: TServiceTableEntryA): BOOL; stdcall;{$EXTERNALSYM StartServiceCtrlDispatcherW}function StartServiceCtrlDispatcherW( var lpServiceStartTable: TServiceTableEntryW): BOOL; stdcall;{$EXTERNALSYM StartServiceCtrlDispatcher}function StartServiceCtrlDispatcher( var lpServiceStartTable: TServiceTableEntry): BOOL; stdcall;{$EXTERNALSYM StartServiceA}function StartServiceA(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PAnsiChar): BOOL; stdcall;{$EXTERNALSYM StartServiceW}function StartServiceW(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PWideChar): BOOL; stdcall;{$EXTERNALSYM StartService}function StartService(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PChar): BOOL; stdcall;{$EXTERNALSYM UnlockServiceDatabase}function UnlockServiceDatabase(ScLock: SC_LOCK): BOOL; stdcall;var fnChangeServiceConfigA: TfnChangeServiceConfigA = nil; fnChangeServiceConfigW: TfnChangeServiceConfigW = nil; fnChangeServiceConfig: TfnChangeServiceConfig = nil; fnCloseServiceHandle: TfnCloseServiceHandle = nil; fnControlService: TfnControlService = nil; fnCreateServiceA: TfnCreateServiceA = nil; fnCreateServiceW: TfnCreateServiceW = nil; fnCreateService: TfnCreateService = nil; fnDeleteService: TfnDeleteService = nil; fnEnumDependentServicesA: TfnEnumDependentServicesA = nil; fnEnumDependentServicesW: TfnEnumDependentServicesW = nil; fnEnumDependentServices: TfnEnumDependentServices = nil; fnEnumServicesStatusA: TfnEnumServicesStatusA = nil; fnEnumServicesStatusW: TfnEnumServicesStatusW = nil; fnEnumServicesStatus: TfnEnumServicesStatus = nil; fnGetServiceKeyNameA: TfnGetServiceKeyNameA = nil; fnGetServiceKeyNameW: TfnGetServiceKeyNameW = nil; fnGetServiceKeyName: TfnGetServiceKeyName = nil; fnGetServiceDisplayNameA: TfnGetServiceDisplayNameA = nil; fnGetServiceDisplayNameW: TfnGetServiceDisplayNameW = nil; fnGetServiceDisplayName: TfnGetServiceDisplayName = nil; fnLockServiceDatabase: TfnLockServiceDatabase = nil; fnNotifyBootConfigStatus: TfnNotifyBootConfigStatus = nil; fnOpenSCManagerA: TfnOpenSCManagerA = nil; fnOpenSCManagerW: TfnOpenSCManagerW = nil; fnOpenSCManager: TfnOpenSCManager = nil; fnOpenServiceA: TfnOpenServiceA = nil; fnOpenServiceW: TfnOpenServiceW = nil; fnOpenService: TfnOpenService = nil; fnQueryServiceConfigA: TfnQueryServiceConfigA = nil; fnQueryServiceConfigW: TfnQueryServiceConfigW = nil; fnQueryServiceConfig: TfnQueryServiceConfig = nil; fnQueryServiceLockStatusA: TfnQueryServiceLockStatusA = nil; fnQueryServiceLockStatusW: TfnQueryServiceLockStatusW = nil; fnQueryServiceLockStatus: TfnQueryServiceLockStatus = nil; fnQueryServiceObjectSecurity: TfnQueryServiceObjectSecurity = nil; fnQueryServiceStatus: TfnQueryServiceStatus = nil; fnRegisterServiceCtrlHandlerA: TfnRegisterServiceCtrlHandlerA = nil; fnRegisterServiceCtrlHandlerW: TfnRegisterServiceCtrlHandlerW = nil; fnRegisterServiceCtrlHandler: TfnRegisterServiceCtrlHandler = nil; fnSetServiceObjectSecurity: TfnSetServiceObjectSecurity = nil; fnSetServiceStatus: TfnSetServiceStatus = nil; fnStartServiceCtrlDispatcherA: TfnStartServiceCtrlDispatcherA = nil; fnStartServiceCtrlDispatcherW: TfnStartServiceCtrlDispatcherW = nil; fnStartServiceCtrlDispatcher: TfnStartServiceCtrlDispatcher = nil; fnStartServiceA: TfnStartServiceA = nil; fnStartServiceW: TfnStartServiceW = nil; fnStartService: TfnStartService = nil; fnUnlockServiceDatabase: TfnUnlockServiceDatabase = nil;implementationfunction ChangeServiceConfigA(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PAnsiChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PAnsiChar): BOOL; stdcall;begin if Assigned(fnChangeServiceConfigA) then Result := fnChangeServiceConfigA(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) else Result := False;end;function ChangeServiceConfigW(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PWideChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PWideChar): BOOL; stdcall;begin if Assigned(fnChangeServiceConfigW) then Result := fnChangeServiceConfigW(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) else Result := False;end;function ChangeServiceConfig(hService: SC_HANDLE; dwServiceType, dwStartType, dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: PChar; lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword, lpDisplayName: PChar): BOOL; stdcall;begin if Assigned(fnChangeServiceConfig) then Result := fnChangeServiceConfig(hService, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword, lpDisplayName) else Result := False;end;function CloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;begin if Assigned(fnCloseServiceHandle) then Result := fnCloseServiceHandle(hSCObject) else Result := False;end;function ControlService(hService: SC_HANDLE; dwControl: DWORD; var lpServiceStatus: TServiceStatus): BOOL; stdcall;begin if Assigned(fnControlService) then Result := fnControlService(hService, dwControl, lpServiceStatus) else Result := False;end;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;begin if Assigned(fnCreateServiceA) then Result := fnCreateServiceA(hSCManager, lpServiceName, lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword) else Result := 0;end;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;begin if Assigned(fnCreateServiceW) then Result := fnCreateServiceW(hSCManager, lpServiceName, lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword) else Result := 0;end;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;begin if Assigned(fnCreateService) then Result := fnCreateService(hSCManager, lpServiceName, lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, lpServiceStartName, lpPassword) else Result := 0;end;function DeleteService(hService: SC_HANDLE): BOOL; stdcall;begin if Assigned(fnDeleteService) then Result := fnDeleteService(hService) else Result := False;end;function EnumDependentServicesA(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;begin if Assigned(fnEnumDependentServicesA) then Result := fnEnumDependentServicesA(hService, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned) else Result := False;end;function EnumDependentServicesW(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;begin if Assigned(fnEnumDependentServicesW) then Result := fnEnumDependentServicesW(hService, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned) else Result := False;end;function EnumDependentServices(hService: SC_HANDLE; dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned : DWORD): BOOL; stdcall;begin if Assigned(fnEnumDependentServices) then Result := fnEnumDependentServices(hService, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned) else Result := False;end;function EnumServicesStatusA(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusA; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;begin if Assigned(fnEnumServicesStatusA) then Result := fnEnumServicesStatusA(hSCManager, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle) else Result := False;end;function EnumServicesStatusW(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatusW; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;begin if Assigned(fnEnumServicesStatusW) then Result := fnEnumServicesStatusW(hSCManager, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle) else Result := False;end;function EnumServicesStatus(hSCManager: SC_HANDLE; dwServiceType, dwServiceState: DWORD; var lpServices: TEnumServiceStatus; cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;begin if Assigned(fnEnumServicesStatus) then Result := fnEnumServicesStatus(hSCManager, dwServiceType, dwServiceState, lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle) else Result := False;end;function GetServiceKeyNameA(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceKeyNameA) then Result := fnGetServiceKeyNameA(hSCManager, lpDisplayName, lpServiceName, lpcchBuffer) else Result := False;end;function GetServiceKeyNameW(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceKeyNameW) then Result := fnGetServiceKeyNameW(hSCManager, lpDisplayName, lpServiceName, lpcchBuffer) else Result := False;end;function GetServiceKeyName(hSCManager: SC_HANDLE; lpDisplayName, lpServiceName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceKeyName) then Result := fnGetServiceKeyName(hSCManager, lpDisplayName, lpServiceName, lpcchBuffer) else Result := False;end;function GetServiceDisplayNameA(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PAnsiChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceDisplayNameA) then Result := fnGetServiceDisplayNameA(hSCManager, lpServiceName, lpDisplayName, lpcchBuffer) else Result := False;end;function GetServiceDisplayNameW(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PWideChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceDisplayNameW) then Result := fnGetServiceDisplayNameW(hSCManager, lpServiceName, lpDisplayName, lpcchBuffer) else Result := False;end;function GetServiceDisplayName(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: PChar; var lpcchBuffer: DWORD): BOOL; stdcall;begin if Assigned(fnGetServiceDisplayName) then Result := fnGetServiceDisplayName(hSCManager, lpServiceName, lpDisplayName, lpcchBuffer) else Result := False;end;function LockServiceDatabase(hSCManager: SC_HANDLE): SC_LOCK; stdcall;begin if Assigned(fnLockServiceDatabase) then Result := fnLockServiceDatabase(hSCManager) else Result := nil;end;function NotifyBootConfigStatus(BootAcceptable: BOOL): BOOL; stdcall;begin if Assigned(fnNotifyBootConfigStatus) then Result := fnNotifyBootConfigStatus(BootAcceptable) else Result := False;end;function OpenSCManagerA(lpMachineName, lpDatabaseName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenSCManagerA) then Result := fnOpenSCManagerA(lpMachineName, lpDatabaseName, dwDesiredAccess) else Result := 0;end;function OpenSCManagerW(lpMachineName, lpDatabaseName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenSCManagerW) then Result := fnOpenSCManagerW(lpMachineName, lpDatabaseName, dwDesiredAccess) else Result := 0;end;function OpenSCManager(lpMachineName, lpDatabaseName: PChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenSCManager) then Result := fnOpenSCManager(lpMachineName, lpDatabaseName, dwDesiredAccess) else Result := 0;end;function OpenServiceA(hSCManager: SC_HANDLE; lpServiceName: PAnsiChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenServiceA) then Result := fnOpenServiceA(hSCManager, lpServiceName, dwDesiredAccess) else Result := 0;end;function OpenServiceW(hSCManager: SC_HANDLE; lpServiceName: PWideChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenServiceW) then Result := fnOpenServiceW(hSCManager, lpServiceName, dwDesiredAccess) else Result := 0;end;function OpenService(hSCManager: SC_HANDLE; lpServiceName: PChar; dwDesiredAccess: DWORD): SC_HANDLE; stdcall;begin if Assigned(fnOpenService) then Result := fnOpenService(hSCManager, lpServiceName, dwDesiredAccess) else Result := 0;end;function QueryServiceConfigA(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceConfigA) then Result := fnQueryServiceConfigA(hService, lpServiceConfig, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceConfigW(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfigW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceConfigW) then Result := fnQueryServiceConfigW(hService, lpServiceConfig, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceConfig(hService: SC_HANDLE; lpServiceConfig: PQueryServiceConfig; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceConfig) then Result := fnQueryServiceConfig(hService, lpServiceConfig, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceLockStatusA(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusA; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceLockStatusA) then Result := fnQueryServiceLockStatusA(hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceLockStatusW(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatusW; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceLockStatusW) then Result := fnQueryServiceLockStatusW(hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceLockStatus(hSCManager: SC_HANDLE; var lpLockStatus: TQueryServiceLockStatus; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceLockStatus) then Result := fnQueryServiceLockStatus(hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceObjectSecurity(hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;begin if Assigned(fnQueryServiceObjectSecurity) then Result := fnQueryServiceObjectSecurity(hService, dwSecurityInformation, lpSecurityDescriptor, cbBufSize, pcbBytesNeeded) else Result := False;end;function QueryServiceStatus(hService: SC_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall;begin if Assigned(fnQueryServiceStatus) then Result := fnQueryServiceStatus(hService, lpServiceStatus) else Result := False;end;function RegisterServiceCtrlHandlerA(lpServiceName: PAnsiChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;begin if Assigned(fnRegisterServiceCtrlHandlerA) then Result := fnRegisterServiceCtrlHandlerA(lpServiceName, lpHandlerProc) else Result := 0;end;function RegisterServiceCtrlHandlerW(lpServiceName: PWideChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;begin if Assigned(fnRegisterServiceCtrlHandlerW) then Result := fnRegisterServiceCtrlHandlerW(lpServiceName, lpHandlerProc) else Result := 0;end;function RegisterServiceCtrlHandler(lpServiceName: PChar; lpHandlerProc: ThandlerFunction): SERVICE_STATUS_HANDLE; stdcall;begin if Assigned(fnRegisterServiceCtrlHandler) then Result := fnRegisterServiceCtrlHandler(lpServiceName, lpHandlerProc) else Result := 0;end;function SetServiceObjectSecurity(hService: SC_HANDLE; dwSecurityInformation: SECURITY_INFORMATION; lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall;begin if Assigned(fnSetServiceObjectSecurity) then Result := fnSetServiceObjectSecurity(hService, dwSecurityInformation, lpSecurityDescriptor) else Result := False;end;function SetServiceStatus(hServiceStatus: SERVICE_STATUS_HANDLE; var lpServiceStatus: TServiceStatus): BOOL; stdcall;begin if Assigned(fnSetServiceStatus) then Result := fnSetServiceStatus(hServiceStatus, lpServiceStatus) else Result := False;end;function StartServiceCtrlDispatcherA( var lpServiceStartTable: TServiceTableEntryA): BOOL; stdcall;begin if Assigned(fnStartServiceCtrlDispatcherA) then Result := fnStartServiceCtrlDispatcherA(lpServiceStartTable) else Result := False;end;function StartServiceCtrlDispatcherW( var lpServiceStartTable: TServiceTableEntryW): BOOL; stdcall;begin if Assigned(fnStartServiceCtrlDispatcherW) then Result := fnStartServiceCtrlDispatcherW(lpServiceStartTable) else Result := False;end;function StartServiceCtrlDispatcher( var lpServiceStartTable: TServiceTableEntry): BOOL; stdcall;begin if Assigned(fnStartServiceCtrlDispatcher) then Result := fnStartServiceCtrlDispatcher(lpServiceStartTable) else Result := False;end;function StartServiceA(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PAnsiChar): BOOL; stdcall;begin if Assigned(fnStartServiceA) then Result := fnStartServiceA(hService, dwNumServiceArgs, lpServiceArgVectors) else Result := False;end;function StartServiceW(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PWideChar): BOOL; stdcall;begin if Assigned(fnStartServiceW) then Result := fnStartServiceW(hService, dwNumServiceArgs, lpServiceArgVectors) else Result := False;end;function StartService(hService: SC_HANDLE; dwNumServiceArgs: DWORD; var lpServiceArgVectors: PChar): BOOL; stdcall;begin if Assigned(fnStartService) then Result := fnStartService(hService, dwNumServiceArgs, lpServiceArgVectors) else Result := False;end;function UnlockServiceDatabase(ScLock: SC_LOCK): BOOL; stdcall;begin if Assigned(fnUnlockServiceDatabase) then Result := fnUnlockServiceDatabase(ScLock) else Result := False;end;const advapi32 = 'advapi32.dll';var hadvapi32: HINST = 0;initialization hadvapi32 := LoadLibrary(advapi32); if (hadvapi32 0) then begin fnChangeServiceConfigA := GetProcAddress(hadvapi32, 'ChangeServiceConfigA'); fnChangeServiceConfigW := Get

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: