예제 #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));
        }
예제 #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));
 }
예제 #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);
        }
예제 #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);
            }
        }
예제 #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);
 }
예제 #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);
 }
예제 #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     Define.Unload();
 }