EvtOpenPublisherMetadata function

Gets a handle that you use to read the specified provider's metadata.


EVT_HANDLE EvtOpenPublisherMetadata(
  EVT_HANDLE Session,
  LPCWSTR    PublisherId,
  LPCWSTR    LogFilePath,
  LCID       Locale,
  DWORD      Flags



A remote session handle that the EvtOpenSession function returns. Set to NULL to get the metadata for a provider on the local computer.


The name of the provider. To enumerate the names of the providers registered on the computer, call the EvtOpenPublisherEnum function.


The full path to an archived log file that contains the events that the provider logged. An archived log file also contains the provider's metadata. Use this parameter when the provider is not registered on the local computer. Set to NULL when reading the metadata from a registered provider..


The locale identifier to use when accessing the localized metadata from the provider. To create the locale identifier, use the MAKELCID macro. Set to 0 to use the locale identifier of the calling thread.


Reserved. Must be zero.

Return Value

If successful, the function returns a handle to the provider's metadata; otherwise, NULL. If NULL, call GetLastError function to get the error code.


If you specify an archived log file, this function will check for the specified provider's metadata in the log file. If the provider's metadata is not found in the log file, the function will search for the provider in the list of registered providers on the local computer.

To read the provider's metadata, call the EvtGetPublisherMetadataProperty function. To enumerate the events that the provider defines, call the EvtOpenEventMetadataEnum function.

You must call the EvtClose function to close the metadata handle when done.


For an example that shows how to use this function, see Getting a Provider's Metadata.


Windows version Windows Vista [desktop apps only] Windows Server 2008 [desktop apps only]
Target Platform Windows
Header winevt.h
Library Wevtapi.lib
DLL Wevtapi.dll

See Also