Referring to this topic: Access memory address in c# , I'm trying to understand how to address a memory location and extract data by knowing its hexadecimal segment:offset. Also, I believe the size can be variable. I would appreciate any advice on proceeding with this.
Well, if you want trouble...
int bufSize = 12;
IntPtr ptr = (IntPtr) (0xffff *16U + 5);
byte[] data = new byte[bufSize];
Marshal.Copy(ptr, data, 0, bufSize);
Managed applications run on platforms with a linear address space. There is no segment, there is no offset. There is only address and you can read and write at any address through Marshal.Copy
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.