Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 02:44

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

Advertisement



Need help - _MemoryModuleGetBaseAddress

Discussion on Need help - _MemoryModuleGetBaseAddress within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2010
Posts: 9
Received Thanks: 0
Need help - _MemoryModuleGetBaseAddress

Hello
Could anyone help me?
I'm using nomad function _MemoryModuleGetBaseAddress..

Im doing like that :
Code:
Global $ID = _MemoryOpen(ProcessExists("Tibia.exe"))
$TibiaBaseAddr = Int(_MemoryModuleGetBaseAddress($ID,"Tibia.exe"))
And $TibiaBaseAddr doesn't work well :<
What im doing wrong? Please help me.

Code:
Func  _MemoryModuleGetBaseAddress($iPID , $sModule)
    If  Not  ProcessExists ($iPID) Then  Return  SetError (1 , 0 , 0)

    If  Not  IsString ($sModule) Then  Return  SetError (2 , 0 , 0)

    Local    $PSAPI=DllOpen ("psapi.dll")

    ;Get Process Handle
    Local    $hProcess
    Local    $PERMISSION=BitOR (0x0002, 0x0400, 0x0008, 0x0010, 0x0020) ; CREATE_THREAD, QUERY_INFORMATION, VM_OPERATION, VM_READ, VM_WRITE

    If  $iPID>0 Then
        Local  $hProcess=DllCall ("kernel32.dll" , "ptr" , "OpenProcess" , "dword" , $PERMISSION , "int" , 0 , "dword" , $iPID)
        If  $hProcess [ 0 ] Then
            $hProcess=$hProcess [ 0 ]
        EndIf
    EndIf

    ;EnumProcessModules
    Local    $Modules=DllStructCreate ("ptr[1024]")
    Local    $aCall=DllCall ($PSAPI , "int" , "EnumProcessModules" , "ptr" , $hProcess , "ptr" , DllStructGetPtr ($Modules), "dword" , DllStructGetSize ($Modules), "dword*" , 0)
    If  $aCall [ 4 ]>0 Then
        Local    $iModnum=$aCall [ 4 ] / 4
        Local    $aTemp
        For  $i=1 To  $iModnum
            $aTemp= DllCall ($PSAPI , "dword" , "GetModuleBaseNameW" , "ptr" , $hProcess , "ptr" , Ptr(DllStructGetData ($Modules , 1 , $i)) , "wstr" , "" , "dword" , 260)
            If  $aTemp [ 3 ]=$sModule Then
                DllClose ($PSAPI)
                Return  Ptr(DllStructGetData ($Modules , 1 , $i))
            EndIf
        Next
    EndIf

    DllClose ($PSAPI)
    Return  SetError (-1 , 0 , 0)

EndFunc
maches is offline  
Old 08/25/2013, 21:52   #2

 
elite*gold: 64
Join Date: May 2011
Posts: 1,229
Received Thanks: 854
You need $iPid not MemoryOpen:

Code:
Global $iPID = ProcessExists("Tibia.exe")
Global $ID = _MemoryOpen($iPID)
$TibiaBaseAddr = _MemoryModuleGetBaseAddress($iPID,"Tibia.exe")
BladeTiger12 is offline  
Old 08/25/2013, 21:57   #3
 
elite*gold: 0
Join Date: Jul 2010
Posts: 9
Received Thanks: 0
Thank you! Working well
maches is offline  
Old 08/25/2013, 21:58   #4
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149

KDeluxe is offline  
Reply




All times are GMT +1. The time now is 02:44.


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.