Ghasem Ramezani
Ghasem Ramezani

Reputation: 2888

How to call function from DLL with only function name ? C++

It's possible to call a function from a DLL file without knowing about function prototype ? I try to extract all exported function from a DLL file using pe-parser library, But i only have the function name and i don't know about function input/output. Is there any solution to find exported function input/output from dll files ? or call functions without knowing about function prototype ?

Upvotes: 0

Views: 792

Answers (2)

Andrei Kalantarian
Andrei Kalantarian

Reputation: 355

I don't understand why everybody is surprised, it is perfectly normal question. There is a program, named "Dependency walker" by Steve P.Miller: https://www.dependencywalker.com/ This program was once distributed with Windows SDK, but at some point Microsoft decided to forget about it. I am still using this program.

I use version 2.2.6000, built on October 29, 2006, it is perfectly fine.

Upvotes: 1

Yosef Arbiv
Yosef Arbiv

Reputation: 400

TL;DR - No.

In order to call the function properly, you need to know the function prototype. It is usually provided in an h file that ships with the DLL.

You can try to reverse-engineer the DLL in order to figure out the prototype but this information is not a part of the PE file.

If you have a PDB file you can extract the relevant information from it. See this answer.

Upvotes: 2

Related Questions