IopApplyMutableTagToRegistryKey

NTSTATUS __stdcall IopApplyMutableTagToRegistryKey(_HANDLE KeyHandle){
  VOID *v1; 
  NTSTATUS result; 
  int KeyInformation; 
  UINT64 ResultLength; 

  KeyInformation = 0;
  v1 = *(VOID **)&KeyHandle;
  LODWORD(ResultLength) = 0;
  if( !*(_QWORD *)&KeyHandle )
    return -1073741811;
  result = ZwQueryKey(*(VOID **)&KeyHandle, KeyHandleTagsInformation, &KeyInformation, 4ui64, &ResultLength);
  if( result >= 0 )
  {
    if( (KeyInformation & 0x1000) != 0 )
    {
      return 0;
    }
    else
    {
      KeyInformation |= 0x1000u;
      return ZwSetInformationKey(v1, KeySetHandleTagsInformation, &KeyInformation, 4ui64);
    }
  }
  return result;
}

Referenced by:

IoOpenDeviceInterfaceRegistryKey
IoOpenDeviceRegistryKey
IoOpenDriverRegistryKey