Microsoft KB Archive/181520

From BetaArchive Wiki

FIX: WSAIoctl SIO_GET_INTERFACE_LIST Option Problem

Q181520



The information in this article applies to:


  • Microsoft Windows NT Server version 4.0
  • Microsoft Windows NT Workstation version 4.0





SYMPTOMS

The Winsock 2 WSAIoctl() SIO_GET_INTERFACE_LIST API option fails to retrieve valid IP interface information on Windows NT 4.0 when it is compiled with include files from the latest Platform SDK release (Oct 97 and later).



CAUSE

The INTERFACE_INFO typedef in WS2TCPIP.H is incompatible with Winsock 2 on Windows NT 4.0. This header file takes future IPV6 capabilities into consideration, which causes the INTERFACE_INFO type to be too large for IP data retrieved from WSAIoctl().



RESOLUTION

To work around this, you can define and use the original prototype of INTERFACE_INFO in WSAIoctl() calls in your application as a new type definition. The original type is referenced as normal. However, by adding a C preprocessor define to replace all occurrences of the original type with the type just defined, the process is practically transparent to the programmer. Notice in the following section of code, the correctly sized structure is defined as OLD_INTERFACE_INFO followed by a preprocessor define that replaces all occurrences of the incorrect INTERFACE_INFO with OLD_INTERFACE_INFO.

Sample Code

   typedef struct _OLD_INTERFACE_INFO
   {

      u_long      iiFlags;      /* Interface flags */ 
      sockaddr   iiAddress;      /* Interface address */ 
      sockaddr   iiBroadcastAddress;    /* Broadcast address */ 
      sockaddr   iiNetmask;      /* Network mask */ 

   } OLD_INTERFACE_INFO;
   #define INTERFACE_INFO OLD_INTERFACE_INFO 



STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem was corrected in Windows NT version 4.0 Service Pack 4.


Additional query words:

Keywords : kbnetwork kbAPI kbOSWinNT400bug kbSDKPlatform kbWinsock kbOSWinNT400sp4fix kbGrpDSNet
Issue type : kbbug
Technology : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT400xsearch kbWinNTSsearch kbWinNTS400xsearch kbWinNTS400


Last Reviewed: October 27, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.