Arithmetic operation resulted in an overflow in unsafe C#

纵然是瞬间 提交于 2019-12-04 10:26:29

The cast is just wrong. The address of stackinfo is a 64-bit value. You cannot cast that to an uint without risking OverflowException. There's no point in subtracting 4096 either, VirtualQuery() will find the base address anyway. Fix:

 IntPtr currentAddr = new IntPtr(&stackInfo);

Duffy's code can only work for 32-bit code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!