ProcessTraceBufferIncrementReference function (evntrace.h)

Called during the BufferCallback on the provided Buffer to prevent it from being freed until the caller is done with it.

Syntax

ETW_APP_DECLSPEC_DEPRECATED ULONG WMIAPI ProcessTraceBufferIncrementReference(
  PROCESSTRACE_HANDLE     TraceHandle,
  const ETW_BUFFER_HEADER *Buffer
);

Parameters

TraceHandle

The processing session that this Buffer came from.

Buffer

The buffer to reference. This buffer must have been obtained by a call to the PETW_BUFFER_CALLBACK callback.

Return value

Win32 Error Code. Possible codes may include ERROR_INVALID_PARAMETER and ERROR_OUTOFMEMORY.

Remarks

If ProcessTraceBufferIncrementReference is not called on a Buffer during the PETW_BUFFER_CALLBACK then the memory is no longer accessible after the PETW_BUFFER_CALLBACK returns.

The caller is responsible for calling ProcessTraceBufferDecrementReference on the Buffer once they are done with it. ProcessTrace will not return until this has been done for every buffer that was incremented.

ProcessTraceBufferIncrementReference is not supported for buffers provided by a processing session opened by OpenTraceFromBufferStream.

Requirements

Requirement Value
Minimum supported client Windows 11 2022 Update
Minimum supported server Windows Server 2022
Target Platform Windows
Header evntrace.h
Library Advapi32.dll
DLL Sechost.dll on Windows 8.1 and Windows Server 2012 R2; Advapi32.dll on Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista and Windows XP