ws2_32: Handle NULL proto in WSAAsyncGetServByName.
This commit is contained in:
parent
ece5d712f6
commit
70be64b2ba
|
@ -384,7 +384,7 @@ HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name,
|
|||
{
|
||||
struct async_query_getservbyname *aq;
|
||||
unsigned int len1 = strlen(name) + 1;
|
||||
unsigned int len2 = strlen(proto) + 1;
|
||||
unsigned int len2 = proto ? strlen(proto) + 1 : 0;
|
||||
|
||||
TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto));
|
||||
|
||||
|
@ -393,10 +393,18 @@ HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name,
|
|||
SetLastError( WSAEWOULDBLOCK );
|
||||
return 0;
|
||||
}
|
||||
|
||||
aq->serv_name = (char *)(aq + 1);
|
||||
aq->serv_proto = aq->serv_name + len1;
|
||||
strcpy( aq->serv_name, name );
|
||||
|
||||
if (proto)
|
||||
{
|
||||
aq->serv_proto = aq->serv_name + len1;
|
||||
strcpy( aq->serv_proto, proto );
|
||||
}
|
||||
else
|
||||
aq->serv_proto = NULL;
|
||||
|
||||
return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen );
|
||||
}
|
||||
|
||||
|
|
|
@ -5203,6 +5203,33 @@ static void test_WSAAsyncGetServByPort(void)
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_WSAAsyncGetServByName(void)
|
||||
{
|
||||
HWND hwnd = create_async_message_window();
|
||||
HANDLE ret;
|
||||
char buffer[MAXGETHOSTSTRUCT];
|
||||
|
||||
if (!hwnd)
|
||||
return;
|
||||
|
||||
/* FIXME: The asynchronous window messages should be tested. */
|
||||
|
||||
/* Parameters are not checked when initiating the asynchronous operation. */
|
||||
ret = WSAAsyncGetServByName(hwnd, WM_ASYNCCOMPLETE, "", NULL, NULL, 0);
|
||||
ok(ret != NULL, "WSAAsyncGetServByName returned NULL\n");
|
||||
|
||||
ret = WSAAsyncGetServByName(hwnd, WM_ASYNCCOMPLETE, "", "", buffer, MAXGETHOSTSTRUCT);
|
||||
ok(ret != NULL, "WSAAsyncGetServByName returned NULL\n");
|
||||
|
||||
ret = WSAAsyncGetServByName(hwnd, WM_ASYNCCOMPLETE, "http", NULL, NULL, 0);
|
||||
ok(ret != NULL, "WSAAsyncGetServByName returned NULL\n");
|
||||
|
||||
ret = WSAAsyncGetServByName(hwnd, WM_ASYNCCOMPLETE, "http", "tcp", buffer, MAXGETHOSTSTRUCT);
|
||||
ok(ret != NULL, "WSAAsyncGetServByName returned NULL\n");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_completion_port(void)
|
||||
{
|
||||
HANDLE previous_port, io_port;
|
||||
|
@ -5770,6 +5797,7 @@ START_TEST( sock )
|
|||
test_sioRoutingInterfaceQuery();
|
||||
|
||||
test_WSAAsyncGetServByPort();
|
||||
test_WSAAsyncGetServByName();
|
||||
|
||||
test_completion_port();
|
||||
|
||||
|
|
Loading…
Reference in New Issue