Ir para conteúdo
Sistema de Servidores de Jogos ×
  • Quem está por aqui   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.

[duvida]Código em C# para abrir portas no firewall


Posts Recomendados

Galerinha gostaria de saber um código em C# para poder abrir porta no windows XP, qual arquivo ".DLL" do windows que uso para mexer no firewall?

Link para o comentário
https://www.webcheats.com.br/topic/586110-duvidac%C3%B3digo-em-c-para-abrir-portas-no-firewall/
Compartilhar em outros sites

Adicione a referência à hnetcfg.dll (C:/WINDOWS/SYSTEM32)

 

Achei este texto em inglês,acho que vai lhe ajudar :

 

 

Setting up

 

Start by adding a reference to the COM dll that provides the functionality to control the windows firewall. The filename is hnetcfg.dll which can be found at the system32 folder inside windows. So add the file to your C# project.

 

File location: \Windows\System32\hnetcfg.dll

Then add these using statements to import the COM Objects

 

É necessário se cadastrar para acessar o conteúdo.

Obtaining a reference to the firewall manager

 

The first step toward controlling the windows firewall is to obtain a reference to the firewall manager class. For this we will use the CLSID of the class which is

 

{304CE942-6E39-40D8-943A-B913C40C9CD4}

 

So our code looks like this

 

É necessário se cadastrar para acessar o conteúdo.

 

The above code shows how to get a reference to the firewall manager

 

Check if the firewall is turned on

 

If the firewall is not turned we should look into the current profile and find out then turn it on.

 

É necessário se cadastrar para acessar o conteúdo.

 

Give full trust to your executable

 

If we want to authorize some application with full trust then we need to create a FirewallAuthorizedApplication (INetFwAuthorizedApplication) object and add it to the authorized application list.

 

É necessário se cadastrar para acessar o conteúdo.

 

The above code is for a function that adds an authorized application. Let see the use by authorizing notepad full internet access!

 

É necessário se cadastrar para acessar o conteúdo.

 

Opening a Port Globally

 

Sometimes we may want to open a port for any application no matter what. Windows Firewall can be instructed to open a port globally for all applications by adding a port to the globally open ports list. Let try to write a function that opens up a port globally ...

 

É necessário se cadastrar para acessar o conteúdo.

 

 

Fonte : shaqal

Mas acho melhor desativar essa droga de firewall logo.:p

Link para o comentário
https://www.webcheats.com.br/topic/586110-duvidac%C3%B3digo-em-c-para-abrir-portas-no-firewall/#findComment-2992672
Compartilhar em outros sites

Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.