학습
모듈
Update Windows client - Training
Explore the Windows servicing channels and use tools such as Windows Server Update Service (WSUS) to manage Windows update deployments.
이벤트 추적 세션의 속성을 업데이트하려면 EVENT_TRACE_CONTROL_UPDATE 컨트롤 코드를 사용하여 ControlTrace 함수를 호출합니다. StartTrace이전 호출에서 얻은 세션 핸들 또는 세션 이름을 사용하여 업데이트할 세션을 지정할 수 있습니다. 이벤트 추적 세션의 속성은 EVENT_TRACE_PROPERTIES 구조에 지정된 값을 사용하여 업데이트됩니다. 속성의 하위 집합만 업데이트할 수 있습니다. 업데이트할 수 있는 속성 목록은 ControlTrace 함수의 Properties 매개 변수를 참조하세요.
ControlTrace 호출에 성공하면 새 속성 값을 반영하도록 EVENT_TRACE_PROPERTIES 구조가 업데이트됩니다. 이 구조에는 이벤트 추적 세션에 대한 새 실행 통계도 포함됩니다.
다음 예제에서는 커널 이벤트 추적 세션을 업데이트하는 방법을 보여줍니다. 이 예제에서는 현재 속성 값을 쿼리하고 세션을 업데이트하기 전에 구조를 업데이트합니다.
#include <windows.h>
#include <stdio.h>
#include <wmistr.h>
#include <evntrace.h>
#define MAX_SESSION_NAME_LEN 1024
#define MAX_LOGFILE_PATH_LEN 1024
void wmain(void)
{
ULONG status = ERROR_SUCCESS;
EVENT_TRACE_PROPERTIES* pSessionProperties = NULL;
ULONG BufferSize = 0;
// Allocate memory for the session properties. The memory must
// be large enough to include the log file name and session name.
// This example specifies the maximum size for the session name
// and log file name.
BufferSize = sizeof(EVENT_TRACE_PROPERTIES) +
(MAX_SESSION_NAME_LEN * sizeof(WCHAR)) +
(MAX_LOGFILE_PATH_LEN * sizeof(WCHAR));
pSessionProperties = (EVENT_TRACE_PROPERTIES*) malloc(BufferSize);
if (NULL == pSessionProperties)
{
wprintf(L"Unable to allocate %d bytes for properties structure.\n", BufferSize);
goto cleanup;
}
ZeroMemory(pSessionProperties, BufferSize);
pSessionProperties->Wnode.BufferSize = BufferSize;
// Query for the kernel trace session's current property values.
status = ControlTrace((TRACEHANDLE)NULL, KERNEL_LOGGER_NAME, pSessionProperties, EVENT_TRACE_CONTROL_QUERY);
if (ERROR_SUCCESS != status)
{
if (ERROR_WMI_INSTANCE_NOT_FOUND == status)
{
wprintf(L"The Kernel Logger is not running.\n");
}
else
{
wprintf(L"ControlTrace(query) failed with %lu\n", status);
}
goto cleanup;
}
// Update the enable flags to also enable the Process and Thread providers.
pSessionProperties->LogFileNameOffset = 0; // Zero tells ETW not to update the file name
pSessionProperties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
pSessionProperties->EnableFlags |= EVENT_TRACE_FLAG_PROCESS | EVENT_TRACE_FLAG_THREAD;
// Update the session's properties.
status = ControlTrace((TRACEHANDLE)NULL, KERNEL_LOGGER_NAME, pSessionProperties, EVENT_TRACE_CONTROL_UPDATE);
if (ERROR_SUCCESS != status)
{
wprintf(L"ControlTrace(update) failed with %lu.\n", status);
goto cleanup;
}
wprintf(L"\nUpdated session");
cleanup:
if (pSessionProperties)
{
free(pSessionProperties);
pSessionProperties = NULL;
}
}
프라이빗 로거 세션 구성 및 시작
SystemTraceProvider 세션 구성 및 시작
이벤트 추적 세션 구성 및 시작
NT 커널 로거 세션 구성 및 시작
학습
모듈
Update Windows client - Training
Explore the Windows servicing channels and use tools such as Windows Server Update Service (WSUS) to manage Windows update deployments.
설명서
이벤트 추적 세션을 시작한 후에는 TraceSetInformation을 사용하여 시스템에 추가 이벤트 추적 데이터를 반환하도록 지시할 수 있습니다.
프라이빗 로거 세션 구성 및 시작 - Win32 apps
프라이빗 이벤트 추적 세션은 이벤트 추적 공급자&\#8212와 동일한 프로세스에서 실행되는 사용자 모드 이벤트 추적 세션입니다. 프라이빗 세션 및 사용하도록 설정하는 공급자는 모두 동일한 프로세스에 있어야 합니다.
SystemTraceProvider 세션 구성 및 시작 - Win32 apps
SystemTraceProvider는 Windows 7, Windows Server 2008 R2 이상에서 지원되는 미리 정의된 커널 이벤트 집합이 있는 커널 공급자입니다.