From e8facaf03b6e8a9e1c291f0228dfa6f6ea35e80e Mon Sep 17 00:00:00 2001 From: dmex04 Date: Sun, 1 Nov 2009 00:45:54 +0000 Subject: [PATCH] added EnumProcessModulesEx with support for 32bit/64bit module querying git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2325 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 1.x/trunk/ProcessHacker.Native/Api/Enums.cs | 9 +++++++++ 1.x/trunk/ProcessHacker.Native/Api/Functions.cs | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/1.x/trunk/ProcessHacker.Native/Api/Enums.cs b/1.x/trunk/ProcessHacker.Native/Api/Enums.cs index f7aae3111..ce499f94e 100644 --- a/1.x/trunk/ProcessHacker.Native/Api/Enums.cs +++ b/1.x/trunk/ProcessHacker.Native/Api/Enums.cs @@ -212,6 +212,15 @@ namespace ProcessHacker.Native.Api Moveable = 0x00000004 } + [Flags] + public enum ModulesFilterFlag : int + { + Default = 0x0, + x32Bit = 0x01, + x64Bit = 0x02, + All = 0x03 + } + public enum LogonFlags : uint { LogonWithProfile = 1, diff --git a/1.x/trunk/ProcessHacker.Native/Api/Functions.cs b/1.x/trunk/ProcessHacker.Native/Api/Functions.cs index 746892d65..a3a032a3b 100644 --- a/1.x/trunk/ProcessHacker.Native/Api/Functions.cs +++ b/1.x/trunk/ProcessHacker.Native/Api/Functions.cs @@ -1079,7 +1079,7 @@ namespace ProcessHacker.Native.Api [In] int ProcessId ); - [DllImport("psapi.dll")] + [DllImport("psapi.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumProcessModules( [In] IntPtr ProcessHandle, @@ -1087,6 +1087,16 @@ namespace ProcessHacker.Native.Api [In] int Size, [Out] out int RequiredSize ); + + [DllImport("psapi.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool EnumProcessModulesEx( + [In] IntPtr ProcessHandle, + [Out] IntPtr[] ModuleHandles, + [In] int Size, + [Out] out int RequiredSize, + [In] ModulesFilterFlag dwFilterFlag + ); [DllImport("psapi.dll", CharSet = CharSet.Unicode)] public static extern int GetModuleBaseName(