Exemple #1
0
        //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));
        }
Exemple #2
0
 public static SYS.NTSTATUS Unload()
 {
     if (Define.Handle != null && Define.Handle.IsInvalid == false)
     {
         Define.Handle.Close(); Define.Handle = null;
     }
     return(Define.UnloadDriver(Define.nameDriver));
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
 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);
 }
Exemple #6
0
 //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);
 }
Exemple #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     Define.Unload();
 }