AlpcpUnlockBlob

VOID __stdcall AlpcpUnlockBlob(PVOID Blob){
  char v1; 
  int v3; 
  signed __int64 BugCheckParameter4; 
  __int64 v5; 
  __int64 *v6; 
  char *v7; 
  v1 = *((char *)Blob - 32);
  if( (v1 & 1) != 0
    && (v3 = *((__int16 *)Blob - 15), *((char *)Blob - 32) = v1 & 0xFE, *((_WORD *)Blob - 15) = 0, 0x10000 - v3 > 0)
    && (BugCheckParameter4 = v3 - 0x10000 + _InterlockedExchangeAdd64((volatile signed __int64 *)Blob - 3, v3 - 0x10000),
        BugCheckParameter4 <= 0) )
  {
    if( BugCheckParameter4 )
      KeBugCheckEx(0x18u, 0i64, (ULONG_PTR)Blob, 0x28ui64, BugCheckParameter4);
    v5 = AlpcpRegisteredTypes[(unsigned __int8)*((char *)Blob - 31)];
    (*(void(__fastcall **)(PVOID))(v5 + 24))(Blob);
    if( (_InterlockedExchangeAdd64((volatile signed __int64 *)Blob - 2, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
      ExfTryToWakePushLock((volatile INT64 *)Blob - 2);
    KeAbPostRelease((char *)Blob - 16);
    if( (*(int(__fastcall **)(PVOID))(v5 + 40))(Blob) >= 0 )
    {
      if( (*((char *)Blob - 32) & 2) != 0 )
      {
        v6 = &AlpcpLookasides[16 * (unsigned __int64)*(unsigned int *)(v5 + 8)];
        ++*((_DWORD *)v6 + 7);
        if( *(_WORD *)v6 >= *((_WORD *)v6 + 8) )
        {
          ++*((_DWORD *)v6 + 8);
          ((void(__fastcall *)(char *))v6[7])((char *)Blob - 48);
        }
        else
        {
          RtlpInterlockedPushEntrySList((PSLIST_HEADER)v6, (PSLIST_ENTRY)Blob - 3);
        }
      }
      else
      {
        v7 = (char *)Blob - 48;
        if( *(_QWORD *)(v5 + 48) )
          ((void(__fastcall *)(char *))AlpcpLookasides[16 * (unsigned __int64)*(unsigned int *)(v5 + 8) + 7])(v7);
        else
          ExFreePoolWithTag(v7, *(_DWORD *)(v5 + 4));
      }
    }
  }
  else
  {
    if( (_InterlockedExchangeAdd64((volatile signed __int64 *)Blob - 2, 0xFFFFFFFFFFFFFFFFui64) & 6) == 2 )
      ExfTryToWakePushLock((volatile INT64 *)Blob - 2);
    KeAbPostRelease((char *)Blob - 16);
  }
}

Referenced by:

AlpcRegionDestroyProcedure
AlpcSectionDeleteProcedure
AlpcViewDestroyProcedure
AlpcpCaptureViewAttributeInternal
AlpcpCreateSectionView
AlpcpCreateView
AlpcpDispatchReplyToWaitingThread
AlpcpExposeAttributes
AlpcpExposeViewAttribute
AlpcpExposeViewAttributeInSenderContext
AlpcpForceUnlinkSecureView
AlpcpMapLegacyPortRemoteView
AlpcpMapLegacyPortView
AlpcpPrepareViewForDelivery
AlpcpProcessSynchronousRequest
AlpcpQueryRemoteView
AlpcpReleaseViewAttribute
AlpcpUnlockMessage
NtAlpcImpersonateClientOfPort