Hello
I was looking for an automated way to generate a lib and inc file starting from an existing (system) DLL.
I just create the lib file using BumpBin.exe and Lib.exe, but I can't find the way to create the inc file.
Using L2INCA.exe returns a message "Library has no imports". Can somebody help?

Regards,
Biterider
Posted on 2003-10-03 05:24:04 by Biterider
There is no easy way of automatic creating of .inc files, since you would have to know beforehand the number of parameters (or at least how much space in the stack is needed) for MASM to invoke them correctly. For the same reason, I *think* (but I'm not very sure about this) that the function names in this libraries are "decorated" by appending them an @ followed by the number of bytes needed to pass the parameters, so this would bring us back to the problem with .inc files. Please correct me if I'm wrong...
:confused:
Posted on 2003-10-03 14:19:08 by QvasiModo
I think so too.
The Problem is - when we are right - that whe don know the size of the seperate parametes.

SuperFunction@4

could be "SuperFunction PROTO temp:DWORD",
but "SuperFunction PROTO t1:BYTE, t2:BYTE, t3:BYTE ,t4:BYTE"

Greets !
Posted on 2003-10-03 14:25:03 by Bubu-Boy
Yes, that's another problem. It could be fixed, though, if we join the 4 bytes in a DWORD before passing it to invoke - but that would be a "patch". Indeed, we don't know the number of parameters nor the size of them, so automation seems pretty much out of the question (unless we put the required data in a file to be processed... but in that case we would not earn much from it :) ).
Posted on 2003-10-03 14:42:49 by QvasiModo
Every windows DLL uses only DWORDs as parameters, I haven't ever run across a DLL that uses either words or bytes. You can safely assume that the number of parameters falls into the following rule:

function@n

n/4 = Parameters

There is no existing DLL in win32 that uses bytes as parameters as you cannot push a single byte onto the stack, words are pushed as two words (one with a zero value) and popped with a halfstack operation. So in all cases assuming dwords is fine, you may have the extremely rare case where you need to make an exception but I have never seen one.
Posted on 2003-10-03 14:44:42 by donkey
I think there is at least one API that passes POINT structures by value. This is a QWORD, and the corresponding INC file prototype breaks it down into two DWORD arguments.
Posted on 2003-10-03 19:31:35 by tenkey
A point structure is *not* a QWORD it is 2 DWORDs. There is a big difference between the two. A QWORD in the ChildWindowFromPoint structure (I am assuming that is what you are talking about) would require that the point structure be passed backwards (pt.y,pt.x). It is 2 DWORDs that are both pushed onto the stack independantly, rather than a pointer to the structure, it falls directly within the rule that everything is a DWORD,
Posted on 2003-10-03 19:45:14 by donkey