473,379 Members | 1,235 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Identifying parameter(s) on Functions in unmanaged DLLs

Hi All,

We know that if we want to list down all methods/functions on an
unmanaged DLL,
we can use command-line tools 'dumpbin' or 'link '
For example, if we want to know method from user32.dll:
dumpbin /exports user32.dll
OR
link /dump /exports user32.dll

by running that comand, i could create a method (Entry Point) like
this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
public static extern int MsgBox( PARMETER??? );

How to identify parameter on a specific function on a DLLs?

Rgds

HF

Apr 4 '07 #1
4 8533
HF,

Are you trying to do this at run time in a program, or are you trying to
figure out what the parameters of a function are so that you can create a
P/Invoke declaration in your program? If the answer is the former, then I
really don't have an answer on how that can be done.

If the answer is the latter, then you should have examples, or better
yet, a header file which you can get the function signature from and then
figure out what the appropriate declaration in .NET should be. If it is a
Windows API function, you can look in the documentation for the signature,
the header files which come with the SDK, or you can go to
http://www.pinvoke.net which has a large number of the Windows API
signatures that you can copy and paste into .NET code. Even better, it has
a plugin which will make the process even easier.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ha*******@gmail.comwrote in message
news:11********************@o5g2000hsb.googlegroup s.com...
Hi All,

We know that if we want to list down all methods/functions on an
unmanaged DLL,
we can use command-line tools 'dumpbin' or 'link '
For example, if we want to know method from user32.dll:
dumpbin /exports user32.dll
OR
link /dump /exports user32.dll

by running that comand, i could create a method (Entry Point) like
this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
public static extern int MsgBox( PARMETER??? );

How to identify parameter on a specific function on a DLLs?

Rgds

HF

Apr 4 '07 #2
On Apr 4, 11:05 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
HF,

Are you trying to do this at run time in a program, or are you trying to
figure out what the parameters of a function are so that you can create a
P/Invoke declaration in your program? If the answer is the former, then I
really don't have an answer on how that can be done.

If the answer is the latter, then you should have examples, or better
yet, a header file which you can get the function signature from and then
figure out what the appropriate declaration in .NET should be. If it is a
Windows API function, you can look in the documentation for the signature,
the header files which come with the SDK, or you can go tohttp://www.pinvoke.netwhich has a large number of the Windows API
signatures that you can copy and paste into .NET code. Even better, it has
a plugin which will make the process even easier.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<harifa...@gmail.comwrote in message

news:11********************@o5g2000hsb.googlegroup s.com...
Hi All,
We know that if we want to list down all methods/functions on an
unmanaged DLL,
we can use command-line tools 'dumpbin' or 'link '
For example, if we want to know method from user32.dll:
dumpbin /exports user32.dll
OR
link /dump /exports user32.dll
by running that comand, i could create a method (Entry Point) like
this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
public static extern int MsgBox( PARMETER??? );
How to identify parameter on a specific function on a DLLs?
Rgds
HF- Hide quoted text -

- Show quoted text -

Thanks for the reply Nicholas Paldino,

I am not trying it at run time. I just try to create declaration to
invoke method on some unmanaged DLL (i.e.: yahoo messanger), which has
no SDK.

Is it possible to guess of what parameter on a functions on dll?

Rgds

HF

Apr 5 '07 #3
I would say no, but I can't say for sure, as I've never had to hack a
dll like this. You might get some luck in a Visual C++ group to see if
there is a way to find the signatures and parameter types from just the DLL.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ha*******@gmail.comwrote in message
news:11*********************@d57g2000hsg.googlegro ups.com...
On Apr 4, 11:05 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>HF,

Are you trying to do this at run time in a program, or are you trying
to
figure out what the parameters of a function are so that you can create a
P/Invoke declaration in your program? If the answer is the former, then
I
really don't have an answer on how that can be done.

If the answer is the latter, then you should have examples, or better
yet, a header file which you can get the function signature from and then
figure out what the appropriate declaration in .NET should be. If it is
a
Windows API function, you can look in the documentation for the
signature,
the header files which come with the SDK, or you can go
tohttp://www.pinvoke.netwhich has a large number of the Windows API
signatures that you can copy and paste into .NET code. Even better, it
has
a plugin which will make the process even easier.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<harifa...@gmail.comwrote in message

news:11********************@o5g2000hsb.googlegrou ps.com...
Hi All,
We know that if we want to list down all methods/functions on an
unmanaged DLL,
we can use command-line tools 'dumpbin' or 'link '
For example, if we want to know method from user32.dll:
dumpbin /exports user32.dll
OR
link /dump /exports user32.dll
by running that comand, i could create a method (Entry Point) like
this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
public static extern int MsgBox( PARMETER??? );
How to identify parameter on a specific function on a DLLs?
Rgds
HF- Hide quoted text -

- Show quoted text -


Thanks for the reply Nicholas Paldino,

I am not trying it at run time. I just try to create declaration to
invoke method on some unmanaged DLL (i.e.: yahoo messanger), which has
no SDK.

Is it possible to guess of what parameter on a functions on dll?

Rgds

HF

Apr 5 '07 #4
<ha*******@gmail.comwrote in message
news:11*********************@d57g2000hsg.googlegro ups.com...
On Apr 4, 11:05 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>HF,

Are you trying to do this at run time in a program, or are you trying to
figure out what the parameters of a function are so that you can create a
P/Invoke declaration in your program? If the answer is the former, then I
really don't have an answer on how that can be done.

If the answer is the latter, then you should have examples, or better
yet, a header file which you can get the function signature from and then
figure out what the appropriate declaration in .NET should be. If it is a
Windows API function, you can look in the documentation for the signature,
the header files which come with the SDK, or you can go tohttp://www.pinvoke.netwhich has
a large number of the Windows API
signatures that you can copy and paste into .NET code. Even better, it has
a plugin which will make the process even easier.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<harifa...@gmail.comwrote in message

news:11********************@o5g2000hsb.googlegrou ps.com...
Hi All,
We know that if we want to list down all methods/functions on an
unmanaged DLL,
we can use command-line tools 'dumpbin' or 'link '
For example, if we want to know method from user32.dll:
dumpbin /exports user32.dll
OR
link /dump /exports user32.dll
by running that comand, i could create a method (Entry Point) like
this:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", EntryPoint="MessageBoxA")]
public static extern int MsgBox( PARMETER??? );
How to identify parameter on a specific function on a DLLs?
Rgds
HF- Hide quoted text -

- Show quoted text -


Thanks for the reply Nicholas Paldino,

I am not trying it at run time. I just try to create declaration to
invoke method on some unmanaged DLL (i.e.: yahoo messanger), which has
no SDK.

Is it possible to guess of what parameter on a functions on dll?
No you can't, more you shouldn't even use this function at all. If it's not documented it
means it's not a public interface, the author can remove the function or change it's
signature for every new release of the DLL.

Willy.

Apr 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Will Pittenger | last post by:
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are...
2
by: Thomas W. Brown | last post by:
I have setup Console redirection within my Console app (via Console.SetOut and Console.SetErrror) to route console WriteLine calls to a logfile. This works just fine with one exception... I use...
0
by: Frank Lopez | last post by:
My program structure is: 1. 2. 3. => manually does the crt-init and crt-terminate calls 4. -- this is accessed by the unmanaged C++ classes in (3) using LoadLibrary and FreeLibrary
5
by: Bern McCarty | last post by:
I have a DLL written in C++ (it's really C code that was adjusted to compile OK as C++) that I compile successfully into IL with the /CLR switch of Visual C 7.1. I use the resultant library...
7
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The...
1
by: Paul_P | last post by:
Hello all, We are using Managed and Unmanaged C++ code, on Windows XP SP2, VC++ .NET 2003. In the SubClass we are trying to override a virtual method of the BaseClass that has an unmanaged type...
6
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
2
by: flyingxu | last post by:
Hi, I run into a cstring related link problem in VC7. My solution has 3 projects, one MFC exe, two MFC extersion DLL. the two MFC extersion DLL export functions which use CString as parameters....
6
by: Volodia | last post by:
Hi, I have a problem to find information how to add unmanaged dll build in VC++ 2005 to the asp.net web site What I have tried: 1. use DllImport("MyDll.dll") to declare function in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.