Redigera

Dela via


EvtOpenLog function (winevt.h)

Gets a handle to a channel or log file that you can then use to get information about the channel or log file.

Syntax

EVT_HANDLE EvtOpenLog(
  [in] EVT_HANDLE Session,
  [in] LPCWSTR    Path,
  [in] DWORD      Flags
);

Parameters

[in] Session

A remote session handle that the EvtOpenSession function returns. Set to NULL to open a channel or log on the local computer.

[in] Path

The name of the channel or the full path to the exported log file.

[in] Flags

A flag that determines whether the Path parameter points to a log file or channel. For possible values, see the EVT_OPEN_LOG_FLAGS enumeration.

Return value

If successful, the function returns a handle to the file or channel; otherwise, NULL. If NULL, call GetLastError function to get the error code.

Remarks

Relative paths and environment variables cannot be used when specifying a file. A Universal Naming Convention (UNC) path can be used to locate the file. Any relative path and environment variable expansion needs to be done prior to making API calls.

To get information about the channel or log file, call the EvtGetLogInfo function.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header winevt.h
Library Wevtapi.lib
DLL Wevtapi.dll

See also

EvtClearLog

EvtExportLog

EvtGetLogInfo