How do I turn a DLL into an INC? :confused:

That's the long and short of my question. I have a DLL file, no LIB file and I'd like to find out what all the entry points or Exported Items are and what they take for parameters. I already know that in some cases I'll be looking at a list of numbers with no significant names, but in this case even that will be a help.

Thanks for your valuable help. :grin:

Posted on 2003-10-29 20:09:59 by magus
Create the protos for your DLL and put them into an inc file. You will find a utility called INC2L.EXE in the mas32\include folder, run that on your newly created inc file and put the resulting lib file in the lib folder and the inc file in the include folder. At that point you can call the dll functions as if they were part of the API.
Posted on 2003-10-29 20:25:56 by donkey

For a list of exported functions there a number of PE viewers, you can use DUMPPE.exe from the bin folder to get a list of exported functions, however it will not tell you how many bytes the function pulls off the stack so you need some documentation to create your protos.
Posted on 2003-10-29 20:31:36 by donkey
Okay, so basically what I have now is I need a "PE Viewer" that also shows me how many bytes each entry point pulls off the stack. Then I somehow take this information and convert it into an INC file (this is what I wanted in the first place) and then run inc2l on it.

Well, I knew about the last part, the running inc2l on it already. So Donkey, do you have any ideas for which "PE Viewer" I should get to allow me to do this? Remember, no documentation on the DLL, so I can't "RTFM" to find the info I want.

Posted on 2003-10-29 21:03:26 by magus
PEBrowse Professional is a good choice:
This is a utility equiped with a parameter list view, but it's not always %100 correct. (In fact it's not possible to determine with certainty the size of parameters based purely on an examination of disassembled of code.)
Posted on 2003-10-29 21:34:51 by Poimander
I know of no PE viewer that can do that reliably, it would require complex analysis of the stack frame and procedure. IE how many local bytes are allocated and how many bytes are returned in the RET statement. You could do it yourself by checking the start and end of each procedure. Generally the RETN command will tell you how many bytes of parameters are passed to the procedure, almost all API functions use DWORD parameters so you can devide this by 4 to arrive at the number of parameters. However if the function uses REAL or other non-dword parameters you will have to examine the code closely to be able to create a prototype.
Posted on 2003-10-29 21:36:14 by donkey

Sometime back I had a program called DLL2LIB which generates LIBs from DLLs. However, I found the program a little *difficult* to understand. I don't know whether it is available or not. I'll just check.

Oh yeah goto this page:

you'll find it there if u figure out how to use it please let us know.

Posted on 2003-10-30 00:40:40 by art_sands
Thanks Guys, :alright:

I followed Poimander's advice and went to Smidgeonsoft where I grabbed the PEBrowse Pro Interactive. It's a free tool and seems to do what's needed which is to help me convert from a DLL to an INC file the entry points of the DLL.

Yes Donkey and Poimander, I know that there is nothing that will reliably tell me how many bytes the function pulls off the stack, that's what disassembling the function and tracing it's execution are for and where Olly Debug will come in handy. Thanks Donkey for the tip on the RETN, I hadn't thought about that before.

Art, I'm sure that DLL2LIB is a usefull and worthwhile utility, but at $99 to do a job I don't need done, somewhat out of my league. Once I have an INC file that accurately describes the entry points to the dll it's a fairly simple matter to run it through inc2l to get a lib, should I want one.

Thanks one and all for your help.

Posted on 2003-10-30 03:59:42 by magus