[PATCH 2/3] ws2_32: Implement get socket option SO_PROTOCOL_INFO (try 3)
Bruno Jesus
00cpxxx at gmail.com
Fri Sep 6 07:38:35 CDT 2013
On Fri, Sep 6, 2013 at 7:16 AM, Alexandre Julliard <julliard at winehq.org> wrote:
> Bruno Jesus <00cpxxx at gmail.com> writes:
>
>> +static int ws_protocol_info(SOCKET s, int unicode, WSAPROTOCOL_INFOW *buffer)
>> +{
>> + int size;
>> + union _info
>> + {
>> + WSAPROTOCOL_INFOA *a;
>> + WSAPROTOCOL_INFOW *w;
>> + } info;
>> + info.w = buffer;
>> +
>> + size = unicode ? sizeof(WSAPROTOCOL_INFOW) : sizeof(WSAPROTOCOL_INFOA);
>> + memset(buffer, 0, size);
>> + info.w->iAddressFamily = WS_AF_UNSPEC;
>> +
>> + SERVER_START_REQ( get_socket_info )
>> + {
>> + req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
>> + wine_server_call( req );
>> + info.w->iAddressFamily = convert_af_u2w(reply->family);
>> + info.w->iSocketType = convert_socktype_u2w(reply->type);
>> + info.w->iProtocol = convert_proto_u2w(reply->protocol);
>> + }
>> + SERVER_END_REQ;
>
> You need to check the server return status and set the correct error
> code.
Thank you for the review, I guess I based my call in the wrong example
from socket.c. Some calls there don't check the return like:
http://source.winehq.org/source/dlls/ws2_32/socket.c#L805
http://source.winehq.org/source/dlls/ws2_32/socket.c#L831
http://source.winehq.org/source/dlls/ws2_32/socket.c#L854
I'll take a better look in the weekend.
> --
> Alexandre Julliard
> julliard at winehq.org
Regards,
Bruno
More information about the wine-devel
mailing list