About using the tow functions: AddIPAddress(...) and GetAdaptersInfo(...)

  • Thread starter Thread starter Jonson
  • Start date Start date
J

Jonson

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
(A2WadapterInfo.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.
 
Jonson,

This is wrong NG for this type of questions but anyway:
You are trying to type cast and use ASCII adapter name in function that require wide character name.
Try using different approach or functions for obtaining adapter name.

Regards,
Slobodan
 

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

Similar Threads


Back
Top