1个回答
2015-09-02 · 知道合伙人软件行家
关注
展开全部
public static string GetModuleFileNameByAddressRange(
int processId,
IntPtr memoryAddress)
{
try
{
int MemAdd32 = memoryAddress.ToInt32();
long MemAdd64 = memoryAddress.ToInt64();
using (Process p = Process.GetProcessById(processId))
{
ProcessModuleCollection LoadedProcessModules = p.Modules;
try
{
if (is32bit == true)
{
foreach (ProcessModule pm in LoadedProcessModules)
{
if (MemAdd32 >= pm.BaseAddress.ToInt32() &&
MemAdd32 <= (pm.ModuleMemorySize + pm.BaseAddress.ToInt32()))
{
return pm.FileName;
}
Application.DoEvents();
}
}
else
{
foreach (ProcessModule pm in LoadedProcessModules)
{
if (MemAdd64 >= pm.BaseAddress.ToInt64() &&
MemAdd64 <= (pm.ModuleMemorySize + pm.BaseAddress.ToInt64()))
{
return pm.FileName;
}
Application.DoEvents();
}
}
}
}
return string.Empty;
}
catch
{
return string.Empty;
}
}
int processId,
IntPtr memoryAddress)
{
try
{
int MemAdd32 = memoryAddress.ToInt32();
long MemAdd64 = memoryAddress.ToInt64();
using (Process p = Process.GetProcessById(processId))
{
ProcessModuleCollection LoadedProcessModules = p.Modules;
try
{
if (is32bit == true)
{
foreach (ProcessModule pm in LoadedProcessModules)
{
if (MemAdd32 >= pm.BaseAddress.ToInt32() &&
MemAdd32 <= (pm.ModuleMemorySize + pm.BaseAddress.ToInt32()))
{
return pm.FileName;
}
Application.DoEvents();
}
}
else
{
foreach (ProcessModule pm in LoadedProcessModules)
{
if (MemAdd64 >= pm.BaseAddress.ToInt64() &&
MemAdd64 <= (pm.ModuleMemorySize + pm.BaseAddress.ToInt64()))
{
return pm.FileName;
}
Application.DoEvents();
}
}
}
}
return string.Empty;
}
catch
{
return string.Empty;
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询