About tow IP Helper Functions

  • Thread starter Thread starter Joson
  • Start date Start date
J

Joson

In windows XP sp1,the code as follow:

DWORD dwRet;
IP_ADAPTER_INFO adapterInfo;
ULONG ulSize = sizeof(IP_ADAPTER_INFO);
dwRet = GetAdaptersInfo(&adapterInfo,&ulSize);
if (dwRet == ERROR_SUCCESS)
{
USES_CONVERSION;
dwRet = GetAdapterIndex(A2W
(adapterInfo.AdapterName),&m_ulIfIndex);
if (dwRet != NO_ERROR)
TraceErrorMsg(dwRet);
else
{
unsigned long ulNTEContext, ulNTEInstance;
dwRet = AddIPAddress(0xDC702AD5, 0xFFFFFF00,
m_ulIfIndex, &ulNTEContext, &ulNTEInstance);
if (dwRet != NO_ERROR)
TraceErrorMsg(dwRet);
}
}
else
TraceErrorMsg(dwRet);


Calling the GetAdapterIndex function always returns error
(error code = 55:The specified network resource or device
is no longer available);
and calling AddIPAddress function always returns error
(error code = 87:The parameter is incorrect).

why? Thanks for any advise!
 
Joson,

The GetAdapterInfo returns list list of the adapter info structures.
Maybe the first one from the list you got was disabled. (you should know the network interfaces installed on your system)

Go through the entire list and see the actual adapters info. Grab the sample code from MSDN:
http://msdn.microsoft.com/library/en-us/iphlp/iphlp/getadaptersinfo.asp


KM

PS. IS this XP Embedded related or XP Pro? If latter, please post the question to microsoft.public.windowsxp.general newsgroup.
 
Thank you,KM!

The adapter info i got is active and available.
The OS is XP Pro.Maybe is the system's bug.
-----Original Message-----
Joson,

The GetAdapterInfo returns list list of the adapter info structures.
Maybe the first one from the list you got was disabled.
(you should know the network interfaces installed on your
system)
Go through the entire list and see the actual adapters
info. Grab the sample code from MSDN:
http://msdn.microsoft.com/library/en- us/iphlp/iphlp/getadaptersinfo.asp


KM

PS. IS this XP Embedded related or XP Pro? If latter,
please post the question to
microsoft.public.windowsxp.general newsgroup.
 
Jonson,
The adapter info i got is active and available.
The OS is XP Pro.Maybe is the system's bug.

Unlikely.

Did you enumerate through all the adapter info structures returned by the function?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top