KB 4038779 problem with getnameinfo() RRS feed

  • Question

  • Don't know whether this is a place to drop my question.  Probably not. But maybe someone coudl guide me to the right place.

    The following program stopped working after this patch (kb4038779) had been installed in Windows 7 Pro x64 SP1:

    // gethostname.c :
    // Testprogramm to show the failure of  getnameinfo-function unter Windows (7,10, Windows Server 20xx with
    // KB4038779 installed)
    // CPK 

    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <stdio.h>
    #include <sys/types.h>

    typedef unsigned int SOCKET;

    #include <Winsock2.h>
    #include <ws2tcpip.h>

    void usage(void);
    int exit(int);
    #define MAXHOSTNAMELEN 512

    static char hostinfo[NI_MAXHOST];
    static char hostname[MAXHOSTNAMELEN];

    int main(int argc, char *argv[])
        int result,err;
        int wsreturn;
        static char tmpstring[1024];
        WORD wVersionRequested;
        WSADATA wsaData;
        SOCKADDR_IN    sa;
        wVersionRequested = MAKEWORD( 2, 2 );

        err = WSAStartup( wVersionRequested , &wsaData );
        if ( err != 0 ) {
            /* Tell the user that we couldn't find a usable */
            /* winsock.dll.                                  */
            printf("server: couldn't find a Winsock 2.2!\n"),exit(3);
        if(argc !=2)

        inet_pton(AF_INET,argv[1], &(sa.sin_addr));

        result=getnameinfo((struct sockaddr *)&sa,
            sizeof (sa),hostinfo,NI_MAXHOST,NULL,0,0);
        printf("CLIENT: ip=[%s] hostinfo=[%s] result=%d wsreturn=%d\n", argv[1],hostinfo,result,wsreturn);

        return 0;

    void usage() {
        printf("gethostname  <IP>\nz.B. gethostname\n"),exit(1);

    Using it, gives the following result:

    C:\>gethostname                  ... a few (10) seconds of waiting here

    CLIENT: ip=[] hostinfo=[] result=0 wsreturn=0

    Without the patch

    C:\>gethostname                  ... no waiting here, immediate return

    CLIENT: ip=[] hostinfo=[some.host.domain] result=0 wsreturn=0

    After a while the behaviour changed again to that of the situation without the patch.


    Christoph Kukulies

    • Moved by Just Karl Thursday, December 28, 2017 2:50 PM Looking for the correct forum
    Wednesday, December 13, 2017 4:07 PM


All replies

  • Hello,

    The MSDN, TechNet and Expression Library Feedback forum is to "Help improve the Library Experience in MSDN, TechNet and Expression by providing feedback on features, bugs, look and feel or by just providing suggestions". This is not a support forum.

    As it's off-topic here, I am moving the question to the Where is the forum for... forum.


    Thursday, December 28, 2017 2:43 PM
  • Hello,

    Please ask in the proper language forum in the Visual Studio Languages forums on MSDN.


    Thursday, December 28, 2017 2:50 PM