Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-02-2003, 12:22 PM   #1 (permalink)
moremonks
Registered User
 
Join Date: Jun 2003
Posts: 9
moremonks is on a distinguished road
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.
moremonks is offline   Reply With Quote
Old 06-02-2003, 02:34 PM   #2 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
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.
abc123 is offline   Reply With Quote
Old 06-02-2003, 03:01 PM   #3 (permalink)
moremonks
Registered User
 
Join Date: Jun 2003
Posts: 9
moremonks is on a distinguished road
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.
moremonks is offline   Reply With Quote
Old 06-02-2003, 06:41 PM   #4 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
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).
joe_bruin is offline   Reply With Quote
Old 06-03-2003, 04:26 AM   #5 (permalink)
moremonks
Registered User
 
Join Date: Jun 2003
Posts: 9
moremonks is on a distinguished road
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.
moremonks is offline   Reply With Quote
Old 06-03-2003, 12:01 PM   #6 (permalink)
moremonks
Registered User
 
Join Date: Jun 2003
Posts: 9
moremonks is on a distinguished road
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.
moremonks is offline   Reply With Quote
Old 07-13-2003, 12:27 AM   #7 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
Valmont is on a distinguished road
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 -
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 12:16 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting