本文整理汇总了Python中win32con.KEY_ALL_ACCESS属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.KEY_ALL_ACCESS属性的具体用法?Python win32con.KEY_ALL_ACCESS怎么用?Python win32con.KEY_ALL_ACCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.KEY_ALL_ACCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deleteKey
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def deleteKey(self, hKey, subKey):
"""
Recursively remove registry keys.
"""
try:
hKey = win32api.RegOpenKeyEx(hKey, subKey, 0,
win32con.KEY_ALL_ACCESS)
try:
while True:
s = win32api.RegEnumKey(hKey, 0)
self.deleteKey(hKey, s)
print("CleanupRegistry: Removing sub-key '{}'".format(s))
win32api.RegDeleteKey(hKey, s)
except win32api.error:
pass
finally:
win32api.RegCloseKey(hKey)
except:
print("Warning: Unable to open registry key!")
pass
示例2: FindHelpPath
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def FindHelpPath(helpFile, helpDesc, searchPaths):
# See if the current registry entry is OK
import os, win32api, win32con
try:
key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Help", 0, win32con.KEY_ALL_ACCESS)
try:
try:
path = win32api.RegQueryValueEx(key, helpDesc)[0]
if FileExists(os.path.join(path, helpFile)):
return os.path.abspath(path)
except win32api.error:
pass # no registry entry.
finally:
key.Close()
except win32api.error:
pass
for pathLook in searchPaths:
if FileExists(os.path.join(pathLook, helpFile)):
return os.path.abspath(pathLook)
pathLook = os.path.join(pathLook, "Help")
if FileExists(os.path.join( pathLook, helpFile)):
return os.path.abspath(pathLook)
raise error("The help file %s can not be located" % helpFile)
示例3: __getitem__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def __getitem__(self, item):
item = str(item)
# is it data?
try:
return self.massageIncomingRegistryValue(win32api.RegQueryValueEx(self.keyhandle, item))
except:
pass
# it's probably a key then
try:
return RegistryDict(self.keyhandle, item, win32con.KEY_ALL_ACCESS)
except:
pass
# must not be there
raise KeyError, item
示例4: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def __init__(self, keyname, handle=None, mode="w"): #access=win32con.KEY_ALL_ACCESS):
"""Easy access to win32 registry.
mode: 'r' or 'w'"""
if mode=="w":
access = win32con.KEY_ALL_ACCESS
elif mode=="r":
access = win32con.KEY_READ
else:
raise ValueError( "mode must be 'r' or 'w'" )
self.mode = mode
self.handle = None
if handle is None:
handle=self.branch
# open key
try:
self.handle = win32api.RegOpenKeyEx(handle, keyname, 0, access)
except:
#except (pywintypes.error, pywintypes.api_error):
self.handle = win32api.RegCreateKey(handle, keyname)
示例5: __init__
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def __init__(self, hKey, path=None, machine=None):
self.access = Con.KEY_ALL_ACCESS
if isinstance(hKey, pywintypes.HANDLEType):
if path is None:
self.hKey = hKey
self.path = None
else:
self.hKey = Api.RegOpenKeyEx(hKey, path, 0, self.access)
self.path = path
self.machine = None
else:
if machine is None:
self.hKey = Api.RegOpenKeyEx(hKey, path, 0, self.access)
self.path = path
else:
if not machine.startswith("\\\\"):
machine = "\\\\%s" % machine
hKey = Api.RegConnectRegistry(machine, hKey)
if path is None:
self.hKey = hKey
else:
self.hKey = Api.RegOpenKeyEx(hKey, path, 0, self.access)
self.path = path
self.machine = machine
示例6: UnregisterHelpFile
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def UnregisterHelpFile(helpFile, helpDesc = None):
"""Unregister a help file in the registry.
helpFile -- the base name of the help file.
helpDesc -- A description for the help file. If None, the helpFile param is used.
"""
key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Help", 0, win32con.KEY_ALL_ACCESS)
try:
try:
win32api.RegDeleteValue(key, helpFile)
except win32api.error, exc:
import winerror
if exc.winerror!=winerror.ERROR_FILE_NOT_FOUND:
raise
finally:
win32api.RegCloseKey(key)
# Now de-register with Python itself.
if helpDesc is None: helpDesc = helpFile
try:
win32api.RegDeleteKey(GetRootKey(),
BuildDefaultPythonKey() + "\\Help\\%s" % helpDesc)
except win32api.error, exc:
import winerror
if exc.winerror!=winerror.ERROR_FILE_NOT_FOUND:
raise
示例7: LocateSpecificServiceExe
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def LocateSpecificServiceExe(serviceName):
# Given the name of a specific service, return the .EXE name _it_ uses
# (which may or may not be the Python Service EXE
hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\%s" % (serviceName), 0, win32con.KEY_ALL_ACCESS)
try:
return win32api.RegQueryValueEx(hkey, "ImagePath")[0]
finally:
hkey.Close()
示例8: getSoftwareList
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def getSoftwareList(self):
try:
hCounter=0
hAttCounter=0
# connecting to the base
hHandle = win32api.RegConnectRegistry(None,win32con.HKEY_LOCAL_MACHINE)
# getting the machine name and domain name
hCompName = win32api.GetComputerName()
hDomainName = win32api.GetDomainName()
# opening the sub key to get the list of Softwares installed
hHandle = win32api.RegOpenKeyEx(self.HKEY_LOCAL_MACHINE,self.CONST_SW_SUBKEY,0,win32con.KEY_ALL_ACCESS)
# get the total no. of sub keys
hNoOfSubNodes = win32api.RegQueryInfoKey(hHandle)
# delete the entire data and insert it again
#deleteMachineSW(hCompName,hDomainName)
# browsing each sub Key which can be Applications installed
while hCounter < hNoOfSubNodes[0]:
hAppName = win32api.RegEnumKey(hHandle,hCounter)
hPath = self.CONST_SW_SUBKEY + "\\" + hAppName
# initialising hAttCounter
hAttCounter = 0
hOpenApp = win32api.RegOpenKeyEx(self.HKEY_LOCAL_MACHINE,hPath,0,win32con.KEY_ALL_ACCESS)
# [1] will give the no. of attributes in this sub key
hKeyCount = win32api.RegQueryInfoKey(hOpenApp)
hMaxKeyCount = hKeyCount[1]
hSWName = ""
hSWVersion = ""
while hAttCounter < hMaxKeyCount:
hData = win32api.RegEnumValue(hOpenApp,hAttCounter)
if hData[0]== "DisplayName":
hSWName = hData[1]
self.preparefile("SW Name",hSWName)
elif hData[0]== "DisplayVersion":
hSWVersion = hData[1]
self.preparefile("SW Version",hSWVersion)
hAttCounter = hAttCounter + 1
#if (hSWName !=""):
#insertMachineSW(hCompName,hDomainName,hSWName,hSWVersion)
hCounter = hCounter + 1
except:
self.preparefile("Exception","In exception in getSoftwareList")
示例9: iteritems_children
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def iteritems_children(self, access=win32con.KEY_ALL_ACCESS):
i = 0
try:
while 1:
s, obj, objtype = win32api.RegEnumKey(self.keyhandle, i)
yield s, RegistryDict(self.keyhandle, [s], access)
i += 1
except:
pass
示例10: iteritems
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def iteritems(self, access=win32con.KEY_ALL_ACCESS):
# yield children
for item in self.iteritems_data():
yield item
for item in self.iteritems_children(access):
yield item
示例11: itervalues_children
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def itervalues_children(self, access=win32con.KEY_ALL_ACCESS):
for key, value in self.iteritems_children(access):
yield value
示例12: itervalues
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def itervalues(self, access=win32con.KEY_ALL_ACCESS):
for key, value in self.iteritems(access):
yield value
示例13: items
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def items(self, access=win32con.KEY_ALL_ACCESS):
return list(self.iteritems())
示例14: values
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def values(self, access=win32con.KEY_ALL_ACCESS):
return list(self.itervalues(access))
示例15: modifyVariableInRegister
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def modifyVariableInRegister( name , value ):
key = win32api.RegOpenKey( win32con.HKEY_CURRENT_USER,"Environment",0,win32con.KEY_ALL_ACCESS)
if not key : raise
win32api.RegSetValueEx( key , name , 0 , win32con.REG_SZ , value )
win32api.RegCloseKey( key )