Solved: Windows ICF Firewall Registry Keys

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

des000

Thread Starter
Joined
May 29, 2008
Messages
307
I've found the registry keys for the Windows XP ICF Firewall Configuration. It's located in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy. That's for everyone's reference. However, I wasn't looking for that registry key. I was looking for the registry key that contains the same type of configuration, except specific to a adapter. Does anybody know where this is? Thanks in advance.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Is it by any chance possible, that these settings are stored in some other manner, such as an .INI file?
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Certainly. At this time, I'm trying to come up with a way to save network settings. I've allowed in the case of this network, for multiple connections per computer sometimes. For example, there are two people who have laptops in one room of this house. Both of those laptops are connected with either wired, or wireless connections, to the same network, and the same point in the network. This allows us to have high speeds while at our desks, however, we can have lower speeds, but be allowed to be just about anywhere using the wireless network.

Now these two cards are connected to the same logical point. They're also on the same computer. Of course, they DO have seperate reservations in the DHCP server, and stuff though. I believe they MUST have seperate reservations as well. But we certainly want them to, even if, as I thought just now, that may or may not be true - I have never tried.

Well, I found that sometimes this act can cause some problems. If two cards connect to the same logical point, sometimes the OS doesn't know which card to send a packet over. I learned now, that this might be able to be solved by using a manual "metric", but we don't want to do this, it's too much setup to require in general. So, the requirement is that the unused adapter at that time, MUST be disabled. You may have more than one adapter connected to the same logical point, but NOT at the same time.

Well, I found an interesting property once in mine. You can set your cards to automatically detect a wired connection, and then they aren't connected that way. However, the other user doesn't have this too. They MUST manually disable the adapter.

Now, you throw in the fact that since these are laptops, we don't know what other networks they may be attatched to, and that means users are regularly reconfiguring their network settings, all the time. Remembering this can be hard, even for very technical users, such as myself. And remembering to reconfigure it right for THIS network can be a problem sometimes too.

Therefore, I was looking for a way to automate the reconfiguration. The first things I found, were articles about this and stuff. I've tried these ways so far. One suggestion, was to use netsh's scripts. That's pretty easy, but not quite powerful enough. It's also not easy for some users, just the more technical ones.

So next, I look at the programs that do this. They fit into a few categories:

a) Too expensive
b) Free, but not allowing you to use them in buisnesses and for personal use
c) Free but not powerful enough, and/or no way to automate those programs themselves
d) Meets all of the above, but perhaps too complicated to set up

Therefore, knowing the basics of how they might work, I get this idea. Why not create one of my own? It'd have just the features I needed, that those were lacking.

It will mainly consist of 2 command line programs, and one user interface, probably made with AutoIt code. One program will save the current network configuration, and the other program will restore a saved configuration. The user interface will just display an icon allowing the user to do all this easily, without the command line, if they choose.

Well, starting the restore part, I've started to come up with a syntax for a simple file format. Realizing that I can't finish, because there are not enough command line tools to call to set all the realevant properties provided with Windows XP (Why was I surprised?), I began to write my own tool. This tool sets and gets the realevant network properties. I started with the piece of the tool that changes adapter specific network properties. Then for no reason at all, I worked first on the "get" portion, which I always knew WOULD be more complicated. The "set" of this tool will come later.

So the NIC tool was born. I'm sure that even outside of this use, I will use the final tool quite a bit, because it can do more than standard tools now. It just uses the standard tools though, if it can easily. So I'm going to create this NIC tool, and then for the non-adapter-specific tools, I'll create another tool, which is more general, but will use this tool for the adapter specific part. Then, finally, I'll go back to coding the origional project, which will use that tool. The language this is all coded in so far, is not that complicated, it's just a standard Windows XP BATCH file. It relies on my other BATCH files, which since I now need to be multi-platform, I'm calling the "standard scripts". Just about everything relies on this, if you do it my way.

I ran through all the basics, and got to the tough parts now. It can get all the information about IP Addresses, and Alternate IP Addresses, etc. The firewall is one of those tough parts. So is the wireless network settings, but they'll come later. While the firewall isn't directly related to the adapter settings, I'm considering it part of that. I looked at the Windows GUI for setting the firewall configuration, and determined that there's a part that is specific to adapters.

When I more closely studied things, I might be able to use netsh to get these, and if it came up, I wondered if anybody thought it does a good job, and knew how to parse it's output to find information, as everything MUST become machine readable to read pretty output back into another program. That's why I can't just use directly the netsh command. I need to be able to read it that way, so I can display it later any old way I want, or in this case, send it to a file with the correct syntax and good-practice rules, so I can save the network settings.

But even if the netsh command is the way to go, I still needed if anyone knows, the registry keys, or where it's stored, so that if I ever do need the information for sure, I can get it. However, I still don't know if netsh would really work, because the netsh command I discovered after posting this thread. I've searched and searched for the answers, so far.

Another possible later application of these tools, is later automating setup tasks I previously could not, such as renaming network connections adapters.
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Oh! I forgot to mention. Most of the settings so far, I DID have to use the registry to get. There just isn't tools to get them any other way in Windows XP. Not from the command line. It was stuff such as the alternate configuration.

ipconfig has some of this, but NOT machine readable easily. It displays inconsistant ways of displaying things, which are great for human understanding, but not for parsing. It would probably take longer to parse that way too, when I'm already really slow using this method.

Therefore, I ended up grabbing most of these properties from the registry. The Windows XP registry also stores stuff in a much more complicated manner than nessessary too. OK, so there's standards on where stuff goes. But why didn't they put it in a logical place? I would've! I guess they aren't that logical. They seem to have all these extra keys that have been proven to be not even needed, by further research. They duplicate the network configuration, and such. But even then, it's not entirely duplicated! Therefore, I also added a bunch of technical registry properties I might need, but don't thus far, except for this.
 
Joined
Aug 7, 2007
Messages
9,028
Should be easy to use the Route command
Parse Route Print to see what card is currently set as the interface for the relevant networks.
Use Route Change to change to the other card if needed. The interface numbers and description are also listed in Route Print. Would need to be able to distinguish between wired and wireless from the description.

If needed, parse the IPconfig output to determine the IP address for each card (use description from the route print output), then you can parse Route Print to find the routes that need to be changed.

If the router (dhcp server) can be configured with different scopes for wired vs wireless (X.X.X.0-X.X.X.127 for wired, X.X.X.128-X.X.X.254 for wireless for example) checking which interface is being used is easy. One script to set the route for the wired card, one to set route to wireless.

Or use AutoIt to disable one card and enable the other. A separate script for each, or a "toggle" script.

HTH

Jerry
 

des000

Thread Starter
Joined
May 29, 2008
Messages
307
Thanks for the help. They're on the same IP subnet currently, so I couldn't use parsing that way, but I did find that netsh CAN read the firewall settings. You just have to do some parsing to find which settings are specific to which card is all.

I was able to figure out how to parse netsh, but it was dificult. Basically I had to do the netsh command, for the specified contexts, and then I had to ask it to filter out the correct information. I used the FINDSTR command to find where to begin. This was the difficult part. I think it's a bug in FINDSTR, but if there's no space in the name of the adapter, I had to use something like FINDSTR /N %NETCONNAME% (%NETCONNAME% is the name in Network Connections). If, however, there WAS a space, then I had to do something like FINDSTR /N /C:"%NETCONNAME%", and that worked.

The second command seemed like it should've worked in all cases, but it didn't. So then I got the appropriate line number by parsing the output of that command with the FOR command. Then finally, I could take the origional output, and use MORE to read starting at the correct line number, and then all I had to do was filter out the unneeded text, using the headers as the beginning lines of the text to stop at, and then get just that output, and display nothing but that output. The rest was offscreen calculations, using the filesystem.

As tends to be usual for me, in this program, I had to make heavy use of the commands I created in the past, such as echochar, which works with strings, and out2com, which sends the output of a command to a variable for later use.

echochar will either tell you the length of a string, or it will display a character using a specified index. This works a lot like an array in a language such as C/C++, or Java. It starts with 0, as it's index, and the length displays the maximum index + 1, just as it would in those languages.

out2com will send the output of a command to a variable for later use, but will also now that I tweaked it more, send the errorlevel of that command to the enviroment variable %OUTERRORLEVEL%. The only problem, once I tweaked this, was that because I'm using this so much, I can't seem to get rid of the extra files, because the delete doesn't seem to work. I had to have it create random file names to use, so that more than one instance could run at once too. If nothing else, I'll later implement some cleanup programs to periodically run.

I'm also making heavy use of recursion, which is this case is using the same program's functions as I've already used, so that this program relies on earlier functions that it had before that point in time, such as the netconname command, which gets the name as specified in Network Connections.

Thanks! This information pointed me in the right direction. Now I'm needing to go on to the next stage of this project, which is proving to be even tougher. Here's the link with the information I started on it: http://forums.techguy.org/windows-nt-2000-xp/774772-view-wireless-network-properties-command.html.
 
Joined
Aug 7, 2007
Messages
9,028
You might want to take a look at the WMIC command, in particular:
wmic NIC get /?
wmic NICconfig get /?


Use /?:full for verbose help.

Using Google for a specific command can be a great resource as well.

You can specify to retrieve just the info you need which will make parsing easier. You can specify a standard format for output (CSV, XML, HTable, MOF), or specify a XSL file to specify the format you want. I'm not familiar with XML/XSL stylesheets, but the default XSL stylesheets are in \%systemroot%\system32\wbem.

I barely know how to use wmic, just enough to google and use help, so I wouldn't be too much help to ya, but hopefully this might be useful for you.

Jerry
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top