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=[] result=0 wsreturn=0

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


    Christoph Kukulies

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


All replies