当前位置: 首页>>代码示例>>Python>>正文


Python win32con.KEY_ALL_ACCESS属性代码示例

本文整理汇总了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 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:22,代码来源:util.py

示例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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:regsetup.py

示例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 
开发者ID:ActiveState,项目名称:code,代码行数:19,代码来源:recipe-174627.py

示例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) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:21,代码来源:msw.py

示例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 
开发者ID:grawity,项目名称:code,代码行数:26,代码来源:registry.py

示例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 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:28,代码来源:regutil.py

示例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() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:win32serviceutil.py

示例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") 
开发者ID:ActiveState,项目名称:code,代码行数:43,代码来源:recipe-265858.py

示例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 
开发者ID:ActiveState,项目名称:code,代码行数:11,代码来源:recipe-174627.py

示例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 
开发者ID:ActiveState,项目名称:code,代码行数:8,代码来源:recipe-174627.py

示例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 
开发者ID:ActiveState,项目名称:code,代码行数:5,代码来源:recipe-174627.py

示例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 
开发者ID:ActiveState,项目名称:code,代码行数:5,代码来源:recipe-174627.py

示例13: items

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import KEY_ALL_ACCESS [as 别名]
def items(self, access=win32con.KEY_ALL_ACCESS):
        return list(self.iteritems()) 
开发者ID:ActiveState,项目名称:code,代码行数:4,代码来源:recipe-174627.py

示例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)) 
开发者ID:ActiveState,项目名称:code,代码行数:4,代码来源:recipe-174627.py

示例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 ) 
开发者ID:ActiveState,项目名称:code,代码行数:7,代码来源:recipe-576431.py


注:本文中的win32con.KEY_ALL_ACCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。