MCPcopy Create free account
hub / github.com/nodejs/node / _RegistryGetValueUsingWinReg

Function _RegistryGetValueUsingWinReg

tools/gyp/pylib/gyp/MSVSVersion.py:220–238  ·  view source on GitHub ↗

Use the _winreg module to obtain the value of a registry key. Args: key: The registry key. value: The particular registry value to read. Return: contents of the registry key's value, or None on failure. Throws ImportError if winreg is unavailable.

(key, value)

Source from the content-addressed store, hash-verified

218
219
220def _RegistryGetValueUsingWinReg(key, value):
221 """Use the _winreg module to obtain the value of a registry key.
222
223 Args:
224 key: The registry key.
225 value: The particular registry value to read.
226 Return:
227 contents of the registry key's value, or None on failure. Throws
228 ImportError if winreg is unavailable.
229 """
230 from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx # noqa: PLC0415
231
232 try:
233 root, subkey = key.split("\\", 1)
234 assert root == "HKLM" # Only need HKLM for now.
235 with OpenKey(HKEY_LOCAL_MACHINE, subkey) as hkey:
236 return QueryValueEx(hkey, value)[0]
237 except OSError:
238 return None
239
240
241def _RegistryGetValue(key, value):

Callers 1

_RegistryGetValueFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected