|
 |
|
 |
06-02-2003, 12:22 PM
|
#1 (permalink)
|
|
Registered User
Join Date: Jun 2003
Posts: 9
|
DLLs and Classes
I've been rummaging through a certain DLL, using dependency walker to find out what functions it's exporting. They're C++ functions, so I know (or think I do) what the parameters are. An example of one function I'd enjoy using is:
void CJobDataBase::GetJobName(char *)
Being relatively new to this whole business of messing with DLLs, and having been away from C++ for a while, I'm having a bit of trouble with the function being a method of a class. Is there any way to get a class definition from the DLL? (there are nothing but functions to my eyes listed in depends) Can I create an empty class called CJobDataBase, fetch it's constructor from the DLL and somehow initialize the class, and then start rocking out with more functions? Or am I just out of luck? Thanks in advance for any help.
|
|
|
06-02-2003, 02:34 PM
|
#2 (permalink)
|
|
bloomberg
Join Date: Jun 2002
Location: bloomberg
Posts: 263
|
unless that is your own dll then you shouldn't be dis-assembling it; its illegal it.
id lock the topic but maybe it is your own dll which you just lost the source for ...
hmmm.
__________________
-- bloomberg.
|
|
|
06-02-2003, 03:01 PM
|
#3 (permalink)
|
|
Registered User
Join Date: Jun 2003
Posts: 9
|
To be honest, I was blissfully unaware of the illegality of the matter. Not like it did anything for me. Assuming that the dependency tracer is not illegal, any ideas? This isn't for cracking or anything, just for a business related curiosity.
|
|
|
06-02-2003, 06:41 PM
|
#4 (permalink)
|
|
LOAD "*",8,1
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
|
reverse engineering, including disassembling, is legal (at least in the united states). unless you signed an agreement in which you specifically agreed not to reverse-engineer this software, or are doing it in order to circumvent a security scheme, then there should be no problems with figuring out how a dll works.
including someone's copyrighted software in your own is a different matter (you cannot do it unless granted rights to do so).
|
|
|
06-03-2003, 04:26 AM
|
#5 (permalink)
|
|
Registered User
Join Date: Jun 2003
Posts: 9
|
Thank you. That's what I thought. But being a newbie on this board, I'm willing to cede almost anything. Yes, it is simply a curiosity, trying to figure out how it works. I won't be including anything copyrighted in any final project, as there won't be one.
|
|
|
06-03-2003, 12:01 PM
|
#6 (permalink)
|
|
Registered User
Join Date: Jun 2003
Posts: 9
|
Nevermind
So I was again playing around, and it appears as if one doesn't need to do anything. Calling the full, decorated function name actually seemed to work. Before it just kept crashing when I tried to return unsigned ints or whatever, but when I tried it with a function that returned a pointer to a structure, it did in fact return a memory address and not have the pointer stay null. And, I realized there's a much easier way of doing what I want, so it's just an intellectual exercise at this point.
|
|
|
07-13-2003, 12:27 AM
|
#7 (permalink)
|
|
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
|
Re: DLLs and Classes
Quote:
Originally posted by moremonks
Can I create an empty class called CJobDataBase, fetch it's constructor from the DLL and somehow initialize the class, and then start rocking out with more functions? Or am I just out of luck? Thanks in advance for any help.
|
1) First of all you can't "fetch" a constructor from a class. The only way to make a constructor work is to instantiate an instance of that class: "SomeClass a;" or "SomeClass* a = new SomeClass;"
2) Learn the very basics of dll programming first. You will learn how functions and object are exposed (exported) and imported.
Then you will know now to deal with your dll perfectly  .
- Val -
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -8. The time now is 12:16 AM.
|
Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
|
 |
|