IopRegistryOpenDeepestPath

INT64 __stdcall IopRegistryOpenDeepestPath(UNICODE_STRING *Path, PVOID *Handle, UINT8 *FoundFullPath){
  UNICODE_STRING v3; 
  unsigned int v7; 
  unsigned __int16 Length; 
  bool v9; 
  UNICODE_STRING KeyName; 
  PVOID Handlea; 
  v3 = *Path;
  Handlea = 0i64;
  KeyName = v3;
  while( 1 )
  {
    v7 = IopOpenRegistryKey(&Handlea, 0i64, &KeyName, 0x10ui64, 0);
    if( (v7 & 0x80000000) == 0 )
      break;
    Length = KeyName.Length;
    if( KeyName.Length )
    {
      while( KeyName.Buffer[((unsigned __int64)Length >> 1) - 1] != 92 )
      {
        v9 = Length == 2;
        Length -= 2;
        KeyName.Length = Length;
        if( v9 )
          return v7;
      }
      KeyName.Length = Length - 2;
      if( Length != 2 )
        continue;
    }
    return v7;
  }
  *Handle = Handlea;
  *FoundFullPath = KeyName.Length == Path->Length;
  return v7;
}

Referenced by:

IopRegistryCallback
IopRegistryInitializeCallbacks