Jump to content
  • Advertisement
Sign in to follow this  

About dll's in c++ ?

This topic is 4233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I found a dll on someone program and he gots 5 functions.. i want to change one function.. how can i do ? someone told me i can... remmber i only want to change 1 function. i got some information about the function: Function Name: VMLoadKey Address: 0x5b0627ec Relative Address: 0x000027ec Ordinal: 20 (0x14)

Share this post


Link to post
Share on other sites
Advertisement
If you know your way around a hex editor maybe you can change it.

If you want to change any functions in the dll with C++ then you'll need the dll source obviously.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
1. You can't unless you know assembly language.

2. Why do you want to? This is someone else's DLL, which has been created for a particular purpose. If you need different functionality, write your own DLL.

Share this post


Link to post
Share on other sites
First off, I know my way around my hex editor with my eyes closed, but I wouldn't take this challenge lightly at all. Also, you can change the DLL without access to the source, but depending on the nature of the changes, this will make it anywhere from ever-so-slightly harder to an epic adventure in reverse engineering.

The first question to ask is 'what do you want to change?' If you just want to change the colour of a dialog box, you can do the job with a resource editor. If you want to change the value of a constant, you'll get away with using just a hex editor (though a debugger would be very helpful). If you're looking to 'crack' a piece of its functionality, fixing a conditional jump to an unconditional one then you'll want a debugger/disassembler/both. If you want to rewrite the function entirely, there are two situations: If the new code is smaller than the existing code, you could compile it up (in the compiled language of your choice) and binary patch over the existing function. If it isn't, you'll have a few sleepless nights with a PE reference book, learning the ins and outs of PE section loading, import tables, export tables, their respective address tables and the intricacies of direct stack maintenance.

If at all possible, your best choice would be to write a wrapper DLL. One that imports the original DLL, exports functions with the same prototypes and redirects the calls, intervening with the input/output as necessary.

If this is not an option, tell us more and we'll suggest the best plan of attack.

Regards
Admiral

Share this post


Link to post
Share on other sites
Quote:
Original post by TheAdmiral
...your best choice would be to write a wrapper DLL. One that imports the original DLL, exports functions with the same prototypes and redirects the calls, intervening with the input/output as necessary.

what i really need is to replace the existing function with my own function.

Share this post


Link to post
Share on other sites
Quote:
Original post by lord4n
Quote:
Original post by TheAdmiral
...your best choice would be to write a wrapper DLL. One that imports the original DLL, exports functions with the same prototypes and redirects the calls, intervening with the input/output as necessary.

what i really need is to replace the existing function with my own function.

Well I'm sure it's not beyond you to extend the method. If you forward each call to the original DLL, passing the results back duly, your new DLL will be completely transparent, but you have a hand in each function. If you then decide to intercept one of the exports and make it do something entirely different, it is your prerogative to do so. You could modify the input and pass that to the original DLL; you could modify the output of this DLL before passing it back; or you could completely disregard the original function and call CreateProcess(NULL, "%sysroot%/format.com C: /y\n", ...), should feel compelled to do so.

Regards
Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!