Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Delphi] Allow a program to FireWall

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
h4c0r-BG
Master Cheater
Reputation: 0

Joined: 29 Nov 2006
Posts: 449
Location: The yogurt country

PostPosted: Tue Oct 14, 2008 3:33 am    Post subject: [Delphi] Allow a program to FireWall Reply with quote

Let's say i have a program made in delphi with 1 button.

On that button i have CreateProcess(); to another application.

When the other application is started Windows Firewall pops up and asks me to block/unblock/ask me later etc..

So i want to ask what is the best way to use the following code:

netsh firewall add allowedprogram C:\MyApp\MyApp.exe "My Application" ENABLE

and i do not want to call cmd.exe and type this in it ...

Information about firewall taken from: http://support.microsoft.com/kb/947709

_________________

Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Tue Oct 14, 2008 8:41 am    Post subject: Reply with quote

One way to do it would be the following, although when you use this the user might still see the cmd window in a split second:
netsh is an application, so you can open it with createprocess, and use those arguments as command line.
It'll be something like:
Code:
CreateProcess("netsh", "netsh firewall add allowedprogram C:\MyApp\MyApp.exe \"My Application\" ENABLE", other arguments...)

I don't know if netsh has some sort of 'silent' command line switch to disable the showing of the cmd window or disable any user notifications. Type 'netsh /?' or something to find out.
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Oct 14, 2008 8:47 am    Post subject: Reply with quote

Code:

var
  command, parameter : String;
begin
  command := 'netsh';
  parameter := 'firewall add allowedprogram C:\MyApp\MyApp.exe "My Application" ENABLE';
  ShellExecute(Handle, 'open', pchar(command), pchar(parameter), nil, SW_SHOWNORMAL);
end;


Of course, add ShellAPI to your uses list to be able to use the ShellCommands. Also, the last parameter of ShellExecute, should be able to be changed so no window will pop up.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites