Using iphlpapi.lib

  • Thread starter Thread starter William Stacey
  • Start date Start date
W

William Stacey

How would you use iphlpapi.lib (from the platform sdk) from a c# app? I can
use iphlpapi.dll on w23 and xp, but seem to need this "lib" from w2k. If
need to wrap in c++ dll, please poing to example. Also, would you need to
distribute lib seperatly with you app, or would it compile "into" one c++
dll? TIA!
 
William,

Iphlpapi.dll is listed as being on W2K3 server, XP, and 2000 (server and
professional). You should have no problem declaring the methods in C# and
making the calls through the P/Invoke layer. What APIs are you having
trouble with specifically?
 
That is what is says, I agree. However, that is not how it works AFAICT, so
I think it is a doco error. The ICMP echo and I think the GetParms work on
xp and w3k, but not w2k (get some kind of entry point error that fails hard
on w2k machine.) The doco also refers to the "lib" version and not the
"dll" version. I don't use c++, so not sure what the lib is here and how to
call. I think the w2k version dll, does not have all the same entry points
(i.e. APIs).
Thanks Nicholas. Any other help would be great.

--
William Stacey, MVP

Nicholas Paldino said:
William,

Iphlpapi.dll is listed as being on W2K3 server, XP, and 2000 (server and
professional). You should have no problem declaring the methods in C# and
making the calls through the P/Invoke layer. What APIs are you having
trouble with specifically?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

William Stacey said:
How would you use iphlpapi.lib (from the platform sdk) from a c# app? I can
use iphlpapi.dll on w23 and xp, but seem to need this "lib" from w2k. If
need to wrap in c++ dll, please poing to example. Also, would you need to
distribute lib seperatly with you app, or would it compile "into" one c++
dll? TIA!
 
William,

I don't have a W2K machine to test this on, but from what you have said,
it would seem that the documentation is incorrect. I doubt that they would
have functions in the library that are not exported in the dll (that would
be a major blunder, greater than the documentation being wrong).

In order to see what the case is, I would create your own DLL which
exports the functions that you need, and link to the lib, and then use that.
Of course, test this to see if it works. At the worse, it is going to
crash, hard (like before), and you will know that the API calls are not
available on the platform. If it does work, then MS should be notified, and
the DLL rebuilt (or the documentation fixed).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)



William Stacey said:
That is what is says, I agree. However, that is not how it works AFAICT, so
I think it is a doco error. The ICMP echo and I think the GetParms work on
xp and w3k, but not w2k (get some kind of entry point error that fails hard
on w2k machine.) The doco also refers to the "lib" version and not the
"dll" version. I don't use c++, so not sure what the lib is here and how to
call. I think the w2k version dll, does not have all the same entry points
(i.e. APIs).
Thanks Nicholas. Any other help would be great.

--
William Stacey, MVP

message news:[email protected]...
William,

Iphlpapi.dll is listed as being on W2K3 server, XP, and 2000 (server and
professional). You should have no problem declaring the methods in C# and
making the calls through the P/Invoke layer. What APIs are you having
trouble with specifically?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

William Stacey said:
How would you use iphlpapi.lib (from the platform sdk) from a c# app?
I
can
use iphlpapi.dll on w23 and xp, but seem to need this "lib" from w2k. If
need to wrap in c++ dll, please poing to example. Also, would you
need
 
That's correct, not all API's are available on W2K, API's ending with Ex
(f.i GetBestInterfaceEx ) do require XP or W2K3, however, the API's
IcmpSendEcho and GetNetworkParams should be available on W2K.
Did you check the exports using depends.exe
(http://www.dependencywalker.com/) or dumpbin?

The Iphlpapi.lib is simply an export library, C++ programs must specify the
target OS version at build time, the dll is dynamically bound at run time.

Willy.


William Stacey said:
That is what is says, I agree. However, that is not how it works AFAICT, so
I think it is a doco error. The ICMP echo and I think the GetParms work on
xp and w3k, but not w2k (get some kind of entry point error that fails hard
on w2k machine.) The doco also refers to the "lib" version and not the
"dll" version. I don't use c++, so not sure what the lib is here and how to
call. I think the w2k version dll, does not have all the same entry points
(i.e. APIs).
Thanks Nicholas. Any other help would be great.

--
William Stacey, MVP

message news:[email protected]...
William,

Iphlpapi.dll is listed as being on W2K3 server, XP, and 2000 (server and
professional). You should have no problem declaring the methods in C# and
making the calls through the P/Invoke layer. What APIs are you having
trouble with specifically?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

William Stacey said:
How would you use iphlpapi.lib (from the platform sdk) from a c# app?
I
can
use iphlpapi.dll on w23 and xp, but seem to need this "lib" from w2k. If
need to wrap in c++ dll, please poing to example. Also, would you
need
 
Thanks to both. I did check depends after first post and many APIs are not
included in w2k version (including the ones I needed.) So now my question
is, how the heck does anyone to ICMPsend on a w2k box? I have seen apps,
and they seem to work. If you use winsock and raw IP, you need to be admin,
so that is not really an option IMO, and icmpsendecho is not supported in
iphlpapi.dll. So how do folks to this on w2k? TIA

--
William Stacey, MVP

Willy Denoyette said:
That's correct, not all API's are available on W2K, API's ending with Ex
(f.i GetBestInterfaceEx ) do require XP or W2K3, however, the API's
IcmpSendEcho and GetNetworkParams should be available on W2K.
Did you check the exports using depends.exe
(http://www.dependencywalker.com/) or dumpbin?

The Iphlpapi.lib is simply an export library, C++ programs must specify the
target OS version at build time, the dll is dynamically bound at run time.

Willy.


William Stacey said:
That is what is says, I agree. However, that is not how it works
AFAICT,
so
I think it is a doco error. The ICMP echo and I think the GetParms work on
xp and w3k, but not w2k (get some kind of entry point error that fails hard
on w2k machine.) The doco also refers to the "lib" version and not the
"dll" version. I don't use c++, so not sure what the lib is here and
how
to
call. I think the w2k version dll, does not have all the same entry points
(i.e. APIs).
Thanks Nicholas. Any other help would be great.

--
William Stacey, MVP

message news:[email protected]...
William,

Iphlpapi.dll is listed as being on W2K3 server, XP, and 2000
(server
and
professional). You should have no problem declaring the methods in C# and
making the calls through the P/Invoke layer. What APIs are you having
trouble with specifically?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

How would you use iphlpapi.lib (from the platform sdk) from a c#
app?
I w2k.
If need one
c++
 
William,

Is it IcmpSendEcho that you're using? It's exported from icmp.dll as
well, and I think that DLL has been included with all Windows versions
(the MSDN Dll Hell database can hopefully tell you for sure). See also
KB 170591.



Mattias
 
Back
Top