-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 32-bit process module enumeration on 64-bit Windows (#70370) #71218
Conversation
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue DetailsFixes the faulty
|
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Constants.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModulesEx.cs
Outdated
Show resolved
Hide resolved
…ProcessModulesEx.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
Test failure is #71233 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I am impressed that you were able to provide the fix so quickly!!
Big thanks @just-ero !
@@ -221,15 +221,15 @@ private static ProcessModuleCollection GetModules(int processId, bool firstModul | |||
} | |||
} | |||
|
|||
private static void EnumProcessModulesUntilSuccess(SafeProcessHandle processHandle, IntPtr[]? modules, int size, out int needed) | |||
private static void EnumProcessModulesUntilSuccess(SafeProcessHandle processHandle, IntPtr[]? modules, int size, out int needed, int filterFlag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if Interop.Kernel32.LIST_MODULES_ALL
is the only value we use, you could avoid adding the new parameter to EnumProcessModulesUntilSuccess
and just always pass Interop.Kernel32.LIST_MODULES_ALL
to EnumProcessModulesEx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't wanna break any of the existing patterns.
Fixes the faulty
Process.Modules
behavior described in #70370.~\Kernel32\Interop.EnumProcessModules.cs
and created~\Kernel32\Interop.EnumProcessModulesEx.cs
in its steadKernel32.Interop.LIST_MODULES_ALL
in~\Kernel32\Interop.Constants.cs
NtProcessManager.GetModules
andNtProcessManager.EnumProcessModulesUntilSuccess
to useInterop.Kernel32.EnumProcessModulesEx
instead of the previousInterop.Kernel32.EnumProcessModules