首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么ReadProcessMemory总是返回false?

为什么ReadProcessMemory总是返回false?
EN

Stack Overflow用户
提问于 2018-08-14 03:27:06
回答 1查看 253关注 0票数 0

不知道为什么,但对某些人来说,ReadProcessMemory总是返回false。始终像这样导入它:

代码语言:javascript
复制
[DefaultDllImportSearchPaths(Kernel32.Path)]
[DllImport(Kernel32.Dll)]
private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int nSize, IntPtr lpNumberOfBytesRead);

下面是运行ReadProcessMemory(IntPtr HandleWithAllAccess, IntPtr ProcessBaseAddress, byte[] BufferSizeOf500, int TheSize500, IntPtr.Zero);的结果

https://preview.ibb.co/eK8189/Screenshot_890.png

Note: just so people don't start asking unrelated questions, Kernel32 is a class with the dll name and the path where to find it

EN

回答 1

Stack Overflow用户

发布于 2018-08-14 03:56:00

读操作进入了进程中无法访问的区域,这就是它返回false的原因。感谢Jeroen Mostert链接文档,从现在开始,我将把SetLastError设置为true。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51829297

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档