Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.InteropServices
- Module Module1
- <DllImport("kernel32.dll")>
- Private Function OpenProcess(ByVal dwDesiredAccess As UInteger, <MarshalAs(UnmanagedType.Bool)> ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
- End Function
- Public Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flNewProtect As Integer, <Out> ByRef lpflOldProtect As Integer) As Boolean
- Dim oldProtect As Integer = 0
- Const PROCESS_VM_WRITE As UInteger = &H20
- Const PROCESS_VM_READ As UInteger = &H10
- Const PROCESS_VM_OPERATION As UInteger = &H8
- Dim processHandle As IntPtr = IntPtr.Zero
- Sub Main()
- Dim p() As Process = Process.GetProcessesByName("process")
- processHandle = OpenProcess(PROCESS_VM_READ Or PROCESS_VM_WRITE Or PROCESS_VM_OPERATION, False, p(0).Id)
- VirtualProtectEx(processHandle, &Haddress, byteLength, PROCESS_VM_WRITE, PROCESS_VM_READ)
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement