Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 03:57

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# - AutoIT : Calculate Pointer

Discussion on C# - AutoIT : Calculate Pointer within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2015
Posts: 7
Received Thanks: 0
C# - AutoIT : Calculate Pointer

Here's code in C# :
Code:
private int CalculatePointer(int iMemoryAddress, int[] iOffsets)
{
int iPointerCount = iOffsets.Length - 1; IntPtr ptrBytesRead; byte[] bBuffer = new byte[4]; int iTemporaryAddress = 0;

if (iPointerCount == 0)
iTemporaryAddress = iMemoryAddress;

for (int i = 0; i <= iPointerCount; i++)
{
if (i == iPointerCount)
{
MAPI.ReadProcessMemory(hReadProcess, (IntPtr)iTemporaryAddress, bBuffer, 4, out ptrBytesRead);
iTemporaryAddress = Dec(CreateAddress(bBuffer)) + iOffsets[i];
return iTemporaryAddress;
}
else if (i == 0)
{
MAPI.ReadProcessMemory(hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptrBytesRead);
iTemporaryAddress = Dec(CreateAddress(bBuffer)) + iOffsets[0];
}
else
{
MAPI.ReadProcessMemory(hReadProcess, (IntPtr)iTemporaryAddress, bBuffer, 4, out ptrBytesRead);
iTemporaryAddress = Dec(CreateAddress(bBuffer)) + iOffsets[i];
}
}
return 0;
}
public int Dec(string sHex)
{
return Int32.Parse(sHex, NumberStyles.HexNumber);
}
public int ReadInt(int iMemoryAddress, int[] iOffsets)
{
int iFinalAddress = CalculatePointer(iMemoryAddress, iOffsets);
byte[] bBuffer = new byte[4];
IntPtr ptrBytesRead;
MAPI.ReadProcessMemory(hReadProcess, (IntPtr)iFinalAddress, bBuffer, 4, out ptrBytesRead);
return BitConverter.ToInt32(bBuffer, 0);
}
And here is code in AutoIT:
Code:
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 [MENTION=2544426]Error T[/MENTION]hen
SetError [MENTION=299637]ErRoR[/MENTION] + 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 [MENTION=2544426]Error T[/MENTION]hen
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 [MENTION=2544426]Error T[/MENTION]hen
SetError(7)
Return 0
EndIf
MsgBox(0,0,$iv_Data[1])
$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 [MENTION=2544426]Error T[/MENTION]hen
SetError(7)
Return 0
EndIf
MsgBox(0,0,$iv_Data[1])
$iv_Data[1] = DllStructGetData($V_BUFFER, 1)
EndIf

Next
$iv_Data[0] = $IV_ADDRESS
Return $iv_Data

EndFunc ;==>_MemoryPointerRead
I gave me 2 results, and the results of AutoIt is true !
I checked C# code, but I don't have any idea......
thfire is offline  
Reply


Similar Threads Similar Threads
AutoIT Pointer von CE
10/08/2013 - AutoIt - 18 Replies
Servus epvp, Ich bin dabei einen Speedhack für Metin2 p-server zu erstellen verzweifle aber :(:confused::confused: Ich hab mich hier im Forum erkundigt un diesen Code gefunden #RequireAdmin #include-once SetPrivilege("SeDebugPrivilege", 1) $pid = WinGetProcess("METIN2")



All times are GMT +1. The time now is 03:57.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.