mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
modules tab now shows mapped files
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@753 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
Process Hacker
|
||||
|
||||
1.3.5.5
|
||||
* NEW:
|
||||
* Modules tab shows mapped files
|
||||
* FIXED:
|
||||
|
||||
1.3.5.0
|
||||
* NEW:
|
||||
* #2596502 - "Add access keys"
|
||||
|
||||
@@ -27,6 +27,7 @@ using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ProcessHacker
|
||||
{
|
||||
@@ -53,7 +54,7 @@ namespace ProcessHacker
|
||||
try
|
||||
{
|
||||
_processHandle = new Win32.ProcessHandle(_pid,
|
||||
Program.MinProcessQueryRights |
|
||||
Win32.PROCESS_RIGHTS.PROCESS_QUERY_INFORMATION |
|
||||
Win32.PROCESS_RIGHTS.PROCESS_VM_READ);
|
||||
}
|
||||
catch
|
||||
@@ -147,6 +148,46 @@ namespace ProcessHacker
|
||||
foreach (var m in processModules)
|
||||
modules.Add(m.BaseAddress.ToInt32(), m);
|
||||
|
||||
// add mapped files
|
||||
{
|
||||
Win32.MEMORY_BASIC_INFORMATION info = new Win32.MEMORY_BASIC_INFORMATION();
|
||||
int address = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!Win32.VirtualQueryEx(_processHandle, address, ref info, Marshal.SizeOf(info)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info.Type == Win32.MEMORY_TYPE.MEM_MAPPED)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(0x400);
|
||||
int length = Win32.GetMappedFileName(_processHandle, info.BaseAddress, sb, sb.Capacity);
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
string fileName = sb.ToString(0, length);
|
||||
|
||||
if (fileName.StartsWith("\\"))
|
||||
fileName = Win32.DeviceFileNameToDos(fileName);
|
||||
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
|
||||
|
||||
modules.Add(info.BaseAddress,
|
||||
new Win32.ProcessModule(
|
||||
new IntPtr(info.BaseAddress),
|
||||
info.RegionSize, IntPtr.Zero,
|
||||
fi.Name, fi.FullName));
|
||||
}
|
||||
}
|
||||
|
||||
address += info.RegionSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// look for unloaded modules
|
||||
foreach (int b in Dictionary.Keys)
|
||||
{
|
||||
|
||||
@@ -302,6 +302,14 @@ namespace ProcessHacker
|
||||
|
||||
#region Processes
|
||||
|
||||
[DllImport("psapi.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern int GetMappedFileName(
|
||||
int ProcessHandle,
|
||||
int Address,
|
||||
StringBuilder Buffer,
|
||||
int Size
|
||||
);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern bool CreateProcess(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string ApplicationName,
|
||||
|
||||
Reference in New Issue
Block a user