NtStopProfile

NTSTATUS __stdcall NtStopProfile(VOID *ProfileHandle){
  NTSTATUS v1; 
  NTSTATUS result; 
  PADAPTER_OBJECT v3; 
  _HALP_DMA_TRANSLATION_BUFFER *ScatterTranslations; 
  _MDL *Buffer; 
  _HALP_DMA_TRANSLATION_BUFFER *ContiguousTranslations; 
  INT64 v7; 
  INT64 v8; 
  PADAPTER_OBJECT DmaAdapter; 

  v1 = 0;
  DmaAdapter = 0i64;
  result = ObReferenceObjectByHandle(
             ProfileHandle,
             1ui64,
             ExProfileObjectType,
             KeGetCurrentThread()->PreviousMode,
             (VOID **)&DmaAdapter,
             0i64);
  if( result >= 0 )
  {
    KeWaitForSingleObject((UINT64)&WheapDeferredInternalLogsEventLock + 608, 0, 0, 0, 0i64);
    v3 = DmaAdapter;
    if( DmaAdapter->AdapterObject.ScatterTranslations )
    {
      KeStopProfile((_KPROFILE *)DmaAdapter->AdapterObject.ContiguousTranslations);
      ScatterTranslations = v3->AdapterObject.ScatterTranslations;
      Buffer = (_MDL *)v3->AdapterObject.ContiguousTranslationEnd.Buffer;
      ContiguousTranslations = v3->AdapterObject.ContiguousTranslations;
      --ExpCurrentProfileUsage;
      v3->AdapterObject.ScatterTranslations = 0i64;
      KeReleaseMutex((_KMUTANT *)((char *)&WheapDeferredInternalLogsEventLock + 608), 0);
      MmUnmapLockedPages(ScatterTranslations, Buffer);
      MmUnlockPages((INT64)Buffer, v7, v8);
      ExFreePoolWithTag(ContiguousTranslations, 0);
    }
    else
    {
      KeReleaseMutex((_KMUTANT *)((char *)&WheapDeferredInternalLogsEventLock + 608), 0);
      v1 = -1073741641;
    }
    HalPutDmaAdapter(v3);
    return v1;
  }
  return result;
}

Referenced by:

No references.