Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private static NetworkAdapter[] GetNetworkAdapters(CimSession session)

if (adapters != null && configs != null)
{
var configDict = new Dictionary<UInt32, WmiNetworkAdapterConfiguration>();
var configDict = new Dictionary<uint, WmiNetworkAdapterConfiguration>();

foreach (var config in configs)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

Expand All @@ -18,7 +17,6 @@ internal static class UnsafeNativeMethods
private static readonly IntPtr s_NULL = IntPtr.Zero;

// WinError.h codes:

internal const int ERROR_SUCCESS = 0x0;
internal const int ERROR_FILE_NOT_FOUND = 0x2;
internal const int ERROR_PATH_NOT_FOUND = 0x3;
Expand Down Expand Up @@ -62,7 +60,6 @@ internal static class UnsafeNativeMethods
internal const int ERROR_RESOURCE_LANG_NOT_FOUND = 0x717; // 1815

// Event log specific codes:

internal const int ERROR_EVT_MESSAGE_NOT_FOUND = 15027;
internal const int ERROR_EVT_MESSAGE_ID_NOT_FOUND = 15028;
internal const int ERROR_EVT_UNRESOLVED_VALUE_INSERT = 15029;
Expand All @@ -71,10 +68,7 @@ internal static class UnsafeNativeMethods
internal const int ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND = 15033;
internal const int ERROR_MUI_FILE_NOT_FOUND = 15100;

//
// ErrorCode & format
//

// for win32 error message formatting
private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
Expand Down Expand Up @@ -108,12 +102,8 @@ internal static string GetMessage(int errorCode)
}
}

//
// ETW Methods
//
//
// Callback
//
[SecurityCritical]
internal unsafe delegate void EtwEnableCallback(
[In] ref Guid sourceId,
Expand All @@ -125,9 +115,7 @@ internal unsafe delegate void EtwEnableCallback(
[In] void* callbackContext
);

//
// Registration APIs
//
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SecurityCritical]
internal static extern unsafe uint EventRegister(
Expand All @@ -141,9 +129,7 @@ [In][Out]ref long registrationHandle
[SecurityCritical]
internal static extern int EventUnregister([In] long registrationHandle);

//
// Control (Is Enabled) APIs
//
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventEnabled", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SecurityCritical]
internal static extern int EventEnabled([In] long registrationHandle, [In] ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor);
Expand All @@ -152,9 +138,7 @@ [In][Out]ref long registrationHandle
[SecurityCritical]
internal static extern int EventProviderEnabled([In] long registrationHandle, [In] byte level, [In] long keywords);

//
// Writing (Publishing/Logging) APIs
//
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SecurityCritical]
internal static extern unsafe uint EventWrite(
Expand All @@ -164,9 +148,7 @@ internal static extern unsafe uint EventWrite(
[In] void* userData
);

//
// Writing (Publishing/Logging) APIs
//
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SecurityCritical]
internal static extern unsafe uint EventWrite(
Expand Down Expand Up @@ -195,16 +177,12 @@ internal static extern unsafe uint EventWriteString(
[In] long keywords,
[In] char* message
);
//
// ActivityId Control APIs
//
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventActivityIdControl", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SecurityCritical]
internal static extern unsafe uint EventActivityIdControl([In] int ControlCode, [In][Out] ref Guid ActivityId);

//
// EventLog
//
[Flags]
internal enum EvtQueryFlags
{
Expand Down Expand Up @@ -384,7 +362,7 @@ internal enum EvtPublisherMetadataPropertyId
EvtPublisherMetadataKeywords = 25, // EvtVarTypeEvtHandle, ObjectArray
EvtPublisherMetadataKeywordName = 26, // EvtVarTypeString
EvtPublisherMetadataKeywordValue = 27, // EvtVarTypeUInt64
EvtPublisherMetadataKeywordMessageID = 28//, // EvtVarTypeUInt32
EvtPublisherMetadataKeywordMessageID = 28 // EvtVarTypeUInt32
// EvtPublisherMetadataPropertyIdEND
}

Expand Down Expand Up @@ -631,7 +609,6 @@ out int publisherMetadataPropertyBufferUsed
);

// NEW

[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
[return: MarshalAs(UnmanagedType.Bool)]
Expand Down Expand Up @@ -682,7 +659,6 @@ out int eventMetadataPropertyBufferUsed
);

// Channel Configuration Native Api

[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
internal static extern EventLogHandle EvtOpenChannelEnum(
Expand Down Expand Up @@ -756,8 +732,7 @@ internal static extern bool EvtGetChannelConfigProperty(
out int propertyValueBufferUsed
);

// Log Information Native Api

// Log Information Native API
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
internal static extern EventLogHandle EvtOpenLog(
Expand All @@ -778,7 +753,6 @@ out int propertyValueBufferUsed
);

// LOG MANIPULATION

[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
[return: MarshalAs(UnmanagedType.Bool)]
Expand Down
4 changes: 0 additions & 4 deletions src/System.Management.Automation/utils/tracing/EtwActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,6 @@ public void Callback(IAsyncResult asyncResult)
/// </summary>
public static event EventHandler<EtwEventArgs> EventWritten;

static EtwActivity()
{
}

/// <summary>
/// Sets the activityId provided in the current thread.
/// If current thread already has the same activityId it does
Expand Down