WheaUnregisterInUsePageOfflineNotification

NTSTATUS __stdcall WheaUnregisterInUsePageOfflineNotification(PFN_IN_USE_PAGE_OFFLINE_NOTIFY Callback){
  char v1; 
  _BYTE *v4; 
  _BYTE *v5; 
  PFN_IN_USE_PAGE_OFFLINE_NOTIFY *v6; 
  PFN_IN_USE_PAGE_OFFLINE_NOTIFY v7; 
  PVOID *v8; 
  v1 = 0;
  if( WheapInUsePageOfflineNotifyInit != 1 )
    return -1073741823;
  LODWORD(v4) = KeAbPreAcquire(&WheapInUsePageOfflineNotifyLock, 0i64, 0i64);
  v5 = v4;
  if( _interlockedbittestandset64((volatile signed __int32 *)&WheapInUsePageOfflineNotifyLock, 0i64) )
    ExfAcquirePushLockExclusiveEx(&WheapInUsePageOfflineNotifyLock, v4, &WheapInUsePageOfflineNotifyLock);
  if( v5 )
    v5[26] |= 1u;
  v6 = (PFN_IN_USE_PAGE_OFFLINE_NOTIFY *)WheapInUsePageOfflineNotifyList;
  if( WheapInUsePageOfflineNotifyList != &WheapInUsePageOfflineNotifyList )
  {
    while( 1 )
    {
      v7 = *v6;
      if( Callback == v6[2] )
        break;
      v6 = (PFN_IN_USE_PAGE_OFFLINE_NOTIFY *)*v6;
      if( (char *)v7 == (char *)&WheapInUsePageOfflineNotifyList )
        goto LABEL_10;
    }
    if( *((PFN_IN_USE_PAGE_OFFLINE_NOTIFY **)v7 + 1) != v6 || (v8 = (PVOID *)v6[1], *v8 != v6) )
      __fastfail(3u);
    *v8 = v7;
    *((_QWORD *)v7 + 1) = v8;
    ExFreePoolWithTag(v6, 0x61656857u);
    v1 = 1;
  }
LABEL_10:
  if( (_InterlockedExchangeAdd64((volatile signed __int64 *)&WheapInUsePageOfflineNotifyLock, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
    ExfTryToWakePushLock((volatile INT64 *)&WheapInUsePageOfflineNotifyLock);
  KeAbPostRelease(&WheapInUsePageOfflineNotifyLock);
  return v1 == 0 ? 0xC0000008 : 0;
}

Referenced by:

HvlUnregisterWheaErrorNotification