| 1 | from pypy.interpreter.mixedmodule import MixedModule |
| 2 | from rpython.rlib.rwinreg import constants |
| 3 | |
| 4 | class Module(MixedModule): |
| 5 | """This module provides access to the Windows registry API. |
| 6 | |
| 7 | Functions: |
| 8 | |
| 9 | CloseKey() - Closes a registry key. |
| 10 | ConnectRegistry() - Establishes a connection to a predefined registry handle |
| 11 | on another computer. |
| 12 | CreateKey() - Creates the specified key, or opens it if it already exists. |
| 13 | DeleteKey() - Deletes the specified key. |
| 14 | DeleteValue() - Removes a named value from the specified registry key. |
| 15 | EnumKey() - Enumerates subkeys of the specified open registry key. |
| 16 | EnumValue() - Enumerates values of the specified open registry key. |
| 17 | ExpandEnvironmentStrings() - Expand the env strings in a REG_EXPAND_SZ string. |
| 18 | FlushKey() - Writes all the attributes of the specified key to the registry. |
| 19 | LoadKey() - Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and stores |
| 20 | registration information from a specified file into that subkey. |
| 21 | OpenKey() - Alias for <om win32api.RegOpenKeyEx> |
| 22 | OpenKeyEx() - Opens the specified key. |
| 23 | QueryValue() - Retrieves the value associated with the unnamed value for a |
| 24 | specified key in the registry. |
| 25 | QueryValueEx() - Retrieves the type and data for a specified value name |
| 26 | associated with an open registry key. |
| 27 | QueryInfoKey() - Returns information about the specified key. |
| 28 | SaveKey() - Saves the specified key, and all its subkeys a file. |
| 29 | SetValue() - Associates a value with a specified key. |
| 30 | SetValueEx() - Stores data in the value field of an open registry key. |
| 31 | |
| 32 | Special objects: |
| 33 | |
| 34 | HKEYType -- type object for HKEY objects |
| 35 | error -- exception raised for Win32 errors |
| 36 | |
| 37 | Integer constants: |
| 38 | Many constants are defined - see the documentation for each function |
| 39 | to see what constants are used, and where.""" |
| 40 | |
| 41 | applevel_name = 'winreg' |
| 42 | |
| 43 | appleveldefs = { |
| 44 | } |
| 45 | interpleveldefs = { |
| 46 | 'error' : 'space.w_WindowsError', |
| 47 | 'HKEYType' : 'interp_winreg.W_HKEY', |
| 48 | 'SetValue' : 'interp_winreg.SetValue', |
| 49 | 'SetValueEx' : 'interp_winreg.SetValueEx', |
| 50 | 'QueryValue' : 'interp_winreg.QueryValue', |
| 51 | 'QueryValueEx' : 'interp_winreg.QueryValueEx', |
| 52 | 'CreateKey' : 'interp_winreg.CreateKey', |
| 53 | 'CreateKeyEx' : 'interp_winreg.CreateKeyEx', |
| 54 | 'DeleteKey' : 'interp_winreg.DeleteKey', |
| 55 | 'DeleteValue' : 'interp_winreg.DeleteValue', |
| 56 | 'OpenKey' : 'interp_winreg.OpenKey', |
| 57 | 'OpenKeyEx' : 'interp_winreg.OpenKey', |
| 58 | 'EnumValue' : 'interp_winreg.EnumValue', |
| 59 | 'EnumKey' : 'interp_winreg.EnumKey', |
| 60 | 'FlushKey' : 'interp_winreg.FlushKey', |
| 61 | 'CloseKey' : 'interp_winreg.CloseKey', |
| 62 | 'QueryInfoKey' : 'interp_winreg.QueryInfoKey', |
| 63 | 'LoadKey' : 'interp_winreg.LoadKey', |
| 64 | 'SaveKey' : 'interp_winreg.SaveKey', |
| 65 | 'ConnectRegistry': 'interp_winreg.ConnectRegistry', |
| 66 | |
| 67 | 'ExpandEnvironmentStrings': 'interp_winreg.ExpandEnvironmentStrings', |
| 68 | |
| 69 | 'DisableReflectionKey': 'interp_winreg.DisableReflectionKey', |
| 70 | 'EnableReflectionKey': 'interp_winreg.EnableReflectionKey', |
| 71 | 'QueryReflectionKey': 'interp_winreg.QueryReflectionKey', |
| 72 | 'DeleteKeyEx': 'interp_winreg.DeleteKeyEx', |
| 73 | } |
| 74 | |
| 75 | for name, value in constants.iteritems(): |
| 76 | interpleveldefs[name] = "space.wrap(%s)" % (value,) |
| 77 | |
| 78 | import pypy.module.sys.version |
| 79 | if pypy.module.sys.version.CPYTHON_VERSION < (3, 6): |
| 80 | del interpleveldefs["REG_QWORD"] |
| 81 | del interpleveldefs["REG_QWORD_LITTLE_ENDIAN"] |