grr/client/grr_response_client/vfs_handlers/registry.py
def EnumKey(key, index):
  """This calls the Windows RegEnumKeyEx function in a Unicode safe way."""
  regenumkeyex = advapi32["RegEnumKeyExW"]
  regenumkeyex.restype = ctypes.c_long
  regenumkeyex.argtypes = [
      ctypes.c_void_p, ctypes.wintypes.DWORD, ctypes.c_wchar_p, LPDWORD,
      LPDWORD, ctypes.c_wchar_p, LPDWORD,
      ctypes.POINTER(FileTime)
  ]

  buf = ctypes.create_unicode_buffer(257)
  length = ctypes.wintypes.DWORD(257)
  rc = regenumkeyex(key.handle, index, ctypes.cast(buf, ctypes.c_wchar_p),
                    ctypes.byref(length), LPDWORD(), ctypes.c_wchar_p(),
                    LPDWORD(),
                    ctypes.POINTER(FileTime)())
  if rc != 0:
    raise ctypes.WinError(2)

  return ctypes.wstring_at(buf, length.value).rstrip(u"\x00")
This calls the Windows RegEnumKeyEx function in a Unicode safe way.
This calls the Windows RegEnumKeyEx function in a Unicode safe way.
This calls the Windows RegEnumKeyEx function in a Unicode safe way .
def EnumKey(key, index):
  regenumkeyex = advapi32["RegEnumKeyExW"]
  regenumkeyex.restype = ctypes.c_long
  regenumkeyex.argtypes = [
      ctypes.c_void_p, ctypes.wintypes.DWORD, ctypes.c_wchar_p, LPDWORD,
      LPDWORD, ctypes.c_wchar_p, LPDWORD,
      ctypes.POINTER(FileTime)
  ]
  buf = ctypes.create_unicode_buffer(257)
  length = ctypes.wintypes.DWORD(257)
  rc = regenumkeyex(key.handle, index, ctypes.cast(buf, ctypes.c_wchar_p),
                    ctypes.byref(length), LPDWORD(), ctypes.c_wchar_p(),
                    LPDWORD(),
                    ctypes.POINTER(FileTime)())
  if rc != 0:
    raise ctypes.WinError(2)
  return ctypes.wstring_at(buf, length.value).rstrip(u"\x00")
def EnumKey ( key , index ) : regenumkeyex = advapi32 [ "RegEnumKeyExW" ] regenumkeyex . restype = ctypes . c_long regenumkeyex . argtypes = [ ctypes . c_void_p , ctypes . wintypes . DWORD , ctypes . c_wchar_p , LPDWORD , LPDWORD , ctypes . c_wchar_p , LPDWORD , ctypes . POINTER ( FileTime ) ] buf = ctypes . create_unicode_buffer ( 257 ) length = ctypes . wintypes . DWORD ( 257 ) rc = regenumkeyex ( key . handle , index , ctypes . cast ( buf , ctypes . c_wchar_p ) , ctypes . byref ( length ) , LPDWORD ( ) , ctypes . c_wchar_p ( ) , LPDWORD ( ) , ctypes . POINTER ( FileTime ) ( ) ) if rc != 0 : raise ctypes . WinError ( 2 ) return ctypes . wstring_at ( buf , length . value ) . rstrip ( u"\x00" )
This calls the Windows RegEnumKeyEx function in a Unicode safe way.
This calls the Windows RegEnumKeyEx function in a Unicode safe way .
"""This calls the Windows RegEnumKeyEx function in a Unicode safe way."""
key
index