473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

windows registry, tuples, turning off winXP firewall with Python

for i in range(10000):
try:
n,v,t = EnumValue(open_key,i)
# n == name of the registry object.
# v == object's value.
# t == object's type.
print n,v,t
except EnvironmentError:
print "\nThere are", i, "registy objects under this key."
break

Is there a way to reference an item within a tuple that you've iterated
over? The above code upacks a tuple into 3 variables n,v and t. In order
to do this, it loops over a Windows registry key. Let's say that I want
to find out which n == 'EnableFirewall' and then read the value of its
v... how can I do that?

BTY, the below code turns off the 'Windows Firewall' on Windows XP
Service Pack 2... I wrote it as a test after reading that MS is allowing
3rd party programs to programmatically enable or disable the firewall
through the registry.

from _winreg import *

sub_key =
r"SYSTEM\ControlSet001\Services\SharedAccess\Param eters\FirewallPolicy\StandardProfile"
open_key = OpenKey(HKEY_LOCAL_MACHINE, sub_key, 0, KEY_ALL_ACCESS)
SetValueEx(open_key,'EnableFirewall',0,REG_DWORD,0 )
CloseKey(open_key)
Jul 18 '05 #1
0 1886

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexandr Molochnikov | last post by:
Hello group, I am trying to cut down the number of ports that must be opened in a firewall to let the client talk to the protected server. The server runs its own registry process by calling...
1
by: George Carman | last post by:
Please excuse the following mailing, I do not have access to a news server and cannot post to comp.lang.python. I recently installed Python 2.3.4 on WinXP. Command line interpreter works fine...
17
by: Paul Rubin | last post by:
Dumb question from a Windows ignoramus: I find myself needing to write a Python app (call it myapp.py) that uses tkinter, which as it happens has to be used under (ugh) Windows. That's Windows...
16
by: Paul Rubin | last post by:
As what must be penance for something or other, I'm needing to release a Python app for use under Windows XP. Please be gentle with me since I'm a Un*x weenie and the only thing I've had much...
5
by: thorley | last post by:
Greetings, I'm interested in a simple content-based internet firewall/filter, similar to dansguardian (http://dansguardian.org/), but written in python, and for windows. I assumed such a project...
2
by: imx | last post by:
Hi, Enviroment: WinXP sp2, python 2.5 problem: click IDLE using shorcut menu or run phthonw.exe directly, nothing happen! But running python.exe from the command line is fine. I searched this...
9
by: Irmen de Jong | last post by:
Hello Sorry this might be a bit offtopic but I don't really know where else to post this question. If you could point me in the right direction that is much appreciated. I'm running into a...
11
by: Unknown Hero | last post by:
Tim Golden wrote: The first link which points to the Python documentation for the _winreg module I already checked, even before coming here. I am wondering how I should do the loop I need (go...
19
by: fx5900 | last post by:
Hi, i am trying to convert an .osm (openstreetmap) file into gml format and finally to shapefile given this wiki info http://wiki.openstreetmap.org/index.php/GML. I'm using windows and when i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.