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 34 35 36 37 38 39 40 41 42
|
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Declare PtrSafe Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere As Long, lpdwProcessId As Long) As Long
Public Declare PtrSafe Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare PtrSafe Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Declare PtrSafe Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Public Declare PtrSafe Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Public Declare PtrSafe Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Sub AppelerMacrotestGetPointed()
Dim SomeValueIsStoredHere As Long, SomeValueIsStoredHereToo As Long, SomeValue As LongPtr ' Ici on déclare tout ce qui va me permettre de trouver le Handle du jeu en question : Assault Cube
SomeValueIsStoredHere = FindWindow(vbNullString, "AssaultCube")
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
Call GetPointedAddr(SomeValue, &H50F4F4, &H34) 'Appel de la fonction pour trouver l'adresse dynamique du jeu "AssaultCube" dont la base address est "50F4F4" et le pointer est "34"
End Sub
Public Function GetPointedAddr(ByVal BFhandle As LongPtr, ByVal BaseAddr As LongPtr, ByVal Offs0 As Long) As Long
Dim TempBuf(4) As Byte 'Big up à Jouad et Docmarti
Dim Message1 As String ' Lecture de ce que l'on vient de lire dans Tempbuf.
ReadProcessMemory BFhandle, BaseAddr, TempBuf, 4, 0&
'''''''''''''''''''''Encore merci à Docmarti, grâce à ce passage j'ai pu voir si j'arrivais à lire quoique ce soit''''''''''''''''''''''''''
Message1 = ""
For i = 0 To 4
Message1 = Message1 & "TempBuf(" & i & ")= " & Hex$(TempBuf(i)) & _
" décimale : " & TempBuf(i) & _
" octale : " & Oct(TempBuf(i)) & vbCrLf
Next i
MsgBox Message1
End Function |
Partager