mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Launching PurePow
This commit is contained in:
parent
ea9e62ca3d
commit
9b24b8c229
8 changed files with 3961 additions and 0 deletions
1244
build/Source/FirewallControl.pas
Normal file
1244
build/Source/FirewallControl.pas
Normal file
File diff suppressed because it is too large
Load diff
126
build/Source/NSIS.pas
Normal file
126
build/Source/NSIS.pas
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
{
|
||||||
|
Original Code from
|
||||||
|
(C) 2001 - Peter Windridge
|
||||||
|
|
||||||
|
Code in seperate unit and some changes
|
||||||
|
2003 by Bernhard Mayer
|
||||||
|
|
||||||
|
Fixed and formatted by Brett Dever
|
||||||
|
http://editor.nfscheats.com/
|
||||||
|
|
||||||
|
simply include this unit in your plugin project and export
|
||||||
|
functions as needed
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unit nsis;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
windows;
|
||||||
|
|
||||||
|
type
|
||||||
|
VarConstants = (
|
||||||
|
INST_0, // $0
|
||||||
|
INST_1, // $1
|
||||||
|
INST_2, // $2
|
||||||
|
INST_3, // $3
|
||||||
|
INST_4, // $4
|
||||||
|
INST_5, // $5
|
||||||
|
INST_6, // $6
|
||||||
|
INST_7, // $7
|
||||||
|
INST_8, // $8
|
||||||
|
INST_9, // $9
|
||||||
|
INST_R0, // $R0
|
||||||
|
INST_R1, // $R1
|
||||||
|
INST_R2, // $R2
|
||||||
|
INST_R3, // $R3
|
||||||
|
INST_R4, // $R4
|
||||||
|
INST_R5, // $R5
|
||||||
|
INST_R6, // $R6
|
||||||
|
INST_R7, // $R7
|
||||||
|
INST_R8, // $R8
|
||||||
|
INST_R9, // $R9
|
||||||
|
INST_CMDLINE, // $CMDLINE
|
||||||
|
INST_INSTDIR, // $INSTDIR
|
||||||
|
INST_OUTDIR, // $OUTDIR
|
||||||
|
INST_EXEDIR, // $EXEDIR
|
||||||
|
INST_LANG, // $LANGUAGE
|
||||||
|
__INST_LAST
|
||||||
|
);
|
||||||
|
TVariableList = INST_0..__INST_LAST;
|
||||||
|
pstack_t = ^stack_t;
|
||||||
|
stack_t = record
|
||||||
|
next: pstack_t;
|
||||||
|
text: PChar;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
g_stringsize: integer;
|
||||||
|
g_stacktop: ^pstack_t;
|
||||||
|
g_variables: PChar;
|
||||||
|
g_hwndParent: HWND;
|
||||||
|
|
||||||
|
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
|
||||||
|
function PopString(): string;
|
||||||
|
procedure PushString(const str: string='');
|
||||||
|
function GetUserVariable(const varnum: TVariableList): string;
|
||||||
|
procedure SetUserVariable(const varnum: TVariableList; const value: string);
|
||||||
|
procedure NSISDialog(const text, caption: string; const buttons: integer);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
|
||||||
|
begin
|
||||||
|
g_stringsize := string_size;
|
||||||
|
g_hwndParent := hwndParent;
|
||||||
|
g_stacktop := stacktop;
|
||||||
|
g_variables := variables;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PopString(): string;
|
||||||
|
var
|
||||||
|
th: pstack_t;
|
||||||
|
begin
|
||||||
|
if integer(g_stacktop^) <> 0 then begin
|
||||||
|
th := g_stacktop^;
|
||||||
|
Result := PChar(@th.text);
|
||||||
|
g_stacktop^ := th.next;
|
||||||
|
GlobalFree(HGLOBAL(th));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure PushString(const str: string='');
|
||||||
|
var
|
||||||
|
th: pstack_t;
|
||||||
|
begin
|
||||||
|
if integer(g_stacktop) <> 0 then begin
|
||||||
|
th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
|
||||||
|
lstrcpyn(@th.text, PChar(str), g_stringsize);
|
||||||
|
th.next := g_stacktop^;
|
||||||
|
g_stacktop^ := th;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetUserVariable(const varnum: TVariableList): string;
|
||||||
|
begin
|
||||||
|
if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||||
|
Result := g_variables + integer(varnum) * g_stringsize
|
||||||
|
else
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SetUserVariable(const varnum: TVariableList; const value: string);
|
||||||
|
begin
|
||||||
|
if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||||
|
lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure NSISDialog(const text, caption: string; const buttons: integer);
|
||||||
|
begin
|
||||||
|
MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
BIN
build/Source/NetFwTypeLib_TLB.dcr
Normal file
BIN
build/Source/NetFwTypeLib_TLB.dcr
Normal file
Binary file not shown.
850
build/Source/NetFwTypeLib_TLB.pas
Normal file
850
build/Source/NetFwTypeLib_TLB.pas
Normal file
|
|
@ -0,0 +1,850 @@
|
||||||
|
unit NetFwTypeLib_TLB;
|
||||||
|
|
||||||
|
// ************************************************************************ //
|
||||||
|
// WARNUNG
|
||||||
|
// -------
|
||||||
|
// Die in dieser Datei deklarierten Typen wurden aus Daten einer Typbibliothek
|
||||||
|
// generiert. Wenn diese Typbibliothek explizit oder indirekt (über eine
|
||||||
|
// andere Typbibliothek) reimportiert wird oder wenn die Anweisung
|
||||||
|
// 'Aktualisieren' im Typbibliotheks-Editor während des Bearbeitens der
|
||||||
|
// Typbibliothek aktiviert ist, wird der Inhalt dieser Datei neu generiert und
|
||||||
|
// alle manuell vorgenommenen Änderungen gehen verloren.
|
||||||
|
// ************************************************************************ //
|
||||||
|
|
||||||
|
// PASTLWTR : $Revision: 1.130.1.0.1.0.1.6 $
|
||||||
|
// Datei generiert am 20.05.2007 16:34:09 aus der unten beschriebenen Typbibliothek.
|
||||||
|
|
||||||
|
// ************************************************************************ //
|
||||||
|
// Type Lib: FirewallAPI.dll (1)
|
||||||
|
// LIBID: {58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}
|
||||||
|
// LCID: 0
|
||||||
|
// Helpfile:
|
||||||
|
// DepndLst:
|
||||||
|
// (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
|
||||||
|
// (2) v4.0 StdVCL, (C:\WINDOWS\system32\stdvcl40.dll)
|
||||||
|
// Fehler
|
||||||
|
// Hinweis: Element 'Type' von 'INetFwService' geändert in 'Type_'
|
||||||
|
// Hinweis: Parameter 'Type' im INetFwService.Type geändert in 'Type_'
|
||||||
|
// Hinweis: Element 'Type' von 'INetFwProfile' geändert in 'Type_'
|
||||||
|
// Hinweis: Parameter 'Type' im INetFwProfile.Type geändert in 'Type_'
|
||||||
|
// Hinweis: Parameter 'Type' im INetFwMgr.IsIcmpTypeAllowed geändert in 'Type_'
|
||||||
|
// Hinweis: Element 'Type' von 'INetFwService' geändert in 'Type_'
|
||||||
|
// Hinweis: Element 'Type' von 'INetFwProfile' geändert in 'Type_'
|
||||||
|
// ************************************************************************ //
|
||||||
|
// *************************************************************************//
|
||||||
|
// HINWEIS:
|
||||||
|
// Von $IFDEF_LIVE_SERVER_AT_DESIGN_TIME überwachte Einträge, werden von
|
||||||
|
// Eigenschaften verwendet, die Objekte zurückgeben, die explizit mit einen Funktionsaufruf
|
||||||
|
// vor dem Zugriff über die Eigenschaft erzeugt werden müssen. Diese Einträge wurden deaktiviert,
|
||||||
|
// um deren unbeabsichtigte Benutzung im Objektinspektor zu verhindern. Sie können sie
|
||||||
|
// aktivieren, indem Sie LIVE_SERVER_AT_DESIGN_TIME definieren oder sie selektiv
|
||||||
|
// aus den $IFDEF-Blöcken entfernen. Solche Einträge müssen jedoch programmseitig
|
||||||
|
// mit einer Methode der geeigneten CoClass vor der Verwendung
|
||||||
|
// erzeugt werden.
|
||||||
|
{$TYPEDADDRESS OFF} // Unit muß ohne Typüberprüfung für Zeiger compiliert werden.
|
||||||
|
{$WARN SYMBOL_PLATFORM OFF}
|
||||||
|
{$WRITEABLECONST ON}
|
||||||
|
{$VARPROPSETTER ON}
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
|
||||||
|
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// In dieser Typbibliothek deklarierte GUIDS . Es werden folgende
|
||||||
|
// Präfixe verwendet:
|
||||||
|
// Typbibliotheken : LIBID_xxxx
|
||||||
|
// CoClasses : CLASS_xxxx
|
||||||
|
// DISPInterfaces : DIID_xxxx
|
||||||
|
// Nicht-DISP-Schnittstellen: IID_xxxx
|
||||||
|
// *********************************************************************//
|
||||||
|
const
|
||||||
|
// Haupt- und Nebenversionen der Typbibliothek
|
||||||
|
NetFwTypeLibMajorVersion = 1;
|
||||||
|
NetFwTypeLibMinorVersion = 0;
|
||||||
|
|
||||||
|
LIBID_NetFwTypeLib: TGUID = '{58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}';
|
||||||
|
|
||||||
|
IID_INetFwRemoteAdminSettings: TGUID = '{D4BECDDF-6F73-4A83-B832-9C66874CD20E}';
|
||||||
|
IID_INetFwIcmpSettings: TGUID = '{A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD}';
|
||||||
|
IID_INetFwOpenPort: TGUID = '{E0483BA0-47FF-4D9C-A6D6-7741D0B195F7}';
|
||||||
|
IID_INetFwOpenPorts: TGUID = '{C0E9D7FA-E07E-430A-B19A-090CE82D92E2}';
|
||||||
|
IID_INetFwService: TGUID = '{79FD57C8-908E-4A36-9888-D5B3F0A444CF}';
|
||||||
|
IID_INetFwServices: TGUID = '{79649BB4-903E-421B-94C9-79848E79F6EE}';
|
||||||
|
IID_INetFwAuthorizedApplication: TGUID = '{B5E64FFA-C2C5-444E-A301-FB5E00018050}';
|
||||||
|
IID_INetFwAuthorizedApplications: TGUID = '{644EFD52-CCF9-486C-97A2-39F352570B30}';
|
||||||
|
IID_INetFwServiceRestriction: TGUID = '{8267BBE3-F890-491C-B7B6-2DB1EF0E5D2B}';
|
||||||
|
IID_INetFwRules: TGUID = '{9C4C6277-5027-441E-AFAE-CA1F542DA009}';
|
||||||
|
IID_INetFwRule: TGUID = '{AF230D27-BABA-4E42-ACED-F524F22CFCE2}';
|
||||||
|
IID_INetFwProfile: TGUID = '{174A0DDA-E9F9-449D-993B-21AB667CA456}';
|
||||||
|
IID_INetFwPolicy: TGUID = '{D46D2478-9AC9-4008-9DC7-5563CE5536CC}';
|
||||||
|
IID_INetFwPolicy2: TGUID = '{98325047-C671-4174-8D81-DEFCD3F03186}';
|
||||||
|
IID_INetFwMgr: TGUID = '{F7898AF5-CAC4-4632-A2EC-DA06E5111AF2}';
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Deklaration von in der Typbibliothek definierten Enumerationen
|
||||||
|
// *********************************************************************//
|
||||||
|
// Konstanten für enum NET_FW_IP_VERSION_
|
||||||
|
type
|
||||||
|
NET_FW_IP_VERSION_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_IP_VERSION_V4 = $00000000;
|
||||||
|
NET_FW_IP_VERSION_V6 = $00000001;
|
||||||
|
NET_FW_IP_VERSION_ANY = $00000002;
|
||||||
|
NET_FW_IP_VERSION_MAX = $00000003;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_SCOPE_
|
||||||
|
type
|
||||||
|
NET_FW_SCOPE_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_SCOPE_ALL = $00000000;
|
||||||
|
NET_FW_SCOPE_LOCAL_SUBNET = $00000001;
|
||||||
|
NET_FW_SCOPE_CUSTOM = $00000002;
|
||||||
|
NET_FW_SCOPE_MAX = $00000003;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_IP_PROTOCOL_
|
||||||
|
type
|
||||||
|
NET_FW_IP_PROTOCOL_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_IP_PROTOCOL_TCP = $00000006;
|
||||||
|
NET_FW_IP_PROTOCOL_UDP = $00000011;
|
||||||
|
NET_FW_IP_PROTOCOL_ANY = $00000100;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_SERVICE_TYPE_
|
||||||
|
type
|
||||||
|
NET_FW_SERVICE_TYPE_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_SERVICE_FILE_AND_PRINT = $00000000;
|
||||||
|
NET_FW_SERVICE_UPNP = $00000001;
|
||||||
|
NET_FW_SERVICE_REMOTE_DESKTOP = $00000002;
|
||||||
|
NET_FW_SERVICE_NONE = $00000003;
|
||||||
|
NET_FW_SERVICE_TYPE_MAX = $00000004;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_RULE_DIRECTION_
|
||||||
|
type
|
||||||
|
NET_FW_RULE_DIRECTION_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_RULE_DIR_IN = $00000001;
|
||||||
|
NET_FW_RULE_DIR_OUT = $00000002;
|
||||||
|
NET_FW_RULE_DIR_MAX = $00000003;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_ACTION_
|
||||||
|
type
|
||||||
|
NET_FW_ACTION_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_ACTION_BLOCK = $00000000;
|
||||||
|
NET_FW_ACTION_ALLOW = $00000001;
|
||||||
|
NET_FW_ACTION_MAX = $00000002;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_PROFILE_TYPE_
|
||||||
|
type
|
||||||
|
NET_FW_PROFILE_TYPE_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_PROFILE_DOMAIN = $00000000;
|
||||||
|
NET_FW_PROFILE_STANDARD = $00000001;
|
||||||
|
NET_FW_PROFILE_CURRENT = $00000002;
|
||||||
|
NET_FW_PROFILE_TYPE_MAX = $00000003;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_PROFILE_TYPE2_
|
||||||
|
type
|
||||||
|
NET_FW_PROFILE_TYPE2_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_PROFILE2_DOMAIN = $00000001;
|
||||||
|
NET_FW_PROFILE2_PRIVATE = $00000002;
|
||||||
|
NET_FW_PROFILE2_PUBLIC = $00000004;
|
||||||
|
NET_FW_PROFILE2_ALL = $7FFFFFFF;
|
||||||
|
|
||||||
|
// Konstanten für enum NET_FW_MODIFY_STATE_
|
||||||
|
type
|
||||||
|
NET_FW_MODIFY_STATE_ = TOleEnum;
|
||||||
|
const
|
||||||
|
NET_FW_MODIFY_STATE_OK = $00000000;
|
||||||
|
NET_FW_MODIFY_STATE_GP_OVERRIDE = $00000001;
|
||||||
|
NET_FW_MODIFY_STATE_INBOUND_BLOCKED = $00000002;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Forward-Deklaration von in der Typbibliothek definierten Typen
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRemoteAdminSettings = interface;
|
||||||
|
INetFwRemoteAdminSettingsDisp = dispinterface;
|
||||||
|
INetFwIcmpSettings = interface;
|
||||||
|
INetFwIcmpSettingsDisp = dispinterface;
|
||||||
|
INetFwOpenPort = interface;
|
||||||
|
INetFwOpenPortDisp = dispinterface;
|
||||||
|
INetFwOpenPorts = interface;
|
||||||
|
INetFwOpenPortsDisp = dispinterface;
|
||||||
|
INetFwService = interface;
|
||||||
|
INetFwServiceDisp = dispinterface;
|
||||||
|
INetFwServices = interface;
|
||||||
|
INetFwServicesDisp = dispinterface;
|
||||||
|
INetFwAuthorizedApplication = interface;
|
||||||
|
INetFwAuthorizedApplicationDisp = dispinterface;
|
||||||
|
INetFwAuthorizedApplications = interface;
|
||||||
|
INetFwAuthorizedApplicationsDisp = dispinterface;
|
||||||
|
INetFwServiceRestriction = interface;
|
||||||
|
INetFwServiceRestrictionDisp = dispinterface;
|
||||||
|
INetFwRules = interface;
|
||||||
|
INetFwRulesDisp = dispinterface;
|
||||||
|
INetFwRule = interface;
|
||||||
|
INetFwRuleDisp = dispinterface;
|
||||||
|
INetFwProfile = interface;
|
||||||
|
INetFwProfileDisp = dispinterface;
|
||||||
|
INetFwPolicy = interface;
|
||||||
|
INetFwPolicyDisp = dispinterface;
|
||||||
|
INetFwPolicy2 = interface;
|
||||||
|
INetFwPolicy2Disp = dispinterface;
|
||||||
|
INetFwMgr = interface;
|
||||||
|
INetFwMgrDisp = dispinterface;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwRemoteAdminSettings
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {D4BECDDF-6F73-4A83-B832-9C66874CD20E}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRemoteAdminSettings = interface(IDispatch)
|
||||||
|
['{D4BECDDF-6F73-4A83-B832-9C66874CD20E}']
|
||||||
|
function Get_IpVersion: NET_FW_IP_VERSION_; safecall;
|
||||||
|
procedure Set_IpVersion(IpVersion: NET_FW_IP_VERSION_); safecall;
|
||||||
|
function Get_Scope: NET_FW_SCOPE_; safecall;
|
||||||
|
procedure Set_Scope(Scope: NET_FW_SCOPE_); safecall;
|
||||||
|
function Get_RemoteAddresses: WideString; safecall;
|
||||||
|
procedure Set_RemoteAddresses(const remoteAddrs: WideString); safecall;
|
||||||
|
function Get_Enabled: WordBool; safecall;
|
||||||
|
procedure Set_Enabled(Enabled: WordBool); safecall;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ read Get_IpVersion write Set_IpVersion;
|
||||||
|
property Scope: NET_FW_SCOPE_ read Get_Scope write Set_Scope;
|
||||||
|
property RemoteAddresses: WideString read Get_RemoteAddresses write Set_RemoteAddresses;
|
||||||
|
property Enabled: WordBool read Get_Enabled write Set_Enabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwRemoteAdminSettingsDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {D4BECDDF-6F73-4A83-B832-9C66874CD20E}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRemoteAdminSettingsDisp = dispinterface
|
||||||
|
['{D4BECDDF-6F73-4A83-B832-9C66874CD20E}']
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ dispid 1;
|
||||||
|
property Scope: NET_FW_SCOPE_ dispid 2;
|
||||||
|
property RemoteAddresses: WideString dispid 3;
|
||||||
|
property Enabled: WordBool dispid 4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwIcmpSettings
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwIcmpSettings = interface(IDispatch)
|
||||||
|
['{A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD}']
|
||||||
|
function Get_AllowOutboundDestinationUnreachable: WordBool; safecall;
|
||||||
|
procedure Set_AllowOutboundDestinationUnreachable(allow: WordBool); safecall;
|
||||||
|
function Get_AllowRedirect: WordBool; safecall;
|
||||||
|
procedure Set_AllowRedirect(allow: WordBool); safecall;
|
||||||
|
function Get_AllowInboundEchoRequest: WordBool; safecall;
|
||||||
|
procedure Set_AllowInboundEchoRequest(allow: WordBool); safecall;
|
||||||
|
function Get_AllowOutboundTimeExceeded: WordBool; safecall;
|
||||||
|
procedure Set_AllowOutboundTimeExceeded(allow: WordBool); safecall;
|
||||||
|
function Get_AllowOutboundParameterProblem: WordBool; safecall;
|
||||||
|
procedure Set_AllowOutboundParameterProblem(allow: WordBool); safecall;
|
||||||
|
function Get_AllowOutboundSourceQuench: WordBool; safecall;
|
||||||
|
procedure Set_AllowOutboundSourceQuench(allow: WordBool); safecall;
|
||||||
|
function Get_AllowInboundRouterRequest: WordBool; safecall;
|
||||||
|
procedure Set_AllowInboundRouterRequest(allow: WordBool); safecall;
|
||||||
|
function Get_AllowInboundTimestampRequest: WordBool; safecall;
|
||||||
|
procedure Set_AllowInboundTimestampRequest(allow: WordBool); safecall;
|
||||||
|
function Get_AllowInboundMaskRequest: WordBool; safecall;
|
||||||
|
procedure Set_AllowInboundMaskRequest(allow: WordBool); safecall;
|
||||||
|
function Get_AllowOutboundPacketTooBig: WordBool; safecall;
|
||||||
|
procedure Set_AllowOutboundPacketTooBig(allow: WordBool); safecall;
|
||||||
|
property AllowOutboundDestinationUnreachable: WordBool read Get_AllowOutboundDestinationUnreachable write Set_AllowOutboundDestinationUnreachable;
|
||||||
|
property AllowRedirect: WordBool read Get_AllowRedirect write Set_AllowRedirect;
|
||||||
|
property AllowInboundEchoRequest: WordBool read Get_AllowInboundEchoRequest write Set_AllowInboundEchoRequest;
|
||||||
|
property AllowOutboundTimeExceeded: WordBool read Get_AllowOutboundTimeExceeded write Set_AllowOutboundTimeExceeded;
|
||||||
|
property AllowOutboundParameterProblem: WordBool read Get_AllowOutboundParameterProblem write Set_AllowOutboundParameterProblem;
|
||||||
|
property AllowOutboundSourceQuench: WordBool read Get_AllowOutboundSourceQuench write Set_AllowOutboundSourceQuench;
|
||||||
|
property AllowInboundRouterRequest: WordBool read Get_AllowInboundRouterRequest write Set_AllowInboundRouterRequest;
|
||||||
|
property AllowInboundTimestampRequest: WordBool read Get_AllowInboundTimestampRequest write Set_AllowInboundTimestampRequest;
|
||||||
|
property AllowInboundMaskRequest: WordBool read Get_AllowInboundMaskRequest write Set_AllowInboundMaskRequest;
|
||||||
|
property AllowOutboundPacketTooBig: WordBool read Get_AllowOutboundPacketTooBig write Set_AllowOutboundPacketTooBig;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwIcmpSettingsDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwIcmpSettingsDisp = dispinterface
|
||||||
|
['{A6207B2E-7CDD-426A-951E-5E1CBC5AFEAD}']
|
||||||
|
property AllowOutboundDestinationUnreachable: WordBool dispid 1;
|
||||||
|
property AllowRedirect: WordBool dispid 2;
|
||||||
|
property AllowInboundEchoRequest: WordBool dispid 3;
|
||||||
|
property AllowOutboundTimeExceeded: WordBool dispid 4;
|
||||||
|
property AllowOutboundParameterProblem: WordBool dispid 5;
|
||||||
|
property AllowOutboundSourceQuench: WordBool dispid 6;
|
||||||
|
property AllowInboundRouterRequest: WordBool dispid 7;
|
||||||
|
property AllowInboundTimestampRequest: WordBool dispid 8;
|
||||||
|
property AllowInboundMaskRequest: WordBool dispid 9;
|
||||||
|
property AllowOutboundPacketTooBig: WordBool dispid 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwOpenPort
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {E0483BA0-47FF-4D9C-A6D6-7741D0B195F7}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwOpenPort = interface(IDispatch)
|
||||||
|
['{E0483BA0-47FF-4D9C-A6D6-7741D0B195F7}']
|
||||||
|
function Get_Name: WideString; safecall;
|
||||||
|
procedure Set_Name(const Name: WideString); safecall;
|
||||||
|
function Get_IpVersion: NET_FW_IP_VERSION_; safecall;
|
||||||
|
procedure Set_IpVersion(IpVersion: NET_FW_IP_VERSION_); safecall;
|
||||||
|
function Get_Protocol: NET_FW_IP_PROTOCOL_; safecall;
|
||||||
|
procedure Set_Protocol(ipProtocol: NET_FW_IP_PROTOCOL_); safecall;
|
||||||
|
function Get_Port: Integer; safecall;
|
||||||
|
procedure Set_Port(portNumber: Integer); safecall;
|
||||||
|
function Get_Scope: NET_FW_SCOPE_; safecall;
|
||||||
|
procedure Set_Scope(Scope: NET_FW_SCOPE_); safecall;
|
||||||
|
function Get_RemoteAddresses: WideString; safecall;
|
||||||
|
procedure Set_RemoteAddresses(const remoteAddrs: WideString); safecall;
|
||||||
|
function Get_Enabled: WordBool; safecall;
|
||||||
|
procedure Set_Enabled(Enabled: WordBool); safecall;
|
||||||
|
function Get_BuiltIn: WordBool; safecall;
|
||||||
|
property Name: WideString read Get_Name write Set_Name;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ read Get_IpVersion write Set_IpVersion;
|
||||||
|
property Protocol: NET_FW_IP_PROTOCOL_ read Get_Protocol write Set_Protocol;
|
||||||
|
property Port: Integer read Get_Port write Set_Port;
|
||||||
|
property Scope: NET_FW_SCOPE_ read Get_Scope write Set_Scope;
|
||||||
|
property RemoteAddresses: WideString read Get_RemoteAddresses write Set_RemoteAddresses;
|
||||||
|
property Enabled: WordBool read Get_Enabled write Set_Enabled;
|
||||||
|
property BuiltIn: WordBool read Get_BuiltIn;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwOpenPortDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {E0483BA0-47FF-4D9C-A6D6-7741D0B195F7}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwOpenPortDisp = dispinterface
|
||||||
|
['{E0483BA0-47FF-4D9C-A6D6-7741D0B195F7}']
|
||||||
|
property Name: WideString dispid 1;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ dispid 2;
|
||||||
|
property Protocol: NET_FW_IP_PROTOCOL_ dispid 3;
|
||||||
|
property Port: Integer dispid 4;
|
||||||
|
property Scope: NET_FW_SCOPE_ dispid 5;
|
||||||
|
property RemoteAddresses: WideString dispid 6;
|
||||||
|
property Enabled: WordBool dispid 7;
|
||||||
|
property BuiltIn: WordBool readonly dispid 8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwOpenPorts
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {C0E9D7FA-E07E-430A-B19A-090CE82D92E2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwOpenPorts = interface(IDispatch)
|
||||||
|
['{C0E9D7FA-E07E-430A-B19A-090CE82D92E2}']
|
||||||
|
function Get_Count: Integer; safecall;
|
||||||
|
procedure Add(const Port: INetFwOpenPort); safecall;
|
||||||
|
procedure Remove(portNumber: Integer; ipProtocol: NET_FW_IP_PROTOCOL_); safecall;
|
||||||
|
function Item(portNumber: Integer; ipProtocol: NET_FW_IP_PROTOCOL_): INetFwOpenPort; safecall;
|
||||||
|
function Get__NewEnum: IUnknown; safecall;
|
||||||
|
property Count: Integer read Get_Count;
|
||||||
|
property _NewEnum: IUnknown read Get__NewEnum;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwOpenPortsDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {C0E9D7FA-E07E-430A-B19A-090CE82D92E2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwOpenPortsDisp = dispinterface
|
||||||
|
['{C0E9D7FA-E07E-430A-B19A-090CE82D92E2}']
|
||||||
|
property Count: Integer readonly dispid 1;
|
||||||
|
procedure Add(const Port: INetFwOpenPort); dispid 2;
|
||||||
|
procedure Remove(portNumber: Integer; ipProtocol: NET_FW_IP_PROTOCOL_); dispid 3;
|
||||||
|
function Item(portNumber: Integer; ipProtocol: NET_FW_IP_PROTOCOL_): INetFwOpenPort; dispid 4;
|
||||||
|
property _NewEnum: IUnknown readonly dispid -4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwService
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {79FD57C8-908E-4A36-9888-D5B3F0A444CF}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwService = interface(IDispatch)
|
||||||
|
['{79FD57C8-908E-4A36-9888-D5B3F0A444CF}']
|
||||||
|
function Get_Name: WideString; safecall;
|
||||||
|
function Get_Type_: NET_FW_SERVICE_TYPE_; safecall;
|
||||||
|
function Get_Customized: WordBool; safecall;
|
||||||
|
function Get_IpVersion: NET_FW_IP_VERSION_; safecall;
|
||||||
|
procedure Set_IpVersion(IpVersion: NET_FW_IP_VERSION_); safecall;
|
||||||
|
function Get_Scope: NET_FW_SCOPE_; safecall;
|
||||||
|
procedure Set_Scope(Scope: NET_FW_SCOPE_); safecall;
|
||||||
|
function Get_RemoteAddresses: WideString; safecall;
|
||||||
|
procedure Set_RemoteAddresses(const remoteAddrs: WideString); safecall;
|
||||||
|
function Get_Enabled: WordBool; safecall;
|
||||||
|
procedure Set_Enabled(Enabled: WordBool); safecall;
|
||||||
|
function Get_GloballyOpenPorts: INetFwOpenPorts; safecall;
|
||||||
|
property Name: WideString read Get_Name;
|
||||||
|
property Type_: NET_FW_SERVICE_TYPE_ read Get_Type_;
|
||||||
|
property Customized: WordBool read Get_Customized;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ read Get_IpVersion write Set_IpVersion;
|
||||||
|
property Scope: NET_FW_SCOPE_ read Get_Scope write Set_Scope;
|
||||||
|
property RemoteAddresses: WideString read Get_RemoteAddresses write Set_RemoteAddresses;
|
||||||
|
property Enabled: WordBool read Get_Enabled write Set_Enabled;
|
||||||
|
property GloballyOpenPorts: INetFwOpenPorts read Get_GloballyOpenPorts;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwServiceDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {79FD57C8-908E-4A36-9888-D5B3F0A444CF}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwServiceDisp = dispinterface
|
||||||
|
['{79FD57C8-908E-4A36-9888-D5B3F0A444CF}']
|
||||||
|
property Name: WideString readonly dispid 1;
|
||||||
|
property Type_: NET_FW_SERVICE_TYPE_ readonly dispid 2;
|
||||||
|
property Customized: WordBool readonly dispid 3;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ dispid 4;
|
||||||
|
property Scope: NET_FW_SCOPE_ dispid 5;
|
||||||
|
property RemoteAddresses: WideString dispid 6;
|
||||||
|
property Enabled: WordBool dispid 7;
|
||||||
|
property GloballyOpenPorts: INetFwOpenPorts readonly dispid 8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwServices
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {79649BB4-903E-421B-94C9-79848E79F6EE}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwServices = interface(IDispatch)
|
||||||
|
['{79649BB4-903E-421B-94C9-79848E79F6EE}']
|
||||||
|
function Get_Count: Integer; safecall;
|
||||||
|
function Item(svcType: NET_FW_SERVICE_TYPE_): INetFwService; safecall;
|
||||||
|
function Get__NewEnum: IUnknown; safecall;
|
||||||
|
property Count: Integer read Get_Count;
|
||||||
|
property _NewEnum: IUnknown read Get__NewEnum;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwServicesDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {79649BB4-903E-421B-94C9-79848E79F6EE}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwServicesDisp = dispinterface
|
||||||
|
['{79649BB4-903E-421B-94C9-79848E79F6EE}']
|
||||||
|
property Count: Integer readonly dispid 1;
|
||||||
|
function Item(svcType: NET_FW_SERVICE_TYPE_): INetFwService; dispid 2;
|
||||||
|
property _NewEnum: IUnknown readonly dispid -4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwAuthorizedApplication
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {B5E64FFA-C2C5-444E-A301-FB5E00018050}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwAuthorizedApplication = interface(IDispatch)
|
||||||
|
['{B5E64FFA-C2C5-444E-A301-FB5E00018050}']
|
||||||
|
function Get_Name: WideString; safecall;
|
||||||
|
procedure Set_Name(const Name: WideString); safecall;
|
||||||
|
function Get_ProcessImageFileName: WideString; safecall;
|
||||||
|
procedure Set_ProcessImageFileName(const imageFileName: WideString); safecall;
|
||||||
|
function Get_IpVersion: NET_FW_IP_VERSION_; safecall;
|
||||||
|
procedure Set_IpVersion(IpVersion: NET_FW_IP_VERSION_); safecall;
|
||||||
|
function Get_Scope: NET_FW_SCOPE_; safecall;
|
||||||
|
procedure Set_Scope(Scope: NET_FW_SCOPE_); safecall;
|
||||||
|
function Get_RemoteAddresses: WideString; safecall;
|
||||||
|
procedure Set_RemoteAddresses(const remoteAddrs: WideString); safecall;
|
||||||
|
function Get_Enabled: WordBool; safecall;
|
||||||
|
procedure Set_Enabled(Enabled: WordBool); safecall;
|
||||||
|
property Name: WideString read Get_Name write Set_Name;
|
||||||
|
property ProcessImageFileName: WideString read Get_ProcessImageFileName write Set_ProcessImageFileName;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ read Get_IpVersion write Set_IpVersion;
|
||||||
|
property Scope: NET_FW_SCOPE_ read Get_Scope write Set_Scope;
|
||||||
|
property RemoteAddresses: WideString read Get_RemoteAddresses write Set_RemoteAddresses;
|
||||||
|
property Enabled: WordBool read Get_Enabled write Set_Enabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwAuthorizedApplicationDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {B5E64FFA-C2C5-444E-A301-FB5E00018050}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwAuthorizedApplicationDisp = dispinterface
|
||||||
|
['{B5E64FFA-C2C5-444E-A301-FB5E00018050}']
|
||||||
|
property Name: WideString dispid 1;
|
||||||
|
property ProcessImageFileName: WideString dispid 2;
|
||||||
|
property IpVersion: NET_FW_IP_VERSION_ dispid 3;
|
||||||
|
property Scope: NET_FW_SCOPE_ dispid 4;
|
||||||
|
property RemoteAddresses: WideString dispid 5;
|
||||||
|
property Enabled: WordBool dispid 6;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwAuthorizedApplications
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {644EFD52-CCF9-486C-97A2-39F352570B30}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwAuthorizedApplications = interface(IDispatch)
|
||||||
|
['{644EFD52-CCF9-486C-97A2-39F352570B30}']
|
||||||
|
function Get_Count: Integer; safecall;
|
||||||
|
procedure Add(const app: INetFwAuthorizedApplication); safecall;
|
||||||
|
procedure Remove(const imageFileName: WideString); safecall;
|
||||||
|
function Item(const imageFileName: WideString): INetFwAuthorizedApplication; safecall;
|
||||||
|
function Get__NewEnum: IUnknown; safecall;
|
||||||
|
property Count: Integer read Get_Count;
|
||||||
|
property _NewEnum: IUnknown read Get__NewEnum;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwAuthorizedApplicationsDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {644EFD52-CCF9-486C-97A2-39F352570B30}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwAuthorizedApplicationsDisp = dispinterface
|
||||||
|
['{644EFD52-CCF9-486C-97A2-39F352570B30}']
|
||||||
|
property Count: Integer readonly dispid 1;
|
||||||
|
procedure Add(const app: INetFwAuthorizedApplication); dispid 2;
|
||||||
|
procedure Remove(const imageFileName: WideString); dispid 3;
|
||||||
|
function Item(const imageFileName: WideString): INetFwAuthorizedApplication; dispid 4;
|
||||||
|
property _NewEnum: IUnknown readonly dispid -4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwServiceRestriction
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {8267BBE3-F890-491C-B7B6-2DB1EF0E5D2B}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwServiceRestriction = interface(IDispatch)
|
||||||
|
['{8267BBE3-F890-491C-B7B6-2DB1EF0E5D2B}']
|
||||||
|
procedure RestrictService(const serviceName: WideString; const appName: WideString;
|
||||||
|
RestrictService: WordBool; serviceSidRestricted: WordBool); safecall;
|
||||||
|
function ServiceRestricted(const serviceName: WideString; const appName: WideString): WordBool; safecall;
|
||||||
|
function Get_Rules: INetFwRules; safecall;
|
||||||
|
property Rules: INetFwRules read Get_Rules;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwServiceRestrictionDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {8267BBE3-F890-491C-B7B6-2DB1EF0E5D2B}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwServiceRestrictionDisp = dispinterface
|
||||||
|
['{8267BBE3-F890-491C-B7B6-2DB1EF0E5D2B}']
|
||||||
|
procedure RestrictService(const serviceName: WideString; const appName: WideString;
|
||||||
|
RestrictService: WordBool; serviceSidRestricted: WordBool); dispid 1;
|
||||||
|
function ServiceRestricted(const serviceName: WideString; const appName: WideString): WordBool; dispid 2;
|
||||||
|
property Rules: INetFwRules readonly dispid 3;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwRules
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {9C4C6277-5027-441E-AFAE-CA1F542DA009}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRules = interface(IDispatch)
|
||||||
|
['{9C4C6277-5027-441E-AFAE-CA1F542DA009}']
|
||||||
|
function Get_Count: Integer; safecall;
|
||||||
|
procedure Add(const rule: INetFwRule); safecall;
|
||||||
|
procedure Remove(const Name: WideString); safecall;
|
||||||
|
function Item(const Name: WideString): INetFwRule; safecall;
|
||||||
|
function Get__NewEnum: IUnknown; safecall;
|
||||||
|
property Count: Integer read Get_Count;
|
||||||
|
property _NewEnum: IUnknown read Get__NewEnum;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwRulesDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {9C4C6277-5027-441E-AFAE-CA1F542DA009}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRulesDisp = dispinterface
|
||||||
|
['{9C4C6277-5027-441E-AFAE-CA1F542DA009}']
|
||||||
|
property Count: Integer readonly dispid 1;
|
||||||
|
procedure Add(const rule: INetFwRule); dispid 2;
|
||||||
|
procedure Remove(const Name: WideString); dispid 3;
|
||||||
|
function Item(const Name: WideString): INetFwRule; dispid 4;
|
||||||
|
property _NewEnum: IUnknown readonly dispid -4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwRule
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {AF230D27-BABA-4E42-ACED-F524F22CFCE2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRule = interface(IDispatch)
|
||||||
|
['{AF230D27-BABA-4E42-ACED-F524F22CFCE2}']
|
||||||
|
function Get_Name: WideString; safecall;
|
||||||
|
procedure Set_Name(const Name: WideString); safecall;
|
||||||
|
function Get_Description: WideString; safecall;
|
||||||
|
procedure Set_Description(const desc: WideString); safecall;
|
||||||
|
function Get_ApplicationName: WideString; safecall;
|
||||||
|
procedure Set_ApplicationName(const imageFileName: WideString); safecall;
|
||||||
|
function Get_serviceName: WideString; safecall;
|
||||||
|
procedure Set_serviceName(const serviceName: WideString); safecall;
|
||||||
|
function Get_Protocol: Integer; safecall;
|
||||||
|
procedure Set_Protocol(Protocol: Integer); safecall;
|
||||||
|
function Get_LocalPorts: WideString; safecall;
|
||||||
|
procedure Set_LocalPorts(const portNumbers: WideString); safecall;
|
||||||
|
function Get_RemotePorts: WideString; safecall;
|
||||||
|
procedure Set_RemotePorts(const portNumbers: WideString); safecall;
|
||||||
|
function Get_LocalAddresses: WideString; safecall;
|
||||||
|
procedure Set_LocalAddresses(const localAddrs: WideString); safecall;
|
||||||
|
function Get_RemoteAddresses: WideString; safecall;
|
||||||
|
procedure Set_RemoteAddresses(const remoteAddrs: WideString); safecall;
|
||||||
|
function Get_IcmpTypesAndCodes: WideString; safecall;
|
||||||
|
procedure Set_IcmpTypesAndCodes(const IcmpTypesAndCodes: WideString); safecall;
|
||||||
|
function Get_Direction: NET_FW_RULE_DIRECTION_; safecall;
|
||||||
|
procedure Set_Direction(dir: NET_FW_RULE_DIRECTION_); safecall;
|
||||||
|
function Get_Interfaces: OleVariant; safecall;
|
||||||
|
procedure Set_Interfaces(Interfaces: OleVariant); safecall;
|
||||||
|
function Get_InterfaceTypes: WideString; safecall;
|
||||||
|
procedure Set_InterfaceTypes(const InterfaceTypes: WideString); safecall;
|
||||||
|
function Get_Enabled: WordBool; safecall;
|
||||||
|
procedure Set_Enabled(Enabled: WordBool); safecall;
|
||||||
|
function Get_Grouping: WideString; safecall;
|
||||||
|
procedure Set_Grouping(const context: WideString); safecall;
|
||||||
|
function Get_Profiles: Integer; safecall;
|
||||||
|
procedure Set_Profiles(profileTypesBitmask: Integer); safecall;
|
||||||
|
function Get_EdgeTraversal: WordBool; safecall;
|
||||||
|
procedure Set_EdgeTraversal(Enabled: WordBool); safecall;
|
||||||
|
function Get_Action: NET_FW_ACTION_; safecall;
|
||||||
|
procedure Set_Action(Action: NET_FW_ACTION_); safecall;
|
||||||
|
property Name: WideString read Get_Name write Set_Name;
|
||||||
|
property Description: WideString read Get_Description write Set_Description;
|
||||||
|
property ApplicationName: WideString read Get_ApplicationName write Set_ApplicationName;
|
||||||
|
property serviceName: WideString read Get_serviceName write Set_serviceName;
|
||||||
|
property Protocol: Integer read Get_Protocol write Set_Protocol;
|
||||||
|
property LocalPorts: WideString read Get_LocalPorts write Set_LocalPorts;
|
||||||
|
property RemotePorts: WideString read Get_RemotePorts write Set_RemotePorts;
|
||||||
|
property LocalAddresses: WideString read Get_LocalAddresses write Set_LocalAddresses;
|
||||||
|
property RemoteAddresses: WideString read Get_RemoteAddresses write Set_RemoteAddresses;
|
||||||
|
property IcmpTypesAndCodes: WideString read Get_IcmpTypesAndCodes write Set_IcmpTypesAndCodes;
|
||||||
|
property Direction: NET_FW_RULE_DIRECTION_ read Get_Direction write Set_Direction;
|
||||||
|
property Interfaces: OleVariant read Get_Interfaces write Set_Interfaces;
|
||||||
|
property InterfaceTypes: WideString read Get_InterfaceTypes write Set_InterfaceTypes;
|
||||||
|
property Enabled: WordBool read Get_Enabled write Set_Enabled;
|
||||||
|
property Grouping: WideString read Get_Grouping write Set_Grouping;
|
||||||
|
property Profiles: Integer read Get_Profiles write Set_Profiles;
|
||||||
|
property EdgeTraversal: WordBool read Get_EdgeTraversal write Set_EdgeTraversal;
|
||||||
|
property Action: NET_FW_ACTION_ read Get_Action write Set_Action;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwRuleDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {AF230D27-BABA-4E42-ACED-F524F22CFCE2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwRuleDisp = dispinterface
|
||||||
|
['{AF230D27-BABA-4E42-ACED-F524F22CFCE2}']
|
||||||
|
property Name: WideString dispid 1;
|
||||||
|
property Description: WideString dispid 2;
|
||||||
|
property ApplicationName: WideString dispid 3;
|
||||||
|
property serviceName: WideString dispid 4;
|
||||||
|
property Protocol: Integer dispid 5;
|
||||||
|
property LocalPorts: WideString dispid 6;
|
||||||
|
property RemotePorts: WideString dispid 7;
|
||||||
|
property LocalAddresses: WideString dispid 8;
|
||||||
|
property RemoteAddresses: WideString dispid 9;
|
||||||
|
property IcmpTypesAndCodes: WideString dispid 10;
|
||||||
|
property Direction: NET_FW_RULE_DIRECTION_ dispid 11;
|
||||||
|
property Interfaces: OleVariant dispid 12;
|
||||||
|
property InterfaceTypes: WideString dispid 13;
|
||||||
|
property Enabled: WordBool dispid 14;
|
||||||
|
property Grouping: WideString dispid 15;
|
||||||
|
property Profiles: Integer dispid 16;
|
||||||
|
property EdgeTraversal: WordBool dispid 17;
|
||||||
|
property Action: NET_FW_ACTION_ dispid 18;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwProfile
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {174A0DDA-E9F9-449D-993B-21AB667CA456}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwProfile = interface(IDispatch)
|
||||||
|
['{174A0DDA-E9F9-449D-993B-21AB667CA456}']
|
||||||
|
function Get_Type_: NET_FW_PROFILE_TYPE_; safecall;
|
||||||
|
function Get_FirewallEnabled: WordBool; safecall;
|
||||||
|
procedure Set_FirewallEnabled(Enabled: WordBool); safecall;
|
||||||
|
function Get_ExceptionsNotAllowed: WordBool; safecall;
|
||||||
|
procedure Set_ExceptionsNotAllowed(notAllowed: WordBool); safecall;
|
||||||
|
function Get_NotificationsDisabled: WordBool; safecall;
|
||||||
|
procedure Set_NotificationsDisabled(disabled: WordBool); safecall;
|
||||||
|
function Get_UnicastResponsesToMulticastBroadcastDisabled: WordBool; safecall;
|
||||||
|
procedure Set_UnicastResponsesToMulticastBroadcastDisabled(disabled: WordBool); safecall;
|
||||||
|
function Get_RemoteAdminSettings: INetFwRemoteAdminSettings; safecall;
|
||||||
|
function Get_IcmpSettings: INetFwIcmpSettings; safecall;
|
||||||
|
function Get_GloballyOpenPorts: INetFwOpenPorts; safecall;
|
||||||
|
function Get_Services: INetFwServices; safecall;
|
||||||
|
function Get_AuthorizedApplications: INetFwAuthorizedApplications; safecall;
|
||||||
|
property Type_: NET_FW_PROFILE_TYPE_ read Get_Type_;
|
||||||
|
property FirewallEnabled: WordBool read Get_FirewallEnabled write Set_FirewallEnabled;
|
||||||
|
property ExceptionsNotAllowed: WordBool read Get_ExceptionsNotAllowed write Set_ExceptionsNotAllowed;
|
||||||
|
property NotificationsDisabled: WordBool read Get_NotificationsDisabled write Set_NotificationsDisabled;
|
||||||
|
property UnicastResponsesToMulticastBroadcastDisabled: WordBool read Get_UnicastResponsesToMulticastBroadcastDisabled write Set_UnicastResponsesToMulticastBroadcastDisabled;
|
||||||
|
property RemoteAdminSettings: INetFwRemoteAdminSettings read Get_RemoteAdminSettings;
|
||||||
|
property IcmpSettings: INetFwIcmpSettings read Get_IcmpSettings;
|
||||||
|
property GloballyOpenPorts: INetFwOpenPorts read Get_GloballyOpenPorts;
|
||||||
|
property Services: INetFwServices read Get_Services;
|
||||||
|
property AuthorizedApplications: INetFwAuthorizedApplications read Get_AuthorizedApplications;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwProfileDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {174A0DDA-E9F9-449D-993B-21AB667CA456}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwProfileDisp = dispinterface
|
||||||
|
['{174A0DDA-E9F9-449D-993B-21AB667CA456}']
|
||||||
|
property Type_: NET_FW_PROFILE_TYPE_ readonly dispid 1;
|
||||||
|
property FirewallEnabled: WordBool dispid 2;
|
||||||
|
property ExceptionsNotAllowed: WordBool dispid 3;
|
||||||
|
property NotificationsDisabled: WordBool dispid 4;
|
||||||
|
property UnicastResponsesToMulticastBroadcastDisabled: WordBool dispid 5;
|
||||||
|
property RemoteAdminSettings: INetFwRemoteAdminSettings readonly dispid 6;
|
||||||
|
property IcmpSettings: INetFwIcmpSettings readonly dispid 7;
|
||||||
|
property GloballyOpenPorts: INetFwOpenPorts readonly dispid 8;
|
||||||
|
property Services: INetFwServices readonly dispid 9;
|
||||||
|
property AuthorizedApplications: INetFwAuthorizedApplications readonly dispid 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwPolicy
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {D46D2478-9AC9-4008-9DC7-5563CE5536CC}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwPolicy = interface(IDispatch)
|
||||||
|
['{D46D2478-9AC9-4008-9DC7-5563CE5536CC}']
|
||||||
|
function Get_CurrentProfile: INetFwProfile; safecall;
|
||||||
|
function GetProfileByType(profileType: NET_FW_PROFILE_TYPE_): INetFwProfile; safecall;
|
||||||
|
property CurrentProfile: INetFwProfile read Get_CurrentProfile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwPolicyDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {D46D2478-9AC9-4008-9DC7-5563CE5536CC}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwPolicyDisp = dispinterface
|
||||||
|
['{D46D2478-9AC9-4008-9DC7-5563CE5536CC}']
|
||||||
|
property CurrentProfile: INetFwProfile readonly dispid 1;
|
||||||
|
function GetProfileByType(profileType: NET_FW_PROFILE_TYPE_): INetFwProfile; dispid 2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwPolicy2
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {98325047-C671-4174-8D81-DEFCD3F03186}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwPolicy2 = interface(IDispatch)
|
||||||
|
['{98325047-C671-4174-8D81-DEFCD3F03186}']
|
||||||
|
function Get_CurrentProfileTypes: Integer; safecall;
|
||||||
|
function Get_FirewallEnabled(profileType: NET_FW_PROFILE_TYPE2_): WordBool; safecall;
|
||||||
|
procedure Set_FirewallEnabled(profileType: NET_FW_PROFILE_TYPE2_; Enabled: WordBool); safecall;
|
||||||
|
function Get_ExcludedInterfaces(profileType: NET_FW_PROFILE_TYPE2_): OleVariant; safecall;
|
||||||
|
procedure Set_ExcludedInterfaces(profileType: NET_FW_PROFILE_TYPE2_; Interfaces: OleVariant); safecall;
|
||||||
|
function Get_BlockAllInboundTraffic(profileType: NET_FW_PROFILE_TYPE2_): WordBool; safecall;
|
||||||
|
procedure Set_BlockAllInboundTraffic(profileType: NET_FW_PROFILE_TYPE2_; Block: WordBool); safecall;
|
||||||
|
function Get_NotificationsDisabled(profileType: NET_FW_PROFILE_TYPE2_): WordBool; safecall;
|
||||||
|
procedure Set_NotificationsDisabled(profileType: NET_FW_PROFILE_TYPE2_; disabled: WordBool); safecall;
|
||||||
|
function Get_UnicastResponsesToMulticastBroadcastDisabled(profileType: NET_FW_PROFILE_TYPE2_): WordBool; safecall;
|
||||||
|
procedure Set_UnicastResponsesToMulticastBroadcastDisabled(profileType: NET_FW_PROFILE_TYPE2_;
|
||||||
|
disabled: WordBool); safecall;
|
||||||
|
function Get_Rules: INetFwRules; safecall;
|
||||||
|
function Get_ServiceRestriction: INetFwServiceRestriction; safecall;
|
||||||
|
procedure EnableRuleGroup(profileTypesBitmask: Integer; const group: WideString;
|
||||||
|
enable: WordBool); safecall;
|
||||||
|
function IsRuleGroupEnabled(profileTypesBitmask: Integer; const group: WideString): WordBool; safecall;
|
||||||
|
procedure RestoreLocalFirewallDefaults; safecall;
|
||||||
|
function Get_DefaultInboundAction(profileType: NET_FW_PROFILE_TYPE2_): NET_FW_ACTION_; safecall;
|
||||||
|
procedure Set_DefaultInboundAction(profileType: NET_FW_PROFILE_TYPE2_; Action: NET_FW_ACTION_); safecall;
|
||||||
|
function Get_DefaultOutboundAction(profileType: NET_FW_PROFILE_TYPE2_): NET_FW_ACTION_; safecall;
|
||||||
|
procedure Set_DefaultOutboundAction(profileType: NET_FW_PROFILE_TYPE2_; Action: NET_FW_ACTION_); safecall;
|
||||||
|
function Get_IsRuleGroupCurrentlyEnabled(const group: WideString): WordBool; safecall;
|
||||||
|
function Get_LocalPolicyModifyState: NET_FW_MODIFY_STATE_; safecall;
|
||||||
|
property CurrentProfileTypes: Integer read Get_CurrentProfileTypes;
|
||||||
|
property FirewallEnabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool read Get_FirewallEnabled write Set_FirewallEnabled;
|
||||||
|
property ExcludedInterfaces[profileType: NET_FW_PROFILE_TYPE2_]: OleVariant read Get_ExcludedInterfaces write Set_ExcludedInterfaces;
|
||||||
|
property BlockAllInboundTraffic[profileType: NET_FW_PROFILE_TYPE2_]: WordBool read Get_BlockAllInboundTraffic write Set_BlockAllInboundTraffic;
|
||||||
|
property NotificationsDisabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool read Get_NotificationsDisabled write Set_NotificationsDisabled;
|
||||||
|
property UnicastResponsesToMulticastBroadcastDisabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool read Get_UnicastResponsesToMulticastBroadcastDisabled write Set_UnicastResponsesToMulticastBroadcastDisabled;
|
||||||
|
property Rules: INetFwRules read Get_Rules;
|
||||||
|
property ServiceRestriction: INetFwServiceRestriction read Get_ServiceRestriction;
|
||||||
|
property DefaultInboundAction[profileType: NET_FW_PROFILE_TYPE2_]: NET_FW_ACTION_ read Get_DefaultInboundAction write Set_DefaultInboundAction;
|
||||||
|
property DefaultOutboundAction[profileType: NET_FW_PROFILE_TYPE2_]: NET_FW_ACTION_ read Get_DefaultOutboundAction write Set_DefaultOutboundAction;
|
||||||
|
property IsRuleGroupCurrentlyEnabled[const group: WideString]: WordBool read Get_IsRuleGroupCurrentlyEnabled;
|
||||||
|
property LocalPolicyModifyState: NET_FW_MODIFY_STATE_ read Get_LocalPolicyModifyState;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwPolicy2Disp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {98325047-C671-4174-8D81-DEFCD3F03186}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwPolicy2Disp = dispinterface
|
||||||
|
['{98325047-C671-4174-8D81-DEFCD3F03186}']
|
||||||
|
property CurrentProfileTypes: Integer readonly dispid 1;
|
||||||
|
property FirewallEnabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool dispid 2;
|
||||||
|
property ExcludedInterfaces[profileType: NET_FW_PROFILE_TYPE2_]: OleVariant dispid 3;
|
||||||
|
property BlockAllInboundTraffic[profileType: NET_FW_PROFILE_TYPE2_]: WordBool dispid 4;
|
||||||
|
property NotificationsDisabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool dispid 5;
|
||||||
|
property UnicastResponsesToMulticastBroadcastDisabled[profileType: NET_FW_PROFILE_TYPE2_]: WordBool dispid 6;
|
||||||
|
property Rules: INetFwRules readonly dispid 7;
|
||||||
|
property ServiceRestriction: INetFwServiceRestriction readonly dispid 8;
|
||||||
|
procedure EnableRuleGroup(profileTypesBitmask: Integer; const group: WideString;
|
||||||
|
enable: WordBool); dispid 9;
|
||||||
|
function IsRuleGroupEnabled(profileTypesBitmask: Integer; const group: WideString): WordBool; dispid 10;
|
||||||
|
procedure RestoreLocalFirewallDefaults; dispid 11;
|
||||||
|
property DefaultInboundAction[profileType: NET_FW_PROFILE_TYPE2_]: NET_FW_ACTION_ dispid 12;
|
||||||
|
property DefaultOutboundAction[profileType: NET_FW_PROFILE_TYPE2_]: NET_FW_ACTION_ dispid 13;
|
||||||
|
property IsRuleGroupCurrentlyEnabled[const group: WideString]: WordBool readonly dispid 14;
|
||||||
|
property LocalPolicyModifyState: NET_FW_MODIFY_STATE_ readonly dispid 15;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// Schnittstelle: INetFwMgr
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {F7898AF5-CAC4-4632-A2EC-DA06E5111AF2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwMgr = interface(IDispatch)
|
||||||
|
['{F7898AF5-CAC4-4632-A2EC-DA06E5111AF2}']
|
||||||
|
function Get_LocalPolicy: INetFwPolicy; safecall;
|
||||||
|
function Get_CurrentProfileType: NET_FW_PROFILE_TYPE_; safecall;
|
||||||
|
procedure RestoreDefaults; safecall;
|
||||||
|
procedure IsPortAllowed(const imageFileName: WideString; IpVersion: NET_FW_IP_VERSION_;
|
||||||
|
portNumber: Integer; const localAddress: WideString;
|
||||||
|
ipProtocol: NET_FW_IP_PROTOCOL_; out allowed: OleVariant;
|
||||||
|
out restricted: OleVariant); safecall;
|
||||||
|
procedure IsIcmpTypeAllowed(IpVersion: NET_FW_IP_VERSION_; const localAddress: WideString;
|
||||||
|
Type_: Byte; out allowed: OleVariant; out restricted: OleVariant); safecall;
|
||||||
|
property LocalPolicy: INetFwPolicy read Get_LocalPolicy;
|
||||||
|
property CurrentProfileType: NET_FW_PROFILE_TYPE_ read Get_CurrentProfileType;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// *********************************************************************//
|
||||||
|
// DispIntf: INetFwMgrDisp
|
||||||
|
// Flags: (4416) Dual OleAutomation Dispatchable
|
||||||
|
// GUID: {F7898AF5-CAC4-4632-A2EC-DA06E5111AF2}
|
||||||
|
// *********************************************************************//
|
||||||
|
INetFwMgrDisp = dispinterface
|
||||||
|
['{F7898AF5-CAC4-4632-A2EC-DA06E5111AF2}']
|
||||||
|
property LocalPolicy: INetFwPolicy readonly dispid 1;
|
||||||
|
property CurrentProfileType: NET_FW_PROFILE_TYPE_ readonly dispid 2;
|
||||||
|
procedure RestoreDefaults; dispid 3;
|
||||||
|
procedure IsPortAllowed(const imageFileName: WideString; IpVersion: NET_FW_IP_VERSION_;
|
||||||
|
portNumber: Integer; const localAddress: WideString;
|
||||||
|
ipProtocol: NET_FW_IP_PROTOCOL_; out allowed: OleVariant;
|
||||||
|
out restricted: OleVariant); dispid 4;
|
||||||
|
procedure IsIcmpTypeAllowed(IpVersion: NET_FW_IP_VERSION_; const localAddress: WideString;
|
||||||
|
Type_: Byte; out allowed: OleVariant; out restricted: OleVariant); dispid 5;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses ComObj;
|
||||||
|
|
||||||
|
end.
|
||||||
987
build/Source/ServiceControl.pas
Normal file
987
build/Source/ServiceControl.pas
Normal file
|
|
@ -0,0 +1,987 @@
|
||||||
|
{
|
||||||
|
License Agreement
|
||||||
|
|
||||||
|
This content is subject to the Mozilla Public License Version 1.1 (the "License");
|
||||||
|
You may not use this plugin except in compliance with the License. You may
|
||||||
|
obtain a copy of the License at http://www.mozilla.org/MPL.
|
||||||
|
|
||||||
|
Alternatively, you may redistribute this library, use and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published
|
||||||
|
by the Free Software Foundation; either version 2.1 of the License,
|
||||||
|
or (at your option) any later version. You may obtain a copy
|
||||||
|
of the LGPL at www.gnu.org/copyleft.
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the License.
|
||||||
|
|
||||||
|
The original code is ServiceControl.pas, released April 16, 2007.
|
||||||
|
|
||||||
|
The initial developer of the original code is Rainer Budde (http://www.speed-soft.de).
|
||||||
|
|
||||||
|
SimpleSC - NSIS Service Control Plugin is written, published and maintaned by
|
||||||
|
Rainer Budde (rainer@speed-soft.de).
|
||||||
|
}
|
||||||
|
unit ServiceControl;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Windows, SysUtils, WinSvc;
|
||||||
|
|
||||||
|
function InstallService(ServiceName, DisplayName: String; ServiceType: DWORD; StartType: DWORD; BinaryPathName: String; Dependencies: String; Username: String; Password: String): Integer;
|
||||||
|
function RemoveService(ServiceName: String): Integer;
|
||||||
|
function GetServiceName(DisplayName: String; var Name: String): Integer;
|
||||||
|
function GetServiceDisplayName(ServiceName: String; var Name: String): Integer;
|
||||||
|
function GetServiceStatus(ServiceName: String; var Status: DWORD): Integer;
|
||||||
|
function GetServiceBinaryPath(ServiceName: String; var BinaryPath: String): Integer;
|
||||||
|
function GetServiceStartType(ServiceName: String; var StartType: DWORD): Integer;
|
||||||
|
function GetServiceDescription(ServiceName: String; var Description: String): Integer;
|
||||||
|
function GetServiceLogon(ServiceName: String; var Username: String): Integer;
|
||||||
|
function SetServiceStartType(ServiceName: String; StartType: DWORD): Integer;
|
||||||
|
function SetServiceDescription(ServiceName: String; Description: String): Integer;
|
||||||
|
function SetServiceLogon(ServiceName: String; Username: String; Password: String): Integer;
|
||||||
|
function SetServiceBinaryPath(ServiceName: String; BinaryPath: String): Integer;
|
||||||
|
function ServiceIsRunning(ServiceName: String; var IsRunning: Boolean): Integer;
|
||||||
|
function ServiceIsStopped(ServiceName: String; var IsStopped: Boolean): Integer;
|
||||||
|
function ServiceIsPaused(ServiceName: String; var IsPaused: Boolean): Integer;
|
||||||
|
function StartService(ServiceName: String; ServiceArguments: String): Integer;
|
||||||
|
function StopService(ServiceName: String): Integer;
|
||||||
|
function PauseService(ServiceName: String): Integer;
|
||||||
|
function ContinueService(ServiceName: String): Integer;
|
||||||
|
function RestartService(ServiceName: String; ServiceArguments: String): Integer;
|
||||||
|
function ExistsService(ServiceName: String): Integer;
|
||||||
|
function GetErrorMessage(ErrorCode: Integer): String;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function WaitForStatus(ServiceName: String; Status: DWord): Integer;
|
||||||
|
var
|
||||||
|
CurrentStatus: DWord;
|
||||||
|
StatusResult: Integer;
|
||||||
|
StatusReached: Boolean;
|
||||||
|
TimeOutReached: Boolean;
|
||||||
|
StartTickCount: Cardinal;
|
||||||
|
const
|
||||||
|
STATUS_TIMEOUT = 30000;
|
||||||
|
WAIT_TIMEOUT = 250;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
StatusReached := False;
|
||||||
|
TimeOutReached := False;
|
||||||
|
|
||||||
|
StartTickCount := GetTickCount;
|
||||||
|
|
||||||
|
while not StatusReached and not TimeOutReached do
|
||||||
|
begin
|
||||||
|
StatusResult := GetServiceStatus(ServiceName, CurrentStatus);
|
||||||
|
|
||||||
|
if StatusResult = 0 then
|
||||||
|
begin
|
||||||
|
if Status = CurrentStatus then
|
||||||
|
StatusReached := True
|
||||||
|
else
|
||||||
|
Sleep(WAIT_TIMEOUT);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := StatusResult;
|
||||||
|
|
||||||
|
if (StartTickCount + STATUS_TIMEOUT) < GetTickCount then
|
||||||
|
begin
|
||||||
|
TimeOutReached := True;
|
||||||
|
Result := ERROR_SERVICE_REQUEST_TIMEOUT;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ExistsService(ServiceName: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
CloseServiceHandle(ServiceHandle)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function StartService(ServiceName: String; ServiceArguments: String): Integer;
|
||||||
|
type
|
||||||
|
TArguments = Array of PChar;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
ServiceArgVectors: TArguments;
|
||||||
|
NumServiceArgs: DWORD;
|
||||||
|
const
|
||||||
|
ArgDelimitterQuote: String = '"';
|
||||||
|
ArgDelimitterWhiteSpace: String = ' ';
|
||||||
|
|
||||||
|
procedure GetServiceArguments(ServiceArguments: String; var NumServiceArgs: DWORD; var ServiceArgVectors: TArguments);
|
||||||
|
var
|
||||||
|
Param: String;
|
||||||
|
Split: Boolean;
|
||||||
|
Quoted: Boolean;
|
||||||
|
CharIsDelimitter: Boolean;
|
||||||
|
begin
|
||||||
|
ServiceArgVectors := nil;
|
||||||
|
NumServiceArgs := 0;
|
||||||
|
|
||||||
|
Quoted := False;
|
||||||
|
|
||||||
|
while Length(ServiceArguments) > 0 do
|
||||||
|
begin
|
||||||
|
Split := False;
|
||||||
|
CharIsDelimitter := False;
|
||||||
|
|
||||||
|
if ServiceArguments[1] = ' ' then
|
||||||
|
if not Quoted then
|
||||||
|
begin
|
||||||
|
CharIsDelimitter := True;
|
||||||
|
Split := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if ServiceArguments[1] = '"' then
|
||||||
|
begin
|
||||||
|
Quoted := not Quoted;
|
||||||
|
CharIsDelimitter := True;
|
||||||
|
|
||||||
|
if not Quoted then
|
||||||
|
Split := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if not CharIsDelimitter then
|
||||||
|
Param := Param + ServiceArguments[1];
|
||||||
|
|
||||||
|
if Split or (Length(ServiceArguments) = 1) then
|
||||||
|
begin
|
||||||
|
SetLength(ServiceArgVectors, Length(ServiceArgVectors) + 1);
|
||||||
|
GetMem(ServiceArgVectors[Length(ServiceArgVectors) -1], Length(Param) + 1);
|
||||||
|
StrPCopy(ServiceArgVectors[Length(ServiceArgVectors) -1], Param);
|
||||||
|
|
||||||
|
Param := '';
|
||||||
|
|
||||||
|
Delete(ServiceArguments, 1, 1);
|
||||||
|
ServiceArguments := Trim(ServiceArguments);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Delete(ServiceArguments, 1, 1);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Length(ServiceArgVectors) > 0 then
|
||||||
|
NumServiceArgs := Length(ServiceArgVectors);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure FreeServiceArguments(ServiceArgVectors: TArguments);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if Length(ServiceArgVectors) > 0 then
|
||||||
|
for i := 0 to Length(ServiceArgVectors) -1 do
|
||||||
|
FreeMem(ServiceArgVectors[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_START);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
GetServiceArguments(ServiceArguments, NumServiceArgs, ServiceArgVectors);
|
||||||
|
|
||||||
|
if WinSvc.StartService(ServiceHandle, NumServiceArgs, ServiceArgVectors[0]) then
|
||||||
|
Result := WaitForStatus(ServiceName, SERVICE_RUNNING)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
FreeServiceArguments(ServiceArgVectors);
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function StopService(ServiceName: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
ServiceStatus: TServiceStatus;
|
||||||
|
Dependencies: PEnumServiceStatus;
|
||||||
|
BytesNeeded: Cardinal;
|
||||||
|
ServicesReturned: Cardinal;
|
||||||
|
ServicesEnumerated: Boolean;
|
||||||
|
EnumerationSuccess: Boolean;
|
||||||
|
i: Cardinal;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
BytesNeeded := 0;
|
||||||
|
ServicesReturned := 0;
|
||||||
|
|
||||||
|
Dependencies := nil;
|
||||||
|
ServicesEnumerated := False;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT or SC_MANAGER_ENUMERATE_SERVICE);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_STOP or SERVICE_ENUMERATE_DEPENDENTS);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
if not EnumDependentServices(ServiceHandle, SERVICE_ACTIVE, Dependencies^, 0, BytesNeeded, ServicesReturned) then
|
||||||
|
begin
|
||||||
|
ServicesEnumerated := True;
|
||||||
|
GetMem(Dependencies, BytesNeeded);
|
||||||
|
|
||||||
|
EnumerationSuccess := EnumDependentServices(ServiceHandle, SERVICE_ACTIVE, Dependencies^, BytesNeeded, BytesNeeded, ServicesReturned);
|
||||||
|
|
||||||
|
if EnumerationSuccess and (ServicesReturned > 0) then
|
||||||
|
begin
|
||||||
|
for i := 1 to ServicesReturned do
|
||||||
|
begin
|
||||||
|
Result := StopService(Dependencies.lpServiceName);
|
||||||
|
|
||||||
|
if Result <> 0 then
|
||||||
|
Break;
|
||||||
|
|
||||||
|
Inc(Dependencies);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (ServicesEnumerated and (Result = 0)) or not ServicesEnumerated then
|
||||||
|
begin
|
||||||
|
if ControlService(ServiceHandle, SERVICE_CONTROL_STOP, ServiceStatus) then
|
||||||
|
Result := WaitForStatus(ServiceName, SERVICE_STOPPED)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError
|
||||||
|
end;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PauseService(ServiceName: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
ServiceStatus: TServiceStatus;
|
||||||
|
begin
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_PAUSE_CONTINUE);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if ControlService(ServiceHandle, SERVICE_CONTROL_PAUSE, ServiceStatus) then
|
||||||
|
Result := WaitForStatus(ServiceName, SERVICE_PAUSED)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ContinueService(ServiceName: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
ServiceStatus: TServiceStatus;
|
||||||
|
begin
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_PAUSE_CONTINUE);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if ControlService(ServiceHandle, SERVICE_CONTROL_CONTINUE, ServiceStatus) then
|
||||||
|
Result := WaitForStatus(ServiceName, SERVICE_RUNNING)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceName(DisplayName: String; var Name: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceName: PChar;
|
||||||
|
ServiceBuffer: Cardinal;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ServiceBuffer := 255;
|
||||||
|
ServiceName := StrAlloc(ServiceBuffer+1);
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
if WinSvc.GetServiceKeyName(ManagerHandle, PChar(DisplayName), ServiceName, ServiceBuffer) then
|
||||||
|
Name := ServiceName
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceDisplayName(ServiceName: String; var Name: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
DisplayName: PChar;
|
||||||
|
ServiceBuffer: Cardinal;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ServiceBuffer := 255;
|
||||||
|
DisplayName := StrAlloc(ServiceBuffer+1);
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
if WinSvc.GetServiceDisplayName(ManagerHandle, PChar(ServiceName), DisplayName, ServiceBuffer) then
|
||||||
|
Name := DisplayName
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceStatus(ServiceName: String; var Status: DWORD): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
ServiceStatus: TServiceStatus;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_STATUS);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
if QueryServiceStatus(ServiceHandle, ServiceStatus) then
|
||||||
|
Status := ServiceStatus.dwCurrentState
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceBinaryPath(ServiceName: String; var BinaryPath: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
BytesNeeded: DWORD;
|
||||||
|
ServiceConfig: PQueryServiceConfig;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
ServiceConfig := nil;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not QueryServiceConfig(ServiceHandle, ServiceConfig, 0, BytesNeeded) and (System.GetLastError = ERROR_INSUFFICIENT_BUFFER) then
|
||||||
|
begin
|
||||||
|
GetMem(ServiceConfig, BytesNeeded);
|
||||||
|
|
||||||
|
if QueryServiceConfig(ServiceHandle, ServiceConfig, BytesNeeded, BytesNeeded) then
|
||||||
|
BinaryPath := ServiceConfig^.lpBinaryPathName
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
FreeMem(ServiceConfig);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceStartType(ServiceName: String; var StartType: DWORD): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
BytesNeeded: DWORD;
|
||||||
|
ServiceConfig: PQueryServiceConfig;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
ServiceConfig := nil;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not QueryServiceConfig(ServiceHandle, ServiceConfig, 0, BytesNeeded) and (System.GetLastError = ERROR_INSUFFICIENT_BUFFER) then
|
||||||
|
begin
|
||||||
|
GetMem(ServiceConfig, BytesNeeded);
|
||||||
|
|
||||||
|
if QueryServiceConfig(ServiceHandle, ServiceConfig, BytesNeeded, BytesNeeded) then
|
||||||
|
StartType := ServiceConfig^.dwStartType
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
FreeMem(ServiceConfig);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceDescription(ServiceName: String; var Description: String): Integer;
|
||||||
|
const
|
||||||
|
SERVICE_CONFIG_DESCRIPTION = 1;
|
||||||
|
type
|
||||||
|
TServiceDescription = record
|
||||||
|
lpDescription: PAnsiChar;
|
||||||
|
end;
|
||||||
|
PServiceDescription = ^TServiceDescription;
|
||||||
|
var
|
||||||
|
QueryServiceConfig2: function(hService: SC_HANDLE; dwInfoLevel: DWORD; pBuffer: Pointer; cbBufSize: DWORD; var cbBytesNeeded: Cardinal): BOOL; stdcall;
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
ServiceDescription: PServiceDescription;
|
||||||
|
BytesNeeded: Cardinal;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_LOCK);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
@QueryServiceConfig2 := GetProcAddress(GetModuleHandle(advapi32), 'QueryServiceConfig2A');
|
||||||
|
|
||||||
|
if Assigned(@QueryServiceConfig2) then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not QueryServiceConfig2(ServiceHandle, SERVICE_CONFIG_DESCRIPTION, nil, 0, BytesNeeded) and (System.GetLastError = ERROR_INSUFFICIENT_BUFFER) then
|
||||||
|
begin
|
||||||
|
GetMem(ServiceDescription, BytesNeeded);
|
||||||
|
|
||||||
|
if QueryServiceConfig2(ServiceHandle, SERVICE_CONFIG_DESCRIPTION, ServiceDescription, BytesNeeded, BytesNeeded) then
|
||||||
|
Description := ServiceDescription.lpDescription
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
FreeMem(ServiceDescription);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetServiceLogon(ServiceName: String; var Username: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
BytesNeeded: DWORD;
|
||||||
|
ServiceConfig: PQueryServiceConfig;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
ServiceConfig := nil;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_CONNECT);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_QUERY_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
|
||||||
|
if not QueryServiceConfig(ServiceHandle, ServiceConfig, 0, BytesNeeded) and (System.GetLastError = ERROR_INSUFFICIENT_BUFFER) then
|
||||||
|
begin
|
||||||
|
GetMem(ServiceConfig, BytesNeeded);
|
||||||
|
|
||||||
|
if QueryServiceConfig(ServiceHandle, ServiceConfig, BytesNeeded, BytesNeeded) then
|
||||||
|
Username := ServiceConfig^.lpServiceStartName
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
FreeMem(ServiceConfig);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetServiceDescription(ServiceName: String; Description: String): Integer;
|
||||||
|
const
|
||||||
|
SERVICE_CONFIG_DESCRIPTION = 1;
|
||||||
|
var
|
||||||
|
ChangeServiceConfig2: function(hService: SC_HANDLE; dwInfoLevel: DWORD; lpInfo: Pointer): BOOL; stdcall;
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_LOCK);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_CHANGE_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
@ChangeServiceConfig2 := GetProcAddress(GetModuleHandle(advapi32), 'ChangeServiceConfig2A');
|
||||||
|
|
||||||
|
if Assigned(@ChangeServiceConfig2) then
|
||||||
|
begin
|
||||||
|
if not ChangeServiceConfig2(ServiceHandle, SERVICE_CONFIG_DESCRIPTION, @Description) then
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetServiceStartType(ServiceName: String; StartType: DWORD): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_LOCK);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_CHANGE_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
if not ChangeServiceConfig(ServiceHandle, SERVICE_NO_CHANGE, StartType, SERVICE_NO_CHANGE, nil, nil, nil, nil, nil, nil, nil) then
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetServiceLogon(ServiceName: String; Username: String; Password: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_LOCK);
|
||||||
|
|
||||||
|
if Pos('\', Username) = 0 then
|
||||||
|
Username := '.\' + Username;
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_CHANGE_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
if not ChangeServiceConfig(ServiceHandle, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, nil, nil, nil, nil, PChar(Username), PChar(Password), nil) then
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetServiceBinaryPath(ServiceName: String; BinaryPath: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_LOCK);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_CHANGE_CONFIG);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
if not ChangeServiceConfig(ServiceHandle, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, PChar(BinaryPath), nil, nil, nil, nil, nil, nil) then
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ServiceIsRunning(ServiceName: String; var IsRunning: Boolean): Integer;
|
||||||
|
var
|
||||||
|
Status: DWORD;
|
||||||
|
begin
|
||||||
|
Result := GetServiceStatus(ServiceName, Status);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
IsRunning := Status = SERVICE_RUNNING
|
||||||
|
else
|
||||||
|
IsRunning := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ServiceIsStopped(ServiceName: String; var IsStopped: Boolean): Integer;
|
||||||
|
var
|
||||||
|
Status: DWORD;
|
||||||
|
begin
|
||||||
|
Result := GetServiceStatus(ServiceName, Status);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
IsStopped := Status = SERVICE_STOPPED
|
||||||
|
else
|
||||||
|
IsStopped := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ServiceIsPaused(ServiceName: String; var IsPaused: Boolean): Integer;
|
||||||
|
var
|
||||||
|
Status: DWORD;
|
||||||
|
begin
|
||||||
|
Result := GetServiceStatus(ServiceName, Status);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
IsPaused := Status = SERVICE_PAUSED
|
||||||
|
else
|
||||||
|
IsPaused := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function RestartService(ServiceName: String; ServiceArguments: String): Integer;
|
||||||
|
begin
|
||||||
|
Result := StopService(ServiceName);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
Result := StartService(ServiceName, ServiceArguments);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function InstallService(ServiceName, DisplayName: String; ServiceType: DWORD;
|
||||||
|
StartType: DWORD; BinaryPathName: String; Dependencies: String;
|
||||||
|
Username: String; Password: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
PDependencies: PChar;
|
||||||
|
PUsername: PChar;
|
||||||
|
PPassword: PChar;
|
||||||
|
const
|
||||||
|
ReplaceDelimitter: String = '/';
|
||||||
|
|
||||||
|
function Replace(Value: String): String;
|
||||||
|
begin
|
||||||
|
while Pos(ReplaceDelimitter, Value) <> 0 do
|
||||||
|
begin
|
||||||
|
Result := Result + Copy(Value, 1, Pos(ReplaceDelimitter, Value) -1) + Chr(0);
|
||||||
|
Delete(Value, 1, Pos(ReplaceDelimitter, Value));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := Result + Value + Chr(0) + Chr(0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
|
if Dependencies = '' then
|
||||||
|
PDependencies := nil
|
||||||
|
else
|
||||||
|
PDependencies := PChar(Replace(Dependencies));
|
||||||
|
|
||||||
|
if UserName = '' then
|
||||||
|
PUsername := nil
|
||||||
|
else
|
||||||
|
PUsername := PChar(Username);
|
||||||
|
|
||||||
|
if Password = '' then
|
||||||
|
PPassword := nil
|
||||||
|
else
|
||||||
|
PPassword := PChar(Password);
|
||||||
|
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := CreateService(ManagerHandle,
|
||||||
|
PChar(ServiceName),
|
||||||
|
PChar(DisplayName),
|
||||||
|
SERVICE_START or SERVICE_QUERY_STATUS or _DELETE,
|
||||||
|
ServiceType,
|
||||||
|
StartType,
|
||||||
|
SERVICE_ERROR_NORMAL,
|
||||||
|
PChar(BinaryPathName),
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
PDependencies,
|
||||||
|
PUsername,
|
||||||
|
PPassword);
|
||||||
|
|
||||||
|
if ServiceHandle <> 0 then
|
||||||
|
CloseServiceHandle(ServiceHandle)
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function RemoveService(ServiceName: String): Integer;
|
||||||
|
var
|
||||||
|
ManagerHandle: SC_HANDLE;
|
||||||
|
ServiceHandle: SC_HANDLE;
|
||||||
|
LockHandle: SC_LOCK;
|
||||||
|
IsStopped: Boolean;
|
||||||
|
Deleted: Boolean;
|
||||||
|
begin
|
||||||
|
IsStopped := False;
|
||||||
|
|
||||||
|
Result := ServiceIsStopped(ServiceName, IsStopped);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
if not IsStopped then
|
||||||
|
Result := StopService(ServiceName);
|
||||||
|
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
ManagerHandle := OpenSCManager('', nil, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
|
if ManagerHandle > 0 then
|
||||||
|
begin
|
||||||
|
ServiceHandle := OpenService(ManagerHandle, PChar(ServiceName), SERVICE_ALL_ACCESS);
|
||||||
|
|
||||||
|
if ServiceHandle > 0 then
|
||||||
|
begin
|
||||||
|
LockHandle := LockServiceDatabase(ManagerHandle);
|
||||||
|
|
||||||
|
if LockHandle <> nil then
|
||||||
|
begin
|
||||||
|
Deleted := DeleteService(ServiceHandle);
|
||||||
|
|
||||||
|
if not Deleted then
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
UnlockServiceDatabase(LockHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ServiceHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
|
||||||
|
CloseServiceHandle(ManagerHandle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := System.GetLastError;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetErrorMessage(ErrorCode: Integer): String;
|
||||||
|
begin
|
||||||
|
Result := SysErrorMessage(ErrorCode);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
35
build/Source/SimpleFC.cfg
Normal file
35
build/Source/SimpleFC.cfg
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
-$A8
|
||||||
|
-$B-
|
||||||
|
-$C+
|
||||||
|
-$D+
|
||||||
|
-$E-
|
||||||
|
-$F-
|
||||||
|
-$G+
|
||||||
|
-$H+
|
||||||
|
-$I+
|
||||||
|
-$J-
|
||||||
|
-$K-
|
||||||
|
-$L+
|
||||||
|
-$M-
|
||||||
|
-$N+
|
||||||
|
-$O-
|
||||||
|
-$P+
|
||||||
|
-$Q-
|
||||||
|
-$R-
|
||||||
|
-$S-
|
||||||
|
-$T-
|
||||||
|
-$U-
|
||||||
|
-$V+
|
||||||
|
-$W-
|
||||||
|
-$X+
|
||||||
|
-$YD
|
||||||
|
-$Z1
|
||||||
|
-cg
|
||||||
|
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||||
|
-H+
|
||||||
|
-W+
|
||||||
|
-M
|
||||||
|
-$M16384,1048576
|
||||||
|
-K$00400000
|
||||||
|
-LE"c:\programme\borland\delphi6\Projects\Bpl"
|
||||||
|
-LN"c:\programme\borland\delphi6\Projects\Bpl"
|
||||||
90
build/Source/SimpleFC.dof
Normal file
90
build/Source/SimpleFC.dof
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
[FileVersion]
|
||||||
|
Version=6.0
|
||||||
|
[Compiler]
|
||||||
|
A=8
|
||||||
|
B=0
|
||||||
|
C=1
|
||||||
|
D=1
|
||||||
|
E=0
|
||||||
|
F=0
|
||||||
|
G=1
|
||||||
|
H=1
|
||||||
|
I=1
|
||||||
|
J=0
|
||||||
|
K=0
|
||||||
|
L=1
|
||||||
|
M=0
|
||||||
|
N=1
|
||||||
|
O=0
|
||||||
|
P=1
|
||||||
|
Q=0
|
||||||
|
R=0
|
||||||
|
S=0
|
||||||
|
T=0
|
||||||
|
U=0
|
||||||
|
V=1
|
||||||
|
W=0
|
||||||
|
X=1
|
||||||
|
Y=1
|
||||||
|
Z=1
|
||||||
|
ShowHints=1
|
||||||
|
ShowWarnings=1
|
||||||
|
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||||
|
[Linker]
|
||||||
|
MapFile=0
|
||||||
|
OutputObjs=0
|
||||||
|
ConsoleApp=1
|
||||||
|
DebugInfo=0
|
||||||
|
RemoteSymbols=0
|
||||||
|
MinStackSize=16384
|
||||||
|
MaxStackSize=1048576
|
||||||
|
ImageBase=4194304
|
||||||
|
ExeDescription=
|
||||||
|
[Directories]
|
||||||
|
OutputDir=
|
||||||
|
UnitOutputDir=
|
||||||
|
PackageDLLOutputDir=
|
||||||
|
PackageDCPOutputDir=
|
||||||
|
SearchPath=
|
||||||
|
Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;dbrtl;adortl;vcldb;qrpt;bdertl;vcldbx;dsnap;cds;bdecds;teeui;teedb;tee;teeqr;ibxpress;visualclx;visualdbclx;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;dbexpress;dbxcds;dclOffice2k;soaprtl;Jcl;VirtualTreesD6;VirtualShellToolsD6;VirtualExplorerListviewExD6;ThemeManagerD6;JclVcl;JvCoreD6R;JvSystemD6R;JvStdCtrlsD6R;JvAppFrmD6R;JvBandsD6R;JvDBD6R;JvDlgsD6R;JvBDED6R;JvCmpD6R;JvCryptD6R;JvCtrlsD6R;JvCustomD6R;JvDockingD6R;JvDotNetCtrlsD6R;JvEDID6R;JvGlobusD6R;JvHMID6R;JvInterpreterD6R;JvJansD6R;JvManagedThreadsD6R;JvMMD6R;JvNetD6R;JvPageCompsD6R;JvPluginD6R;JvPrintPreviewD6R;JvRuntimeDesignD6R;JvTimeFrameworkD6R;JvUIBD6R;JvValidatorsD6R;JvWizardD6R;JvXPCtrlsD6R;FModPackage;NetBrowserPackage;ThreadCopyPackage;TMSMenusD6;DSPack_D6;SNTPServer
|
||||||
|
Conditionals=
|
||||||
|
DebugSourceDirs=
|
||||||
|
UsePackages=0
|
||||||
|
[Parameters]
|
||||||
|
RunParams=
|
||||||
|
HostApplication=
|
||||||
|
Launcher=
|
||||||
|
UseLauncher=0
|
||||||
|
DebugCWD=
|
||||||
|
[Language]
|
||||||
|
ActiveLang=
|
||||||
|
ProjectLang=
|
||||||
|
RootDir=
|
||||||
|
[Version Info]
|
||||||
|
IncludeVerInfo=0
|
||||||
|
AutoIncBuild=0
|
||||||
|
MajorVer=1
|
||||||
|
MinorVer=0
|
||||||
|
Release=0
|
||||||
|
Build=0
|
||||||
|
Debug=0
|
||||||
|
PreRelease=0
|
||||||
|
Special=0
|
||||||
|
Private=0
|
||||||
|
DLL=0
|
||||||
|
Locale=1031
|
||||||
|
CodePage=1252
|
||||||
|
[Version Info Keys]
|
||||||
|
CompanyName=
|
||||||
|
FileDescription=
|
||||||
|
FileVersion=1.0.0.0
|
||||||
|
InternalName=
|
||||||
|
LegalCopyright=
|
||||||
|
LegalTrademarks=
|
||||||
|
OriginalFilename=
|
||||||
|
ProductName=
|
||||||
|
ProductVersion=1.0.0.0
|
||||||
|
Comments=
|
||||||
|
[HistoryLists\hlUnitAliases]
|
||||||
|
Count=1
|
||||||
|
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||||
629
build/Source/SimpleFC.dpr
Normal file
629
build/Source/SimpleFC.dpr
Normal file
|
|
@ -0,0 +1,629 @@
|
||||||
|
library SimpleFC;
|
||||||
|
|
||||||
|
uses
|
||||||
|
NSIS, Windows, FirewallControl, SysUtils;
|
||||||
|
|
||||||
|
function ResultToStr(Value: Boolean): String;
|
||||||
|
begin
|
||||||
|
if Value then
|
||||||
|
result := '0'
|
||||||
|
else
|
||||||
|
result := '1';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function BoolToStr(Value: Boolean): String;
|
||||||
|
begin
|
||||||
|
if Value then
|
||||||
|
result := '1'
|
||||||
|
else
|
||||||
|
result := '0';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function StrToBool(Value: String): Boolean;
|
||||||
|
begin
|
||||||
|
if Value = '1' then
|
||||||
|
result := True
|
||||||
|
else
|
||||||
|
result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AddPort(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Port: Integer;
|
||||||
|
Name: String;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
Scope: NET_FW_SCOPE;
|
||||||
|
Enabled: Boolean;
|
||||||
|
IpVersion: NET_FW_IP_VERSION;
|
||||||
|
RemoteAddresses: String;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Port := StrToInt(PopString);
|
||||||
|
Name := PopString;
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
Scope := NET_FW_SCOPE(StrToInt(PopString));
|
||||||
|
IpVersion := NET_FW_IP_VERSION(StrToInt(PopString));
|
||||||
|
RemoteAddresses := PopString;
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AddPort(Port,
|
||||||
|
Name,
|
||||||
|
Protocol,
|
||||||
|
Scope,
|
||||||
|
IpVersion,
|
||||||
|
RemoteAddresses,
|
||||||
|
Enabled) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RemovePort(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Port: Integer;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Port := StrToInt(PopString);
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.RemovePort(Port, Protocol) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AddApplication(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Name: String;
|
||||||
|
BinaryPath: String;
|
||||||
|
IpVersion: NET_FW_IP_VERSION;
|
||||||
|
Scope: NET_FW_SCOPE;
|
||||||
|
RemoteAdresses: String;
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Name := PopString;
|
||||||
|
BinaryPath := PopString;
|
||||||
|
Scope := NET_FW_SCOPE(StrToInt(PopString));
|
||||||
|
IpVersion := NET_FW_IP_VERSION(StrToInt(PopString));
|
||||||
|
RemoteAdresses := PopString;
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AddApplication(Name,
|
||||||
|
BinaryPath,
|
||||||
|
Scope,
|
||||||
|
IpVersion,
|
||||||
|
RemoteAdresses,
|
||||||
|
Enabled) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RemoveApplication(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
BinaryPath: String;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
BinaryPath := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.RemoveApplication(BinaryPath) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsPortAdded(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Port: Integer;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
Added: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Port := StrToInt(PopString);
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsPortAdded(Port, Protocol, Added) = 0);
|
||||||
|
PushString(BoolToStr(Added));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsApplicationAdded(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
BinaryPath: String;
|
||||||
|
Added: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
BinaryPath := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsApplicationAdded(BinaryPath, Added) = 0);
|
||||||
|
PushString(BoolToStr(Added));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsPortEnabled(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Port: Integer;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Port := StrToInt(PopString);
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsPortEnabled(Port, Protocol, Enabled) = 0);
|
||||||
|
PushString(BoolToStr(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsApplicationEnabled(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
BinaryPath: String;
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
BinaryPath := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsApplicationEnabled(BinaryPath, Enabled) = 0);
|
||||||
|
PushString(BoolToStr(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure EnableDisablePort(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Port: Integer;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Port := StrToInt(PopString);
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.EnableDisablePort(Port, Protocol, Enabled) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure EnableDisableApplication(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
BinaryPath: String;
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
BinaryPath := PopString;
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.EnableDisableApplication(BinaryPath, Enabled) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsFirewallEnabled(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsFirewallEnabled(Enabled) = 0);
|
||||||
|
PushString(BoolToStr(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure EnableDisableFirewall(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.EnableDisableFirewall(Enabled) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowExceptionsNotAllowed(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
NotAllowed: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
NotAllowed := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowExceptionsNotAllowed(NotAllowed) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AreExceptionsNotAllowed(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
NotAllowed: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AreExceptionsNotAllowed(NotAllowed) = 0);
|
||||||
|
PushString(BoolToStr(NotAllowed));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure EnableDisableNotifications(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.EnableDisableNotifications(Enabled) = 0);
|
||||||
|
PushString(BoolToStr(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AreNotificationsEnabled(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AreNotificationsEnabled(Enabled) = 0);
|
||||||
|
PushString(BoolToStr(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure StartStopFirewallService(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Enabled: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.StartStopFirewallService(Enabled));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsFirewallServiceRunning(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
IsRunning: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsFirewallServiceRunning(IsRunning));
|
||||||
|
PushString(BoolToStr(IsRunning));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RestoreDefaults(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.RestoreDefaults = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpOutboundDestinationUnreachable(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpOutboundDestinationUnreachable(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpRedirect(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpRedirect(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpInboundEchoRequest(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpInboundEchoRequest(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpOutboundTimeExceeded(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpOutboundTimeExceeded(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpOutboundParameterProblem(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpOutboundParameterProblem(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpOutboundSourceQuench(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpOutboundSourceQuench(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpInboundRouterRequest(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpInboundRouterRequest(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpInboundTimestampRequest(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpInboundTimestampRequest(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpInboundMaskRequest(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpInboundMaskRequest(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AllowDisallowIcmpOutboundPacketTooBig(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Allow: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Allow := StrToBool(PopString);
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AllowDisallowIcmpOutboundPacketTooBig(Allow) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure IsIcmpTypeAllowed(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
IpVersion: NET_FW_IP_VERSION;
|
||||||
|
LocalAddress: String;
|
||||||
|
IcmpType: NET_FW_ICMP_TYPE;
|
||||||
|
Allowed: Boolean;
|
||||||
|
Restricted: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
IpVersion := NET_FW_IP_VERSION(StrToInt(PopString));
|
||||||
|
LocalAddress := PopString;
|
||||||
|
IcmpType := NET_FW_ICMP_TYPE(StrToInt(PopString));
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.IsIcmpTypeAllowed(IpVersion,
|
||||||
|
LocalAddress,
|
||||||
|
IcmpType,
|
||||||
|
Allowed,
|
||||||
|
Restricted) = 0);
|
||||||
|
PushString(BoolToStr(Allowed));
|
||||||
|
PushString(BoolToStr(Restricted));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AdvAddRule(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Name: String;
|
||||||
|
Description: String;
|
||||||
|
Protocol: NET_FW_IP_PROTOCOL;
|
||||||
|
IcmpTypesAndCodes: String;
|
||||||
|
ApplicationName: String;
|
||||||
|
ServiceName: String;
|
||||||
|
Direction: NET_FW_RULE_DIRECTION;
|
||||||
|
Enabled: Boolean;
|
||||||
|
Group: String;
|
||||||
|
Profile: NET_FW_PROFILE_TYPE2;
|
||||||
|
Action: NET_FW_ACTION;
|
||||||
|
LocalPorts: String;
|
||||||
|
RemotePorts: String;
|
||||||
|
LocalAddress: String;
|
||||||
|
RemoteAddress: String;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Name := PopString;
|
||||||
|
Description := PopString;
|
||||||
|
Protocol := NET_FW_IP_PROTOCOL(StrToInt(PopString));
|
||||||
|
Direction := NET_FW_RULE_DIRECTION(StrToInt(PopString));
|
||||||
|
Enabled := StrToBool(PopString);
|
||||||
|
Profile := NET_FW_PROFILE_TYPE2(StrToInt(PopString));
|
||||||
|
Action := NET_FW_ACTION(StrToInt(PopString));
|
||||||
|
ApplicationName := PopString;
|
||||||
|
ServiceName := PopString;
|
||||||
|
IcmpTypesAndCodes := PopString;
|
||||||
|
Group := PopString;
|
||||||
|
LocalPorts := PopString;
|
||||||
|
RemotePorts := PopString;
|
||||||
|
LocalAddress := PopString;
|
||||||
|
RemoteAddress := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AdvAddRule(Name,
|
||||||
|
Description,
|
||||||
|
Protocol,
|
||||||
|
Direction,
|
||||||
|
Enabled,
|
||||||
|
Profile,
|
||||||
|
Action,
|
||||||
|
ApplicationName,
|
||||||
|
ServiceName,
|
||||||
|
IcmpTypesAndCodes,
|
||||||
|
Group,
|
||||||
|
LocalPorts,
|
||||||
|
RemotePorts,
|
||||||
|
LocalAddress,
|
||||||
|
RemoteAddress) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AdvRemoveRule(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Name: String;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Name := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AdvRemoveRule(Name) = 0);
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AdvExistsRule(const hwndParent: HWND; const string_size: integer;
|
||||||
|
const variables: PChar; const stacktop: pointer); cdecl;
|
||||||
|
var
|
||||||
|
Name: String;
|
||||||
|
Exists: Boolean;
|
||||||
|
FirewallResult: String;
|
||||||
|
begin
|
||||||
|
Init(hwndParent, string_size, variables, stacktop);
|
||||||
|
|
||||||
|
Name := PopString;
|
||||||
|
|
||||||
|
FirewallResult := ResultToStr(FirewallControl.AdvExistsRule(Name, Exists) = 0);
|
||||||
|
PushString(BoolToStr(Exists));
|
||||||
|
PushString(FirewallResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
exports AddPort;
|
||||||
|
exports RemovePort;
|
||||||
|
exports AddApplication;
|
||||||
|
exports RemoveApplication;
|
||||||
|
exports IsPortAdded;
|
||||||
|
exports IsApplicationAdded;
|
||||||
|
exports IsPortEnabled;
|
||||||
|
exports IsApplicationEnabled;
|
||||||
|
exports EnableDisablePort;
|
||||||
|
exports EnableDisableApplication;
|
||||||
|
exports IsFirewallEnabled;
|
||||||
|
exports EnableDisableFirewall;
|
||||||
|
exports AllowDisallowExceptionsNotAllowed;
|
||||||
|
exports AreExceptionsNotAllowed;
|
||||||
|
exports EnableDisableNotifications;
|
||||||
|
exports AreNotificationsEnabled;
|
||||||
|
exports StartStopFirewallService;
|
||||||
|
exports IsFirewallServiceRunning;
|
||||||
|
exports RestoreDefaults;
|
||||||
|
exports AllowDisallowIcmpOutboundDestinationUnreachable;
|
||||||
|
exports AllowDisallowIcmpRedirect;
|
||||||
|
exports AllowDisallowIcmpInboundEchoRequest;
|
||||||
|
exports AllowDisallowIcmpOutboundTimeExceeded;
|
||||||
|
exports AllowDisallowIcmpOutboundParameterProblem;
|
||||||
|
exports AllowDisallowIcmpOutboundSourceQuench;
|
||||||
|
exports AllowDisallowIcmpInboundRouterRequest;
|
||||||
|
exports AllowDisallowIcmpInboundTimestampRequest;
|
||||||
|
exports AllowDisallowIcmpInboundMaskRequest;
|
||||||
|
exports AllowDisallowIcmpOutboundPacketTooBig;
|
||||||
|
exports IsIcmpTypeAllowed;
|
||||||
|
exports AdvAddRule;
|
||||||
|
exports AdvRemoveRule;
|
||||||
|
exports AdvExistsRule;
|
||||||
|
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue