|
-
May 15th, 2010, 01:08 AM
#1
Thread Starter
Hyperactive Member
Using GetModuleHandle on another process.
Is this possible? If yes, how would you do it?
-
May 15th, 2010, 01:47 AM
#2
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
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
May 15th, 2010, 11:35 AM
#3
Thread Starter
Hyperactive Member
Re: Using GetModuleHandle on another process.
 Originally Posted by weirddemon
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?
-
May 15th, 2010, 07:09 PM
#4
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
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
May 15th, 2010, 10:00 PM
#5
Thread Starter
Hyperactive Member
Re: Using GetModuleHandle on another process.
 Originally Posted by weirddemon
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?
-
May 15th, 2010, 10:25 PM
#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?
-
May 16th, 2010, 10:30 AM
#7
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|