grr/client/grr_response_client/vfs_handlers/registry.py
def EnumValue(key, index):
  """This calls the Windows RegEnumValue function in a Unicode safe way."""
  regenumvalue = advapi32["RegEnumValueW"]
  regenumvalue.restype = ctypes.c_long
  regenumvalue.argtypes = [
      ctypes.c_void_p, ctypes.wintypes.DWORD, ctypes.c_wchar_p, LPDWORD,
      LPDWORD, LPDWORD, LPBYTE, LPDWORD
  ]

  regqueryinfokey = advapi32["RegQueryInfoKeyW"]
  regqueryinfokey.restype = ctypes.c_long
  regqueryinfokey.argtypes = [
      ctypes.c_void_p, ctypes.c_wchar_p, LPDWORD, LPDWORD, LPDWORD, LPDWORD,
      LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD,
      ctypes.POINTER(FileTime)
  ]

  null = ctypes.POINTER(ctypes.wintypes.DWORD)()
  value_size = ctypes.wintypes.DWORD()
  data_size = ctypes.wintypes.DWORD()

  rc = regqueryinfokey(key.handle, ctypes.c_wchar_p(), null, null, null, null,
                       null, null, ctypes.byref(value_size),
                       ctypes.byref(data_size), null,
                       ctypes.POINTER(FileTime)())
  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)

  value_size.value += 1
  data_size.value += 1

  value = ctypes.create_unicode_buffer(value_size.value)

  while True:
    data = ctypes.create_string_buffer(data_size.value)

    tmp_value_size = ctypes.wintypes.DWORD(value_size.value)
    tmp_data_size = ctypes.wintypes.DWORD(data_size.value)
    data_type = ctypes.wintypes.DWORD()
    rc = regenumvalue(key.handle, index, ctypes.cast(value, ctypes.c_wchar_p),
                      ctypes.byref(tmp_value_size), null,
                      ctypes.byref(data_type), ctypes.cast(data, LPBYTE),
                      ctypes.byref(tmp_data_size))

    if rc != ERROR_MORE_DATA:
      break

    data_size.value *= 2

  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)

  return (value.value, Reg2Py(data, tmp_data_size.value, data_type.value),
          data_type.value)
This calls the Windows RegEnumValue function in a Unicode safe way.
This calls the Windows RegEnumValue function in a Unicode safe way.
This calls the Windows RegEnumValue function in a Unicode safe way .
def EnumValue(key, index):
  regenumvalue = advapi32["RegEnumValueW"]
  regenumvalue.restype = ctypes.c_long
  regenumvalue.argtypes = [
      ctypes.c_void_p, ctypes.wintypes.DWORD, ctypes.c_wchar_p, LPDWORD,
      LPDWORD, LPDWORD, LPBYTE, LPDWORD
  ]
  regqueryinfokey = advapi32["RegQueryInfoKeyW"]
  regqueryinfokey.restype = ctypes.c_long
  regqueryinfokey.argtypes = [
      ctypes.c_void_p, ctypes.c_wchar_p, LPDWORD, LPDWORD, LPDWORD, LPDWORD,
      LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD,
      ctypes.POINTER(FileTime)
  ]
  null = ctypes.POINTER(ctypes.wintypes.DWORD)()
  value_size = ctypes.wintypes.DWORD()
  data_size = ctypes.wintypes.DWORD()
  rc = regqueryinfokey(key.handle, ctypes.c_wchar_p(), null, null, null, null,
                       null, null, ctypes.byref(value_size),
                       ctypes.byref(data_size), null,
                       ctypes.POINTER(FileTime)())
  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)
  value_size.value += 1
  data_size.value += 1
  value = ctypes.create_unicode_buffer(value_size.value)
  while True:
    data = ctypes.create_string_buffer(data_size.value)
    tmp_value_size = ctypes.wintypes.DWORD(value_size.value)
    tmp_data_size = ctypes.wintypes.DWORD(data_size.value)
    data_type = ctypes.wintypes.DWORD()
    rc = regenumvalue(key.handle, index, ctypes.cast(value, ctypes.c_wchar_p),
                      ctypes.byref(tmp_value_size), null,
                      ctypes.byref(data_type), ctypes.cast(data, LPBYTE),
                      ctypes.byref(tmp_data_size))
    if rc != ERROR_MORE_DATA:
      break
    data_size.value *= 2
  if rc != ERROR_SUCCESS:
    raise ctypes.WinError(2)
  return (value.value, Reg2Py(data, tmp_data_size.value, data_type.value),
          data_type.value)
def EnumValue ( key , index ) : regenumvalue = advapi32 [ "RegEnumValueW" ] regenumvalue . restype = ctypes . c_long regenumvalue . argtypes = [ ctypes . c_void_p , ctypes . wintypes . DWORD , ctypes . c_wchar_p , LPDWORD , LPDWORD , LPDWORD , LPBYTE , LPDWORD ] regqueryinfokey = advapi32 [ "RegQueryInfoKeyW" ] regqueryinfokey . restype = ctypes . c_long regqueryinfokey . argtypes = [ ctypes . c_void_p , ctypes . c_wchar_p , LPDWORD , LPDWORD , LPDWORD , LPDWORD , LPDWORD , LPDWORD , LPDWORD , LPDWORD , LPDWORD , ctypes . POINTER ( FileTime ) ] null = ctypes . POINTER ( ctypes . wintypes . DWORD ) ( ) value_size = ctypes . wintypes . DWORD ( ) data_size = ctypes . wintypes . DWORD ( ) rc = regqueryinfokey ( key . handle , ctypes . c_wchar_p ( ) , null , null , null , null , null , null , ctypes . byref ( value_size ) , ctypes . byref ( data_size ) , null , ctypes . POINTER ( FileTime ) ( ) ) if rc != ERROR_SUCCESS : raise ctypes . WinError ( 2 ) value_size . value += 1 data_size . value += 1 value = ctypes . create_unicode_buffer ( value_size . value ) while True : data = ctypes . create_string_buffer ( data_size . value ) tmp_value_size = ctypes . wintypes . DWORD ( value_size . value ) tmp_data_size = ctypes . wintypes . DWORD ( data_size . value ) data_type = ctypes . wintypes . DWORD ( ) rc = regenumvalue ( key . handle , index , ctypes . cast ( value , ctypes . c_wchar_p ) , ctypes . byref ( tmp_value_size ) , null , ctypes . byref ( data_type ) , ctypes . cast ( data , LPBYTE ) , ctypes . byref ( tmp_data_size ) ) if rc != ERROR_MORE_DATA : break data_size . value *= 2 if rc != ERROR_SUCCESS : raise ctypes . WinError ( 2 ) return ( value . value , Reg2Py ( data , tmp_data_size . value , data_type . value ) , data_type . value )
This calls the Windows RegEnumValue function in a Unicode safe way.
This calls the Windows RegEnumValue function in a Unicode safe way .
"""This calls the Windows RegEnumValue function in a Unicode safe way."""
key
index