From 94ac6de39064fce6b1cb6045f8e1ff349816de3b Mon Sep 17 00:00:00 2001 From: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com> Date: Tue, 25 Nov 2025 21:07:47 -0500 Subject: [PATCH] Remove Windows 2000 dead code Fixes dotnet/wpf#11276 --- .../AutomationProxies/CommonXSendMessage.cs | 47 +++---------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/CommonXSendMessage.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/CommonXSendMessage.cs index c6e92e6f147..552a2bc5b37 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/CommonXSendMessage.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/CommonXSendMessage.cs @@ -1482,59 +1482,24 @@ private static bool IsWOW64Process(IntPtr hwnd) throw new Win32Exception(); } - // Windows XP(major version 5 and minor version 1) and above - if (Environment.OSVersion.Version.Major > 5 || (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor == 1)) + try { - try - { - // IsWow64Process() implemented in Windows XP - bool isWOW64Process; - - if (!Misc.IsWow64Process(hProcess, out isWOW64Process)) - { - // Function failed. Assume not running under WOW64. - return false; - } - - return isWOW64Process; - } - catch (Win32Exception) + if (!Misc.IsWow64Process(hProcess, out bool isWOW64Process)) { // Function failed. Assume not running under WOW64. return false; } + + return isWOW64Process; } - // Windows 2000 (major version 5) - else if (Environment.OSVersion.Version.Major == 5) - { - // NtQueryInformationProcess is available for use in Windows 2000 and Windows XP. - // It may be altered or unavailable in subsequent versions. Applications should use the alternate functions - ulong infoWOW64 = 0; - int status = UnsafeNativeMethods.NtQueryInformationProcess(hProcess, UnsafeNativeMethods.ProcessWow64Information, ref infoWOW64, sizeof(ulong), null); - if (NT_ERROR(status)) - { - // Query failed. Assume not running under WOW64. - return false; - } - return infoWOW64 != 0; - } - // Windows 95, Windows 98, Windows Me, or Windows NT (major version 4) - else + catch (Win32Exception) { - // WOW64 was not available in these versions of Windows. + // Function failed. Assume not running under WOW64. return false; } } } - // - // Generic test for error on any status value. - // - private static bool NT_ERROR(int status) - { - return (ulong)(status) >> 30 == 3; - } - #endregion // ------------------------------------------------------