432 references to UnsafeNativeMethods
System.Diagnostics.EventLog (432)
_generated\0\LibraryImports.g.cs (48)
65
internal static partial bool EvtSeek(global::System.Diagnostics.Eventing.Reader.EventLogHandle resultSet, long position, global::System.Diagnostics.Eventing.Reader.EventLogHandle bookmark, int timeout, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtSeekFlags flags)
103
static extern unsafe int __PInvoke(nint __resultSet_native, long __position_native, nint __bookmark_native, int __timeout_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtSeekFlags __flags_native);
292
internal static partial bool EvtGetEventInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtEventPropertyId propertyId, int bufferSize, nint bufferPtr, out int bufferUsed)
328
static extern unsafe int __PInvoke(nint __eventHandle_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtEventPropertyId __propertyId_native, int __bufferSize_native, nint __bufferPtr_native, int* __bufferUsed_native);
338
internal static partial bool EvtGetQueryInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle queryHandle, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtQueryPropertyId propertyId, int bufferSize, nint buffer, ref int bufferRequired)
373
static extern unsafe int __PInvoke(nint __queryHandle_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtQueryPropertyId __propertyId_native, int __bufferSize_native, nint __buffer_native, int* __bufferRequired_native);
440
internal static partial bool EvtGetPublisherMetadataProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId propertyId, int flags, int publisherMetadataPropertyBufferSize, nint publisherMetadataPropertyBuffer, out int publisherMetadataPropertyBufferUsed)
476
static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId __propertyId_native, int __flags_native, int __publisherMetadataPropertyBufferSize_native, nint __publisherMetadataPropertyBuffer_native, int* __publisherMetadataPropertyBufferUsed_native);
686
internal static partial bool EvtGetEventMetadataProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle eventMetadata, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtEventMetadataPropertyId propertyId, int flags, int eventMetadataPropertyBufferSize, nint eventMetadataPropertyBuffer, out int eventMetadataPropertyBufferUsed)
722
static extern unsafe int __PInvoke(nint __eventMetadata_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtEventMetadataPropertyId __propertyId_native, int __flags_native, int __eventMetadataPropertyBufferSize_native, nint __eventMetadataPropertyBuffer_native, int* __eventMetadataPropertyBufferUsed_native);
1033
internal static partial bool EvtSetChannelConfigProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelConfig, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtChannelConfigPropertyId propertyId, int flags, ref global::Microsoft.Win32.
UnsafeNativeMethods
.EvtVariant propertyValue)
1046
fixed (global::Microsoft.Win32.
UnsafeNativeMethods
.EvtVariant* __propertyValue_native = &propertyValue)
1068
static extern unsafe int __PInvoke(nint __channelConfig_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtChannelConfigPropertyId __propertyId_native, int __flags_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtVariant* __propertyValue_native);
1078
internal static partial bool EvtGetChannelConfigProperty(global::System.Diagnostics.Eventing.Reader.EventLogHandle channelConfig, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtChannelConfigPropertyId propertyId, int flags, int propertyValueBufferSize, nint propertyValueBuffer, out int propertyValueBufferUsed)
1114
static extern unsafe int __PInvoke(nint __channelConfig_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtChannelConfigPropertyId __propertyId_native, int __flags_native, int __propertyValueBufferSize_native, nint __propertyValueBuffer_native, int* __propertyValueBufferUsed_native);
1180
internal static partial bool EvtGetLogInfo(global::System.Diagnostics.Eventing.Reader.EventLogHandle log, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtLogPropertyId propertyId, int propertyValueBufferSize, nint propertyValueBuffer, out int propertyValueBufferUsed)
1216
static extern unsafe int __PInvoke(nint __log_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtLogPropertyId __propertyId_native, int __propertyValueBufferSize_native, nint __propertyValueBuffer_native, int* __propertyValueBufferUsed_native);
1364
internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtCreateRenderContext(int valuePathsCount, string[] valuePaths, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderContextFlags flags)
1432
static extern unsafe nint __PInvoke(int __valuePathsCount_native, global::System.IntPtr* __valuePaths_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderContextFlags __flags_native);
1442
internal static partial bool EvtRender(global::System.Diagnostics.Eventing.Reader.EventLogHandle context, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderFlags flags, int buffSize, char[] buffer, out int buffUsed, out int propCount)
1486
static extern unsafe int __PInvoke(nint __context_native, nint __eventHandle_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderFlags __flags_native, int __buffSize_native, char* __buffer_native, int* __buffUsed_native, int* __propCount_native);
1496
internal static partial bool EvtRender(global::System.Diagnostics.Eventing.Reader.EventLogHandle context, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderFlags flags, int buffSize, nint buffer, out int buffUsed, out int propCount)
1539
static extern unsafe int __PInvoke(nint __context_native, nint __eventHandle_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRenderFlags __flags_native, int __buffSize_native, nint __buffer_native, int* __buffUsed_native, int* __propCount_native);
1549
internal static partial bool EvtFormatMessage(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, uint messageId, int valueCount, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant[] values, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtFormatMessageFlags flags, int bufferSize, global::System.Span<char> buffer, out int bufferUsed)
1556
global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native* __values_native = default;
1560
scoped global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native>.ManagedToUnmanagedIn __values_native__marshaller = new();
1567
__values_native__marshaller.FromManaged(values, stackalloc global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native[global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native>.ManagedToUnmanagedIn.BufferSize]);
1569
global::System.ReadOnlySpan<global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant> __values_native__managedSpan = __values_native__marshaller.GetManagedValuesSource();
1570
global::System.Span<global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native> __values_native__nativeSpan = __values_native__marshaller.GetUnmanagedValuesDestination();
1573
__values_native__nativeSpan[__i0] = global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.ConvertToUnmanaged(__values_native__managedSpan[__i0]);
1607
global::System.ReadOnlySpan<global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native> __values_native__nativeSpan = __values_native__marshaller.GetUnmanagedValuesDestination();
1610
global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Free(__values_native__nativeSpan[__i0]);
1623
static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, nint __eventHandle_native, uint __messageId_native, int __valueCount_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtStringVariant.Marshaller.Native* __values_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtFormatMessageFlags __flags_native, int __bufferSize_native, char* __buffer_native, int* __bufferUsed_native);
1633
internal static partial bool EvtFormatMessageBuffer(global::System.Diagnostics.Eventing.Reader.EventLogHandle publisherMetadataHandle, global::System.Diagnostics.Eventing.Reader.EventLogHandle eventHandle, uint messageId, int valueCount, nint values, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtFormatMessageFlags flags, int bufferSize, nint buffer, out int bufferUsed)
1674
static extern unsafe int __PInvoke(nint __publisherMetadataHandle_native, nint __eventHandle_native, uint __messageId_native, int __valueCount_native, nint __values_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtFormatMessageFlags __flags_native, int __bufferSize_native, nint __buffer_native, int* __bufferUsed_native);
1684
internal static partial global::System.Diagnostics.Eventing.Reader.EventLogHandle EvtOpenSession(global::Microsoft.Win32.
UnsafeNativeMethods
.EvtLoginClass loginClass, ref global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRpcLogin login, int timeout, int flags)
1688
global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRpcLogin.Marshaller.ValueMarshaller.Native __login_native = default;
1693
global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRpcLogin.Marshaller.ValueMarshaller __login_native__marshaller = new();
1730
static extern unsafe nint __PInvoke(global::Microsoft.Win32.
UnsafeNativeMethods
.EvtLoginClass __loginClass_native, global::Microsoft.Win32.
UnsafeNativeMethods
.EvtRpcLogin.Marshaller.ValueMarshaller.Native* __login_native, int __timeout_native, int __flags_native);
System\Diagnostics\Reader\EventLogConfiguration.cs (30)
68
return (EventLogType)((uint)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigType)!);
76
return (EventLogIsolation)((uint)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigIsolation)!);
84
return (bool)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigEnabled)!;
88
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigEnabled, (object)value);
96
return (bool)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigClassicEventlog)!;
104
var descriptor = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigAccess);
110
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigAccess, (object?)value);
118
var logFilePath = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigLogFilePath);
124
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigLogFilePath, (object?)value);
132
return (long)((ulong)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigMaxSize)!);
136
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigMaxSize, (object)value);
144
object? nativeRetentionObject = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention);
145
object? nativeAutoBackupObject = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup);
163
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup, (object)false);
164
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention, (object)false);
167
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup, (object)true);
168
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention, (object)true);
171
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup, (object)false);
172
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention, (object)true);
182
var owningProviderName = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigOwningPublisher);
192
var providerNames = NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublisherList);
202
return (int?)((uint?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigLevel));
206
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigLevel, (object?)value);
214
return (long?)((ulong?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigKeywords));
218
NativeWrapper.EvtSetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigKeywords, (object?)value);
226
return (int?)((uint?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigBufferSize));
234
return (int?)((uint?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigMinBuffers));
242
return (int?)((uint?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigMaxBuffers));
250
return (int?)((uint?)NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigLatency));
258
return (Guid?)(NativeWrapper.EvtGetChannelConfigProperty(_handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigControlGuid));
System\Diagnostics\Reader\EventLogInformation.cs (8)
20
CreationTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogCreationTime);
21
LastAccessTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogLastAccessTime);
22
LastWriteTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogLastWriteTime);
23
FileSize = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogFileSize));
24
Attributes = (int?)((uint?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogAttributes));
25
RecordCount = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogNumberOfLogRecords));
26
OldestRecordNumber = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogOldestRecordNumber));
27
IsLogFull = (bool?)NativeWrapper.EvtGetLogInfo(logHandle,
UnsafeNativeMethods
.EvtLogPropertyId.EvtLogFull);
System\Diagnostics\Reader\EventLogPropertySelector.cs (1)
34
Handle = NativeWrapper.EvtCreateRenderContext(paths.Length, paths,
UnsafeNativeMethods
.EvtRenderContextFlags.EvtRenderContextValues);
System\Diagnostics\Reader\EventLogReader.cs (11)
88
flag |= (int)
UnsafeNativeMethods
.EvtQueryFlags.EvtQueryChannelPath;
90
flag |= (int)
UnsafeNativeMethods
.EvtQueryFlags.EvtQueryFilePath;
93
flag |= (int)
UnsafeNativeMethods
.EvtQueryFlags.EvtQueryReverseDirection;
96
flag |= (int)
UnsafeNativeMethods
.EvtQueryFlags.EvtQueryTolerateQueryErrors;
108
NativeWrapper.EvtSeek(_handle, 1, bookmarkHandle, 0,
UnsafeNativeMethods
.EvtSeekFlags.EvtSeekRelativeToBookmark);
225
NativeWrapper.EvtSeek(_handle, offset, EventLogHandle.Zero, 0,
UnsafeNativeMethods
.EvtSeekFlags.EvtSeekRelativeToCurrent);
240
NativeWrapper.EvtSeek(_handle, offset, bookmarkHandle, 0,
UnsafeNativeMethods
.EvtSeekFlags.EvtSeekRelativeToBookmark);
251
NativeWrapper.EvtSeek(_handle, offset, EventLogHandle.Zero, 0,
UnsafeNativeMethods
.EvtSeekFlags.EvtSeekRelativeToFirst);
257
NativeWrapper.EvtSeek(_handle, offset, EventLogHandle.Zero, 0,
UnsafeNativeMethods
.EvtSeekFlags.EvtSeekRelativeToLast);
309
string?[] channelNames = (string?[])NativeWrapper.EvtGetQueryInfo(queryHandle,
UnsafeNativeMethods
.EvtQueryPropertyId.EvtQueryNames)!;
310
int[] errorStatuses = (int[])NativeWrapper.EvtGetQueryInfo(queryHandle,
UnsafeNativeMethods
.EvtQueryPropertyId.EvtQueryStatuses)!;
System\Diagnostics\Reader\EventLogRecord.cs (3)
60
NativeWrapper.EvtRenderBufferWithContextSystem(_session.renderContextHandleSystem, Handle,
UnsafeNativeMethods
.EvtRenderFlags.EvtRenderEventValues, _systemProperties);
238
return _containerChannel ??= (string?)NativeWrapper.EvtGetEventInfo(this.Handle,
UnsafeNativeMethods
.EvtEventPropertyId.EvtEventPath);
251
return _matchedQueryIds ??= (int[]?)NativeWrapper.EvtGetEventInfo(this.Handle,
UnsafeNativeMethods
.EvtEventPropertyId.EvtEventQueryIDs);
System\Diagnostics\Reader\EventLogSession.cs (9)
66
this.renderContextHandleSystem = NativeWrapper.EvtCreateRenderContext(0, null,
UnsafeNativeMethods
.EvtRenderContextFlags.EvtRenderContextSystem);
78
this.renderContextHandleUser = NativeWrapper.EvtCreateRenderContext(0, null,
UnsafeNativeMethods
.EvtRenderContextFlags.EvtRenderContextUser);
105
UnsafeNativeMethods
.EvtRpcLogin erLogin = new
UnsafeNativeMethods
.EvtRpcLogin(
116
Handle = NativeWrapper.EvtOpenSession(
UnsafeNativeMethods
.EvtLoginClass.EvtRpcLogin, ref erLogin, 0, 0);
226
UnsafeNativeMethods
.EvtExportLogFlags flag = pathType switch
228
PathType.LogName =>
UnsafeNativeMethods
.EvtExportLogFlags.EvtExportLogChannelPath,
229
PathType.FilePath =>
UnsafeNativeMethods
.EvtExportLogFlags.EvtExportLogFilePath,
235
NativeWrapper.EvtExportLog(this.Handle, path, query, targetFilePath, (int)flag | (int)
UnsafeNativeMethods
.EvtExportLogFlags.EvtExportLogTolerateQueryErrors);
System\Diagnostics\Reader\EventLogWatcher.cs (6)
136
UnsafeNativeMethods
.EvtClose(_eventsBuffer[i]);
160
flag |= (int)
UnsafeNativeMethods
.EvtSubscribeFlags.EvtSubscribeStartAfterBookmark;
164
flag |= (int)
UnsafeNativeMethods
.EvtSubscribeFlags.EvtSubscribeStartAtOldestRecord;
168
flag |= (int)
UnsafeNativeMethods
.EvtSubscribeFlags.EvtSubscribeToFutureEvents;
173
flag |= (int)
UnsafeNativeMethods
.EvtSubscribeFlags.EvtSubscribeTolerateQueryErrors;
187
_handle =
UnsafeNativeMethods
.EvtSubscribe(_eventQuery.Session.Handle,
System\Diagnostics\Reader\NativeWrapper.cs (260)
58
EventLogHandle handle =
UnsafeNativeMethods
.EvtQuery(session, path, query, flags);
74
UnsafeNativeMethods
.EvtSeekFlags flags)
76
bool status =
UnsafeNativeMethods
.EvtSeek(resultSet, position, bookmark, timeout, flags);
90
bool status =
UnsafeNativeMethods
.EvtNext(queryHandle, eventSize, events, timeout, flags, ref returned);
99
if (!
UnsafeNativeMethods
.EvtCancel(handle))
112
UnsafeNativeMethods
.EvtClose(handle);
124
EventLogHandle handle =
UnsafeNativeMethods
.EvtOpenPublisherMetadata(session, ProviderId, logFilePath, 0, flags);
139
bool status =
UnsafeNativeMethods
.EvtGetObjectArraySize(objectArray, out arraySize);
148
EventLogHandle emEnumHandle =
UnsafeNativeMethods
.EvtOpenEventMetadataEnum(ProviderMetadata, flags);
162
EventLogHandle emHandle =
UnsafeNativeMethods
.EvtNextEventMetadata(eventMetadataEnum, flags);
178
EventLogHandle channelEnum =
UnsafeNativeMethods
.EvtOpenChannelEnum(session, flags);
191
EventLogHandle pubEnum =
UnsafeNativeMethods
.EvtOpenPublisherEnum(session, flags);
204
EventLogHandle handle =
UnsafeNativeMethods
.EvtOpenChannelConfig(session, channelPath, flags);
217
bool status =
UnsafeNativeMethods
.EvtSaveChannelConfig(channelConfig, flags);
225
EventLogHandle logHandle =
UnsafeNativeMethods
.EvtOpenLog(session, path, flags);
244
status =
UnsafeNativeMethods
.EvtExportLog(session, channelPath, query, targetFilePath, flags);
257
status =
UnsafeNativeMethods
.EvtArchiveExportedLog(session, logFilePath, locale, flags);
270
status =
UnsafeNativeMethods
.EvtClearLog(session, channelPath, targetFilePath, flags);
279
UnsafeNativeMethods
.EvtRenderContextFlags flags)
281
EventLogHandle renderContextHandleValues =
UnsafeNativeMethods
.EvtCreateRenderContext(valuePathsCount, valuePaths, flags);
298
UnsafeNativeMethods
.EvtRenderFlags flags =
UnsafeNativeMethods
.EvtRenderFlags.EvtRenderEventXml;
299
bool status =
UnsafeNativeMethods
.EvtRender(context, eventHandle, flags, buffer.Length, buffer, out buffUsed, out _);
307
status =
UnsafeNativeMethods
.EvtRender(context, eventHandle, flags, buffer.Length, buffer, out buffUsed, out _);
323
public static EventLogHandle EvtOpenSession(
UnsafeNativeMethods
.EvtLoginClass loginClass, ref
UnsafeNativeMethods
.EvtRpcLogin login, int timeout, int flags)
325
EventLogHandle handle =
UnsafeNativeMethods
.EvtOpenSession(loginClass, ref login, timeout, flags);
334
EventLogHandle handle =
UnsafeNativeMethods
.EvtCreateBookmark(bookmarkXml);
347
bool status =
UnsafeNativeMethods
.EvtUpdateBookmark(bookmark, eventHandle);
353
public static object? EvtGetEventInfo(EventLogHandle handle,
UnsafeNativeMethods
.EvtEventPropertyId enumType)
360
bool status =
UnsafeNativeMethods
.EvtGetEventInfo(handle, enumType, 0, IntPtr.Zero, out bufferNeeded);
371
status =
UnsafeNativeMethods
.EvtGetEventInfo(handle, enumType, bufferNeeded, buffer, out bufferNeeded);
376
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
386
public static object? EvtGetQueryInfo(EventLogHandle handle,
UnsafeNativeMethods
.EvtQueryPropertyId enumType)
392
bool status =
UnsafeNativeMethods
.EvtGetQueryInfo(handle, enumType, 0, IntPtr.Zero, ref bufferNeeded);
400
status =
UnsafeNativeMethods
.EvtGetQueryInfo(handle, enumType, bufferNeeded, buffer, ref bufferNeeded);
405
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
415
public static object? EvtGetPublisherMetadataProperty(EventLogHandle pmHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId thePropertyId)
422
bool status =
UnsafeNativeMethods
.EvtGetPublisherMetadataProperty(pmHandle, thePropertyId, 0, 0, IntPtr.Zero, out bufferNeeded);
430
status =
UnsafeNativeMethods
.EvtGetPublisherMetadataProperty(pmHandle, thePropertyId, 0, bufferNeeded, buffer, out bufferNeeded);
435
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
445
internal static EventLogHandle EvtGetPublisherMetadataPropertyHandle(EventLogHandle pmHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId thePropertyId)
451
bool status =
UnsafeNativeMethods
.EvtGetPublisherMetadataProperty(pmHandle, thePropertyId, 0, 0, IntPtr.Zero, out bufferNeeded);
459
status =
UnsafeNativeMethods
.EvtGetPublisherMetadataProperty(pmHandle, thePropertyId, 0, bufferNeeded, buffer, out bufferNeeded);
471
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
486
bool status =
UnsafeNativeMethods
.EvtFormatMessage(handle, EventLogHandle.Zero, msgId, 0, null,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageId, 0, emptyBuffer, out bufferNeeded);
490
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
491
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT
492
&& error !=
UnsafeNativeMethods
.ERROR_EVT_MAX_INSERTS_REACHED)
503
status =
UnsafeNativeMethods
.EvtFormatMessage(handle, EventLogHandle.Zero, msgId, 0, null,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageId, bufferNeeded, buffer, out bufferNeeded);
506
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
507
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT
508
&& error !=
UnsafeNativeMethods
.ERROR_EVT_MAX_INSERTS_REACHED)
531
bool status =
UnsafeNativeMethods
.EvtGetObjectArrayProperty(objArrayHandle, thePropertyId, index, 0, 0, IntPtr.Zero, out bufferNeeded);
540
status =
UnsafeNativeMethods
.EvtGetObjectArrayProperty(objArrayHandle, thePropertyId, index, 0, bufferNeeded, buffer, out bufferNeeded);
545
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
555
public static object? EvtGetEventMetadataProperty(EventLogHandle handle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId enumType)
562
bool status =
UnsafeNativeMethods
.EvtGetEventMetadataProperty(handle, enumType, 0, 0, IntPtr.Zero, out bufferNeeded);
570
status =
UnsafeNativeMethods
.EvtGetEventMetadataProperty(handle, enumType, 0, bufferNeeded, buffer, out bufferNeeded);
575
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
585
public static object? EvtGetChannelConfigProperty(EventLogHandle handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId enumType)
592
bool status =
UnsafeNativeMethods
.EvtGetChannelConfigProperty(handle, enumType, 0, 0, IntPtr.Zero, out bufferNeeded);
600
status =
UnsafeNativeMethods
.EvtGetChannelConfigProperty(handle, enumType, 0, bufferNeeded, buffer, out bufferNeeded);
612
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
622
public static void EvtSetChannelConfigProperty(EventLogHandle handle,
UnsafeNativeMethods
.EvtChannelConfigPropertyId enumType, object? val)
624
UnsafeNativeMethods
.EvtVariant varVal = default;
634
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigEnabled:
636
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBoolean;
640
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelConfigAccess:
642
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString;
647
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigLogFilePath:
649
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString;
654
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigMaxSize:
656
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt64;
660
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigLevel:
662
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt32;
666
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelPublishingConfigKeywords:
668
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt64;
672
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigRetention:
674
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBoolean;
678
case
UnsafeNativeMethods
.EvtChannelConfigPropertyId.EvtChannelLoggingConfigAutoBackup:
680
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBoolean;
690
varVal.Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeNull;
692
bool status =
UnsafeNativeMethods
.EvtSetChannelConfigProperty(handle, enumType, 0, ref varVal);
702
bool status =
UnsafeNativeMethods
.EvtNextChannelPath(handle, 0, null, out channelNameNeeded);
717
status =
UnsafeNativeMethods
.EvtNextChannelPath(handle, channelNameNeeded, buffer, out channelNameNeeded);
733
bool status =
UnsafeNativeMethods
.EvtNextPublisherId(handle, 0, null, out ProviderIdNeeded);
748
status =
UnsafeNativeMethods
.EvtNextPublisherId(handle, ProviderIdNeeded, buffer, out ProviderIdNeeded);
760
public static object? EvtGetLogInfo(EventLogHandle handle,
UnsafeNativeMethods
.EvtLogPropertyId enumType)
767
bool status =
UnsafeNativeMethods
.EvtGetLogInfo(handle, enumType, 0, IntPtr.Zero, out bufferNeeded);
775
status =
UnsafeNativeMethods
.EvtGetLogInfo(handle, enumType, bufferNeeded, buffer, out bufferNeeded);
780
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(buffer);
790
public static void EvtRenderBufferWithContextSystem(EventLogHandle contextHandle, EventLogHandle eventHandle,
UnsafeNativeMethods
.EvtRenderFlags flag, SystemProperties systemProperties)
799
bool status =
UnsafeNativeMethods
.EvtRender(contextHandle, eventHandle, flag, 0, IntPtr.Zero, out bufferNeeded, out propCount);
808
status =
UnsafeNativeMethods
.EvtRender(contextHandle, eventHandle, flag, bufferNeeded, buffer, out bufferNeeded, out propCount);
817
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(pointer);
820
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemProviderName:
821
systemProperties.ProviderName = (string?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString);
823
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemProviderGuid:
824
systemProperties.ProviderId = (Guid?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeGuid);
826
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemEventID:
827
systemProperties.Id = (ushort?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt16);
829
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemQualifiers:
830
systemProperties.Qualifiers = (ushort?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt16);
832
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemLevel:
833
systemProperties.Level = (byte?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeByte);
835
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemTask:
836
systemProperties.Task = (ushort?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt16);
838
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemOpcode:
839
systemProperties.Opcode = (byte?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeByte);
841
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemKeywords:
842
systemProperties.Keywords = (ulong?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeHexInt64);
844
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemTimeCreated:
845
systemProperties.TimeCreated = (DateTime?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeFileTime);
847
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemEventRecordId:
848
systemProperties.RecordId = (ulong?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt64);
850
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemActivityID:
851
systemProperties.ActivityId = (Guid?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeGuid);
853
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemRelatedActivityID:
854
systemProperties.RelatedActivityId = (Guid?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeGuid);
856
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemProcessID:
857
systemProperties.ProcessId = (uint?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt32);
859
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemThreadID:
860
systemProperties.ThreadId = (uint?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt32);
862
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemChannel:
863
systemProperties.ChannelName = (string?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString);
865
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemComputer:
866
systemProperties.ComputerName = (string?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString);
868
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemUserID:
869
systemProperties.UserId = (SecurityIdentifier?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSid);
871
case (int)
UnsafeNativeMethods
.EvtSystemPropertyId.EvtSystemVersion:
872
systemProperties.Version = (byte?)ConvertToObject(varVal,
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeByte);
896
UnsafeNativeMethods
.EvtRenderFlags flag =
UnsafeNativeMethods
.EvtRenderFlags.EvtRenderEventValues;
900
bool status =
UnsafeNativeMethods
.EvtRender(contextHandle, eventHandle, flag, 0, IntPtr.Zero, out bufferNeeded, out propCount);
909
status =
UnsafeNativeMethods
.EvtRender(contextHandle, eventHandle, flag, bufferNeeded, buffer, out bufferNeeded, out propCount);
920
UnsafeNativeMethods
.EvtVariant varVal = Marshal.PtrToStructure<
UnsafeNativeMethods
.EvtVariant>(pointer);
934
public static string? EvtFormatMessageRenderName(EventLogHandle pmHandle, EventLogHandle eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags flag)
938
bool status =
UnsafeNativeMethods
.EvtFormatMessage(pmHandle, eventHandle, 0, 0, null, flag, 0, emptyBuffer, out bufferNeeded);
941
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
942
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT)
959
status =
UnsafeNativeMethods
.EvtFormatMessage(pmHandle, eventHandle, 0, 0, null, flag, bufferNeeded, buffer, out bufferNeeded);
962
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
963
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT)
986
public static IEnumerable<string> EvtFormatMessageRenderKeywords(EventLogHandle pmHandle, EventLogHandle eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags flag)
995
bool status =
UnsafeNativeMethods
.EvtFormatMessage(pmHandle, eventHandle, 0, 0, null, flag, 0, emptyBuffer, out bufferNeeded);
1009
status =
UnsafeNativeMethods
.EvtFormatMessageBuffer(pmHandle, eventHandle, 0, 0, IntPtr.Zero, flag, bufferNeeded, buffer, out bufferNeeded);
1046
UnsafeNativeMethods
.EvtRenderFlags flag =
UnsafeNativeMethods
.EvtRenderFlags.EvtRenderBookmark;
1050
bool status =
UnsafeNativeMethods
.EvtRender(EventLogHandle.Zero, eventHandle, flag, 0, IntPtr.Zero, out bufferNeeded, out propCount);
1059
status =
UnsafeNativeMethods
.EvtRender(EventLogHandle.Zero, eventHandle, flag, bufferNeeded, buffer, out bufferNeeded, out propCount);
1079
UnsafeNativeMethods
.EvtStringVariant[] stringVariants = new
UnsafeNativeMethods
.EvtStringVariant[values.Length];
1082
stringVariants[i].Type = (uint)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString;
1086
bool status =
UnsafeNativeMethods
.EvtFormatMessage(handle, eventHandle, 0xffffffff, values.Length, stringVariants,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageEvent, 0, emptyBuffer, out bufferNeeded);
1089
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
1090
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT)
1107
status =
UnsafeNativeMethods
.EvtFormatMessage(handle, eventHandle, 0xffffffff, values.Length, stringVariants,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageEvent, bufferNeeded, buffer, out bufferNeeded);
1110
if (!status && error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_VALUE_INSERT
1111
&& error !=
UnsafeNativeMethods
.ERROR_EVT_UNRESOLVED_PARAMETER_INSERT)
1127
private static object? ConvertToObject(
UnsafeNativeMethods
.EvtVariant val)
1131
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt32:
1133
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt32:
1135
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt16:
1137
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt16:
1139
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeByte:
1141
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSByte:
1143
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt64:
1145
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt64:
1147
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeHexInt64:
1149
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeHexInt32:
1151
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSingle:
1153
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeDouble:
1155
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeNull:
1157
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString:
1159
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeAnsiString:
1161
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSid:
1163
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeGuid:
1165
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeEvtHandle:
1167
case (int)(int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeFileTime:
1169
case (int)(int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSysTime:
1170
UnsafeNativeMethods
.SystemTime sysTime = Marshal.PtrToStructure<
UnsafeNativeMethods
.SystemTime>(val.SystemTime);
1172
case (int)(int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSizeT:
1174
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBoolean:
1179
case (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBinary:
1180
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeByte):
1186
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt16):
1192
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt32):
1198
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeInt64):
1204
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSingle):
1210
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeDouble):
1216
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSByte):
1218
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt16):
1220
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt64):
1221
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeHexInt64):
1223
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeUInt32):
1224
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeHexInt32):
1226
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeString):
1228
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeAnsiString):
1230
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBoolean):
1232
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeGuid):
1234
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeFileTime):
1236
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSysTime):
1238
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeBinary): // both length and count in the manifest: tracrpt supports, Crimson APIs don't
1239
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSizeT): // unused: array of win:pointer is returned as HexIntXX
1240
case ((int)
UnsafeNativeMethods
.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeSid): // unsupported by native APIs
1246
public static object? ConvertToObject(
UnsafeNativeMethods
.EvtVariant val,
UnsafeNativeMethods
.EvtVariantType desiredType)
1248
if (val.Type == (int)
UnsafeNativeMethods
.EvtVariantType.EvtVarTypeNull)
1256
public static string? ConvertToString(
UnsafeNativeMethods
.EvtVariant val)
1264
public static string? ConvertToAnsiString(
UnsafeNativeMethods
.EvtVariant val)
1272
public static EventLogHandle ConvertToSafeHandle(
UnsafeNativeMethods
.EvtVariant val)
1280
public static unsafe T[] ConvertToArray<T>(
UnsafeNativeMethods
.EvtVariant val)
1299
public static unsafe bool[] ConvertToBoolArray(
UnsafeNativeMethods
.EvtVariant val)
1318
public static unsafe DateTime[] ConvertToFileTimeArray(
UnsafeNativeMethods
.EvtVariant val)
1336
public static unsafe DateTime[] ConvertToSysTimeArray(
UnsafeNativeMethods
.EvtVariant val)
1338
UnsafeNativeMethods
.SystemTime* ptr = (
UnsafeNativeMethods
.SystemTime*)val.Reference;
1348
UnsafeNativeMethods
.SystemTime sysTime = ptr[i];
1355
public static unsafe string?[] ConvertToStringArray(
UnsafeNativeMethods
.EvtVariant val, bool ansi)
1377
case
UnsafeNativeMethods
.ERROR_EVT_MESSAGE_NOT_FOUND:
1378
case
UnsafeNativeMethods
.ERROR_EVT_MESSAGE_ID_NOT_FOUND:
1379
case
UnsafeNativeMethods
.ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND:
1381
case
UnsafeNativeMethods
.ERROR_MUI_FILE_NOT_FOUND:
System\Diagnostics\Reader\ProviderMetadata.cs (51)
88
return (Guid)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataPublisherGuid)!;
96
return (string?)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataMessageFilePath);
104
return (string?)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataResourceFilePath);
112
return (string?)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataParameterFilePath);
120
string? helpLinkStr = (string?)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataHelpLink);
131
return (uint)NativeWrapper.EvtGetPublisherMetadataProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataPublisherMessageID)!;
160
elHandle = NativeWrapper.EvtGetPublisherMetadataPropertyHandle(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferences);
168
string? channelName = (string?)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferencePath);
170
uint channelId = (uint)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferenceID)!;
172
uint flag = (uint)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferenceFlags)!;
175
if (flag == (int)
UnsafeNativeMethods
.EvtChannelReferenceFlags.EvtChannelReferenceImported)
180
int channelRefMessageId = unchecked((int)((uint)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferenceMessageID)!));
240
_standardLevels ??= (List<EventLevel>)GetProviderListProperty(_defaultProviderHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevels)!;
250
_standardOpcodes ??= (List<EventOpcode>)GetProviderListProperty(_defaultProviderHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodes)!;
260
_standardKeywords ??= (List<EventKeyword>)GetProviderListProperty(_defaultProviderHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywords)!;
270
_standardTasks ??= (List<EventTask>)GetProviderListProperty(_defaultProviderHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTasks)!;
279
internal object? GetProviderListProperty(EventLogHandle providerHandle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId metadataProperty)
285
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId propName;
286
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId propValue;
287
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId propMessageId;
301
case
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevels:
302
propName =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevelName;
303
propValue =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevelValue;
304
propMessageId =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevelMessageID;
309
case
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodes:
310
propName =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodeName;
311
propValue =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodeValue;
312
propMessageId =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodeMessageID;
317
case
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywords:
318
propName =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywordName;
319
propValue =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywordValue;
320
propMessageId =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywordMessageID;
325
case
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTasks:
326
propName =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTaskName;
327
propValue =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTaskValue;
328
propMessageId =
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTaskMessageID;
391
Guid taskGuid = (Guid)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTaskEventGuid)!;
424
el = (List<EventLevel>)this.GetProviderListProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataLevels)!;
441
eo = (List<EventOpcode>)this.GetProviderListProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataOpcodes)!;
458
ek = (List<EventKeyword>)this.GetProviderListProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataKeywords)!;
475
et = (List<EventTask>)this.GetProviderListProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTasks)!;
502
uint emId = (uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventID)!;
503
byte emVersion = (byte)((uint)(NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventVersion))!);
504
byte emChannelId = (byte)((uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventChannel)!);
505
byte emLevel = (byte)((uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventLevel)!);
506
byte emOpcode = (byte)((uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventOpcode)!);
507
short emTask = (short)((uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventTask)!);
508
long emKeywords = (long)(ulong)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventKeyword)!;
509
string? emTemplate = (string?)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventTemplate);
510
int messageId = (int)((uint)NativeWrapper.EvtGetEventMetadataProperty(emHandle,
UnsafeNativeMethods
.EvtEventMetadataPropertyId.EventMetadataEventMessageID)!);
531
this.GetProviderListProperty(_handle,
UnsafeNativeMethods
.EvtPublisherMetadataPropertyId.EvtPublisherMetadataTasks);
System\Diagnostics\Reader\ProviderMetadataCachedInformation.cs (5)
188
return NativeWrapper.EvtFormatMessageRenderName(pm.Handle, eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageEvent);
220
return NativeWrapper.EvtFormatMessageRenderName(pm.Handle, eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageLevel);
230
return NativeWrapper.EvtFormatMessageRenderName(pm.Handle, eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageOpcode);
240
return NativeWrapper.EvtFormatMessageRenderName(pm.Handle, eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageTask);
250
return NativeWrapper.EvtFormatMessageRenderKeywords(pm.Handle, eventHandle,
UnsafeNativeMethods
.EvtFormatMessageFlags.EvtFormatMessageKeyword);