//mRead(int pid, Int64 addr, Int64 size, object buffer) public static T ReadMemory <T>(int address) where T : struct { int ByteSize = Marshal.SizeOf(typeof(T)); byte[] buffer = new byte[ByteSize]; Define.mRead((int)pID, address, buffer.Length, buffer); return(ByteArrayToStructure <T>(buffer)); }
public static SYS.NTSTATUS Unload() { if (Define.Handle != null && Define.Handle.IsInvalid == false) { Define.Handle.Close(); Define.Handle = null; } return(Define.UnloadDriver(Define.nameDriver)); }
private static uint Read = CODE(0x1692, 0x633, 0, 3); // не менять //Загружаем драйвер // Выгружаем драйвер \\ Для вызова функций // public static SYS.NTSTATUS EnsureLoaded(string path = "") { if (Define.Handle != null && Define.Handle.IsInvalid == false) { return(SYS.NTSTATUS.Success); } Define.Handle = SYS.CreateFile(Define.linkDriver, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero); if (Define.Handle == null || Define.Handle.IsInvalid) { return(Define.Reload(path)); } return(SYS.NTSTATUS.Success); }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName(Application.ExecutablePath); openFileDialog1.Filter = "All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { textBox1.Text = openFileDialog1.FileName; Define.EnsureLoaded(textBox1.Text); } }
private static SYS.NTSTATUS Reload(string path) { Define.Unload(); if (String.IsNullOrWhiteSpace(path)) { return(SYS.NTSTATUS.ObjectPathNotFound); } SYS.NTSTATUS status = Define.LoadDriver(Define.nameDriver, path); if (status >= 0) { Define.Handle = SYS.CreateFile(Define.linkDriver, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero); if (Define.Handle == null || Define.Handle.IsInvalid) { return((SYS.NTSTATUS)Marshal.GetLastWin32Error()); } } return(SYS.NTSTATUS.Success); }
//WriteMem(DWORD pid, uint64_t base, uint64_t size, PVOID buffer) public static void WriteMemory <T>(int address, object Value) where T : struct { byte[] buffer = StructureToByteArray(Value); Define.mWrite((int)pID, address, buffer.Length, buffer); }
private void button2_Click(object sender, EventArgs e) { Define.Unload(); }