Improve ProcessManager.Win (#32010)
authorNext Turn <45985406+NextTurn@users.noreply.github.com>
Wed, 11 Mar 2020 15:48:50 +0000 (23:48 +0800)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 15:48:50 +0000 (11:48 -0400)
commit99af7453a356b7b564a0d21bf644f164858d1010
treebe0fed27dd06fc787dba5decb65f13ec072444f9
parent19400a449ac3b0cfc7216c04eef9f9312fef7d3a
Improve ProcessManager.Win (#32010)

* ---- Style changes start here ----

* Remove unnecessary using directives

* Remove unnecessary assignments

* Use IntPtr.Zero

* Replace magic numbers

* Remove unused parameters

* Replace constructor with initializer

* Simplify delegate interop

* Inline temporary variables

* Remove unnecessary checked keyword

* Remove unnecessary cast

* Introduce using statement

* ---- Style changes end here ----

* Remove magic sleep

* Prealloc list

* Reduce copying

* Use ArrayPool

* Support long path

* Improve P/Invoke signatures

* Optimize modules enumeration

* Rename and move HandleLastWin32Error

* while (true)

* Move comments near codes

* Revert "Support long path"

This reverts commit 1f06435144925668e7273ec458e78b869aad6055.

* Revert "Introduce using statement"

This reverts commit e3d383a229c13b096dbdef9aa9c857ee6cf986e1.

* Revert "Remove magic sleep"

This reverts commit d8bc0017131a9d9d6c1f66569a87699f9f7faea6.

* Add braces

* Simplify initialization

* Fix last Win32 error

* Avoid reallocation if modules count decreased

* Nits

* Simplify codes
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModules.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.IsWow64Process_SafeProcessHandle.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessInfo.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs