ReactOS  0.4.14-dev-358-gbef841c
windowsize.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS API Tests
3  * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE: Test for AFD_INFO_RECEIVE_WINDOW_SIZE/AFD_INFO_SEND_WINDOW_SIZE
5  * COPYRIGHT: Copyright 2019 Pierre Schweitzer (pierre@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 static
11 void
12 TestTcp(void)
13 {
15  HANDLE SocketHandle;
16  struct sockaddr_in addr;
17  ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize;
18 
20  ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status);
21 
22  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL);
23  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
24  ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize);
25  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL);
26  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
27  ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize);
28 
29  ReceiveSize = 0;
30  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
31  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
32  SendSize = 0;
33  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
34  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
35 
36  ReceiveSize = (ULONG)-1L;
37  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
38  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
39  SendSize = (ULONG)-1L;
40  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
41  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
42 
43  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
44  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
45  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
46  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
47  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
48  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
49 
50  ReceiveSize = OrigReceiveSize;
51  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
52  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
53  SendSize = OrigSendSize;
54  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
55  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
56 
57  memset(&addr, 0, sizeof(addr));
58  addr.sin_family = AF_INET;
59  addr.sin_addr.s_addr = inet_addr("0.0.0.0");
60  addr.sin_port = htons(0);
61 
62  Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
63  ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status);
64 
65  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
66  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
67  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
68  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
69  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
70  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
71 
72  ReceiveSize = 0;
73  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
74  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
75  SendSize = 0;
76  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
77  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
78 
79  ReceiveSize = (ULONG)-1L;
80  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
81  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
82  SendSize = (ULONG)-1L;
83  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
84  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
85 
86  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
87  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
88  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
89  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
90  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
91  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
92 
93  ReceiveSize = OrigReceiveSize;
94  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
95  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
96  SendSize = OrigSendSize;
97  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
98  ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status);
99 
100  memset(&addr, 0, sizeof(addr));
101  addr.sin_family = AF_INET;
102  addr.sin_addr.s_addr = inet_addr("8.8.8.8");
103  addr.sin_port = htons(53);
104 
105  Status = AfdConnect(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
106  ok(Status == STATUS_SUCCESS, "AfdConnect failed with %lx\n", Status);
107 
108  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
109  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
110  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
111  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
112  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
113  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
114 
115  ReceiveSize = 0;
116  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
117  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
118  SendSize = 0;
119  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
120  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
121 
122  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
123  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
124  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
125  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
126  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
127  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
128 
129  ReceiveSize = (ULONG)-1L;
130  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
131  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
132  SendSize = (ULONG)-1L;
133  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
134  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
135 
136  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
137  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
138  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
139  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
140  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
141  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
142 
143  ReceiveSize = OrigReceiveSize + 1;
144  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
145  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
146  SendSize = OrigSendSize + 1;
147  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
148  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
149 
150  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
151  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
152  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
153  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
154  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
155  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
156 
157  ReceiveSize = OrigReceiveSize - 1;
158  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
159  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
160  SendSize = OrigSendSize - 1;
161  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
162  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
163 
164  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
165  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
166  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
167  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
168  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
169  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
170 
171  NtClose(SocketHandle);
172 }
173 
174 static
175 void
176 TestUdp(void)
177 {
179  HANDLE SocketHandle;
180  struct sockaddr_in addr;
181  ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize;
182 
184  ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status);
185 
186  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL);
187  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
188  ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize);
189  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL);
190  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
191  ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize);
192 
193  ReceiveSize = 0;
194  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
195  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
196  SendSize = 0;
197  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
198  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
199 
200  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
201  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
202  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
203  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
204  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
205  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
206 
207  ReceiveSize = (ULONG)-1L;
208  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
209  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
210  SendSize = (ULONG)-1L;
211  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
212  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
213 
214  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
215  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
216  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
217  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
218  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
219  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
220 
221  ReceiveSize = OrigReceiveSize;
222  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
223  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
224  SendSize = OrigSendSize;
225  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
226  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
227 
228  memset(&addr, 0, sizeof(addr));
229  addr.sin_family = AF_INET;
230  addr.sin_addr.s_addr = inet_addr("0.0.0.0");
231  addr.sin_port = htons(0);
232 
233  Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr));
234  ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status);
235 
236  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
237  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
238  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
239  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
240  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
241  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
242 
243  ReceiveSize = 0;
244  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
245  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
246  SendSize = 0;
247  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
248  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
249 
250  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
251  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
252  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
253  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
254  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
255  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
256 
257  ReceiveSize = (ULONG)-1L;
258  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
259  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
260  SendSize = (ULONG)-1L;
261  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
262  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
263 
264  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
265  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
266  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
267  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
268  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
269  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
270 
271  ReceiveSize = OrigReceiveSize + 1;
272  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
273  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
274  SendSize = OrigSendSize + 1;
275  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
276  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
277 
278  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
279  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
280  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
281  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
282  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
283  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
284 
285  ReceiveSize = OrigReceiveSize - 1;
286  Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
287  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
288  SendSize = OrigSendSize - 1;
289  Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
290  ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status);
291 
292  Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL);
293  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
294  ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize);
295  Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL);
296  ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status);
297  ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize);
298 
299  NtClose(SocketHandle);
300 }
301 
302 START_TEST(windowsize)
303 {
304  TestTcp();
305  TestUdp();
306 }
START_TEST(windowsize)
Definition: windowsize.c:302
#define inet_addr(cp)
Definition: inet.h:98
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
static void TestTcp(void)
Definition: windowsize.c:12
#define AFD_INFO_SEND_WINDOW_SIZE
Definition: shared.h:186
NTSTATUS AfdBind(_In_ HANDLE SocketHandle, _In_ const struct sockaddr *Address, _In_ ULONG AddressLength)
Definition: AfdHelpers.c:134
NTSTATUS AfdGetInformation(_In_ HANDLE SocketHandle, _In_ ULONG InformationClass, _In_opt_ PBOOLEAN Boolean, _In_opt_ PULONG Ulong, _In_opt_ PLARGE_INTEGER LargeInteger)
Definition: AfdHelpers.c:447
static NTSTATUS NTAPI AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: main.c:302
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
NTSTATUS AfdConnect(_In_ HANDLE SocketHandle, _In_ const struct sockaddr *Address, _In_ ULONG AddressLength)
Definition: AfdHelpers.c:197
GLenum const GLvoid * addr
Definition: glext.h:9621
NTSTATUS AfdSetInformation(_In_ HANDLE SocketHandle, _In_ ULONG InformationClass, _In_opt_ PBOOLEAN Boolean, _In_opt_ PULONG Ulong, _In_opt_ PLARGE_INTEGER LargeInteger)
Definition: AfdHelpers.c:388
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define AFD_INFO_RECEIVE_WINDOW_SIZE
Definition: shared.h:185
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
#define AF_INET
Definition: tcpip.h:117
static void TestUdp(void)
Definition: windowsize.c:176
#define SOCK_STREAM
Definition: tcpip.h:118
#define htons(x)
Definition: module.h:213
#define SOCK_DGRAM
Definition: winsock.h:336
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define memset(x, y, z)
Definition: compat.h:39