Solved

DLL import functions???

Posted on 1997-10-31
6
291 Views
Last Modified: 2010-04-04
Given a DLL with no supporting documentation around what functions it contains, and what parameters it takes for each function, how would you go about finding this information out?

I know how to get hold of the functions that it contains, the main problem that I have is I don't know what parameters each function takes...


I won't accept the response 'Talk to the author, what DLL is it' and other related statements.
0
Comment
Question by:john_m
6 Comments
 

Author Comment

by:john_m
ID: 1349209
Edited text of question
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1349210
Unfortunatelly you can't. You can get names of exported function and paramcount for this, however you don't know what you can do with this. If this can help you then try find NEWEXE.ZIP at FtpSearch. This is utility for dumping exe and dll (without flat drivers).

good luck.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1349211
You can get a decompiler, and decompile the dll. then you can check the parametrs of the function, and what it does
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:john_m
ID: 1349212
Unfortunately I know all this already. If you could recommend a decompiler though, maybe that would be worth some points...
0
 
LVL 1

Accepted Solution

by:
ergates earned 350 total points
ID: 1349213
This is obviously a tough one.

I managed to reverse engineer an interface in the Trumpet Winsock  
DLL, which is used by the Trumpet "TCP meter" application. (It's probably all changed now).

What I did was put the DLL call into my code, and then step through the code by assembler instructions. When you step into the called routine, you can see the assembler code for it. Now you need to 80x86 assembler and know what calling conventions are used, i.e. where and how parameters are passed. They are usually passed on stack, but may also be passed in registers. In the called routine look for access to the stack to get parameters. You can tell if the called routine is expecting an address.

Similarly, returned parameters are left in registers or are pushed back onto the stack before the routine returns.

Using this I was able to deduce the interface, though there was one parameter I never worked out! I had a pretty good idea that the routine returned two ints, one for received and transmitted bytes.

Note the above was done with BPW not Delphi, but the principle is the same. I have seen a decompiler that works on TPUs, and also on (C) .exe programs. Working out the types is possible, if you know how compilers generate code (which I do) to access them. It would be very difficult without knowledge of what the routines are supposed to do.

I would be interested to know what DLL you want to decode and why, unless it is just an academic exercise.

Regards,
0
 

Author Comment

by:john_m
ID: 1349214
egrates,
Cheers for the info. Although I don't have enough information to continue with what I wanted to do, you did at least give a fair answer to a fair question. FYI the DLL I have been looking at is DCC.DLL as supplied with Delphi 3... Doubtful that I'll get anywhere with it though...
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question