[AFD_APITEST] Add apitest for AFD window size options

This commit is contained in:
Pierre Schweitzer 2019-02-25 22:28:18 +01:00
parent 86483d6e22
commit 6bf5a8a43d
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
5 changed files with 450 additions and 0 deletions

View file

@ -3,6 +3,7 @@
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
* PURPOSE: Utility function definitions for calling AFD
* COPYRIGHT: Copyright 2015-2018 Thomas Faber (thomas.faber@reactos.org)
* Copyright 2019 Pierre Schweitzer (pierre@reactos.org)
*/
#include "precomp.h"
@ -382,3 +383,126 @@ AfdSendTo(
return Status;
}
NTSTATUS
AfdSetInformation(
_In_ HANDLE SocketHandle,
_In_ ULONG InformationClass,
_In_opt_ PBOOLEAN Boolean,
_In_opt_ PULONG Ulong,
_In_opt_ PLARGE_INTEGER LargeInteger)
{
NTSTATUS Status;
IO_STATUS_BLOCK IoStatus;
AFD_INFO InfoData;
HANDLE Event;
Status = NtCreateEvent(&Event,
EVENT_ALL_ACCESS,
NULL,
NotificationEvent,
FALSE);
if (!NT_SUCCESS(Status))
{
return Status;
}
InfoData.InformationClass = InformationClass;
if (Ulong != NULL)
{
InfoData.Information.Ulong = *Ulong;
}
if (LargeInteger != NULL)
{
InfoData.Information.LargeInteger = *LargeInteger;
}
if (Boolean != NULL)
{
InfoData.Information.Boolean = *Boolean;
}
Status = NtDeviceIoControlFile(SocketHandle,
Event,
NULL,
NULL,
&IoStatus,
IOCTL_AFD_SET_INFO,
&InfoData,
sizeof(InfoData),
NULL,
0);
if (Status == STATUS_PENDING)
{
NtWaitForSingleObject(Event, FALSE, NULL);
Status = IoStatus.Status;
}
NtClose(Event);
return Status;
}
NTSTATUS
AfdGetInformation(
_In_ HANDLE SocketHandle,
_In_ ULONG InformationClass,
_In_opt_ PBOOLEAN Boolean,
_In_opt_ PULONG Ulong,
_In_opt_ PLARGE_INTEGER LargeInteger)
{
NTSTATUS Status;
IO_STATUS_BLOCK IoStatus;
AFD_INFO InfoData;
HANDLE Event;
Status = NtCreateEvent(&Event,
EVENT_ALL_ACCESS,
NULL,
NotificationEvent,
FALSE);
if (!NT_SUCCESS(Status))
{
return Status;
}
InfoData.InformationClass = InformationClass;
Status = NtDeviceIoControlFile(SocketHandle,
Event,
NULL,
NULL,
&IoStatus,
IOCTL_AFD_GET_INFO,
&InfoData,
sizeof(InfoData),
&InfoData,
sizeof(InfoData));
if (Status == STATUS_PENDING)
{
NtWaitForSingleObject(Event, FALSE, NULL);
Status = IoStatus.Status;
}
NtClose(Event);
if (Status != STATUS_SUCCESS)
{
return Status;
}
if (Ulong != NULL)
{
*Ulong = InfoData.Information.Ulong;
}
if (LargeInteger != NULL)
{
*LargeInteger = InfoData.Information.LargeInteger;
}
if (Boolean != NULL)
{
*Boolean = InfoData.Information.Boolean;
}
return Status;
}

View file

@ -3,6 +3,7 @@
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
* PURPOSE: Utility function declarations for calling AFD
* COPYRIGHT: Copyright 2015 Thomas Faber (thomas.faber@reactos.org)
* Copyright 2019 Pierre Schweitzer (pierre@reactos.org)
*/
#pragma once
@ -39,3 +40,19 @@ AfdSendTo(
_In_ ULONG BufferLength,
_In_ const struct sockaddr *Address,
_In_ ULONG AddressLength);
NTSTATUS
AfdSetInformation(
_In_ HANDLE SocketHandle,
_In_ ULONG InformationClass,
_In_opt_ PBOOLEAN Boolean,
_In_opt_ PULONG Ulong,
_In_opt_ PLARGE_INTEGER LargeInteger);
NTSTATUS
AfdGetInformation(
_In_ HANDLE SocketHandle,
_In_ ULONG InformationClass,
_In_opt_ PBOOLEAN Boolean,
_In_opt_ PULONG Ulong,
_In_opt_ PLARGE_INTEGER LargeInteger);

View file

@ -5,6 +5,7 @@ include_directories(
list(APPEND SOURCE
AfdHelpers.c
send.c
windowsize.c
precomp.h)
add_executable(afd_apitest ${SOURCE} testlist.c)

View file

@ -2,9 +2,11 @@
#include <apitest.h>
extern void func_send(void);
extern void func_windowsize(void);
const struct test winetest_testlist[] =
{
{ "send", func_send },
{ "windowsize", func_windowsize },
{ 0, 0 }
};

View file

@ -0,0 +1,306 @@
/*
* PROJECT: ReactOS API Tests
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
* PURPOSE: Test for AFD_INFO_RECEIVE_WINDOW_SIZE/AFD_INFO_SEND_WINDOW_SIZE
* COPYRIGHT: Copyright 2019 Pierre Schweitzer (pierre@reactos.org)
*/
#include "precomp.h"
static
void
TestTcp(void)
{
NTSTATUS Status;
HANDLE SocketHandle;
struct sockaddr_in addr;
ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize;
Status = AfdCreateSocket(&SocketHandle, AF_INET, SOCK_STREAM, IPPROTO_TCP);
ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize);
ReceiveSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
ReceiveSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("0.0.0.0");
addr.sin_port = htons(0);
Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
ReceiveSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("8.8.8.8");
addr.sin_port = htons(53);
Status = AfdConnect(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
ok(Status == STATUS_SUCCESS, "AfdConnect failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize + 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize + 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize - 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize - 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
NtClose(SocketHandle);
}
static
void
TestUdp(void)
{
NTSTATUS Status;
HANDLE SocketHandle;
struct sockaddr_in addr;
ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize;
Status = AfdCreateSocket(&SocketHandle, AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize);
ReceiveSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("0.0.0.0");
addr.sin_port = htons(0);
Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = 0;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = (ULONG)-1L;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize + 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize + 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
ReceiveSize = OrigReceiveSize - 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
SendSize = OrigSendSize - 1;
Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
NtClose(SocketHandle);
}
START_TEST(windowsize)
{
TestTcp();
TestUdp();
}