Recent

Author Topic: How to use unknown external dll?  (Read 3758 times)

DL4OCE

  • New Member
  • *
  • Posts: 14
How to use unknown external dll?
« on: July 03, 2013, 04:04:14 pm »
Hi,

I need to use a DLL but have no documentation on it. I already read about statically or dynamically linking it, and I found out that there a many functions inside that sound good in my ears and should be exactly what I need - the DLL Export Viewer offers lots of useful information on that thing.

But that's all I have. Names and entry points of the functions. No parameter lists, no header files.

The bad thing is that I am expecting the function I need the most to have more than 30 parameters which is far too much to find by trial-and-error  %)

How can I solve this?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12950
  • FPC developer.
Re: How to use unknown external dll?
« Reply #1 on: July 03, 2013, 04:19:14 pm »
Not many options , except find documentation or other code that uses the DLL (in whatever language).

In theory you could try to disassemble, but that is a lot of work, and is typically only the ultimate desperate option.


ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: How to use unknown external dll?
« Reply #2 on: July 04, 2013, 07:02:35 am »
If you are "lucky" you can infer the parameter types from the function name mangling. See http://en.wikipedia.org/wiki/Visual_C%2B%2B_name_mangling . But in that case that is where your luck ends because you can't use C++ dll's directly from FPC/Lazarus :(

Another tiny possibility is that the dll is a COM object and has a TLB embedded. Try the type library import tool (tlimport) to see if it contains a TLB.

Now, 30 parameters for a function doesn't sound as if the dll was written in an object oriented way. If you don't find any documentation or usage example then you are in for a lot of work I would say. Finding the parameter types will be the easy part. FInding out what they stand for is the big challenge.

 

TinyPortal © 2005-2018