IoWMIRegistrationControl

NTSTATUS __stdcall IoWMIRegistrationControl(DEVICE_OBJECT *DeviceObject, UINT64 Action){
  unsigned int v2; 
  char v3; 
  int v5; 
  unsigned int v6; 
  int v7; 
  NTSTATUS v8; 
  int v10; 
  int v12; 
  int v13; 
  LIST_ENTRY *RegEntryByDevice; 
  v2 = 0;
  v3 = 0;
  if( WmipServiceDeviceObject )
  {
    v5 = Action & 0x7FFFFFFF;
    if( (Action & 0x80000000) == 0i64 )
      v5 = Action;
    v6 = ((int)Action >> 31) & 0x80000000;
    if( (v5 & 0x10000) != 0 )
    {
      v3 = 1;
      v2 = v5 & 0xF00000;
      v5 &= 0xFF0EFFFF;
      v6 |= v2 | 0x10000;
    }
    v7 = v5 - 1;
    if( !v7 )
    {
      v8 = WmipRegisterDevice(DeviceObject, v6);
      if( v3 )
        WmipSetTraceNotify(DeviceObject, v2);
      return v8;
    }
    v10 = v7 - 1;
    if( !v10 )
      return WmipDeregisterDevice(DeviceObject);
    v12 = v10 - 1;
    if( v12 )
    {
      v13 = v12 - 1;
      if( v13 )
      {
        if( v13 != 1 )
          return -1073741811;
        RegEntryByDevice = WmipFindRegEntryByDevice(DeviceObject);
        if( !RegEntryByDevice )
          return -1073741811;
        KeWaitForSingleObject(&WmipSMMutex, Executive, 0, 0, 0i64);
        _InterlockedOr((volatile signed __int32 *)&RegEntryByDevice[3], 0x20000000u);
        KeReleaseMutex(&WmipSMMutex, 0);
        WmipUnreferenceRegEntry((INT64)RegEntryByDevice);
        return 0;
      }
      return WmipUpdateRegistration(DeviceObject);
    }
    else
    {
      v8 = WmipDeregisterDevice(DeviceObject);
      if( v8 < 0 )
        return v8;
      return WmipRegisterDevice(DeviceObject, v6);
    }
  }
  return -1073741823;
}

Referenced by:

PpmEnableWmiInterface
ViDdiDriverEntry
WheaWmiInit
WmipDriverEntry