Re: Identifying parameter(s) on Functions in unmanaged DLLs

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



<harifajri@xxxxxxxxx> wrote in message news:1175745057.451796.29290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 4, 11:05 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
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...@xxxxxxxxxxxxxxxxxxxxxxxxxxx

<harifa...@xxxxxxxxx> wrote in message

news:1175672817.235237.7510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



> 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.

.



Relevant Pages

  • Re: Pinvoke and decorated names
    ... The declaration is correct. ... Now you need to make sure that the dll is in the ... > and Dumpbin now reports it as just "Myfcn". ... >>> public static extern int Myfcn(); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Accessing Delphi DLLs
    ... Both the calling app and DLL have myUnit in their uses clause. ... The notation you wrote above tries to make the function "acquire" its signature from a function-pointer type, but that doesn't work because, as you've noted, that's not really a function declaration. ... AddNumbersSignature = AddNumbers; ...
    (alt.comp.lang.borland-delphi)
  • Re: SafeArrayTypeMismatchException - .NET GURUS PLEASE HELP
    ... There is a function in one of my dlls whose signature is as follows: ... The above dll was written in VC++ 6.0. ... Declare Function my_function Lib "tcvbadm.dll" (ByVal X As Integer, ... As Integer, ByVal Z As String, AAs String, AAs Integer) As ...
    (microsoft.public.dotnet.languages.vb)
  • Re: exporting classes from DLL using def file and NONAME
    ... dumpbin on the generated DLL. ... Actually, VC++ name decoration has been very stable since V1.0, ... signature does not change - EVEN if the signature of other methods of ... the class interface ...
    (microsoft.public.vc.language)
  • Re: Is there any posssibility to see the function definitions of dll f
    ... and @ characters, you can get the function signature ... signatures for the publicly available COM objects implemented in the DLL -- ... you really can't get complete signature ... definitions of dll file? ...
    (microsoft.public.win32.programmer.kernel)