ws2_32: Partial implementation of TransmitFile/TransmitPackets

Alexandre Julliard julliard at winehq.org
Tue Jul 8 05:17:06 CDT 2008


Jon Griffiths <jon_p_griffiths at yahoo.com> writes:

> +            while (send_len)
> +            {
> +                wsabuf.len = send_len;
> +                if (wsabuf.len > chunk_len)
> +                    wsabuf.len = chunk_len;
> +                if (!ReadFile(packet->u.s.hFile, wsabuf.buf, wsabuf.len, NULL, NULL) ||
> +                    WSASendTo(s, &wsabuf, 1, &n, 0, NULL, 0, NULL, NULL) == SOCKET_ERROR)
> +                    goto TransmitPackets_fail;

Both ReadFile and WSASendTo will return the number of bytes
read/written, you need to take that into account.

> +                if (WSASendTo(s, &wsabuf, 1, &n, 0, NULL, 0, NULL, NULL) == SOCKET_ERROR)
> +                    goto TransmitPackets_fail;
> +                send_len -= wsabuf.len;
> +                wsabuf.buf += wsabuf.len;

Same here.

> +        packet->cLength = total_len;
> +        /* FIXME: I'm not certain we should always use the current file
> +         * position (rather than the start of the file), though it works
> +         * for mapache.exe.
> +         */

Some test cases would be a good idea.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list