Je suis en train de faire un memory editor pour un jeu pour pouvoir changer les sons du jeu.
Le probleme c'est que les offsets a editer son dynamique j'ai donc trouvé la base address puis les pointers.
Donc mon probleme c'est que ma fonction MemoryGetBaseAddress me retourne 0 avec un @error a 2 c'est a a dire "Impossible de trouver la correcte base de l'allocation ".
Voici l'UDF :
► Afficher le texte
Code : Tout sélectionner
#include-once
#region _Memory
;==================================================================================
; AutoIt Version: 3.1.127 (beta)
; Language: English
; Platform: All Windows
; Author: Nomad
; Requirements: These functions will only work with beta.
;
; Functions:
;
;==================================================================================
; Function: _MemoryOpen($iv_Pid[, $iv_DesiredAccess[, $iv_InheritHandle]])
; Description: Opens a process and enables all possible access rights to the
; process. The Process ID of the process is used to specify which
; process to open. You must call this function before calling
; _MemoryClose(), _MemoryRead(), or _MemoryWrite().
; Parameter(s): $iv_Pid - The Process ID of the program you want to open.
; $iv_DesiredAccess - (optional) Set to 0x1F0FFF by default, which
; enables all possible access rights to the
; process specified by the Process ID.
; $iv_InheritHandle - (optional) If this value is TRUE, all processes
; created by this process will inherit the access
; handle. Set to 1 (TRUE) by default. Set to 0
; if you want it FALSE.
; Requirement(s): None.
; Return Value(s): On Success - Returns an array containing the Dll handle and an
; open handle to the specified process.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $iv_Pid.
; 2 = Failed to open Kernel32.dll.
; 3 = Failed to open the specified process.
; Author(s): Nomad
; Note(s):
;==================================================================================
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $iv_InheritHandle = 1)
If Not ProcessExists($iv_Pid) Then
SetError(1)
Return 0
EndIf
Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
If @Error Then
SetError(2)
Return 0
EndIf
Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $iv_InheritHandle, 'int', $iv_Pid)
If @Error Then
DllClose($ah_Handle[0])
SetError(3)
Return 0
EndIf
$ah_Handle[1] = $av_OpenProcess[0]
Return $ah_Handle
EndFunc
;==================================================================================
; Function: _MemoryRead($iv_Address, $ah_Handle[, $sv_Type])
; Description: Reads the value located in the memory address specified.
; Parameter(s): $iv_Address - The memory address you want to read from. It must
; be in hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; $sv_Type - (optional) The "Type" of value you intend to read.
; This is set to 'dword'(32bit(4byte) signed integer)
; by default. See the help file for DllStructCreate
; for all types. An example: If you want to read a
; word that is 15 characters in length, you would use
; 'char[16]' since a 'char' is 8 bits (1 byte) in size.
; Return Value(s): On Success - Returns the value located at the specified address.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = $sv_Type was not a string.
; 3 = $sv_Type is an unknown data type.
; 4 = Failed to allocate the memory needed for the DllStructure.
; 5 = Error allocating memory for $sv_Type.
; 6 = Failed to read from the specified process.
; Author(s): Nomad
; Note(s): Values returned are in Decimal format, unless specified as a
; 'char' type, then they are returned in ASCII format. Also note
; that size ('char[size]') for all 'char' types should be 1
; greater than the actual size.
;==================================================================================
Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
Local $v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 1)
Return 0
EndIf
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If Not @Error Then
Local $v_Value = DllStructGetData($v_Buffer, 1)
Return $v_Value
Else
SetError(6)
Return 0
EndIf
EndFunc
;==================================================================================
; Function: _MemoryWrite($iv_Address, $ah_Handle, $v_Data[, $sv_Type])
; Description: Writes data to the specified memory address.
; Parameter(s): $iv_Address - The memory address which you want to write to.
; It must be in hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; $v_Data - The data to be written.
; $sv_Type - (optional) The "Type" of value you intend to write.
; This is set to 'dword'(32bit(4byte) signed integer)
; by default. See the help file for DllStructCreate
; for all types. An example: If you want to write a
; word that is 15 characters in length, you would use
; 'char[16]' since a 'char' is 8 bits (1 byte) in size.
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = $sv_Type was not a string.
; 3 = $sv_Type is an unknown data type.
; 4 = Failed to allocate the memory needed for the DllStructure.
; 5 = Error allocating memory for $sv_Type.
; 6 = $v_Data is not in the proper format to be used with the
; "Type" selected for $sv_Type, or it is out of range.
; 7 = Failed to write to the specified process.
; Author(s): Nomad
; Note(s): Values sent must be in Decimal format, unless specified as a
; 'char' type, then they must be in ASCII format. Also note
; that size ('char[size]') for all 'char' types should be 1
; greater than the actual size.
;==================================================================================
Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
Local $v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 1)
Return 0
Else
DllStructSetData($v_Buffer, 1, $v_Data)
If @Error Then
SetError(6)
Return 0
EndIf
EndIf
DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If Not @Error Then
Return 1
Else
SetError(7)
Return 0
EndIf
EndFunc
;==================================================================================
; Function: _MemoryClose($ah_Handle)
; Description: Closes the process handle opened by using _MemoryOpen().
; Parameter(s): $ah_Handle - An array containing the Dll handle and the handle
; of the open process as returned by _MemoryOpen().
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = Invalid $ah_Handle.
; 2 = Unable to close the process handle.
; Author(s): Nomad
; Note(s):
;==================================================================================
Func _MemoryClose($ah_Handle)
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
If Not @Error Then
DllClose($ah_Handle[0])
Return 1
Else
DllClose($ah_Handle[0])
SetError(2)
Return 0
EndIf
EndFunc
;==================================================================================
; Function: SetPrivilege( $privilege, $bEnable )
; Description: Enables (or disables) the $privilege on the current process
; (Probably) requires administrator privileges to run
;
; Author(s): Larry (from autoitscript.com's Forum)
; Notes(s):
; http://www.autoitscript.com/forum/index ... t&p=223999
;==================================================================================
Func SetPrivilege( $privilege, $bEnable )
Const $TOKEN_ADJUST_PRIVILEGES = 0x0020
Const $TOKEN_QUERY = 0x0008
Const $SE_PRIVILEGE_ENABLED = 0x0002
Local $hToken, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
$nTokens = 1
$LUID = DLLStructCreate("dword;int")
If IsArray($privilege) Then $nTokens = UBound($privilege)
$TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
$hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
$SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","hwnd",$hCurrProcess[0], _
"int",BitOR($TOKEN_ADJUST_PRIVILEGES,$TOKEN_QUERY),"int*",0)
If $SP_auxret[0] Then
$hToken = $SP_auxret[3]
DLLStructSetData($TOKEN_PRIVILEGES,1,1)
$nTokenIndex = 1
While $nTokenIndex <= $nTokens
If IsArray($privilege) Then
$priv = $privilege[$nTokenIndex-1]
Else
$priv = $privilege
EndIf
$ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue","str","","str",$priv, _
"ptr",DLLStructGetPtr($LUID))
If $ret[0] Then
If $bEnable Then
DLLStructSetData($TOKEN_PRIVILEGES,2,$SE_PRIVILEGE_ENABLED,(3 * $nTokenIndex))
Else
DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
EndIf
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,1),(3 * ($nTokenIndex-1)) + 1)
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,2),(3 * ($nTokenIndex-1)) + 2)
DLLStructSetData($LUID,1,0)
DLLStructSetData($LUID,2,0)
EndIf
$nTokenIndex += 1
WEnd
$ret = DLLCall("advapi32.dll","int","AdjustTokenPrivileges","hwnd",$hToken,"int",0, _
"ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",DllStructGetSize($NEWTOKEN_PRIVILEGES), _
"ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int*",0)
$f = DLLCall("kernel32.dll","int","GetLastError")
EndIf
$NEWTOKEN_PRIVILEGES=0
$TOKEN_PRIVILEGES=0
$LUID=0
If $SP_auxret[0] = 0 Then Return 0
$SP_auxret = DLLCall("kernel32.dll","int","CloseHandle","hwnd",$hToken)
If Not $ret[0] And Not $SP_auxret[0] Then Return 0
return $ret[0]
EndFunc ;==>SetPrivilege
;=================================================================================================
; Function: _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset[, $sv_Type])
; Description: Reads a chain of pointers and returns an array containing the destination
; address and the data at the address.
; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in
; hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle of the open
; process as returned by _MemoryOpen().
; $av_Offset - An array of offsets for the pointers. Each pointer must have an
; offset. If there is no offset for a pointer, enter 0 for that
; array dimension.
; $sv_Type - (optional) The "Type" of data you intend to read at the destination
; address. This is set to 'dword'(32bit(4byte) signed integer) by
; default. See the help file for DllStructCreate for all types.
; Requirement(s): The $ah_Handle returned from _MemoryOpen.
; Return Value(s): On Success - Returns an array containing the destination address and the value
; located at the address.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = $av_Offset is not an array.
; 2 = Invalid $ah_Handle.
; 3 = $sv_Type is not a string.
; 4 = $sv_Type is an unknown data type.
; 5 = Failed to allocate the memory needed for the DllStructure.
; 6 = Error allocating memory for $sv_Type.
; 7 = Failed to read from the specified process.
; Author(s): Nomad
; Note(s): Values returned are in Decimal format, unless a 'char' type is selected.
; Set $av_Offset like this:
; $av_Offset[0] = NULL (not used)
; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
; $av_Offset[2] = Offset for pointer 2
; etc...
; (The number of array dimensions determines the number of pointers)
;=================================================================================================
Func _MemoryPointerRead($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword')
If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf
Local $iv_Data[2], $i
Local $v_Buffer = DllStructCreate('dword')
For $i = 0 To $iv_PointerCount
If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @error Then
SetError(@error + 2)
Return 0
EndIf
$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
Else
$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
EndIf
Next
$iv_Data[0] = $iv_Address
Return $iv_Data
EndFunc ;==>_MemoryPointerRead
;=================================================================================================
; Function: _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data[, $sv_Type])
; Description: Reads a chain of pointers and writes the data to the destination address.
; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in
; hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle of the open
; process as returned by _MemoryOpen().
; $av_Offset - An array of offsets for the pointers. Each pointer must have an
; offset. If there is no offset for a pointer, enter 0 for that
; array dimension.
; $v_Data - The data to be written.
; $sv_Type - (optional) The "Type" of data you intend to write at the destination
; address. This is set to 'dword'(32bit(4byte) signed integer) by
; default. See the help file for DllStructCreate for all types.
; Requirement(s): The $ah_Handle returned from _MemoryOpen.
; Return Value(s): On Success - Returns the destination address.
; On Failure - Returns 0.
; @Error - 0 = No error.
; 1 = $av_Offset is not an array.
; 2 = Invalid $ah_Handle.
; 3 = Failed to read from the specified process.
; 4 = $sv_Type is not a string.
; 5 = $sv_Type is an unknown data type.
; 6 = Failed to allocate the memory needed for the DllStructure.
; 7 = Error allocating memory for $sv_Type.
; 8 = $v_Data is not in the proper format to be used with the
; "Type" selected for $sv_Type, or it is out of range.
; 9 = Failed to write to the specified process.
; Author(s): Nomad
; Note(s): Data written is in Decimal format, unless a 'char' type is selected.
; Set $av_Offset like this:
; $av_Offset[0] = NULL (not used, doesn't matter what's entered)
; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
; $av_Offset[2] = Offset for pointer 2
; etc...
; (The number of array dimensions determines the number of pointers)
;=================================================================================================
Func _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data, $sv_Type = 'dword')
If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf
Local $iv_StructData, $i
Local $v_Buffer = DllStructCreate('dword')
For $i = 0 to $iv_PointerCount
If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 3)
Return 0
EndIf
DllStructSetData($v_Buffer, 1, $v_Data)
If @Error Then
SetError(8)
Return 0
EndIf
$iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(9)
Return 0
Else
Return $iv_Address
EndIf
ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(3)
Return 0
EndIf
$iv_StructData = DllStructGetData($v_Buffer, 1)
Else
$iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(3)
Return 0
EndIf
$iv_StructData = DllStructGetData($v_Buffer, 1)
EndIf
Next
EndFunc
;===================================================================================================
; Function........: _MemoryGetBaseAddress($ah_Handle, $iHD)
;
; Description.....: Reads the 'Allocation Base' from the open process.
;
; Parameter(s)....: $ah_Handle - An array containing the Dll handle and the handle of the open
; process as returned by _MemoryOpen().
; $iHD - Return type:
; |0 = Hex (Default)
; |1 = Dec
;
; Requirement(s)..: A valid process ID.
;
; Return Value(s).: On Success - Returns the 'allocation Base' address and sets @Error to 0.
; On Failure - Returns 0 and sets @Error to:
; |1 = Invalid $ah_Handle.
; |2 = Failed to find correct allocation address.
; |3 = Failed to read from the specified process.
;
; Author(s).......: Nomad. Szhlopp.
; URL.............: http://www.autoitscript.com/forum/index.php?showtopic=78834
; Note(s).........: Go to http://Www.CheatEngine.org for the latest version of CheatEngine.
;===================================================================================================
Func _MemoryGetBaseAddress($ah_Handle, $iHexDec = 0)
Local $iv_Address = 0x00100000
Local $v_Buffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
Local $vData
Local $vType
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
If Not @Error Then
$vData = Hex(Int(DllStructGetData($v_Buffer, 2)))
$vType = Hex(Int(DllStructGetData($v_Buffer, 3)))
While $vType <> "00000080"
DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
$vData = Hex(DllStructGetData($v_Buffer, 2))
$vType = Hex(DllStructGetData($v_Buffer, 3))
If Hex($iv_Address) = "01000000" Then ExitLoop
$iv_Address += 65536
WEnd
If $vType = "00000080" Then
SetError(0)
If $iHexDec = 1 Then
Return Dec($vData)
Else
Return $vData
EndIf
Else
SetError(2)
Return 0
EndIf
Else
SetError(3)
Return 0
EndIf
EndFunc ;==>_MemoryGetBaseAddress
#EndRegion
► Afficher le texte
Code : Tout sélectionner
#include-once
#include "Constants.au3"
; Title .........: KryMemory
; AutoIt Version : 3.3.8.1
; Language ......: English
; Description ...: Functions for modifying and querying process memory.
; Author(s) .....: KryziK (John Fedorchak) <john.fedorchak@gmail.com>
; Dll(s) ........: Kernel32.dll
; #CURRENT# =====================================================================================================================
; _Process_Open($sProcessName, $iDesiredAccess = $PROCESS_ALL_ACCESS, $fInheritAccess = False)
; _Process_Close($ahHandle)
; _Process_ReadMemory($ahHandle, $ivAddress, $sType = "dword")
; _Process_ReadMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $sType = "dword")
; _Process_WriteMemory($ahHandle, $ivAddress, $vData, $sType = "dword")
; _Process_WriteMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $vData, $sType = "dword")
; _Process_GetBaseAddress($ahHandle)
; _Process_GetParent($ahHandle)
; _Process_GetModules($ahHandle)
;
; _Address_CalculateStatic($ahHandle, $sModuleName, $ivOffset)
; _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets)
;
; _Module_GetBaseAddress($ahHandle, $sModuleName)
; ===============================================================================================================================
; #CONSTANTS# ===================================================================================================================
; CreateToolhelp32Snapshot
Global Const $TH32CS_SNAPPROCESS = 0x00000002
Global Const $TH32CS_SNAPMODULE = 0x00000008
Global Const $TH32CS_SNAPMODULE32 = 0x00000010
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_Open
; Description ...: Opens an existing local process object.
; Syntax ........: _Process_Open($sProcessName[, $iDesiredAccess = $PROCESS_ALL_ACCESS[, $fInheritAccess = False]])
; Parameters ....: $sProcessName - A string value.
; $iDesiredAccess - [optional] An integer value. Default is $PROCESS_ALL_ACCESS.
; The access to the process object.
; This access right is checked against the security descriptor for the process.
; This parameter can be one or more of the process access rights.
; $fInheritAccess - [optional] A boolean value. Default is False.
; If this value is TRUE, processes created by this process will inherit the handle.
; Otherwise, the processes do not inherit this handle.
; Return values .: $ahHandle - An array of values, or FALSE if an error occurred.
; $ahHandle[0] = Open handle to kernel32.dll.
; $ahHandle[1] = Open handle to the specified process.
; $ahHandle[2] = The identifier of the specified open process.
; @error - 0 = No error occurred.
; 1 = The specified process doesn't exist.
; 2 = A handle to kernel32.dll could not be opened.
; 3 = A handle to the specified process could not be opened.
; @extended = @error of DllCall()
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320.aspx
; Example .......: _Process_Open("KryziK.exe")
; ===============================================================================================================================
Func _Process_Open($sProcessName, $iDesiredAccess = $PROCESS_ALL_ACCESS, $fInheritAccess = False)
Local $iPID = ProcessExists($sProcessName)
If Not $iPID Then
SetError(1, 0, False)
;Return False
EndIf
Local $ahHandle[3] = [DllOpen("kernel32.dll"), 0, $iPID]
If ($ahHandle[0] = -1) Then
SetError(2, 0, False)
;Return False
EndIf
Local $ahCall = DllCall($ahHandle[0], "handle", "OpenProcess", _
"dword", $iDesiredAccess, _
"bool", $fInheritAccess, _
"dword", $iPID)
If @error Then
DllClose($ahHandle[0])
SetError(3, @error, False)
;Return False
EndIf
$ahHandle[1] = $ahCall[0]
Return $ahHandle
EndFunc ;==>_Process_Open
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_Close
; Description ...: Closes all handles associated with an array returned by _Process_Open.
; Syntax ........: _Process_Close($ahHandle)
; Parameters ....: $ahHandle - An array of handles.
; Return values .: A boolean value. TRUE if CloseHandle succeeded in closing the open process handle, otherwise FALSE.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724211.aspx
; Example .......: _Process_Close($ahHandle)
; ===============================================================================================================================
Func _Process_Close($ahHandle)
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $ahCall = DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahHandle[1])
DllClose($ahHandle[0])
Return $ahCall[0]
EndFunc ;==>_Process_Close
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_ReadMemory
; Description ...: Reads data from an area of memory in a specified process.
; The entire area to be read must be accessible or the operation fails.
; Syntax ........: _Process_ReadMemory($ahHandle, $ivAddress[, $sType = "dword"])
; Parameters ....: $ahHandle - An array of handles.
; $ivAddress - An integer value.
; A pointer to the base address in the specified process from which to read.
; Before any data transfer occurs, the system verifies that all data in the base address
; and memory of the specified size is accessible for read access, and if it is not
; accessible the function fails.
; $sType - [optional] A string value. Default is "dword".
; The data type of the value to read.
; Return values .: The value that was read from the specified address, or FALSE if an error occurred.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; 2 = The process' memory could not be read, or an inconsistent number of bytes were read.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680553.aspx
; Example .......: _Process_ReadMemory($ahHandle, 0xDEADDEAD)
; ===============================================================================================================================
Func _Process_ReadMemory($ahHandle, $ivAddress, $sType = "dword")
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $vReadData = DllStructCreate($sType)
Local $vNumberOfBytesRead = DllStructCreate("ulong_ptr lpNumberOfBytesRead")
Local $ahCall = DllCall($ahHandle[0], "bool", "ReadProcessMemory", _
"handle", $ahHandle[1], _
"dword_ptr", $ivAddress, _
"ptr", DllStructGetPtr($vReadData), _
"ulong_ptr", DllStructGetSize($vReadData), _
"ptr", DllStructGetPtr($vNumberOfBytesRead))
ConsoleWrite(DllStructGetData($vNumberOfBytesRead, "lpNumberOfBytesRead") & @CRLF & DllStructGetSize($vReadData) & @CRLF)
If (Not $ahCall[0]) Or (DllStructGetData($vNumberOfBytesRead, "lpNumberOfBytesRead") <> DllStructGetSize($vReadData)) Then
SetError(2, 0, False)
;Return False
EndIf
Return DllStructGetData($vReadData, 1)
EndFunc ;==>_Process_ReadMemory
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_ReadMemoryPointer
; Description ...: Reads data from an area of memory in a specified process, which is calculated based on the static address
; and array of offsets given.
; Syntax ........: _Process_ReadMemoryPointer($ahHandle, $ivAddress, $aiOffsets[, $sType = "dword"])
; Parameters ....: $ahHandle - An array of handles.
; $ivAddress - An integer value.
; A pointer to the base address in the specified process from which to read.
; Before any data transfer occurs, the system verifies that all data in the base address
; and memory of the specified size is accessible for read access, and if it is not
; accessible the function fails.
; $aiOffsets - An array of integers.
; Offsets to apply to the static address.
; $sType - [optional] A string value. Default is "dword".
; The data type of the value to read.
; Return values .: The value that was read from the specified address, or FALSE if an error occurred.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Local $aiOffsets[2] = [0xDEAD, 0xDEAD]
; _Process_ReadMemoryPointer($ahHandle, 0xDEADDEAD, $aiOffsets)
; ===============================================================================================================================
Func _Process_ReadMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $sType = "dword")
Return _Process_ReadMemory($ahHandle, _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets), $sType)
EndFunc ;==>_Process_ReadMemoryPointer
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_WriteMemory
; Description ...: Writes data to an area of memory in a specified process.
; The entire area to be written to must be accessible or the operation fails.
; Syntax ........: _Process_WriteMemory($ahHandle, $ivAddress, $vData[, $sType = "dword"])
; Parameters ....: $ahHandle - An array of handles.
; $ivAddress - An integer value.
; A pointer to the base address in the specified process to which data is written.
; Before data transfer occurs, the system verifies that all data in the base address
; and memory of the specified size is accessible for write access, and if it is not
; accessible, the function fails.
; $vData - A variant value.
; The value to write to the address.
; $sType - [optional] A string value. Default is "dword".
; The data type of the value to write.
; Return values .: A boolean value. TRUE if the write succeeded, otherwise FALSE.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681674.aspx
; Example .......: _Process_WriteMemory($ahHandle, 0xDEADDEAD, 0xDEAD)
; ===============================================================================================================================
Func _Process_WriteMemory($ahHandle, $ivAddress, $vData, $sType = "dword")
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $vWriteData = DllStructCreate($sType)
Local $vNumberOfBytesWritten = DllStructCreate("ulong_ptr lpNumberOfBytesWritten")
DllStructSetData($vWriteData, 1, $vData)
Local $ahCall = DllCall($ahHandle[0], "bool", "WriteProcessMemory", _
"handle", $ahHandle[1], _
"dword_ptr", $ivAddress, _
"ptr", DllStructGetPtr($vWriteData), _
"ulong_ptr", DllStructGetSize($vWriteData), _
"ptr", DllStructGetPtr($vNumberOfBytesWritten))
Return ($ahCall[0] And (DllStructGetData($vNumberOfBytesWritten, "lpNumberOfBytesWritten") = DllStructGetSize($vWriteData)))
EndFunc ;==>_Process_WriteMemory
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_WriteMemoryPointer
; Description ...: Writes data to an area of memory in a specified process, which is calculated based on the static address
; and array of offsets given.
; Syntax ........: _Process_WriteMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $vData[, $sType = "dword"])
; Parameters ....: $ahHandle - An array of handles.
; $ivAddress - An integer value.
; A pointer to the base address in the specified process to which data is written.
; Before data transfer occurs, the system verifies that all data in the base address
; and memory of the specified size is accessible for write access, and if it is not
; accessible, the function fails.
; $aiOffsets - An array of integers.
; Offsets to apply to the static address.
; $vData - A variant value.
; The value to write to the address.
; $sType - [optional] A string value. Default is "dword".
; The data type of the value to write.
; Return values .: A boolean value. TRUE if the write succeeded, otherwise FALSE.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Local $aiOffsets[2] = [0xDEAD, 0xDEAD]
; _Process_WriteMemoryPointer($ahHandle, 0xDEADDEAD, $aiOffsets, 0xDEAD)
; ===============================================================================================================================
Func _Process_WriteMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $vData, $sType = "dword")
Return _Process_WriteMemory($ahHandle, _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets), $vData, $sType)
EndFunc ;==>_Process_WriteMemoryPointer
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_GetBaseAddress
; Description ...: Gets the base address of the process associated with an array returned by _Process_Open.
; Syntax ........: _Process_GetBaseAddress($ahHandle)
; Parameters ....: $ahHandle - An array of handles.
; Return values .: An integer value. The base address of the open process, or FALSE if an error occurred.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; 2 = An error occurred while obtaining the first module of the process.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684218.aspx
; Example .......: _Process_GetBaseAddress($ahHandle)
; ===============================================================================================================================
Func _Process_GetBaseAddress($ahHandle)
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
Return False
EndIf
Local $ahSnapshot = DllCall($ahHandle[0], "handle", "CreateToolhelp32Snapshot", _
"dword", BitOR($TH32CS_SNAPMODULE, $TH32CS_SNAPMODULE32), _
"dword", $ahHandle[2])
Local $vModuleEntry32 = DllStructCreate("dword dwSize;" & _
"dword th32ModuleID;" & _
"dword th32ProcessID;" & _
"dword GlblcntUsage;" & _
"dword ProccntUsage;" & _
"ptr modBaseAddr;" & _
"dword modBaseSize;" & _
"handle hModule;" & _
"char szModule[256];" & _
"char szExePath[260]")
DllStructSetData($vModuleEntry32, "dwSize", DllStructGetSize($vModuleEntry32))
Local $ahCall = DllCall($ahHandle[0], "bool", "Module32First", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vModuleEntry32))
If Not $ahCall[0] Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
SetError(2, 0, False)
;Return False
EndIf
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return DllStructGetData($vModuleEntry32, "modBaseAddr")
EndFunc ;==>_Process_GetBaseAddress
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_GetParent
; Description ...: Gets the parent of the process associated with an array returned by _Process_Open.
; Syntax ........: _Process_GetParent($ahHandle)
; Parameters ....: $ahHandle - An array of handles.
; Return values .: An integer value. The process ID of the parent, or FALSE if an error occurred or no parent exists.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; 2 = An error occurred while obtaining the first process.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684834.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684836.aspx
; Example .......: _Process_GetParent($ahHandle)
; ===============================================================================================================================
Func _Process_GetParent($ahHandle)
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $ahSnapshot = DllCall($ahHandle[0], "handle", "CreateToolhelp32Snapshot", _
"dword", $TH32CS_SNAPPROCESS, _
"dword", $ahHandle[2])
Local $vProcessEntry32 = DllStructCreate("dword dwSize;" & _
"dword dwSize;" & _
"dword cntUsage;" & _
"dword th32ProcessID;" & _
"ulong_ptr th32DefaultHeapID;" & _
"dword th32ModuleID;" & _
"dword cntThreads;" & _
"dword th32ParentProcessID;" & _
"long pcPriClassBase;" & _
"dword dwFlags;" & _
"char szExeFile[260]")
DllStructSetData($vProcessEntry32, "dwSize", DllStructGetSize($vProcessEntry32))
Local $ahCall = DllCall($ahHandle[0], "bool", "Process32First", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vProcessEntry32))
If Not $ahCall[0] Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
SetError(2, 0, False)
;Return False
EndIf
Do
If DllStructGetData($vProcessEntry32, "th32ProcessID") = $ahHandle[2] Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return DllStructGetData($vProcessEntry32, "th32ParentProcessID")
EndIf
$ahCall = DllCall($ahHandle[0], "bool", "Process32Next", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vProcessEntry32))
Until Not $ahCall[0]
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return False
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _Process_GetModules
; Description ...: Returns the names of the modules loaded into the process associated with an array returned by _Process_Open.
; Syntax ........: _Process_GetModules($ahHandle)
; Parameters ....: $ahHandle - An array of handles.
; Return values .: An array of strings. An array of the names of the modules loaded into the opened process.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......: x64: Currently includes the main executable twice in the list because of the snapshot creation flags.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; 2 = An error occurred while obtaining the first module of the process.
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684218.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684221.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms724211.aspx
; Example .......: _Process_GetModules($ahHandle)
; ===============================================================================================================================
Func _Process_GetModules($ahHandle)
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $ahSnapshot = DllCall($ahHandle[0], "handle", "CreateToolhelp32Snapshot", _
"dword", BitOR($TH32CS_SNAPMODULE, $TH32CS_SNAPMODULE32), _
"dword", $ahHandle[2])
Local $vModuleEntry32 = DllStructCreate("dword dwSize;" & _
"dword th32ModuleID;" & _
"dword th32ProcessID;" & _
"dword GlblcntUsage;" & _
"dword ProccntUsage;" & _
"ptr modBaseAddr;" & _
"dword modBaseSize;" & _
"handle hModule;" & _
"char szModule[256];" & _
"char szExePath[260]")
DllStructSetData($vModuleEntry32, "dwSize", DllStructGetSize($vModuleEntry32))
Local $ahCall = DllCall($ahHandle[0], "bool", "Module32First", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vModuleEntry32))
If Not $ahCall[0] Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
SetError(2, 0, False)
;Return False
EndIf
Local $asModules[1]
Local $iModuleCount = 1
Do
If UBound($asModules) < $iModuleCount Then
ReDim $asModules[UBound($asModules) + 1]
EndIf
$asModules[$iModuleCount - 1] = DllStructGetData($vModuleEntry32, "szModule")
$iModuleCount += 1
$ahCall = DllCall($ahHandle[0], "bool", "Module32Next", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vModuleEntry32))
Until Not $ahCall[0]
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return $asModules
EndFunc ;==>_Process_GetModules
; #FUNCTION# ====================================================================================================================
; Name ..........: _Address_CalculateStatic
; Description ...: Gets an address by applying a single offset to a module's base address.
; Syntax ........: _Address_CalculateStatic($ahHandle, $sModuleName, $ivOffset)
; Parameters ....: $ahHandle - An array of handles.
; $sModuleName - A string value.
; The name of the module.
; $ivOffset - An integer value.
; The offset to add to the module's base address.
; Return values .: An integer value. The final address, after the offset has been added to the module's base address.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: _Address_CalculateStatic($ahHandle, "KryziK.exe", 0xDEAD)
; _Address_CalculateStatic($ahHandle, "KryziK.dll", 0xDEAD)
; ===============================================================================================================================
Func _Address_CalculateStatic($ahHandle, $sModuleName, $ivOffset)
Return _Module_GetBaseAddress($ahHandle, $sModuleName) + $ivOffset
EndFunc ;==>_Address_CalculateStatic
; #FUNCTION# ====================================================================================================================
; Name ..........: _Address_CalculatePointer
; Description ...: Gets an address by applying an array of offsets to a static address. After each offset is applied,
; the address is read from to obtain the next address until all offsets are exhausted.
; Syntax ........: _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets)
; Parameters ....: $ahHandle - An array of handles.
; $ivAddress - An integer value.
; A static address used as the starting point of the calculation.
; $aiOffsets - An array of integers.
; Offsets to apply to the static address.
; Return values .: An integer value. The final address, after all offsets have been applied.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Local $aiOffsets[2] = [0xDEAD, 0xDEAD]
; _Address_CalculatePointer($ahHandle, 0xDEADDEAD, $aiOffsets)
; ===============================================================================================================================
Func _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets)
Local $vFinalAddress = DllStructCreate("dword_ptr")
DllStructSetData($vFinalAddress, 1, $ivAddress)
For $iOffset In $aiOffsets
DllStructSetData($vFinalAddress, 1, _Process_ReadMemory($ahHandle, DllStructGetData($vFinalAddress, 1)) + $iOffset)
Next
Return DllStructGetData($vFinalAddress, 1)
EndFunc ;==>_Address_CalculatePointer
; #FUNCTION# ====================================================================================================================
; Name ..........: _Module_GetBaseAddress
; Description ...: Gets the base address of a module in the process associated with an array returned by _Process_Open.
; Syntax ........: _Module_GetBaseAddress($ahHandle, $sModuleName)
; Parameters ....: $ahHandle - An array of handles.
; $sModuleName - A string value.
; The name of the module.
; Return values .: An integer value. The base address of the module in the open process.
; @error - 0 = No error occurred.
; 1 = An invalid handle array was specified.
; 2 = An error occurred while obtaining the first module of the process.
; Author ........: KryziK
; Modified ......: 1/12/2013
; Remarks .......:
; Related .......:
; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682489.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684218.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms684221.aspx
; http://msdn.microsoft.com/en-us/library/windows/desktop/ms724211.aspx
; Example .......: _Module_GetBaseAddress($ahHandle, "KryziK.dll")
; ===============================================================================================================================
Func _Module_GetBaseAddress($ahHandle, $sModuleName)
If Not IsArray($ahHandle) Then
SetError(1, 0, False)
;Return False
EndIf
Local $ahSnapshot = DllCall($ahHandle[0], "handle", "CreateToolhelp32Snapshot", _
"dword", BitOR($TH32CS_SNAPMODULE, $TH32CS_SNAPMODULE32), _
"dword", $ahHandle[2])
Local $vModuleEntry32 = DllStructCreate("dword dwSize;" & _
"dword th32ModuleID;" & _
"dword th32ProcessID;" & _
"dword GlblcntUsage;" & _
"dword ProccntUsage;" & _
"ptr modBaseAddr;" & _
"dword modBaseSize;" & _
"handle hModule;" & _
"char szModule[256];" & _
"char szExePath[260]")
DllStructSetData($vModuleEntry32, "dwSize", DllStructGetSize($vModuleEntry32))
Local $ahCall = DllCall($ahHandle[0], "bool", "Module32First", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vModuleEntry32))
If Not $ahCall[0] Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
SetError(2, 0, False)
;Return False
EndIf
Do
If DllStructGetData($vModuleEntry32, "szModule") = $sModuleName Then
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return DllStructGetData($vModuleEntry32, "modBaseAddr")
EndIf
$ahCall = DllCall($ahHandle[0], "bool", "Module32Next", _
"handle", $ahSnapshot[0], _
"ptr", DllStructGetPtr($vModuleEntry32))
Until Not $ahCall[0]
DllCall($ahHandle[0], "bool", "CloseHandle", _
"handle", $ahSnapshot[0])
Return False
EndFunc ;==>_Module_GetBaseAddressCode : Tout sélectionner
SetPrivilege("SeDebugPrivilege", 1)
Global $Addy3
Dim $Offset1[4]
$Offset1[0] = 0
$Offset1[1] = Dec("70")
MsgBox(0,"",$Offset1[1])
$Offset1[2] = Dec("30")
MsgBox(0,"",$Offset1[2])
$Offset1[3] = Dec("C0D8")
MsgBox(0,"",$Offset1[3])
$StaticOffset = Dec("16B2068")
MsgBox(0,"",$StaticOffset)
$pid = ProcessExists("arma3.exe")
MsgBox(0,"",$pid)
Global $openmem = _MemoryOpen($pid)
MsgBox(0,"",$openmem)
$baseADDR = _MemoryGetBaseAddress($openmem, 1)
MsgBox(0,"",$baseADDR & " Error : "& @error)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
MsgBox(0,"",$finalADDR)
$Addy3 = _MemoryPointerRead($finalADDR, $openmem, $Offset1)
$Addy2 = $Addy3[0]
MsgBox(0,"",$Addy2)Si vous avez une solution merci de poster si dessous
Merci !
EDIT : J'ai changé d'UDF pour KryMemory, probleme fixé mais un probleme pour le PointerRead de cet UDF, il me retourne le troisieme offset que j'ai mis dans le tableau exemple :
Code : Tout sélectionner
Global $Offset1[4] = [0, 0x70, 0x30, --->0xC0D8<---- c'est ce qui me donne a la fin pour CalculatePointer]
MsgBox(0,"",$Offset1[1])
MsgBox(0,"",$Offset1[2])
MsgBox(0,"",$Offset1[3])
$StaticOffset = 0x16B2068
MsgBox(0,"",$StaticOffset)
$pid = ProcessExists("arma3.exe")
MsgBox(0,"",$pid)
Global $openmem = _Process_Open($pid)
MsgBox(0,"",$openmem)
$baseADDR = _Process_GetBaseAddress($openmem)
MsgBox(0,"",$baseADDR & " Error : "& @error)
$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
MsgBox(0,"",$finalADDR)
$Addy3 = _Address_CalculatePointer($openmem, $finalADDR, $Offset1)
MsgBox(0,"",$Addy3) ; $Addy3 = Offsets[3] :/

