[Zlib-devel] zlib 1.2.4 released!

William A. Rowe Jr. wrowe at rowe-clan.net
Thu Mar 18 01:37:24 EDT 2010


On 3/17/2010 11:56 PM, John Bowler wrote:
> From: William A. Rowe Jr. [mailto:wrowe at rowe-clan.net] 
>> Yes, it is a CRT object.  The fd is an index to an array of crt structs of which
>> HFILE is but one member.  Remember 'fd's support several posix modalities which
>> aren't part of the Win32 API, so more context is required.
> 
> You are correct,  the program at the end verifies this and shows (as well, when LIBTEST is 1) that the multiple-CRT environment breaks gzdopen.  In both cases the first 'write' within gz_comp in gzwrite.c fails with the msg "Bad file descriptor".  In the OS (CreateFile) case the fd value is an OS HANDLE, nominally void* but actually also a small integer (48 or 52 in my test cases), in the LIBTEST case the fd is 3 - apaprently not POSIX compliant (since it is apparently per-CRT).
> 
> I generated the LIBTEST break by compiling with Visual Studio 2010 (msvcr100) but linking against your (MSVCRT) zdll.lib and using your zlib1.dll to test.

Sweet!

A much simpler test is to examine the CRT :)  (see internal.h);

/*
 * Control structure for lowio file handles
 */
typedef struct {
        long osfhnd;    /* underlying OS file HANDLE */
        char osfile;    /* attributes of file (e.g., open in text mode?) */
        char pipech;    /* one char buffer for handles opened on pipes */
#ifdef _MT
        int lockinitflag;
        CRITICAL_SECTION lock;
#endif  /* _MT */
    }   ioinfo;

/*






More information about the Zlib-devel mailing list