1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Option Explicit On
Public Class Form1
Private Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, ByVal lpflOldProtect As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef BytesWritten As Integer) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Byte(), ByVal nSize As Integer, ByRef BytesWritten As Integer) As Long
Private Const PAGE_WRITECOPY = &H8&
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim hProcess As Long
Dim lpBuffer As Long
Dim iw4mp As Long = Process.GetProcessesByName("iw4mp")(0).Id
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, iw4mp)
If hProcess <> 0 Then
If VirtualProtectEx(hProcess, &H1AD099C, 6, PAGE_WRITECOPY, 0&) <> 0 Then
Dim b As Byte() = {&H0, &H20, &HD4, &H5B} 'traduction de 2151515 ou bien je me trompe ^^
WriteProcessMemory(hProcess, &H1AD099C, b, b.Length, lpBuffer)
MsgBox("Success! " & lpBuffer)
ReadProcessMemory(hProcess, &H1AD099C, lpBuffer, 4, 0&)
'MsgBox("Success!" & vbCrLf & vRead)
End If
End If
CloseHandle(hProcess)
Application.Exit()
End Sub
End Class |
Partager