PopDisableCoolingExtension

VOID __stdcall PopDisableCoolingExtension(_POP_COOLING_EXTENSION *CoolingExtension){
  _POP_RW_LOCK *p_Lock; 
  void *Context; 
  void(__fastcall *InterfaceDereference)(void *); 
  __int128 Object; 
  __int64 v6; 

  p_Lock = &CoolingExtension->Lock;
  v6 = 0i64;
  Object = 0i64;
  PopAcquireRwLockExclusive(&CoolingExtension->Lock);
  if( CoolingExtension->Enabled )
  {
    CoolingExtension->Enabled = 0;
    PopDiagTraceCoolingExtension(
      (__int64)CoolingExtension,
      (const _EVENT_DESCRIPTOR *)POP_ETW_EVENT_COOLING_EXTENSION_REMOVE);
    KeInitializeEvent((INT64)&Object, 0, 0);
    CoolingExtension->PnpFlushEvent = (_KEVENT *)&Object;
    PopPropogateCoolingChange(CoolingExtension);
    PopReleaseRwLock(p_Lock);
    KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
    PopAcquireRwLockExclusive(p_Lock);
    CoolingExtension->PnpFlushEvent = 0i64;
    Context = CoolingExtension->Interface.Context;
    InterfaceDereference = CoolingExtension->Interface.InterfaceDereference;
    PopReleaseRwLock(p_Lock);
    InterfaceDereference(Context);
  }
  else
  {
    PopReleaseRwLock(p_Lock);
  }
}

Referenced by:

PopCoolingExtensionPnpNotification