Results 1 to 7 of 7

Thread: Using GetModuleHandle on another process.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    435

    Using GetModuleHandle on another process.

    Is this possible? If yes, how would you do it?

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Using GetModuleHandle on another process.

    What is it that you're trying to accomplish exactly?

    The documentation for this API states that you must pass the module name to it as its own parameter. Which can be obtained via the framework very easily. My process manager can assist with that part.

    But this API, as far as I understand, will only give you the readable information. You can't actually do anything with it.
    Last edited by weirddemon; May 15th, 2010 at 01:51 AM.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    435

    Re: Using GetModuleHandle on another process.

    Quote Originally Posted by weirddemon View Post
    What is it that you're trying to accomplish exactly?

    The documentation for this API states that you must pass the module name to it as its own parameter. Which can be obtained via the framework very easily. My process manager can assist with that part.

    But this API, as far as I understand, will only give you the readable information. You can't actually do anything with it.
    Code:
     Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
        Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Code:
    MessageBox.Show( GetProcAddress(GetModuleHandle("insertdllnamehere.dll"), "Notepad"))
    I tried that code, and it didn't show a messagebox. Whats wrong?

  4. #4
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Using GetModuleHandle on another process.

    Have you tried your test without the GetProcAddress function? Narrow it down to determine what is and isn't working.

    Also, you still haven't answered the original question. What is the end result?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    435

    Re: Using GetModuleHandle on another process.

    Quote Originally Posted by weirddemon View Post
    Have you tried your test without the GetProcAddress function? Narrow it down to determine what is and isn't working.

    Also, you still haven't answered the original question. What is the end result?
    1. Correct me if I'm wrong, but doesn't GetModuleHandle only get the Module Handles for the Modules in the current process?
    2. What do you mean by End Result?

  6. #6

    Re: Using GetModuleHandle on another process.

    End Result: Why do you want to know how to do this? What are you going to do this for?

  7. #7
    Lively Member
    Join Date
    Jan 2008
    Location
    England
    Posts
    113

    Re: Using GetModuleHandle on another process.

    A HMODULE is only valid in the process containing the module, its there address where the the module is loaded into the process.

    You can get the base address of the module in an external process in .net using the Process class e.g.
    Process.GetCurrentProcess.Modules(0).BaseAddress

    But as asked above, whats this for since GetModuleHandle probably isnt what your looking for

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width