Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

editing user32.dll to change behavior of a function

I want to make a copy my user32.dll but change the SendMessage function in it to first write info about the function call into a text file, and then do its normal thing. This way i can swap in and out my original user32.dll and modified one. This way i can monitor calls to the sendMessage function when i want. How would i go about doing this. Where in the user32.dll file would i insert my code for writing the function call's info. My thinking is to just insert my code at the top of the original SendMessage function body in user32.dll, but how do i find where the original SendMessage function body is? Any answers on how to go about doing this?
0
spines11
Asked:
spines11
  • 2
1 Solution
 
cookreCommented:
Rather than modifying the DLL file, you fiddle with the loaded image in RAM.  Use GetProcAddress() to find where the desired entry point is and insert a call to your code there.  You'll also have to look at the code you're overlaying and figure out how much to save for later execution before you jump back into the DLL's code.
0
 
cookreCommented:
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now