
Code: Alles auswählen
;add your app to firewall - AuthorizedApplication (xp/sp2)
Interface INetFwAuthorizedApplication Extends IDispatch
get_Name(a)
put_Name(a)
get_ProcessImageFileName(a)
put_ProcessImageFileName(a)
get_IpVersion(a)
put_IpVersion(a)
get_Scope(a)
put_Scope(a)
get_RemoteAddresses(a)
put_RemoteAddresses(a)
get_Enabled(a)
put_Enabled(a)
EndInterface
Interface INetFwAuthorizedApplications Extends IDispatch
get_Count(a)
Add(a)
Remove(a)
Item(a,b)
get__NewEnum(a)
EndInterface
Interface INetFwProfile Extends IDispatch
get_Type(a)
get_FirewallEnabled(a)
put_FirewallEnabled(a)
get_ExceptionsNotAllowed(a)
put_ExceptionsNotAllowed(a)
get_NotificationsDisabled(a)
put_NotificationsDisabled(a)
get_UnicastResponsesToMulticastBroadcastDisabled(a)
put_UnicastResponsesToMulticastBroadcastDisabled(a)
get_RemoteAdminSettings(a)
get_IcmpSettings(a)
get_GloballyOpenPorts(a)
get_Services(a)
get_AuthorizedApplications(a)
EndInterface
Interface INetFwPolicy Extends IDispatch
get_CurrentProfile(a)
GetProfileByType(a,b)
EndInterface
Interface INetFwMgr Extends IDispatch
get_LocalPolicy(a)
get_CurrentProfileType(a)
RestoreDefaults()
IsPortAllowed(a,b,c,d,e,f,g)
IsIcmpTypeAllowed(a,b,c,d,e)
EndInterface
Global memtarget
Procedure.l Ansi2Uni(ansi.s) ;short way to unicode
If memtarget > 0 : CoTaskMemFree_(memtarget) : EndIf
SHStrDup_(@ansi,@memtarget)
;use it if SHStrDup - error
;--------------------------
;OpenLibrary(1,"shlwapi.dll")
;CallFunction (1, "SHStrDupA",@ansi,@memtarget)
;CloseLibrary(1)
;--------------------------
ProcedureReturn memtarget
EndProcedure
Procedure free_app_firewall(name.s,app.s)
ret.l
CoInitialize_(0)
If CoCreateInstance_(?CLSID_NetFwMgr,0,1,?IID_INetFwMgr,@object0.INetFwMgr) = 0
object0\get_LocalPolicy(@a.INetFwPolicy)
a\get_CurrentProfile(@objPolicy.INetFwProfile)
If CoCreateInstance_(?CLSID_FwAuthorizedApplication,0,1,?IID_INetFwAuthorizedApplication,@object.INetFwAuthorizedApplication) = 0
object\put_Name(Ansi2Uni(name))
object\put_IPVersion(2)
object\put_ProcessImageFileName (Ansi2Uni(app))
object\put_RemoteAddresses(Ansi2Uni("*"))
object\put_Scope(0)
object\put_Enabled(#True)
EndIf
objPolicy\get_AuthorizedApplications(@colApplications.INetFwAuthorizedApplications)
If colApplications\add(object) = 0 : ret = 1 : EndIf
EndIf
CoUninitialize_()
DataSection
CLSID_NetFwMgr:
Data.l $304CE942
Data.w $6E39,$40D8
Data.b $94,$3A,$B9,$13,$C4,$0C,$9C,$D4
IID_INetFwMgr:
Data.l $F7898AF5
Data.w $CAC4,$4632
Data.b $A2,$EC,$DA,$06,$E5,$11,$1A,$F2
CLSID_FwAuthorizedApplication:
Data.l $EC9846B3
Data.w $2762,$4A6B
Data.b $A2,$14,$6A,$CB,$60,$34,$62,$D2
IID_INetFwAuthorizedApplication:
Data.l $B5E64FFA
Data.w $C2C5,$444E
Data.b $A3,$01,$FB,$5E,$00,$01,$80,$50
EndDataSection
ProcedureReturn ret
EndProcedure
Debug free_app_firewall("my app","c:\windows\notepad.exe") ; should be a real app !
->systemsteuerung
->windows firewall
->ausnahmen
...was tut man nicht alles , wenn's so warm ist
