[Xcb] [PATCH 3/3] Use WSAStartup()/WSACleanup() on WIN32

Josh Triplett josh at joshtriplett.org
Thu Jan 5 19:36:32 PST 2012


On Thu, Jan 05, 2012 at 11:55:30PM +0200, Rémi Denis-Courmont wrote:
> Le jeudi 5 janvier 2012 23:28:06 Josh Triplett, vous avez écrit :
> > What happens if the application using XCB has already called WSAStartup,
> > and passes a lower version number than 2.2?
> 
> If the sockets library does not support version 2.2, WSAStartup() will fail. 
> Then XCB should either fail, or try to negotiate another usable version with 
> the library.

I meant the case where the sockets library supports 2.2 but the
application using libxcb calls WSAStartup with a version number lower
than 2.2.

> > Will XCB's call to WSAStartup cause Winsock to start assuming 2.2
> > semantics instead of whatever older semantics the application requested?
> 
> The new semantics would be new functions or parameters that a Winsock 1.1 
> should not be using in the first place. Unless the application is buggy, this 
> cannot be a problem.

That sounds plausible.

> > Or will Winsock just tell XCB to use the older version?
> 
> If the version requested by XCB is not supported, WSAStartup() will fail. Note 
> that there is a bug in the patch: XCB should never call WSACleanup() if 
> WSAStartup() did not succeed.

I don't see how that case could happen in the patch you provided.

> > In the latter case, can XCB live with that?
> 
> Someone could check if XCB can live with Winsock 1.1. However, support for 
> versions of Windows without Winsock 1.x has ceased many years ago. So most 
> probably nobody cares.

Again, I meant the case with Winsock 2.2 but an application which
requests the semantics of an older version.

- Josh Triplett


More information about the Xcb mailing list