FIX: WSAIoctl SIO_GET_INTERFACE_LIST Option Problem (181520)



The information in this article applies to:

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

This article was previously published under Q181520

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.

Modification Type:MinorLast Reviewed:3/21/2005
Keywords:kbAPI kbBug kbfix kbnetwork kbOSWinNT400sp4fix kbWinsock KB181520