grr/client/grr_response_client/vfs_handlers/registry.py
def OpenKey(key, sub_key):
  """This calls the Windows OpenKeyEx function in a Unicode safe way."""
  regopenkeyex = advapi32["RegOpenKeyExW"]
  regopenkeyex.restype = ctypes.c_long
  regopenkeyex.argtypes = [
      ctypes.c_void_p, ctypes.c_wchar_p, ctypes.c_ulong, ctypes.c_ulong,
      ctypes.POINTER(ctypes.c_void_p)
  ]

  new_key = KeyHandle()
  # Don't use KEY_WOW64_64KEY (0x100) since it breaks on Windows 2000
  rc = regopenkeyex(
      key.handle, sub_key, 0, KEY_READ,
      ctypes.cast(
          ctypes.byref(new_key.handle), ctypes.POINTER(ctypes.c_void_p)))
  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)

  return new_key
This calls the Windows OpenKeyEx function in a Unicode safe way.
This calls the Windows OpenKeyEx function in a Unicode safe way.
This calls the Windows OpenKeyEx function in a Unicode safe way .
def OpenKey(key, sub_key):
  regopenkeyex = advapi32["RegOpenKeyExW"]
  regopenkeyex.restype = ctypes.c_long
  regopenkeyex.argtypes = [
      ctypes.c_void_p, ctypes.c_wchar_p, ctypes.c_ulong, ctypes.c_ulong,
      ctypes.POINTER(ctypes.c_void_p)
  ]
  new_key = KeyHandle()
  rc = regopenkeyex(
      key.handle, sub_key, 0, KEY_READ,
      ctypes.cast(
          ctypes.byref(new_key.handle), ctypes.POINTER(ctypes.c_void_p)))
  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)
  return new_key
def OpenKey ( key , sub_key ) : regopenkeyex = advapi32 [ "RegOpenKeyExW" ] regopenkeyex . restype = ctypes . c_long regopenkeyex . argtypes = [ ctypes . c_void_p , ctypes . c_wchar_p , ctypes . c_ulong , ctypes . c_ulong , ctypes . POINTER ( ctypes . c_void_p ) ] new_key = KeyHandle ( ) rc = regopenkeyex ( key . handle , sub_key , 0 , KEY_READ , ctypes . cast ( ctypes . byref ( new_key . handle ) , ctypes . POINTER ( ctypes . c_void_p ) ) ) if rc != ERROR_SUCCESS : raise ctypes . WinError ( 2 ) return new_key
This calls the Windows OpenKeyEx function in a Unicode safe way.
This calls the Windows OpenKeyEx function in a Unicode safe way .
"""This calls the Windows OpenKeyEx function in a Unicode safe way.""" # Don't use KEY_WOW64_64KEY (0x100) since it breaks on Windows 2000
key
sub_key