1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(_overlapped_CreateIoCompletionPort__doc__,
6 "CreateIoCompletionPort($module, handle, port, key, concurrency, /)\n"
7 "--\n"
8 "\n"
9 "Create a completion port or register a handle with a port.");
10
11 #define _OVERLAPPED_CREATEIOCOMPLETIONPORT_METHODDEF \
12 {"CreateIoCompletionPort", (PyCFunction)(void(*)(void))_overlapped_CreateIoCompletionPort, METH_FASTCALL, _overlapped_CreateIoCompletionPort__doc__},
13
14 static PyObject *
15 _overlapped_CreateIoCompletionPort_impl(PyObject *module, HANDLE FileHandle,
16 HANDLE ExistingCompletionPort,
17 ULONG_PTR CompletionKey,
18 DWORD NumberOfConcurrentThreads);
19
20 static PyObject *
_overlapped_CreateIoCompletionPort(PyObject * module,PyObject * const * args,Py_ssize_t nargs)21 _overlapped_CreateIoCompletionPort(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
22 {
23 PyObject *return_value = NULL;
24 HANDLE FileHandle;
25 HANDLE ExistingCompletionPort;
26 ULONG_PTR CompletionKey;
27 DWORD NumberOfConcurrentThreads;
28
29 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE""F_ULONG_PTR"k:CreateIoCompletionPort",
30 &FileHandle, &ExistingCompletionPort, &CompletionKey, &NumberOfConcurrentThreads)) {
31 goto exit;
32 }
33 return_value = _overlapped_CreateIoCompletionPort_impl(module, FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads);
34
35 exit:
36 return return_value;
37 }
38
39 PyDoc_STRVAR(_overlapped_GetQueuedCompletionStatus__doc__,
40 "GetQueuedCompletionStatus($module, port, msecs, /)\n"
41 "--\n"
42 "\n"
43 "Get a message from completion port.\n"
44 "\n"
45 "Wait for up to msecs milliseconds.");
46
47 #define _OVERLAPPED_GETQUEUEDCOMPLETIONSTATUS_METHODDEF \
48 {"GetQueuedCompletionStatus", (PyCFunction)(void(*)(void))_overlapped_GetQueuedCompletionStatus, METH_FASTCALL, _overlapped_GetQueuedCompletionStatus__doc__},
49
50 static PyObject *
51 _overlapped_GetQueuedCompletionStatus_impl(PyObject *module,
52 HANDLE CompletionPort,
53 DWORD Milliseconds);
54
55 static PyObject *
_overlapped_GetQueuedCompletionStatus(PyObject * module,PyObject * const * args,Py_ssize_t nargs)56 _overlapped_GetQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
57 {
58 PyObject *return_value = NULL;
59 HANDLE CompletionPort;
60 DWORD Milliseconds;
61
62 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:GetQueuedCompletionStatus",
63 &CompletionPort, &Milliseconds)) {
64 goto exit;
65 }
66 return_value = _overlapped_GetQueuedCompletionStatus_impl(module, CompletionPort, Milliseconds);
67
68 exit:
69 return return_value;
70 }
71
72 PyDoc_STRVAR(_overlapped_PostQueuedCompletionStatus__doc__,
73 "PostQueuedCompletionStatus($module, port, bytes, key, address, /)\n"
74 "--\n"
75 "\n"
76 "Post a message to completion port.");
77
78 #define _OVERLAPPED_POSTQUEUEDCOMPLETIONSTATUS_METHODDEF \
79 {"PostQueuedCompletionStatus", (PyCFunction)(void(*)(void))_overlapped_PostQueuedCompletionStatus, METH_FASTCALL, _overlapped_PostQueuedCompletionStatus__doc__},
80
81 static PyObject *
82 _overlapped_PostQueuedCompletionStatus_impl(PyObject *module,
83 HANDLE CompletionPort,
84 DWORD NumberOfBytes,
85 ULONG_PTR CompletionKey,
86 OVERLAPPED *Overlapped);
87
88 static PyObject *
_overlapped_PostQueuedCompletionStatus(PyObject * module,PyObject * const * args,Py_ssize_t nargs)89 _overlapped_PostQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
90 {
91 PyObject *return_value = NULL;
92 HANDLE CompletionPort;
93 DWORD NumberOfBytes;
94 ULONG_PTR CompletionKey;
95 OVERLAPPED *Overlapped;
96
97 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k"F_ULONG_PTR""F_POINTER":PostQueuedCompletionStatus",
98 &CompletionPort, &NumberOfBytes, &CompletionKey, &Overlapped)) {
99 goto exit;
100 }
101 return_value = _overlapped_PostQueuedCompletionStatus_impl(module, CompletionPort, NumberOfBytes, CompletionKey, Overlapped);
102
103 exit:
104 return return_value;
105 }
106
107 PyDoc_STRVAR(_overlapped_RegisterWaitWithQueue__doc__,
108 "RegisterWaitWithQueue($module, Object, CompletionPort, Overlapped,\n"
109 " Timeout, /)\n"
110 "--\n"
111 "\n"
112 "Register wait for Object; when complete CompletionPort is notified.");
113
114 #define _OVERLAPPED_REGISTERWAITWITHQUEUE_METHODDEF \
115 {"RegisterWaitWithQueue", (PyCFunction)(void(*)(void))_overlapped_RegisterWaitWithQueue, METH_FASTCALL, _overlapped_RegisterWaitWithQueue__doc__},
116
117 static PyObject *
118 _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
119 HANDLE CompletionPort,
120 OVERLAPPED *Overlapped,
121 DWORD Milliseconds);
122
123 static PyObject *
_overlapped_RegisterWaitWithQueue(PyObject * module,PyObject * const * args,Py_ssize_t nargs)124 _overlapped_RegisterWaitWithQueue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
125 {
126 PyObject *return_value = NULL;
127 HANDLE Object;
128 HANDLE CompletionPort;
129 OVERLAPPED *Overlapped;
130 DWORD Milliseconds;
131
132 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE""F_POINTER"k:RegisterWaitWithQueue",
133 &Object, &CompletionPort, &Overlapped, &Milliseconds)) {
134 goto exit;
135 }
136 return_value = _overlapped_RegisterWaitWithQueue_impl(module, Object, CompletionPort, Overlapped, Milliseconds);
137
138 exit:
139 return return_value;
140 }
141
142 PyDoc_STRVAR(_overlapped_UnregisterWait__doc__,
143 "UnregisterWait($module, WaitHandle, /)\n"
144 "--\n"
145 "\n"
146 "Unregister wait handle.");
147
148 #define _OVERLAPPED_UNREGISTERWAIT_METHODDEF \
149 {"UnregisterWait", (PyCFunction)_overlapped_UnregisterWait, METH_O, _overlapped_UnregisterWait__doc__},
150
151 static PyObject *
152 _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle);
153
154 static PyObject *
_overlapped_UnregisterWait(PyObject * module,PyObject * arg)155 _overlapped_UnregisterWait(PyObject *module, PyObject *arg)
156 {
157 PyObject *return_value = NULL;
158 HANDLE WaitHandle;
159
160 if (!PyArg_Parse(arg, ""F_HANDLE":UnregisterWait", &WaitHandle)) {
161 goto exit;
162 }
163 return_value = _overlapped_UnregisterWait_impl(module, WaitHandle);
164
165 exit:
166 return return_value;
167 }
168
169 PyDoc_STRVAR(_overlapped_UnregisterWaitEx__doc__,
170 "UnregisterWaitEx($module, WaitHandle, Event, /)\n"
171 "--\n"
172 "\n"
173 "Unregister wait handle.");
174
175 #define _OVERLAPPED_UNREGISTERWAITEX_METHODDEF \
176 {"UnregisterWaitEx", (PyCFunction)(void(*)(void))_overlapped_UnregisterWaitEx, METH_FASTCALL, _overlapped_UnregisterWaitEx__doc__},
177
178 static PyObject *
179 _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
180 HANDLE Event);
181
182 static PyObject *
_overlapped_UnregisterWaitEx(PyObject * module,PyObject * const * args,Py_ssize_t nargs)183 _overlapped_UnregisterWaitEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
184 {
185 PyObject *return_value = NULL;
186 HANDLE WaitHandle;
187 HANDLE Event;
188
189 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE":UnregisterWaitEx",
190 &WaitHandle, &Event)) {
191 goto exit;
192 }
193 return_value = _overlapped_UnregisterWaitEx_impl(module, WaitHandle, Event);
194
195 exit:
196 return return_value;
197 }
198
199 PyDoc_STRVAR(_overlapped_CreateEvent__doc__,
200 "CreateEvent($module, EventAttributes, ManualReset, InitialState, Name,\n"
201 " /)\n"
202 "--\n"
203 "\n"
204 "Create an event.\n"
205 "\n"
206 "EventAttributes must be None.");
207
208 #define _OVERLAPPED_CREATEEVENT_METHODDEF \
209 {"CreateEvent", (PyCFunction)(void(*)(void))_overlapped_CreateEvent, METH_FASTCALL, _overlapped_CreateEvent__doc__},
210
211 static PyObject *
212 _overlapped_CreateEvent_impl(PyObject *module, PyObject *EventAttributes,
213 BOOL ManualReset, BOOL InitialState,
214 const Py_UNICODE *Name);
215
216 static PyObject *
_overlapped_CreateEvent(PyObject * module,PyObject * const * args,Py_ssize_t nargs)217 _overlapped_CreateEvent(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
218 {
219 PyObject *return_value = NULL;
220 PyObject *EventAttributes;
221 BOOL ManualReset;
222 BOOL InitialState;
223 const Py_UNICODE *Name;
224
225 if (!_PyArg_ParseStack(args, nargs, "OiiO&:CreateEvent",
226 &EventAttributes, &ManualReset, &InitialState, _PyUnicode_WideCharString_Opt_Converter, &Name)) {
227 goto exit;
228 }
229 return_value = _overlapped_CreateEvent_impl(module, EventAttributes, ManualReset, InitialState, Name);
230
231 exit:
232 /* Cleanup for Name */
233 #if !USE_UNICODE_WCHAR_CACHE
234 PyMem_Free((void *)Name);
235 #endif /* USE_UNICODE_WCHAR_CACHE */
236
237 return return_value;
238 }
239
240 PyDoc_STRVAR(_overlapped_SetEvent__doc__,
241 "SetEvent($module, Handle, /)\n"
242 "--\n"
243 "\n"
244 "Set event.");
245
246 #define _OVERLAPPED_SETEVENT_METHODDEF \
247 {"SetEvent", (PyCFunction)_overlapped_SetEvent, METH_O, _overlapped_SetEvent__doc__},
248
249 static PyObject *
250 _overlapped_SetEvent_impl(PyObject *module, HANDLE Handle);
251
252 static PyObject *
_overlapped_SetEvent(PyObject * module,PyObject * arg)253 _overlapped_SetEvent(PyObject *module, PyObject *arg)
254 {
255 PyObject *return_value = NULL;
256 HANDLE Handle;
257
258 if (!PyArg_Parse(arg, ""F_HANDLE":SetEvent", &Handle)) {
259 goto exit;
260 }
261 return_value = _overlapped_SetEvent_impl(module, Handle);
262
263 exit:
264 return return_value;
265 }
266
267 PyDoc_STRVAR(_overlapped_ResetEvent__doc__,
268 "ResetEvent($module, Handle, /)\n"
269 "--\n"
270 "\n"
271 "Reset event.");
272
273 #define _OVERLAPPED_RESETEVENT_METHODDEF \
274 {"ResetEvent", (PyCFunction)_overlapped_ResetEvent, METH_O, _overlapped_ResetEvent__doc__},
275
276 static PyObject *
277 _overlapped_ResetEvent_impl(PyObject *module, HANDLE Handle);
278
279 static PyObject *
_overlapped_ResetEvent(PyObject * module,PyObject * arg)280 _overlapped_ResetEvent(PyObject *module, PyObject *arg)
281 {
282 PyObject *return_value = NULL;
283 HANDLE Handle;
284
285 if (!PyArg_Parse(arg, ""F_HANDLE":ResetEvent", &Handle)) {
286 goto exit;
287 }
288 return_value = _overlapped_ResetEvent_impl(module, Handle);
289
290 exit:
291 return return_value;
292 }
293
294 PyDoc_STRVAR(_overlapped_BindLocal__doc__,
295 "BindLocal($module, handle, family, /)\n"
296 "--\n"
297 "\n"
298 "Bind a socket handle to an arbitrary local port.\n"
299 "\n"
300 "family should be AF_INET or AF_INET6.");
301
302 #define _OVERLAPPED_BINDLOCAL_METHODDEF \
303 {"BindLocal", (PyCFunction)(void(*)(void))_overlapped_BindLocal, METH_FASTCALL, _overlapped_BindLocal__doc__},
304
305 static PyObject *
306 _overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family);
307
308 static PyObject *
_overlapped_BindLocal(PyObject * module,PyObject * const * args,Py_ssize_t nargs)309 _overlapped_BindLocal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
310 {
311 PyObject *return_value = NULL;
312 HANDLE Socket;
313 int Family;
314
315 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"i:BindLocal",
316 &Socket, &Family)) {
317 goto exit;
318 }
319 return_value = _overlapped_BindLocal_impl(module, Socket, Family);
320
321 exit:
322 return return_value;
323 }
324
325 PyDoc_STRVAR(_overlapped_FormatMessage__doc__,
326 "FormatMessage($module, error_code, /)\n"
327 "--\n"
328 "\n"
329 "Return error message for an error code.");
330
331 #define _OVERLAPPED_FORMATMESSAGE_METHODDEF \
332 {"FormatMessage", (PyCFunction)_overlapped_FormatMessage, METH_O, _overlapped_FormatMessage__doc__},
333
334 static PyObject *
335 _overlapped_FormatMessage_impl(PyObject *module, DWORD code);
336
337 static PyObject *
_overlapped_FormatMessage(PyObject * module,PyObject * arg)338 _overlapped_FormatMessage(PyObject *module, PyObject *arg)
339 {
340 PyObject *return_value = NULL;
341 DWORD code;
342
343 if (!PyArg_Parse(arg, "k:FormatMessage", &code)) {
344 goto exit;
345 }
346 return_value = _overlapped_FormatMessage_impl(module, code);
347
348 exit:
349 return return_value;
350 }
351
352 PyDoc_STRVAR(_overlapped_Overlapped__doc__,
353 "Overlapped(event=_overlapped.INVALID_HANDLE_VALUE)\n"
354 "--\n"
355 "\n"
356 "OVERLAPPED structure wrapper.");
357
358 static PyObject *
359 _overlapped_Overlapped_impl(PyTypeObject *type, HANDLE event);
360
361 static PyObject *
_overlapped_Overlapped(PyTypeObject * type,PyObject * args,PyObject * kwargs)362 _overlapped_Overlapped(PyTypeObject *type, PyObject *args, PyObject *kwargs)
363 {
364 PyObject *return_value = NULL;
365 static const char * const _keywords[] = {"event", NULL};
366 static _PyArg_Parser _parser = {"|"F_HANDLE":Overlapped", _keywords, 0};
367 HANDLE event = INVALID_HANDLE_VALUE;
368
369 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
370 &event)) {
371 goto exit;
372 }
373 return_value = _overlapped_Overlapped_impl(type, event);
374
375 exit:
376 return return_value;
377 }
378
379 PyDoc_STRVAR(_overlapped_Overlapped_cancel__doc__,
380 "cancel($self, /)\n"
381 "--\n"
382 "\n"
383 "Cancel overlapped operation.");
384
385 #define _OVERLAPPED_OVERLAPPED_CANCEL_METHODDEF \
386 {"cancel", (PyCFunction)_overlapped_Overlapped_cancel, METH_NOARGS, _overlapped_Overlapped_cancel__doc__},
387
388 static PyObject *
389 _overlapped_Overlapped_cancel_impl(OverlappedObject *self);
390
391 static PyObject *
_overlapped_Overlapped_cancel(OverlappedObject * self,PyObject * Py_UNUSED (ignored))392 _overlapped_Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
393 {
394 return _overlapped_Overlapped_cancel_impl(self);
395 }
396
397 PyDoc_STRVAR(_overlapped_Overlapped_getresult__doc__,
398 "getresult($self, wait=False, /)\n"
399 "--\n"
400 "\n"
401 "Retrieve result of operation.\n"
402 "\n"
403 "If wait is true then it blocks until the operation is finished. If wait\n"
404 "is false and the operation is still pending then an error is raised.");
405
406 #define _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF \
407 {"getresult", (PyCFunction)(void(*)(void))_overlapped_Overlapped_getresult, METH_FASTCALL, _overlapped_Overlapped_getresult__doc__},
408
409 static PyObject *
410 _overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait);
411
412 static PyObject *
_overlapped_Overlapped_getresult(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)413 _overlapped_Overlapped_getresult(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
414 {
415 PyObject *return_value = NULL;
416 BOOL wait = FALSE;
417
418 if (!_PyArg_ParseStack(args, nargs, "|i:getresult",
419 &wait)) {
420 goto exit;
421 }
422 return_value = _overlapped_Overlapped_getresult_impl(self, wait);
423
424 exit:
425 return return_value;
426 }
427
428 PyDoc_STRVAR(_overlapped_Overlapped_ReadFile__doc__,
429 "ReadFile($self, handle, size, /)\n"
430 "--\n"
431 "\n"
432 "Start overlapped read.");
433
434 #define _OVERLAPPED_OVERLAPPED_READFILE_METHODDEF \
435 {"ReadFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ReadFile, METH_FASTCALL, _overlapped_Overlapped_ReadFile__doc__},
436
437 static PyObject *
438 _overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle,
439 DWORD size);
440
441 static PyObject *
_overlapped_Overlapped_ReadFile(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)442 _overlapped_Overlapped_ReadFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
443 {
444 PyObject *return_value = NULL;
445 HANDLE handle;
446 DWORD size;
447
448 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:ReadFile",
449 &handle, &size)) {
450 goto exit;
451 }
452 return_value = _overlapped_Overlapped_ReadFile_impl(self, handle, size);
453
454 exit:
455 return return_value;
456 }
457
458 PyDoc_STRVAR(_overlapped_Overlapped_ReadFileInto__doc__,
459 "ReadFileInto($self, handle, buf, /)\n"
460 "--\n"
461 "\n"
462 "Start overlapped receive.");
463
464 #define _OVERLAPPED_OVERLAPPED_READFILEINTO_METHODDEF \
465 {"ReadFileInto", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ReadFileInto, METH_FASTCALL, _overlapped_Overlapped_ReadFileInto__doc__},
466
467 static PyObject *
468 _overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
469 HANDLE handle, PyObject *bufobj);
470
471 static PyObject *
_overlapped_Overlapped_ReadFileInto(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)472 _overlapped_Overlapped_ReadFileInto(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
473 {
474 PyObject *return_value = NULL;
475 HANDLE handle;
476 PyObject *bufobj;
477
478 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:ReadFileInto",
479 &handle, &bufobj)) {
480 goto exit;
481 }
482 return_value = _overlapped_Overlapped_ReadFileInto_impl(self, handle, bufobj);
483
484 exit:
485 return return_value;
486 }
487
488 PyDoc_STRVAR(_overlapped_Overlapped_WSARecv__doc__,
489 "WSARecv($self, handle, size, flags=0, /)\n"
490 "--\n"
491 "\n"
492 "Start overlapped receive.");
493
494 #define _OVERLAPPED_OVERLAPPED_WSARECV_METHODDEF \
495 {"WSARecv", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecv, METH_FASTCALL, _overlapped_Overlapped_WSARecv__doc__},
496
497 static PyObject *
498 _overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle,
499 DWORD size, DWORD flags);
500
501 static PyObject *
_overlapped_Overlapped_WSARecv(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)502 _overlapped_Overlapped_WSARecv(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
503 {
504 PyObject *return_value = NULL;
505 HANDLE handle;
506 DWORD size;
507 DWORD flags = 0;
508
509 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k|k:WSARecv",
510 &handle, &size, &flags)) {
511 goto exit;
512 }
513 return_value = _overlapped_Overlapped_WSARecv_impl(self, handle, size, flags);
514
515 exit:
516 return return_value;
517 }
518
519 PyDoc_STRVAR(_overlapped_Overlapped_WSARecvInto__doc__,
520 "WSARecvInto($self, handle, buf, flags, /)\n"
521 "--\n"
522 "\n"
523 "Start overlapped receive.");
524
525 #define _OVERLAPPED_OVERLAPPED_WSARECVINTO_METHODDEF \
526 {"WSARecvInto", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecvInto, METH_FASTCALL, _overlapped_Overlapped_WSARecvInto__doc__},
527
528 static PyObject *
529 _overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
530 HANDLE handle, PyObject *bufobj,
531 DWORD flags);
532
533 static PyObject *
_overlapped_Overlapped_WSARecvInto(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)534 _overlapped_Overlapped_WSARecvInto(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
535 {
536 PyObject *return_value = NULL;
537 HANDLE handle;
538 PyObject *bufobj;
539 DWORD flags;
540
541 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSARecvInto",
542 &handle, &bufobj, &flags)) {
543 goto exit;
544 }
545 return_value = _overlapped_Overlapped_WSARecvInto_impl(self, handle, bufobj, flags);
546
547 exit:
548 return return_value;
549 }
550
551 PyDoc_STRVAR(_overlapped_Overlapped_WriteFile__doc__,
552 "WriteFile($self, handle, buf, /)\n"
553 "--\n"
554 "\n"
555 "Start overlapped write.");
556
557 #define _OVERLAPPED_OVERLAPPED_WRITEFILE_METHODDEF \
558 {"WriteFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WriteFile, METH_FASTCALL, _overlapped_Overlapped_WriteFile__doc__},
559
560 static PyObject *
561 _overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
562 PyObject *bufobj);
563
564 static PyObject *
_overlapped_Overlapped_WriteFile(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)565 _overlapped_Overlapped_WriteFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
566 {
567 PyObject *return_value = NULL;
568 HANDLE handle;
569 PyObject *bufobj;
570
571 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:WriteFile",
572 &handle, &bufobj)) {
573 goto exit;
574 }
575 return_value = _overlapped_Overlapped_WriteFile_impl(self, handle, bufobj);
576
577 exit:
578 return return_value;
579 }
580
581 PyDoc_STRVAR(_overlapped_Overlapped_WSASend__doc__,
582 "WSASend($self, handle, buf, flags, /)\n"
583 "--\n"
584 "\n"
585 "Start overlapped send.");
586
587 #define _OVERLAPPED_OVERLAPPED_WSASEND_METHODDEF \
588 {"WSASend", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSASend, METH_FASTCALL, _overlapped_Overlapped_WSASend__doc__},
589
590 static PyObject *
591 _overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
592 PyObject *bufobj, DWORD flags);
593
594 static PyObject *
_overlapped_Overlapped_WSASend(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)595 _overlapped_Overlapped_WSASend(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
596 {
597 PyObject *return_value = NULL;
598 HANDLE handle;
599 PyObject *bufobj;
600 DWORD flags;
601
602 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSASend",
603 &handle, &bufobj, &flags)) {
604 goto exit;
605 }
606 return_value = _overlapped_Overlapped_WSASend_impl(self, handle, bufobj, flags);
607
608 exit:
609 return return_value;
610 }
611
612 PyDoc_STRVAR(_overlapped_Overlapped_AcceptEx__doc__,
613 "AcceptEx($self, listen_handle, accept_handle, /)\n"
614 "--\n"
615 "\n"
616 "Start overlapped wait for client to connect.");
617
618 #define _OVERLAPPED_OVERLAPPED_ACCEPTEX_METHODDEF \
619 {"AcceptEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_AcceptEx, METH_FASTCALL, _overlapped_Overlapped_AcceptEx__doc__},
620
621 static PyObject *
622 _overlapped_Overlapped_AcceptEx_impl(OverlappedObject *self,
623 HANDLE ListenSocket,
624 HANDLE AcceptSocket);
625
626 static PyObject *
_overlapped_Overlapped_AcceptEx(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)627 _overlapped_Overlapped_AcceptEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
628 {
629 PyObject *return_value = NULL;
630 HANDLE ListenSocket;
631 HANDLE AcceptSocket;
632
633 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE":AcceptEx",
634 &ListenSocket, &AcceptSocket)) {
635 goto exit;
636 }
637 return_value = _overlapped_Overlapped_AcceptEx_impl(self, ListenSocket, AcceptSocket);
638
639 exit:
640 return return_value;
641 }
642
643 PyDoc_STRVAR(_overlapped_Overlapped_ConnectEx__doc__,
644 "ConnectEx($self, client_handle, address_as_bytes, /)\n"
645 "--\n"
646 "\n"
647 "Start overlapped connect.\n"
648 "\n"
649 "client_handle should be unbound.");
650
651 #define _OVERLAPPED_OVERLAPPED_CONNECTEX_METHODDEF \
652 {"ConnectEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_ConnectEx, METH_FASTCALL, _overlapped_Overlapped_ConnectEx__doc__},
653
654 static PyObject *
655 _overlapped_Overlapped_ConnectEx_impl(OverlappedObject *self,
656 HANDLE ConnectSocket,
657 PyObject *AddressObj);
658
659 static PyObject *
_overlapped_Overlapped_ConnectEx(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)660 _overlapped_Overlapped_ConnectEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
661 {
662 PyObject *return_value = NULL;
663 HANDLE ConnectSocket;
664 PyObject *AddressObj;
665
666 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O!:ConnectEx",
667 &ConnectSocket, &PyTuple_Type, &AddressObj)) {
668 goto exit;
669 }
670 return_value = _overlapped_Overlapped_ConnectEx_impl(self, ConnectSocket, AddressObj);
671
672 exit:
673 return return_value;
674 }
675
676 PyDoc_STRVAR(_overlapped_Overlapped_DisconnectEx__doc__,
677 "DisconnectEx($self, handle, flags, /)\n"
678 "--\n"
679 "\n");
680
681 #define _OVERLAPPED_OVERLAPPED_DISCONNECTEX_METHODDEF \
682 {"DisconnectEx", (PyCFunction)(void(*)(void))_overlapped_Overlapped_DisconnectEx, METH_FASTCALL, _overlapped_Overlapped_DisconnectEx__doc__},
683
684 static PyObject *
685 _overlapped_Overlapped_DisconnectEx_impl(OverlappedObject *self,
686 HANDLE Socket, DWORD flags);
687
688 static PyObject *
_overlapped_Overlapped_DisconnectEx(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)689 _overlapped_Overlapped_DisconnectEx(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
690 {
691 PyObject *return_value = NULL;
692 HANDLE Socket;
693 DWORD flags;
694
695 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k:DisconnectEx",
696 &Socket, &flags)) {
697 goto exit;
698 }
699 return_value = _overlapped_Overlapped_DisconnectEx_impl(self, Socket, flags);
700
701 exit:
702 return return_value;
703 }
704
705 PyDoc_STRVAR(_overlapped_Overlapped_TransmitFile__doc__,
706 "TransmitFile($self, socket, file, offset, offset_high, count_to_write,\n"
707 " count_per_send, flags, /)\n"
708 "--\n"
709 "\n"
710 "Transmit file data over a connected socket.");
711
712 #define _OVERLAPPED_OVERLAPPED_TRANSMITFILE_METHODDEF \
713 {"TransmitFile", (PyCFunction)(void(*)(void))_overlapped_Overlapped_TransmitFile, METH_FASTCALL, _overlapped_Overlapped_TransmitFile__doc__},
714
715 static PyObject *
716 _overlapped_Overlapped_TransmitFile_impl(OverlappedObject *self,
717 HANDLE Socket, HANDLE File,
718 DWORD offset, DWORD offset_high,
719 DWORD count_to_write,
720 DWORD count_per_send, DWORD flags);
721
722 static PyObject *
_overlapped_Overlapped_TransmitFile(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)723 _overlapped_Overlapped_TransmitFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
724 {
725 PyObject *return_value = NULL;
726 HANDLE Socket;
727 HANDLE File;
728 DWORD offset;
729 DWORD offset_high;
730 DWORD count_to_write;
731 DWORD count_per_send;
732 DWORD flags;
733
734 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE""F_HANDLE"kkkkk:TransmitFile",
735 &Socket, &File, &offset, &offset_high, &count_to_write, &count_per_send, &flags)) {
736 goto exit;
737 }
738 return_value = _overlapped_Overlapped_TransmitFile_impl(self, Socket, File, offset, offset_high, count_to_write, count_per_send, flags);
739
740 exit:
741 return return_value;
742 }
743
744 PyDoc_STRVAR(_overlapped_Overlapped_ConnectNamedPipe__doc__,
745 "ConnectNamedPipe($self, handle, /)\n"
746 "--\n"
747 "\n"
748 "Start overlapped wait for a client to connect.");
749
750 #define _OVERLAPPED_OVERLAPPED_CONNECTNAMEDPIPE_METHODDEF \
751 {"ConnectNamedPipe", (PyCFunction)_overlapped_Overlapped_ConnectNamedPipe, METH_O, _overlapped_Overlapped_ConnectNamedPipe__doc__},
752
753 static PyObject *
754 _overlapped_Overlapped_ConnectNamedPipe_impl(OverlappedObject *self,
755 HANDLE Pipe);
756
757 static PyObject *
_overlapped_Overlapped_ConnectNamedPipe(OverlappedObject * self,PyObject * arg)758 _overlapped_Overlapped_ConnectNamedPipe(OverlappedObject *self, PyObject *arg)
759 {
760 PyObject *return_value = NULL;
761 HANDLE Pipe;
762
763 if (!PyArg_Parse(arg, ""F_HANDLE":ConnectNamedPipe", &Pipe)) {
764 goto exit;
765 }
766 return_value = _overlapped_Overlapped_ConnectNamedPipe_impl(self, Pipe);
767
768 exit:
769 return return_value;
770 }
771
772 PyDoc_STRVAR(_overlapped_Overlapped_ConnectPipe__doc__,
773 "ConnectPipe($self, addr, /)\n"
774 "--\n"
775 "\n"
776 "Connect to the pipe for asynchronous I/O (overlapped).");
777
778 #define _OVERLAPPED_OVERLAPPED_CONNECTPIPE_METHODDEF \
779 {"ConnectPipe", (PyCFunction)_overlapped_Overlapped_ConnectPipe, METH_O, _overlapped_Overlapped_ConnectPipe__doc__},
780
781 static PyObject *
782 _overlapped_Overlapped_ConnectPipe_impl(OverlappedObject *self,
783 const Py_UNICODE *Address);
784
785 static PyObject *
_overlapped_Overlapped_ConnectPipe(OverlappedObject * self,PyObject * arg)786 _overlapped_Overlapped_ConnectPipe(OverlappedObject *self, PyObject *arg)
787 {
788 PyObject *return_value = NULL;
789 const Py_UNICODE *Address;
790
791 if (!PyUnicode_Check(arg)) {
792 _PyArg_BadArgument("ConnectPipe", "argument", "str", arg);
793 goto exit;
794 }
795 #if USE_UNICODE_WCHAR_CACHE
796 Address = _PyUnicode_AsUnicode(arg);
797 #else /* USE_UNICODE_WCHAR_CACHE */
798 Address = PyUnicode_AsWideCharString(arg, NULL);
799 #endif /* USE_UNICODE_WCHAR_CACHE */
800 if (Address == NULL) {
801 goto exit;
802 }
803 return_value = _overlapped_Overlapped_ConnectPipe_impl(self, Address);
804
805 exit:
806 /* Cleanup for Address */
807 #if !USE_UNICODE_WCHAR_CACHE
808 PyMem_Free((void *)Address);
809 #endif /* USE_UNICODE_WCHAR_CACHE */
810
811 return return_value;
812 }
813
814 PyDoc_STRVAR(_overlapped_WSAConnect__doc__,
815 "WSAConnect($module, client_handle, address_as_bytes, /)\n"
816 "--\n"
817 "\n"
818 "Bind a remote address to a connectionless (UDP) socket.");
819
820 #define _OVERLAPPED_WSACONNECT_METHODDEF \
821 {"WSAConnect", (PyCFunction)(void(*)(void))_overlapped_WSAConnect, METH_FASTCALL, _overlapped_WSAConnect__doc__},
822
823 static PyObject *
824 _overlapped_WSAConnect_impl(PyObject *module, HANDLE ConnectSocket,
825 PyObject *AddressObj);
826
827 static PyObject *
_overlapped_WSAConnect(PyObject * module,PyObject * const * args,Py_ssize_t nargs)828 _overlapped_WSAConnect(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
829 {
830 PyObject *return_value = NULL;
831 HANDLE ConnectSocket;
832 PyObject *AddressObj;
833
834 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:WSAConnect",
835 &ConnectSocket, &AddressObj)) {
836 goto exit;
837 }
838 return_value = _overlapped_WSAConnect_impl(module, ConnectSocket, AddressObj);
839
840 exit:
841 return return_value;
842 }
843
844 PyDoc_STRVAR(_overlapped_Overlapped_WSASendTo__doc__,
845 "WSASendTo($self, handle, buf, flags, address_as_bytes, /)\n"
846 "--\n"
847 "\n"
848 "Start overlapped sendto over a connectionless (UDP) socket.");
849
850 #define _OVERLAPPED_OVERLAPPED_WSASENDTO_METHODDEF \
851 {"WSASendTo", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSASendTo, METH_FASTCALL, _overlapped_Overlapped_WSASendTo__doc__},
852
853 static PyObject *
854 _overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
855 PyObject *bufobj, DWORD flags,
856 PyObject *AddressObj);
857
858 static PyObject *
_overlapped_Overlapped_WSASendTo(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)859 _overlapped_Overlapped_WSASendTo(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
860 {
861 PyObject *return_value = NULL;
862 HANDLE handle;
863 PyObject *bufobj;
864 DWORD flags;
865 PyObject *AddressObj;
866
867 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"OkO:WSASendTo",
868 &handle, &bufobj, &flags, &AddressObj)) {
869 goto exit;
870 }
871 return_value = _overlapped_Overlapped_WSASendTo_impl(self, handle, bufobj, flags, AddressObj);
872
873 exit:
874 return return_value;
875 }
876
877 PyDoc_STRVAR(_overlapped_Overlapped_WSARecvFrom__doc__,
878 "WSARecvFrom($self, handle, size, flags=0, /)\n"
879 "--\n"
880 "\n"
881 "Start overlapped receive.");
882
883 #define _OVERLAPPED_OVERLAPPED_WSARECVFROM_METHODDEF \
884 {"WSARecvFrom", (PyCFunction)(void(*)(void))_overlapped_Overlapped_WSARecvFrom, METH_FASTCALL, _overlapped_Overlapped_WSARecvFrom__doc__},
885
886 static PyObject *
887 _overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self,
888 HANDLE handle, DWORD size,
889 DWORD flags);
890
891 static PyObject *
_overlapped_Overlapped_WSARecvFrom(OverlappedObject * self,PyObject * const * args,Py_ssize_t nargs)892 _overlapped_Overlapped_WSARecvFrom(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
893 {
894 PyObject *return_value = NULL;
895 HANDLE handle;
896 DWORD size;
897 DWORD flags = 0;
898
899 if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"k|k:WSARecvFrom",
900 &handle, &size, &flags)) {
901 goto exit;
902 }
903 return_value = _overlapped_Overlapped_WSARecvFrom_impl(self, handle, size, flags);
904
905 exit:
906 return return_value;
907 }
908 /*[clinic end generated code: output=ee2ec2f93c8d334b input=a9049054013a1b77]*/
909