Re: Can a windows DLL have more than one process attached? - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Can a windows DLL have more than one process attached?
Date
Msg-id 176.1006908011@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can a windows DLL have more than one process attached?  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-interfaces
Actually, the more I look at this, the more broken it looks.

(1) netmsgModule and winsock_strerror_buf are declared as static
variables in libpq/win32.h.  Unless Windows has some truly creative new
interpretation of static variables, this means that there'll be a
separate instance of these vars in each .c file that #includes win32.h.
Wasting half a K of space per .c file is the least of the consequences.

(2) Since libpqdll.c and fe-misc.c don't share the same instance of
netmsgModule, winsock_strerror will always see it as NULL regardless
of what DllMain has done or not done.

(3) Even if winsock_strerror saw netmsgModule, it doesn't pass it to
FormatMessage, which means (if I'm reading the documentation I found on
the net correctly) that the wrong message table would be searched.
I think that the "0" parameter should be netmsgModule instead.

Have we got any people who actually know the Windows platform and
can confirm or deny these points?

I'd be happy to change the code to something that looks reasonable to
me, but I'm in no position to test it.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: ODBC driver with dynamic cursor support ??
Next
From: "Magnus Hagander"
Date:
Subject: Re: Can a windows DLL have more than one process attached?