Python win32con.HKEY_CURRENT_USER Examples
The following are 28
code examples of win32con.HKEY_CURRENT_USER().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32con
, or try the search function
.
Example #1
Source File: skype.py From Radium with Apache License 2.0 | 7 votes |
def get_regkey(self): try: accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE keyPath = 'Software\\Skype\\ProtectedStorage' try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead) except Exception, e: print e return '' num = win32api.RegQueryInfoKey(hkey)[1] k = win32api.RegEnumValue(hkey, 0) if k: key = k[1] return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]
Example #2
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def StartYardServer(self): try: rkey = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Webers\\Y.A.R.D") path = RegQueryValueEx(rkey, "program")[0] if not os.path.exists(path): raise Exception except: raise self.Exception( "Please start Yards.exe first and configure it." ) try: hProcess = CreateProcess( None, path, None, None, 0, CREATE_NEW_CONSOLE, None, None, STARTUPINFO() )[0] except Exception, exc: raise eg.Exception(FormatError(exc[0]))
Example #3
Source File: skype.py From BrainDamage with Apache License 2.0 | 6 votes |
def get_regkey(self): try: accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE keyPath = 'Software\\Skype\\ProtectedStorage' try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead) except Exception, e: # print e return '' num = win32api.RegQueryInfoKey(hkey)[1] k = win32api.RegEnumValue(hkey, 0) if k: key = k[1] return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]
Example #4
Source File: test_win32api.py From ironpython2 with Apache License 2.0 | 6 votes |
def test1(self): # This used to leave a stale exception behind. def reg_operation(): hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, self.key_name) x = 3/0 # or a statement like: raise 'error' # do the test try: try: try: reg_operation() except: 1/0 # Force exception finally: win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER, self.key_name) except ZeroDivisionError: pass
Example #5
Source File: test_win32api.py From ironpython2 with Apache License 2.0 | 6 votes |
def testValues(self): key_name = r'PythonTestHarness\win32api' ## tuples containing value name, value type, data values=( (None, win32con.REG_SZ, 'This is default unnamed value'), ('REG_SZ', win32con.REG_SZ,'REG_SZ text data'), ('REG_EXPAND_SZ', win32con.REG_EXPAND_SZ, '%systemdir%'), ## REG_MULTI_SZ value needs to be a list since strings are returned as a list ('REG_MULTI_SZ', win32con.REG_MULTI_SZ, ['string 1','string 2','string 3','string 4']), ('REG_DWORD', win32con.REG_DWORD, 666), ('REG_BINARY', win32con.REG_BINARY, str2bytes('\x00\x01\x02\x03\x04\x05\x06\x07\x08\x01\x00')), ) hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, key_name) for value_name, reg_type, data in values: win32api.RegSetValueEx(hkey, value_name, None, reg_type, data) for value_name, orig_type, orig_data in values: data, typ=win32api.RegQueryValueEx(hkey, value_name) self.assertEqual(typ, orig_type) self.assertEqual(data, orig_data)
Example #6
Source File: rtd_function.py From pyxll-examples with The Unlicense | 6 votes |
def _register(cls): """Register an inproc com server in HKEY_CURRENT_USER. This may be used as a replacement for win32com.server.register.UseCommandLine to register the server into the HKEY_CURRENT_USER area of the registry instead of HKEY_LOCAL_MACHINE. """ clsid_path = "Software\\Classes\\CLSID\\" + cls._reg_clsid_ progid_path = "Software\\Classes\\" + cls._reg_progid_ spec = cls.__module__ + "." + cls.__name__ # register the class information win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path, win32con.REG_SZ, cls._reg_desc_) win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path + "\\ProgID", win32con.REG_SZ, cls._reg_progid_) win32api.RegSetValue(win32con.HKEY_CURRENT_USER, clsid_path + "\\PythonCOM", win32con.REG_SZ, spec) hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, clsid_path + "\\InprocServer32") win32api.RegSetValueEx(hkey, None, None, win32con.REG_SZ, pythoncom.__file__) win32api.RegSetValueEx(hkey, "ThreadingModel", None, win32con.REG_SZ, "Both") # and add the progid win32api.RegSetValue(win32con.HKEY_CURRENT_USER, progid_path, win32con.REG_SZ, cls._reg_desc_) win32api.RegSetValue(win32con.HKEY_CURRENT_USER, progid_path + "\\CLSID", win32con.REG_SZ, cls._reg_clsid_) # make sure the example RTD server is registered
Example #7
Source File: recipe-265858.py From code with MIT License | 5 votes |
def __init__(self): # variable to write a flat file self.fileHandle = None self.HKEY_CLASSES_ROOT = win32con.HKEY_CLASSES_ROOT self.HKEY_CURRENT_USER = win32con.HKEY_CURRENT_USER self.HKEY_LOCAL_MACHINE = win32con.HKEY_LOCAL_MACHINE self.HKEY_USERS = win32con.HKEY_USERS self.FILE_PATH = "//masblrfs06/karcherarea$/workarea/nishitg/"+ win32api.GetComputerName() self.CONST_OS_SUBKEY = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" self.CONST_PROC_SUBKEY = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" self.CONST_SW_SUBKEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
Example #8
Source File: outlook.py From BrainDamage with Apache License 2.0 | 5 votes |
def run(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE keyPath = 'Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles\\Outlook' try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead) except Exception, e: return
Example #9
Source File: putty.py From BrainDamage with Apache License 2.0 | 5 votes |
def get_default_database(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\\ACS\\PuTTY Connection Manager', 0, accessRead) thisName = str(win32api.RegQueryValueEx(key, 'DefaultDatabase')[0]) if thisName: return thisName else: return ' '
Example #10
Source File: winscp.py From BrainDamage with Apache License 2.0 | 5 votes |
def get_logins_info(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Sessions', 0, accessRead) except Exception, e: return False
Example #11
Source File: winscp.py From BrainDamage with Apache License 2.0 | 5 votes |
def check_masterPassword(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Configuration\Security', 0, accessRead) thisName = str(win32api.RegQueryValueEx(key, 'UseMasterPassword')[0]) if thisName == '0': return False else: return True
Example #12
Source File: winscp.py From BrainDamage with Apache License 2.0 | 5 votes |
def check_winscp_installed(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Configuration\Security', 0, accessRead) return True except Exception, e: return False
Example #13
Source File: impdirector.py From ConTroll_Remote_Access_Trojan with Apache License 2.0 | 5 votes |
def __init__(self): self.path = "WindowsRegistry" self.map = {} try: import win32api import win32con except ImportError: return subkey = r"Software\Python\PythonCore\%s\Modules" % sys.winver for root in (win32con.HKEY_CURRENT_USER, win32con.HKEY_LOCAL_MACHINE): try: hkey = win32api.RegOpenKeyEx(root, subkey, 0, win32con.KEY_READ) except Exception, e: logger.debug('RegistryImportDirector: %s' % e) continue numsubkeys, numvalues, lastmodified = win32api.RegQueryInfoKey(hkey) for i in range(numsubkeys): subkeyname = win32api.RegEnumKey(hkey, i) hskey = win32api.RegOpenKeyEx(hkey, subkeyname, 0, win32con.KEY_READ) val = win32api.RegQueryValueEx(hskey, '') desc = getDescr(val[0]) #print " RegistryImportDirector got %s %s" % (val[0], desc) #XXX self.map[subkeyname] = (val[0], desc) hskey.Close() hkey.Close() break
Example #14
Source File: process.py From peach with Mozilla Public License 2.0 | 5 votes |
def LocateWinDbg(self): # NOTE: Update master copy in debugger.py if you change this. try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\DebuggingTools") val, _ = win32api.RegQueryValueEx(hkey, "WinDbg") return val except: # Lets try a few common places before failing. pgPaths = [ "c:\\", os.environ["SystemDrive"] + "\\", os.environ["ProgramFiles"], ] if "ProgramW6432" in os.environ: pgPaths.append(os.environ["ProgramW6432"]) if "ProgramFiles(x86)" in os.environ: pgPaths.append(os.environ["ProgramFiles(x86)"]) dbgPaths = [ "Debuggers", "Debugger", "Debugging Tools for Windows", "Debugging Tools for Windows (x64)", "Debugging Tools for Windows (x86)", ] for p in pgPaths: for d in dbgPaths: testPath = os.path.join(p, d) if os.path.exists(testPath): return testPath print("Unable to locate gflags.exe!")
Example #15
Source File: util.py From peach with Mozilla Public License 2.0 | 5 votes |
def __init__(self, args): """ Constructor. Arguments are supplied via the Peach XML file. @type args: Dictionary @param args: Dictionary of parameters """ self._name = None self._key = args['Key'].replace("'''", "") if self._key.startswith("HKCU\\"): self._root = win32con.HKEY_CURRENT_USER elif self._key.startswith("HKCC\\"): self._root = win32con.HKEY_CURRENT_CONFIG elif self._key.startswith("HKLM\\"): self._root = win32con.HKEY_LOCAL_MACHINE elif self._key.startswith("HKPD\\"): self._root = win32con.HKEY_PERFORMANCE_DATA elif self._key.startswith("HKU\\"): self._root = win32con.HKEY_USERS else: print("CleanupRegistry: Error, key must be prefixed with: " "HKCU, HKCC, HKLM, HKPD, or HKU.") raise Exception("CleanupRegistry: Error, key must be prefixed " "with: HKCU, HKCC, HKLM, HKPD, or HKU.") self._key = self._key[self._key.find("\\") + 1:]
Example #16
Source File: recipe-576431.py From code with MIT License | 5 votes |
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 )
Example #17
Source File: winscp.py From Radium with Apache License 2.0 | 5 votes |
def check_winscp_installed(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Configuration\Security', 0, accessRead) return True except Exception, e: return False
Example #18
Source File: Constant.py From pc-protector-moe with GNU General Public License v3.0 | 5 votes |
def get_desktop(): key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 0, win32con.KEY_READ) return win32api.RegQueryValueEx(key, 'Desktop')[0]
Example #19
Source File: earthWallpaper.py From Tools with MIT License | 5 votes |
def setWallPaper(imagepath='download/cache_wallpaper.png'): keyex = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, win32con.KEY_SET_VALUE) win32api.RegSetValueEx(keyex, "WallpaperStyle", 0, win32con.REG_SZ, "0") win32api.RegSetValueEx(keyex, "TileWallpaper", 0, win32con.REG_SZ, "0") win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, imagepath, win32con.SPIF_SENDWININICHANGE)
Example #20
Source File: testExchange.py From ironpython2 with Apache License 2.0 | 5 votes |
def GetDefaultProfileName(): import win32api, win32con try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles") try: return win32api.RegQueryValueEx(key, "DefaultProfile")[0] finally: key.Close() except win32api.error: return None # # Recursive dump of folders. #
Example #21
Source File: regutil.py From ironpython2 with Apache License 2.0 | 5 votes |
def GetRegisteredHelpFile(helpDesc): """Given a description, return the registered entry. """ try: return GetRegistryDefaultValue(BuildDefaultPythonKey() + "\\Help\\" + helpDesc) except win32api.error: try: return GetRegistryDefaultValue(BuildDefaultPythonKey() + "\\Help\\" + helpDesc, win32con.HKEY_CURRENT_USER) except win32api.error: pass return None
Example #22
Source File: help.py From ironpython2 with Apache License 2.0 | 5 votes |
def ListAllHelpFiles(): ret = [] ret = _ListAllHelpFilesInRoot(win32con.HKEY_LOCAL_MACHINE) # Ensure we don't get dups. for item in _ListAllHelpFilesInRoot(win32con.HKEY_CURRENT_USER): if item not in ret: ret.append(item) return ret
Example #23
Source File: app.py From ironpython2 with Apache License 2.0 | 5 votes |
def _GetRegistryValue(key, val, default = None): # val is registry value - None for default val. try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, key) return win32api.RegQueryValueEx(hkey, val)[0] except win32api.error: try: hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, key) return win32api.RegQueryValueEx(hkey, val)[0] except win32api.error: return default
Example #24
Source File: outlook.py From Radium with Apache License 2.0 | 5 votes |
def run(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE keyPath = 'Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles\\Outlook' try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, keyPath, 0, accessRead) except Exception, e: return
Example #25
Source File: putty.py From Radium with Apache License 2.0 | 5 votes |
def get_default_database(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\\ACS\\PuTTY Connection Manager', 0, accessRead) thisName = str(win32api.RegQueryValueEx(key, 'DefaultDatabase')[0]) if thisName: return thisName else: return ' '
Example #26
Source File: winscp.py From Radium with Apache License 2.0 | 5 votes |
def get_logins_info(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE try: key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Sessions', 0, accessRead) except Exception, e: return False
Example #27
Source File: winscp.py From Radium with Apache License 2.0 | 5 votes |
def check_masterPassword(self): accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, 'Software\Martin Prikryl\WinSCP 2\Configuration\Security', 0, accessRead) thisName = str(win32api.RegQueryValueEx(key, 'UseMasterPassword')[0]) if thisName == '0': return False else: return True
Example #28
Source File: debugger.py From peach with Mozilla Public License 2.0 | 4 votes |
def LocateWinDbg(self): """ This method also exists in process.PageHeap! """ try: hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\DebuggingTools") except: # Lets try a few common places before failing. pgPaths = [ "c:\\", os.environ["SystemDrive"] + "\\", os.environ["ProgramFiles"], ] if "ProgramW6432" in os.environ: pgPaths.append(os.environ["ProgramW6432"]) if "ProgramFiles(x86)" in os.environ: pgPaths.append(os.environ["ProgramFiles(x86)"]) dbgPaths = [ "Debuggers", "Debugger", "Debugging Tools for Windows", "Debugging Tools for Windows (x64)", "Debugging Tools for Windows (x86)", ] for p in pgPaths: for d in dbgPaths: testPath = os.path.join(p, d) if os.path.exists(testPath): return testPath return None val, type = win32api.RegQueryValueEx(hkey, "WinDbg") win32api.RegCloseKey(hkey) return val