Python winreg.HKEY_USERS Examples

The following are 1 code examples of winreg.HKEY_USERS(). 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 winreg , or try the search function .
Example #1
Source File: rpath.py    From r-bridge-install with Apache License 2.0 5 votes vote down vote up
def _user_hive(username=None):
    """Find the registry hive for a particular user."""
    hive_base = None
    sids = _user_sids()
    if username and username in sids:
        sid = sids[username]
        root_key = winreg.HKEY_USERS
        try:
            hive_reg = winreg.OpenKey(root_key, sid, 0, READ_ACCESS)
            if hive_reg:
                hive_base = sid
        except:
            pass
    return hive_base