diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/clipboard.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/clipboard.cs index 7bc1983ec21..734d6020000 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/clipboard.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/clipboard.cs @@ -15,13 +15,10 @@ using MS.Internal; using System.Collections.Specialized; using System.IO; -using System.Security; using System.ComponentModel; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Threading; using System.Windows.Media.Imaging; -using System.Windows.Threading; using SR = MS.Internal.PresentationCore.SR; using IComDataObject = System.Runtime.InteropServices.ComTypes.IDataObject; @@ -530,62 +527,6 @@ internal static bool IsClipboardPopulated() #region Private Methods - /// - /// Calls IsDynamicCodePolicyEnabled to determine if DeviceGuard is enabled, then caches it so subsequent calls only return the cached value. - /// - private static bool IsDeviceGuardEnabled - { - get - { - if (_isDeviceGuardEnabled < 0) return false; - if (_isDeviceGuardEnabled > 0) return true; - - bool isDynamicCodePolicyEnabled = IsDynamicCodePolicyEnabled(); - _isDeviceGuardEnabled = isDynamicCodePolicyEnabled ? 1 : -1; - - return isDynamicCodePolicyEnabled; - } - } - - /// - /// Loads Wldp.dll and looks for WldpIsDynamicCodePolicyEnabled to determine whether DeviceGuard is enabled. - /// - private static bool IsDynamicCodePolicyEnabled() - { - bool isEnabled = false; - - IntPtr hModule = IntPtr.Zero; - try - { - hModule = LoadLibraryHelper.SecureLoadLibraryEx(ExternDll.Wldp, IntPtr.Zero, UnsafeNativeMethods.LoadLibraryFlags.LOAD_LIBRARY_SEARCH_SYSTEM32); - if (hModule != IntPtr.Zero) - { - IntPtr entryPoint = UnsafeNativeMethods.GetProcAddressNoThrow(new HandleRef(null, hModule), "WldpIsDynamicCodePolicyEnabled"); - if (entryPoint != IntPtr.Zero) - { - int hResult = UnsafeNativeMethods.WldpIsDynamicCodePolicyEnabled(out isEnabled); - - if (hResult != NativeMethods.S_OK) - { - isEnabled = false; - } - } - } - } - catch - { - } - finally - { - if (hModule != IntPtr.Zero) - { - UnsafeNativeMethods.FreeLibrary(hModule); - } - } - - return isEnabled; - } - private static IDataObject GetDataObjectInternal() { IDataObject dataObject; @@ -769,7 +710,6 @@ private static bool IsDataFormatAutoConvert(string format) #endregion Private Constants - private static int _isDeviceGuardEnabled = 0; } #endregion Clipboard class diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/ExternDll.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/ExternDll.cs index 8a1e2fa785b..b9df9e3a4da 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/ExternDll.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/ExternDll.cs @@ -48,7 +48,6 @@ internal static class ExternDll public const string Wininet = "wininet.dll"; public const string Winmm = "winmm.dll"; public const string Winspool = "winspool.drv"; - public const string Wldp = "wldp.dll"; public const string WpfGfx = "WpfGfx_cor3.dll"; public const string WtsApi32 = "wtsapi32.dll"; } diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsCLR.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsCLR.cs index 3f7a7a66582..c377c9bf1ea 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsCLR.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsCLR.cs @@ -3150,18 +3150,6 @@ public static extern uint GetRawInputDeviceInfo( /// [DllImport(ExternDll.User32, CallingConvention = CallingConvention.Winapi)] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool EnumDisplayMonitors( - IntPtr hdc, - IntPtr lprcClip, - NativeMethods.MonitorEnumProc lpfnEnum, - IntPtr lParam); - - /// - /// Retrieves a value that describes the Device Guard policy enforcement status for .NET dynamic code. - /// - /// On success, returns true if the Device Guard policy enforces .NET Dynamic Code policy; otherwise, returns false. - /// This method returns S_OK if successful or a failure code otherwise. - [DllImport(ExternDll.Wldp, CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] - internal static extern int WldpIsDynamicCodePolicyEnabled([Out] out bool enabled); + internal static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, NativeMethods.MonitorEnumProc lpfnEnum, IntPtr lParam); } }