public Native(EvtStringVariant managed) { StringVal = Marshal.StringToCoTaskMemUni(managed.StringVal); Count = managed.Count; Type = managed.Type; }
internal static bool EvtFormatMessage (EventLogHandle publisherMetadataHandle, EventLogHandle eventHandle, uint messageId, int valueCount, EvtStringVariant[] values, [MarshalAs(UnmanagedType.I4)] EvtFormatMessageFlags flags, int bufferSize, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer, out int bufferUsed) { buffer = new StringBuilder(); if (values != null && valueCount > 0) { foreach (var e in values) { buffer.Append(e.StringVal); } } bufferUsed = buffer.Length; return true; }
internal static extern bool EvtFormatMessage(EventLogHandle publisherMetadataHandle, EventLogHandle eventHandle, uint messageId, int valueCount, EvtStringVariant[] values, [MarshalAs(UnmanagedType.I4)] EvtFormatMessageFlags flags, int bufferSize, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer, out int bufferUsed);
public static Native ConvertToUnmanaged(EvtStringVariant managed) => new(managed);