public void WriterMemory(Person person) { try { structPerson s_person = new structPerson(); s_person.person = person; if (this.G_MemoryAddress == IntPtr.Zero) { this.G_MemoryAddress = CreateFileMapping(0xFFFFFFFF, IntPtr.Zero, 0, 0, (uint)0x1024 * 10, "person"); } if (this.G_ProcessAddress == IntPtr.Zero) { this.G_ProcessAddress = MapViewOfFile(this.G_MemoryAddress, 0xf001f, 0, 0, 0); } var num = G_ProcessAddress.ToInt32() + 0x1024 * 10; Marshal.StructureToPtr(s_person, (IntPtr)(num), true); } catch (Exception exception) { throw exception; } }
public bool ReadMemory() { try { G_Person.person = null; if (G_MemoryAddress == IntPtr.Zero) { G_MemoryAddress = CreateFileMapping(0xFFFFFFFF, IntPtr.Zero, (uint)0, 0, (uint)0x1024 * 10, "person"); } if (G_ProcessAddress == IntPtr.Zero) { G_ProcessAddress = MapViewOfFile(this.G_MemoryAddress, 0xf001f, 0, 0, 0); } var num = G_ProcessAddress.ToInt32() + 0x1024 * 10; G_Person = (structPerson)Marshal.PtrToStructure((IntPtr)(num), typeof(structPerson)); this._person = G_Person.person; return(true); } catch { return(false); } }