Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 03:11

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

Advertisement



Auto it Read/Write Process Memory - hlp

Discussion on Auto it Read/Write Process Memory - hlp within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
Cycos's Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 12
Received Thanks: 15
Auto it Read/Write Process Memory - hlp

I can Read Process Memory But i Cant WriteProcessMemory!?
Code:
#RequireAdmin 
#Include <WinAPI.au3>
setprivilege("sedebugprivilege", 1)
ReadMemory(0x008C4734,"MineSweeper.exe")
WriteMemory(0x008C4734,"MineSweeper.exe","43")
Func ReadMemory($adresR,$handle)
Local $PROCESS_ALL_ACCESS = 0xfff
Dim $procHwnd = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, ProcessExists($handle));
Dim $pBuffer = DllStructCreate("int[4]"), $iRead = 0
_WinAPI_ReadProcessMemory($procHwnd,$adresR,DllStructGetPtr($pBuffer),DllStructGetSize($pBuffer),$iRead); here we read the memory
Local $d = DllStructGetData($pBuffer,1)
MsgBox(0,"","->" &$d)
EndFunc
Func WriteMemory($address,$ah_Handle,$v_data)
	Local $PROCESS_ALL_ACCESS = 0xfff
	Dim $procHwnd = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, ProcessExists($ah_Handle));
	Dim $v_Buffer = DllStructCreate("int[4]"),$iRead2 = 0
	Dim $s_Buffer = $v_Buffer
_WinAPI_WriteProcessMemory($procHwnd,$address,DllStructGetPtr($v_Buffer),DllStructGetSize($v_Buffer),$iRead2,DllStructGetPtr($s_Buffer))
$4 = DllStructSetData($v_Buffer,1,$v_data)
MsgBox(0,"","->" & $4)
EndFunc


Func setprivilege($PRIVILEGE, $BENABLE)
    Const $MY_TOKEN_ADJUST_PRIVILEGES = 32
    Const $MY_TOKEN_QUERY = 8
    Const $MY_SE_PRIVILEGE_ENABLED = 2
    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($MY_TOKEN_ADJUST_PRIVILEGES, $MY_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, $MY_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
Cycos is offline  
Old 06/10/2013, 21:00   #2
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
PROCESS_ALL_ACCESS = 0x1F0FFF != 0xFFF
lolkop is offline  
Old 06/10/2013, 21:05   #3
 
elite*gold: 0
Join Date: Aug 2012
Posts: 222
Received Thanks: 1,821
Quote:
Originally Posted by lolkop View Post
PROCESS_ALL_ACCESS = 0x1F0FFF != 0xFFF
same is correct 0xFFF or 0x1F0FFF
JohnAndersn is offline  
Reply


Similar Threads Similar Threads
SharpMagic.dll Read/Write/Process Memory [C#]
09/26/2012 - Coding Releases - 7 Replies
SharpMagic.dll 1. Was ist die SharpMagic.dll ? Die SharpMagic.dll ist eine Bibliothek verschiedenster Funktionen innerhalb einer Klasse. Geschrieben wird sie für C#, kann natürlich aber beliebig in anderen Sprachen benutzt werden. 1. Wer kann diese Bibliothek benutzen ?
[VB]Write Memory bzw Read Memory
06/26/2010 - .NET Languages - 8 Replies
Hi Ich hab das TuT von *Guidman* benütz um einen hack zu machen. So aber nun hab ihc ein paar fragen könnte man memory teil kürzer machen und am besten wie kann man das selber machen weil ich will nihct immer C&P machen. Und zu Read Memory kann man das auch machen das ein Label immer die Bestimmte Ahnzahl angiebt von dem Pointer?.(Wenn das Read Memory ist ?) Bitte helf mir Danke
write memory process problem
10/28/2009 - General Coding - 3 Replies
Hey Leute Habe mir ebem mal das tut von Blackfog angeschaut. Verstehe es auch, bloss will mein compi nich so wie ich will XD habe es au scho mit copy and paste versucht, das ding macht einfach nix
Habe eine wichtige frage zu write process memory (packete verändern und zurück senden
10/28/2009 - General Coding - 3 Replies
Hey Leute Habe mal eine wichtige frage. Ihr wisst doch bestimmt das man bei einem Spiel sachen bauen kann z.b eine Waffe für seinen charackter. Ist es möglich mittels write memory process... oder auch anders z.b rohstoffe die man bekommt beliebig die anzahl zu verändern und an den server zurück zu schicken? Ich möchte nur wissen ob es möglich ist, soweit bin ich noch nicht, werde erstmal einfache bots schreiben, die Leben auslesen und paar mobs killen können ^^.
C# Write process memory
08/16/2008 - CO2 Programming - 6 Replies
ok so i have a question about how do i use the api function writeprocessmemory in C#, i already have readprocessmemory but i can't seem to get writeprocessmemory... so if anyone could show me the call and an example (preferably a pinball example) it would be very helpful :) heres what i have so far: //================================================ ==============================================// // Function: MemoryOpen(int ProcessID])) // ...



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


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.