Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Disable Internet Connection Firewall on Windows XP

Status
Not open for further replies.

maupiti

Programmer
Oct 27, 2003
240
0
0
US
Visual Basic 5.0
Disabling Internet Connection Firewall on Windows XP using VB 5.0

On Windows XP. Right click on the LAN connection
(Network card)
Properties --> "Advanced" TAB

uncheck the box - Protect my computert and network by
limiting or preventing access to this
computer from the internet.

=========================================

Hot do I Disable "Internet Connection Firewall"
in Windows XP using VB 5.0 ?

Microsoft web site said use the DisableInternetFirewall API, but it never specify exactly what is needed and there is no example code of how the API is called.

 
Why would you want to disable this?

This is a basic protection subsystem for the operating system, and any attempt to disable it should (in my opinion) be regarded as a prelude to a virus or worm attack.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Hi chiph.

The thing that I am doing is pretty advance. I am implementing an IPSEC tunnel using Windows 2000 and XP. IPSEC is built-in to these two OS.

In Windows XP, if ICF is not disabled, then the IPSEC tunnel cannot be established. This has nothing to do with writing virus and worms to nullify someone else 's computer security.

However, when turning of the ICF feature, Windows XP will always prompt the user if he wanted to turned off, and he can elect to turned ICF off or leave it on.



 
Didn't know that ICF would block outgoing IPSEC connections (why would they do that?? Doesn't make sense!).

I suspect (I don't have XP) that ICF runs as a Windows Service, so if you know the name of it you can issue commands to the service control manager to stop it.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
ICS/ICF have COM interfaces. To access them set a reference to NetCon 1.0 Type Library
 
Go to Start Bar Click [Start]

then [Settings]

then Click Mouse on [Network Conection] and a Window will open

Now you should be able to see an ICON under Dial-up, this is the settings for your ISP

right click on the ICON and a menu will appears

Click on [Properties] and a widow will open

at the top of this window are 5 Tab's to Choose from
[General] [Options] [Security] [ Networking] [Advanced]

Click on [Advanced]

now at the top of the Advanced section is the Heading "Internet Connection Firewall.
under this is a Check-box with a tick in it, Click the Check-box so tick is gone

then Click [OK] button at bottom of window

if you are already conected to the internet a window will appear telling you
some changes wont take effect until the next time you dial it. Click the [OK] button

Thats it!! Windows XP Firewall is now turned off.
 
Ok, so Im presuming there will be a registry key that stores the value of the checkbox (mentioned above).

Search the registry for the key and change it through VB
 
I just searched for the NetCon COM library on my win2k machine -- not surprisingly, it's not there. :)

It's be a good idea to make sure your app is running on WinXP before calling NetCon, and you'd want to do it via late-binding instead of setting a reference (if you need to run on non-XP boxes too)

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
>it's not there

Indeed not - but the original question specifies XP...

Mind you, like you I'm a little suprised that one might need to disable the ICF to enable the creation of an IPSEC tunnel. On the other hand, I've never tried it from scratch myself, so...
 
maupiti (Programmer) Feb 2, 2004 in thread222-764903

>You said that "ICS/ICF have COM interfaces. To access them set a reference to NetCon 1.0 Type Library "

>I am using Visual Basic 5.0. The VB 5.0 was released some 5 years before Windows XP and I am sure that the NetCon 1.0 >Type library is not under Project --> References or
>Project --> Components. I did looked and it was not there.
>Now, VB 6.0 also came out before Windows XP, so I am sure that NetCon 1.0 is not there either. Perhaps I need a >service pack. If you know how anything about this NetCon 1.0 then please let me know.

The version of VB is irrelevant. The library does not come with VB, it comes with the OS. But I guess it is possible that it only comes with the Pro version of XP, although the Microsoft documentation ( makes no such distinction

Try and see if you get an error with CreateObject("HNetCfg.HNetShare.1")
 
Hi strongm. Thank you for your help. I have been to that web site before I decided to post my question at Tek-tips. The documentation there is very sparse. If you know how to do it step by step, then please post the answer here.
 
Hi strongm. What is the name of the library ?
At the web site below, I downloaded the file name IPv6 Internet Connection Firewall SDK. Maybe this is it, but what are the steps needed to get it to work ?


The code below results in "Run-time error '429' Active X component can 't create object.

==============================
Option Explicit

Private Sub Form_Load()
Dim ABC As Variant

ABC = CreateObject("HNetCfg.HNetShare.1")
End Sub
=============================
 
To use the IPv6 stuff you need to have previously installed the Advanced Networking Pack for Windows XP (on Windows XP SP1)

The ICS/ICF API is something different

HNetCfg.HNetShare.1 is the ProgID for the home networking components of XP (i.e ICS/ICF API). If the CreateObject call using this ProgID is failing...well, then it looks like the install is broken (and would explain the missing Netcon 1.0 Typelibrary).
 
Anyone interested this works, and if you want to enable just change the EachConnection.DisableInternetFirewall to EachConnection.EnableInternetFirewall.


Public Function DisableInternetFirewall(strConnection As String) As Boolean
Dim SharingMgr, EachConnection, ConnectionProps, item
Set SharingMgr = CreateObject("HNetCfg.HNetShare.1")
For Each item In SharingMgr.EnumEveryConnection
Set EachConnection = SharingMgr.INetSharingConfigurationForINetConnection(item)
Set ConnectionProps = SharingMgr.NetConnectionProps(item)
If ConnectionProps.Name = strConnection Then
EachConnection.DisableInternetFirewall
DisableInternetFirewall = True
Exit For
End If
Next
End Function

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Hi DrJavaJoe. Thank you for your help.

Public Function DisableInternetFirewall(strConnection As String) As Boolean

1) What does "strConnection" suppose to contain ? Is it a name of an Network Interface Card or what ?

2) Do I have to call another API to access this value in "strConnection" or do I supply it myself ?

===============================

Error message: variable not defined.
Since I do not know what suppose to be in
strConnection, the program won 't run.

Option Explicit

Private Sub Form_Load()
Dim abc As Variant

MsgBox DisableInternetFirewall(strConnection)
End Sub
 
It's the name of the connection that you want to disable, such as "Local Area Connection". This is incase you have multiple connections and only want to disable a specific one. If you go to Network Connections from control panel you'll see a list of your connections.

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Hi DrJavaJoe. Thank you so much for your help.
You are a genius.
I tested on the Windows XP machine and it work.
=============================================

Windows Explorer --> Tools --> Options --> View TAB
Show hidden files and folders
uncheck hide file extensions
uncheck hide protected operating system files

I searched the Windows XP computer for the file "HNetCfg.HNetShare.1", or "HNetCfg", or "HNetShare"
and none were founded.

1)What are the name of the .dll or .ocx files that are used to make the code works ?

2) Please show me the site where you obtain that code.


 
This is the dll you are looking for C:\WINDOWS\SYSTEM32\hnetcfg.dll as far as the code I put it together by browsing the NetSharingManager and INetConnection objects in the Object Browser.

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Hi DrJavaJoe. Thank you for your help.

In VB 5.0, I select

View --> Object Browser
A New window appeared
I Selected <All Libraries> from the drop down combo box

I Entered INetSharingManager
I clicked a &quot;Binocular&quot; for find, but nothing was found

I Entered NetSharingManager
I clicked a &quot;Binocular&quot; for find, but nothing was found

-------------------------------------------------

I Entered INetConnection
I clicked a &quot;Binocular&quot; for find, but nothing was found

I Entered NetConnection
I clicked a &quot;Binocular&quot; for find, but nothing was found

-------------------------------------------------

Please show me how you find them in the Object Browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top