EtwpFlushBuffer

NTSTATUS __stdcall EtwpFlushBuffer(_WMI_LOGGER_CONTEXT *LoggerContext, _WMI_BUFFER_HEADER *Buffer, UINT16 BufferFlag){
  NTSTATUS v3; 
  char v4; 
  NTSTATUS v5; 
  NTSTATUS v8; 
  char v9; 
  NTSTATUS v10; 
  NTSTATUS v12; 

  v3 = -1073741823;
  v4 = BufferFlag;
  v5 = -1073741823;
  v8 = EtwpPrepareHeader(LoggerContext, Buffer, BufferFlag);
  v9 = v4 & 1;
  if( v8 == -2147483614 && !v9 )
    return 0;
  if( (LoggerContext->Flags & 8) != 0 )
  {
    v10 = EtwpFlushBufferToRealtime(LoggerContext, Buffer, v8 == -2147483614);
    v3 = v10;
    if( v10 < 0 )
      EtwpSendSessionNotification(LoggerContext, 4, (unsigned int)v10);
  }
  if( LoggerContext->LogFileHandle )
  {
    v12 = EtwpFlushBufferToLogfile(LoggerContext, Buffer);
    v5 = v12;
    if( v12 < 0 )
      EtwpSendSessionNotification(LoggerContext, 3, (unsigned int)v12);
  }
  if( (int)(v3 + 0x80000000) < 0 || v3 == -1073741432 || v5 >= 0 )
    return 0;
  if( v5 != -1073741823 )
    return v5;
  return v3;
}

Referenced by:

EtwpFlushActiveBuffers