Debian Codegraph @

Modules/clinic/overlapped.c.h

raw
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6 # include "pycore_gc.h" // PyGC_Head
7 # include "pycore_runtime.h" // _Py_ID()
8 #endif
9 #include "pycore_long.h" // _PyLong_UnsignedLong_Converter()
10 #include "pycore_modsupport.h" // _PyArg_CheckPositional()
11
12 PyDoc_STRVAR(_overlapped_CreateIoCompletionPort__doc__,
13 "CreateIoCompletionPort($module, handle, port, key, concurrency, /)\n"
14 "--\n"
15 "\n"
16 "Create a completion port or register a handle with a port.");
17
18 #define _OVERLAPPED_CREATEIOCOMPLETIONPORT_METHODDEF \
19 {"CreateIoCompletionPort", _PyCFunction_CAST(_overlapped_CreateIoCompletionPort), METH_FASTCALL, _overlapped_CreateIoCompletionPort__doc__},
20
21 static PyObject *
22 _overlapped_CreateIoCompletionPort_impl(PyObject *module, HANDLE FileHandle,
23 HANDLE ExistingCompletionPort,
24 ULONG_PTR CompletionKey,
25 DWORD NumberOfConcurrentThreads);
26
27 static PyObject *
28 _overlapped_CreateIoCompletionPort(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
29 {
30 PyObject *return_value = NULL;
31 HANDLE FileHandle;
32 HANDLE ExistingCompletionPort;
33 ULONG_PTR CompletionKey;
34 DWORD NumberOfConcurrentThreads;
35
36 if (!_PyArg_CheckPositional("CreateIoCompletionPort", nargs, 4, 4)) {
37 goto exit;
38 }
39 FileHandle = PyLong_AsVoidPtr(args[0]);
40 if (!FileHandle && PyErr_Occurred()) {
41 goto exit;
42 }
43 ExistingCompletionPort = PyLong_AsVoidPtr(args[1]);
44 if (!ExistingCompletionPort && PyErr_Occurred()) {
45 goto exit;
46 }
47 CompletionKey = (uintptr_t)PyLong_AsVoidPtr(args[2]);
48 if (!CompletionKey && PyErr_Occurred()) {
49 goto exit;
50 }
51 if (!_PyLong_UnsignedLong_Converter(args[3], &NumberOfConcurrentThreads)) {
52 goto exit;
53 }
54 return_value = _overlapped_CreateIoCompletionPort_impl(module, FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads);
55
56 exit:
57 return return_value;
58 }
59
60 PyDoc_STRVAR(_overlapped_GetQueuedCompletionStatus__doc__,
61 "GetQueuedCompletionStatus($module, port, msecs, /)\n"
62 "--\n"
63 "\n"
64 "Get a message from completion port.\n"
65 "\n"
66 "Wait for up to msecs milliseconds.");
67
68 #define _OVERLAPPED_GETQUEUEDCOMPLETIONSTATUS_METHODDEF \
69 {"GetQueuedCompletionStatus", _PyCFunction_CAST(_overlapped_GetQueuedCompletionStatus), METH_FASTCALL, _overlapped_GetQueuedCompletionStatus__doc__},
70
71 static PyObject *
72 _overlapped_GetQueuedCompletionStatus_impl(PyObject *module,
73 HANDLE CompletionPort,
74 DWORD Milliseconds);
75
76 static PyObject *
77 _overlapped_GetQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
78 {
79 PyObject *return_value = NULL;
80 HANDLE CompletionPort;
81 DWORD Milliseconds;
82
83 if (!_PyArg_CheckPositional("GetQueuedCompletionStatus", nargs, 2, 2)) {
84 goto exit;
85 }
86 CompletionPort = PyLong_AsVoidPtr(args[0]);
87 if (!CompletionPort && PyErr_Occurred()) {
88 goto exit;
89 }
90 if (!_PyLong_UnsignedLong_Converter(args[1], &Milliseconds)) {
91 goto exit;
92 }
93 return_value = _overlapped_GetQueuedCompletionStatus_impl(module, CompletionPort, Milliseconds);
94
95 exit:
96 return return_value;
97 }
98
99 PyDoc_STRVAR(_overlapped_PostQueuedCompletionStatus__doc__,
100 "PostQueuedCompletionStatus($module, port, bytes, key, address, /)\n"
101 "--\n"
102 "\n"
103 "Post a message to completion port.");
104
105 #define _OVERLAPPED_POSTQUEUEDCOMPLETIONSTATUS_METHODDEF \
106 {"PostQueuedCompletionStatus", _PyCFunction_CAST(_overlapped_PostQueuedCompletionStatus), METH_FASTCALL, _overlapped_PostQueuedCompletionStatus__doc__},
107
108 static PyObject *
109 _overlapped_PostQueuedCompletionStatus_impl(PyObject *module,
110 HANDLE CompletionPort,
111 DWORD NumberOfBytes,
112 ULONG_PTR CompletionKey,
113 OVERLAPPED *Overlapped);
114
115 static PyObject *
116 _overlapped_PostQueuedCompletionStatus(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
117 {
118 PyObject *return_value = NULL;
119 HANDLE CompletionPort;
120 DWORD NumberOfBytes;
121 ULONG_PTR CompletionKey;
122 OVERLAPPED *Overlapped;
123
124 if (!_PyArg_CheckPositional("PostQueuedCompletionStatus", nargs, 4, 4)) {
125 goto exit;
126 }
127 CompletionPort = PyLong_AsVoidPtr(args[0]);
128 if (!CompletionPort && PyErr_Occurred()) {
129 goto exit;
130 }
131 if (!_PyLong_UnsignedLong_Converter(args[1], &NumberOfBytes)) {
132 goto exit;
133 }
134 CompletionKey = (uintptr_t)PyLong_AsVoidPtr(args[2]);
135 if (!CompletionKey && PyErr_Occurred()) {
136 goto exit;
137 }
138 Overlapped = PyLong_AsVoidPtr(args[3]);
139 if (!Overlapped && PyErr_Occurred()) {
140 goto exit;
141 }
142 return_value = _overlapped_PostQueuedCompletionStatus_impl(module, CompletionPort, NumberOfBytes, CompletionKey, Overlapped);
143
144 exit:
145 return return_value;
146 }
147
148 PyDoc_STRVAR(_overlapped_RegisterWaitWithQueue__doc__,
149 "RegisterWaitWithQueue($module, Object, CompletionPort, Overlapped,\n"
150 " Timeout, /)\n"
151 "--\n"
152 "\n"
153 "Register wait for Object; when complete CompletionPort is notified.");
154
155 #define _OVERLAPPED_REGISTERWAITWITHQUEUE_METHODDEF \
156 {"RegisterWaitWithQueue", _PyCFunction_CAST(_overlapped_RegisterWaitWithQueue), METH_FASTCALL, _overlapped_RegisterWaitWithQueue__doc__},
157
158 static PyObject *
159 _overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
160 HANDLE CompletionPort,
161 OVERLAPPED *Overlapped,
162 DWORD Milliseconds);
163
164 static PyObject *
165 _overlapped_RegisterWaitWithQueue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
166 {
167 PyObject *return_value = NULL;
168 HANDLE Object;
169 HANDLE CompletionPort;
170 OVERLAPPED *Overlapped;
171 DWORD Milliseconds;
172
173 if (!_PyArg_CheckPositional("RegisterWaitWithQueue", nargs, 4, 4)) {
174 goto exit;
175 }
176 Object = PyLong_AsVoidPtr(args[0]);
177 if (!Object && PyErr_Occurred()) {
178 goto exit;
179 }
180 CompletionPort = PyLong_AsVoidPtr(args[1]);
181 if (!CompletionPort && PyErr_Occurred()) {
182 goto exit;
183 }
184 Overlapped = PyLong_AsVoidPtr(args[2]);
185 if (!Overlapped && PyErr_Occurred()) {
186 goto exit;
187 }
188 if (!_PyLong_UnsignedLong_Converter(args[3], &Milliseconds)) {
189 goto exit;
190 }
191 return_value = _overlapped_RegisterWaitWithQueue_impl(module, Object, CompletionPort, Overlapped, Milliseconds);
192
193 exit:
194 return return_value;
195 }
196
197 PyDoc_STRVAR(_overlapped_UnregisterWait__doc__,
198 "UnregisterWait($module, WaitHandle, /)\n"
199 "--\n"
200 "\n"
201 "Unregister wait handle.");
202
203 #define _OVERLAPPED_UNREGISTERWAIT_METHODDEF \
204 {"UnregisterWait", (PyCFunction)_overlapped_UnregisterWait, METH_O, _overlapped_UnregisterWait__doc__},
205
206 static PyObject *
207 _overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle);
208
209 static PyObject *
210 _overlapped_UnregisterWait(PyObject *module, PyObject *arg)
211 {
212 PyObject *return_value = NULL;
213 HANDLE WaitHandle;
214
215 WaitHandle = PyLong_AsVoidPtr(arg);
216 if (!WaitHandle && PyErr_Occurred()) {
217 goto exit;
218 }
219 return_value = _overlapped_UnregisterWait_impl(module, WaitHandle);
220
221 exit:
222 return return_value;
223 }
224
225 PyDoc_STRVAR(_overlapped_UnregisterWaitEx__doc__,
226 "UnregisterWaitEx($module, WaitHandle, Event, /)\n"
227 "--\n"
228 "\n"
229 "Unregister wait handle.");
230
231 #define _OVERLAPPED_UNREGISTERWAITEX_METHODDEF \
232 {"UnregisterWaitEx", _PyCFunction_CAST(_overlapped_UnregisterWaitEx), METH_FASTCALL, _overlapped_UnregisterWaitEx__doc__},
233
234 static PyObject *
235 _overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
236 HANDLE Event);
237
238 static PyObject *
239 _overlapped_UnregisterWaitEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
240 {
241 PyObject *return_value = NULL;
242 HANDLE WaitHandle;
243 HANDLE Event;
244
245 if (!_PyArg_CheckPositional("UnregisterWaitEx", nargs, 2, 2)) {
246 goto exit;
247 }
248 WaitHandle = PyLong_AsVoidPtr(args[0]);
249 if (!WaitHandle && PyErr_Occurred()) {
250 goto exit;
251 }
252 Event = PyLong_AsVoidPtr(args[1]);
253 if (!Event && PyErr_Occurred()) {
254 goto exit;
255 }
256 return_value = _overlapped_UnregisterWaitEx_impl(module, WaitHandle, Event);
257
258 exit:
259 return return_value;
260 }
261
262 PyDoc_STRVAR(_overlapped_CreateEvent__doc__,
263 "CreateEvent($module, EventAttributes, ManualReset, InitialState, Name,\n"
264 " /)\n"
265 "--\n"
266 "\n"
267 "Create an event.\n"
268 "\n"
269 "EventAttributes must be None.");
270
271 #define _OVERLAPPED_CREATEEVENT_METHODDEF \
272 {"CreateEvent", _PyCFunction_CAST(_overlapped_CreateEvent), METH_FASTCALL, _overlapped_CreateEvent__doc__},
273
274 static PyObject *
275 _overlapped_CreateEvent_impl(PyObject *module, PyObject *EventAttributes,
276 BOOL ManualReset, BOOL InitialState,
277 const wchar_t *Name);
278
279 static PyObject *
280 _overlapped_CreateEvent(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
281 {
282 PyObject *return_value = NULL;
283 PyObject *EventAttributes;
284 BOOL ManualReset;
285 BOOL InitialState;
286 const wchar_t *Name = NULL;
287
288 if (!_PyArg_CheckPositional("CreateEvent", nargs, 4, 4)) {
289 goto exit;
290 }
291 EventAttributes = args[0];
292 ManualReset = PyLong_AsInt(args[1]);
293 if (ManualReset == -1 && PyErr_Occurred()) {
294 goto exit;
295 }
296 InitialState = PyLong_AsInt(args[2]);
297 if (InitialState == -1 && PyErr_Occurred()) {
298 goto exit;
299 }
300 if (args[3] == Py_None) {
301 Name = NULL;
302 }
303 else if (PyUnicode_Check(args[3])) {
304 Name = PyUnicode_AsWideCharString(args[3], NULL);
305 if (Name == NULL) {
306 goto exit;
307 }
308 }
309 else {
310 _PyArg_BadArgument("CreateEvent", "argument 4", "str or None", args[3]);
311 goto exit;
312 }
313 return_value = _overlapped_CreateEvent_impl(module, EventAttributes, ManualReset, InitialState, Name);
314
315 exit:
316 /* Cleanup for Name */
317 PyMem_Free((void *)Name);
318
319 return return_value;
320 }
321
322 PyDoc_STRVAR(_overlapped_SetEvent__doc__,
323 "SetEvent($module, Handle, /)\n"
324 "--\n"
325 "\n"
326 "Set event.");
327
328 #define _OVERLAPPED_SETEVENT_METHODDEF \
329 {"SetEvent", (PyCFunction)_overlapped_SetEvent, METH_O, _overlapped_SetEvent__doc__},
330
331 static PyObject *
332 _overlapped_SetEvent_impl(PyObject *module, HANDLE Handle);
333
334 static PyObject *
335 _overlapped_SetEvent(PyObject *module, PyObject *arg)
336 {
337 PyObject *return_value = NULL;
338 HANDLE Handle;
339
340 Handle = PyLong_AsVoidPtr(arg);
341 if (!Handle && PyErr_Occurred()) {
342 goto exit;
343 }
344 return_value = _overlapped_SetEvent_impl(module, Handle);
345
346 exit:
347 return return_value;
348 }
349
350 PyDoc_STRVAR(_overlapped_ResetEvent__doc__,
351 "ResetEvent($module, Handle, /)\n"
352 "--\n"
353 "\n"
354 "Reset event.");
355
356 #define _OVERLAPPED_RESETEVENT_METHODDEF \
357 {"ResetEvent", (PyCFunction)_overlapped_ResetEvent, METH_O, _overlapped_ResetEvent__doc__},
358
359 static PyObject *
360 _overlapped_ResetEvent_impl(PyObject *module, HANDLE Handle);
361
362 static PyObject *
363 _overlapped_ResetEvent(PyObject *module, PyObject *arg)
364 {
365 PyObject *return_value = NULL;
366 HANDLE Handle;
367
368 Handle = PyLong_AsVoidPtr(arg);
369 if (!Handle && PyErr_Occurred()) {
370 goto exit;
371 }
372 return_value = _overlapped_ResetEvent_impl(module, Handle);
373
374 exit:
375 return return_value;
376 }
377
378 PyDoc_STRVAR(_overlapped_BindLocal__doc__,
379 "BindLocal($module, handle, family, /)\n"
380 "--\n"
381 "\n"
382 "Bind a socket handle to an arbitrary local port.\n"
383 "\n"
384 "family should be AF_INET or AF_INET6.");
385
386 #define _OVERLAPPED_BINDLOCAL_METHODDEF \
387 {"BindLocal", _PyCFunction_CAST(_overlapped_BindLocal), METH_FASTCALL, _overlapped_BindLocal__doc__},
388
389 static PyObject *
390 _overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family);
391
392 static PyObject *
393 _overlapped_BindLocal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
394 {
395 PyObject *return_value = NULL;
396 HANDLE Socket;
397 int Family;
398
399 if (!_PyArg_CheckPositional("BindLocal", nargs, 2, 2)) {
400 goto exit;
401 }
402 Socket = PyLong_AsVoidPtr(args[0]);
403 if (!Socket && PyErr_Occurred()) {
404 goto exit;
405 }
406 Family = PyLong_AsInt(args[1]);
407 if (Family == -1 && PyErr_Occurred()) {
408 goto exit;
409 }
410 return_value = _overlapped_BindLocal_impl(module, Socket, Family);
411
412 exit:
413 return return_value;
414 }
415
416 PyDoc_STRVAR(_overlapped_FormatMessage__doc__,
417 "FormatMessage($module, error_code, /)\n"
418 "--\n"
419 "\n"
420 "Return error message for an error code.");
421
422 #define _OVERLAPPED_FORMATMESSAGE_METHODDEF \
423 {"FormatMessage", (PyCFunction)_overlapped_FormatMessage, METH_O, _overlapped_FormatMessage__doc__},
424
425 static PyObject *
426 _overlapped_FormatMessage_impl(PyObject *module, DWORD code);
427
428 static PyObject *
429 _overlapped_FormatMessage(PyObject *module, PyObject *arg)
430 {
431 PyObject *return_value = NULL;
432 DWORD code;
433
434 if (!_PyLong_UnsignedLong_Converter(arg, &code)) {
435 goto exit;
436 }
437 return_value = _overlapped_FormatMessage_impl(module, code);
438
439 exit:
440 return return_value;
441 }
442
443 PyDoc_STRVAR(_overlapped_Overlapped__doc__,
444 "Overlapped(event=_overlapped.INVALID_HANDLE_VALUE)\n"
445 "--\n"
446 "\n"
447 "OVERLAPPED structure wrapper.");
448
449 static PyObject *
450 _overlapped_Overlapped_impl(PyTypeObject *type, HANDLE event);
451
452 static PyObject *
453 _overlapped_Overlapped(PyTypeObject *type, PyObject *args, PyObject *kwargs)
454 {
455 PyObject *return_value = NULL;
456 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
457
458 #define NUM_KEYWORDS 1
459 static struct {
460 PyGC_Head _this_is_not_used;
461 PyObject_VAR_HEAD
462 Py_hash_t ob_hash;
463 PyObject *ob_item[NUM_KEYWORDS];
464 } _kwtuple = {
465 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
466 .ob_hash = -1,
467 .ob_item = { &_Py_ID(event), },
468 };
469 #undef NUM_KEYWORDS
470 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
471
472 #else // !Py_BUILD_CORE
473 # define KWTUPLE NULL
474 #endif // !Py_BUILD_CORE
475
476 static const char * const _keywords[] = {"event", NULL};
477 static _PyArg_Parser _parser = {
478 .keywords = _keywords,
479 .fname = "Overlapped",
480 .kwtuple = KWTUPLE,
481 };
482 #undef KWTUPLE
483 PyObject *argsbuf[1];
484 PyObject * const *fastargs;
485 Py_ssize_t nargs = PyTuple_GET_SIZE(args);
486 Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
487 HANDLE event = INVALID_HANDLE_VALUE;
488
489 fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser,
490 /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
491 if (!fastargs) {
492 goto exit;
493 }
494 if (!noptargs) {
495 goto skip_optional_pos;
496 }
497 event = PyLong_AsVoidPtr(fastargs[0]);
498 if (!event && PyErr_Occurred()) {
499 goto exit;
500 }
501 skip_optional_pos:
502 return_value = _overlapped_Overlapped_impl(type, event);
503
504 exit:
505 return return_value;
506 }
507
508 PyDoc_STRVAR(_overlapped_Overlapped_cancel__doc__,
509 "cancel($self, /)\n"
510 "--\n"
511 "\n"
512 "Cancel overlapped operation.");
513
514 #define _OVERLAPPED_OVERLAPPED_CANCEL_METHODDEF \
515 {"cancel", (PyCFunction)_overlapped_Overlapped_cancel, METH_NOARGS, _overlapped_Overlapped_cancel__doc__},
516
517 static PyObject *
518 _overlapped_Overlapped_cancel_impl(OverlappedObject *self);
519
520 static PyObject *
521 _overlapped_Overlapped_cancel(PyObject *self, PyObject *Py_UNUSED(ignored))
522 {
523 return _overlapped_Overlapped_cancel_impl((OverlappedObject *)self);
524 }
525
526 PyDoc_STRVAR(_overlapped_Overlapped_getresult__doc__,
527 "getresult($self, wait=False, /)\n"
528 "--\n"
529 "\n"
530 "Retrieve result of operation.\n"
531 "\n"
532 "If wait is true then it blocks until the operation is finished. If\n"
533 "wait is false and the operation is still pending then an error is\n"
534 "raised.");
535
536 #define _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF \
537 {"getresult", _PyCFunction_CAST(_overlapped_Overlapped_getresult), METH_FASTCALL, _overlapped_Overlapped_getresult__doc__},
538
539 static PyObject *
540 _overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait);
541
542 static PyObject *
543 _overlapped_Overlapped_getresult(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
544 {
545 PyObject *return_value = NULL;
546 BOOL wait = FALSE;
547
548 if (!_PyArg_CheckPositional("getresult", nargs, 0, 1)) {
549 goto exit;
550 }
551 if (nargs < 1) {
552 goto skip_optional;
553 }
554 wait = PyLong_AsInt(args[0]);
555 if (wait == -1 && PyErr_Occurred()) {
556 goto exit;
557 }
558 skip_optional:
559 return_value = _overlapped_Overlapped_getresult_impl((OverlappedObject *)self, wait);
560
561 exit:
562 return return_value;
563 }
564
565 PyDoc_STRVAR(_overlapped_Overlapped_ReadFile__doc__,
566 "ReadFile($self, handle, size, /)\n"
567 "--\n"
568 "\n"
569 "Start overlapped read.");
570
571 #define _OVERLAPPED_OVERLAPPED_READFILE_METHODDEF \
572 {"ReadFile", _PyCFunction_CAST(_overlapped_Overlapped_ReadFile), METH_FASTCALL, _overlapped_Overlapped_ReadFile__doc__},
573
574 static PyObject *
575 _overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle,
576 DWORD size);
577
578 static PyObject *
579 _overlapped_Overlapped_ReadFile(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
580 {
581 PyObject *return_value = NULL;
582 HANDLE handle;
583 DWORD size;
584
585 if (!_PyArg_CheckPositional("ReadFile", nargs, 2, 2)) {
586 goto exit;
587 }
588 handle = PyLong_AsVoidPtr(args[0]);
589 if (!handle && PyErr_Occurred()) {
590 goto exit;
591 }
592 if (!_PyLong_UnsignedLong_Converter(args[1], &size)) {
593 goto exit;
594 }
595 return_value = _overlapped_Overlapped_ReadFile_impl((OverlappedObject *)self, handle, size);
596
597 exit:
598 return return_value;
599 }
600
601 PyDoc_STRVAR(_overlapped_Overlapped_ReadFileInto__doc__,
602 "ReadFileInto($self, handle, buf, /)\n"
603 "--\n"
604 "\n"
605 "Start overlapped receive.");
606
607 #define _OVERLAPPED_OVERLAPPED_READFILEINTO_METHODDEF \
608 {"ReadFileInto", _PyCFunction_CAST(_overlapped_Overlapped_ReadFileInto), METH_FASTCALL, _overlapped_Overlapped_ReadFileInto__doc__},
609
610 static PyObject *
611 _overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
612 HANDLE handle, Py_buffer *bufobj);
613
614 static PyObject *
615 _overlapped_Overlapped_ReadFileInto(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
616 {
617 PyObject *return_value = NULL;
618 HANDLE handle;
619 Py_buffer bufobj = {NULL, NULL};
620
621 if (!_PyArg_CheckPositional("ReadFileInto", nargs, 2, 2)) {
622 goto exit;
623 }
624 handle = PyLong_AsVoidPtr(args[0]);
625 if (!handle && PyErr_Occurred()) {
626 goto exit;
627 }
628 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
629 goto exit;
630 }
631 return_value = _overlapped_Overlapped_ReadFileInto_impl((OverlappedObject *)self, handle, &bufobj);
632
633 exit:
634 /* Cleanup for bufobj */
635 if (bufobj.obj) {
636 PyBuffer_Release(&bufobj);
637 }
638
639 return return_value;
640 }
641
642 PyDoc_STRVAR(_overlapped_Overlapped_WSARecv__doc__,
643 "WSARecv($self, handle, size, flags=0, /)\n"
644 "--\n"
645 "\n"
646 "Start overlapped receive.");
647
648 #define _OVERLAPPED_OVERLAPPED_WSARECV_METHODDEF \
649 {"WSARecv", _PyCFunction_CAST(_overlapped_Overlapped_WSARecv), METH_FASTCALL, _overlapped_Overlapped_WSARecv__doc__},
650
651 static PyObject *
652 _overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle,
653 DWORD size, DWORD flags);
654
655 static PyObject *
656 _overlapped_Overlapped_WSARecv(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
657 {
658 PyObject *return_value = NULL;
659 HANDLE handle;
660 DWORD size;
661 DWORD flags = 0;
662
663 if (!_PyArg_CheckPositional("WSARecv", nargs, 2, 3)) {
664 goto exit;
665 }
666 handle = PyLong_AsVoidPtr(args[0]);
667 if (!handle && PyErr_Occurred()) {
668 goto exit;
669 }
670 if (!_PyLong_UnsignedLong_Converter(args[1], &size)) {
671 goto exit;
672 }
673 if (nargs < 3) {
674 goto skip_optional;
675 }
676 if (!_PyLong_UnsignedLong_Converter(args[2], &flags)) {
677 goto exit;
678 }
679 skip_optional:
680 return_value = _overlapped_Overlapped_WSARecv_impl((OverlappedObject *)self, handle, size, flags);
681
682 exit:
683 return return_value;
684 }
685
686 PyDoc_STRVAR(_overlapped_Overlapped_WSARecvInto__doc__,
687 "WSARecvInto($self, handle, buf, flags, /)\n"
688 "--\n"
689 "\n"
690 "Start overlapped receive.");
691
692 #define _OVERLAPPED_OVERLAPPED_WSARECVINTO_METHODDEF \
693 {"WSARecvInto", _PyCFunction_CAST(_overlapped_Overlapped_WSARecvInto), METH_FASTCALL, _overlapped_Overlapped_WSARecvInto__doc__},
694
695 static PyObject *
696 _overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
697 HANDLE handle, Py_buffer *bufobj,
698 DWORD flags);
699
700 static PyObject *
701 _overlapped_Overlapped_WSARecvInto(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
702 {
703 PyObject *return_value = NULL;
704 HANDLE handle;
705 Py_buffer bufobj = {NULL, NULL};
706 DWORD flags;
707
708 if (!_PyArg_CheckPositional("WSARecvInto", nargs, 3, 3)) {
709 goto exit;
710 }
711 handle = PyLong_AsVoidPtr(args[0]);
712 if (!handle && PyErr_Occurred()) {
713 goto exit;
714 }
715 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
716 goto exit;
717 }
718 if (!_PyLong_UnsignedLong_Converter(args[2], &flags)) {
719 goto exit;
720 }
721 return_value = _overlapped_Overlapped_WSARecvInto_impl((OverlappedObject *)self, handle, &bufobj, flags);
722
723 exit:
724 /* Cleanup for bufobj */
725 if (bufobj.obj) {
726 PyBuffer_Release(&bufobj);
727 }
728
729 return return_value;
730 }
731
732 PyDoc_STRVAR(_overlapped_Overlapped_WriteFile__doc__,
733 "WriteFile($self, handle, buf, /)\n"
734 "--\n"
735 "\n"
736 "Start overlapped write.");
737
738 #define _OVERLAPPED_OVERLAPPED_WRITEFILE_METHODDEF \
739 {"WriteFile", _PyCFunction_CAST(_overlapped_Overlapped_WriteFile), METH_FASTCALL, _overlapped_Overlapped_WriteFile__doc__},
740
741 static PyObject *
742 _overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
743 Py_buffer *bufobj);
744
745 static PyObject *
746 _overlapped_Overlapped_WriteFile(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
747 {
748 PyObject *return_value = NULL;
749 HANDLE handle;
750 Py_buffer bufobj = {NULL, NULL};
751
752 if (!_PyArg_CheckPositional("WriteFile", nargs, 2, 2)) {
753 goto exit;
754 }
755 handle = PyLong_AsVoidPtr(args[0]);
756 if (!handle && PyErr_Occurred()) {
757 goto exit;
758 }
759 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
760 goto exit;
761 }
762 return_value = _overlapped_Overlapped_WriteFile_impl((OverlappedObject *)self, handle, &bufobj);
763
764 exit:
765 /* Cleanup for bufobj */
766 if (bufobj.obj) {
767 PyBuffer_Release(&bufobj);
768 }
769
770 return return_value;
771 }
772
773 PyDoc_STRVAR(_overlapped_Overlapped_WSASend__doc__,
774 "WSASend($self, handle, buf, flags, /)\n"
775 "--\n"
776 "\n"
777 "Start overlapped send.");
778
779 #define _OVERLAPPED_OVERLAPPED_WSASEND_METHODDEF \
780 {"WSASend", _PyCFunction_CAST(_overlapped_Overlapped_WSASend), METH_FASTCALL, _overlapped_Overlapped_WSASend__doc__},
781
782 static PyObject *
783 _overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
784 Py_buffer *bufobj, DWORD flags);
785
786 static PyObject *
787 _overlapped_Overlapped_WSASend(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
788 {
789 PyObject *return_value = NULL;
790 HANDLE handle;
791 Py_buffer bufobj = {NULL, NULL};
792 DWORD flags;
793
794 if (!_PyArg_CheckPositional("WSASend", nargs, 3, 3)) {
795 goto exit;
796 }
797 handle = PyLong_AsVoidPtr(args[0]);
798 if (!handle && PyErr_Occurred()) {
799 goto exit;
800 }
801 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
802 goto exit;
803 }
804 if (!_PyLong_UnsignedLong_Converter(args[2], &flags)) {
805 goto exit;
806 }
807 return_value = _overlapped_Overlapped_WSASend_impl((OverlappedObject *)self, handle, &bufobj, flags);
808
809 exit:
810 /* Cleanup for bufobj */
811 if (bufobj.obj) {
812 PyBuffer_Release(&bufobj);
813 }
814
815 return return_value;
816 }
817
818 PyDoc_STRVAR(_overlapped_Overlapped_AcceptEx__doc__,
819 "AcceptEx($self, listen_handle, accept_handle, /)\n"
820 "--\n"
821 "\n"
822 "Start overlapped wait for client to connect.");
823
824 #define _OVERLAPPED_OVERLAPPED_ACCEPTEX_METHODDEF \
825 {"AcceptEx", _PyCFunction_CAST(_overlapped_Overlapped_AcceptEx), METH_FASTCALL, _overlapped_Overlapped_AcceptEx__doc__},
826
827 static PyObject *
828 _overlapped_Overlapped_AcceptEx_impl(OverlappedObject *self,
829 HANDLE ListenSocket,
830 HANDLE AcceptSocket);
831
832 static PyObject *
833 _overlapped_Overlapped_AcceptEx(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
834 {
835 PyObject *return_value = NULL;
836 HANDLE ListenSocket;
837 HANDLE AcceptSocket;
838
839 if (!_PyArg_CheckPositional("AcceptEx", nargs, 2, 2)) {
840 goto exit;
841 }
842 ListenSocket = PyLong_AsVoidPtr(args[0]);
843 if (!ListenSocket && PyErr_Occurred()) {
844 goto exit;
845 }
846 AcceptSocket = PyLong_AsVoidPtr(args[1]);
847 if (!AcceptSocket && PyErr_Occurred()) {
848 goto exit;
849 }
850 return_value = _overlapped_Overlapped_AcceptEx_impl((OverlappedObject *)self, ListenSocket, AcceptSocket);
851
852 exit:
853 return return_value;
854 }
855
856 PyDoc_STRVAR(_overlapped_Overlapped_ConnectEx__doc__,
857 "ConnectEx($self, client_handle, address_as_bytes, /)\n"
858 "--\n"
859 "\n"
860 "Start overlapped connect.\n"
861 "\n"
862 "client_handle should be unbound.");
863
864 #define _OVERLAPPED_OVERLAPPED_CONNECTEX_METHODDEF \
865 {"ConnectEx", _PyCFunction_CAST(_overlapped_Overlapped_ConnectEx), METH_FASTCALL, _overlapped_Overlapped_ConnectEx__doc__},
866
867 static PyObject *
868 _overlapped_Overlapped_ConnectEx_impl(OverlappedObject *self,
869 HANDLE ConnectSocket,
870 PyObject *AddressObj);
871
872 static PyObject *
873 _overlapped_Overlapped_ConnectEx(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
874 {
875 PyObject *return_value = NULL;
876 HANDLE ConnectSocket;
877 PyObject *AddressObj;
878
879 if (!_PyArg_CheckPositional("ConnectEx", nargs, 2, 2)) {
880 goto exit;
881 }
882 ConnectSocket = PyLong_AsVoidPtr(args[0]);
883 if (!ConnectSocket && PyErr_Occurred()) {
884 goto exit;
885 }
886 if (!PyTuple_Check(args[1])) {
887 _PyArg_BadArgument("ConnectEx", "argument 2", "tuple", args[1]);
888 goto exit;
889 }
890 AddressObj = args[1];
891 return_value = _overlapped_Overlapped_ConnectEx_impl((OverlappedObject *)self, ConnectSocket, AddressObj);
892
893 exit:
894 return return_value;
895 }
896
897 PyDoc_STRVAR(_overlapped_Overlapped_DisconnectEx__doc__,
898 "DisconnectEx($self, handle, flags, /)\n"
899 "--\n"
900 "\n");
901
902 #define _OVERLAPPED_OVERLAPPED_DISCONNECTEX_METHODDEF \
903 {"DisconnectEx", _PyCFunction_CAST(_overlapped_Overlapped_DisconnectEx), METH_FASTCALL, _overlapped_Overlapped_DisconnectEx__doc__},
904
905 static PyObject *
906 _overlapped_Overlapped_DisconnectEx_impl(OverlappedObject *self,
907 HANDLE Socket, DWORD flags);
908
909 static PyObject *
910 _overlapped_Overlapped_DisconnectEx(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
911 {
912 PyObject *return_value = NULL;
913 HANDLE Socket;
914 DWORD flags;
915
916 if (!_PyArg_CheckPositional("DisconnectEx", nargs, 2, 2)) {
917 goto exit;
918 }
919 Socket = PyLong_AsVoidPtr(args[0]);
920 if (!Socket && PyErr_Occurred()) {
921 goto exit;
922 }
923 if (!_PyLong_UnsignedLong_Converter(args[1], &flags)) {
924 goto exit;
925 }
926 return_value = _overlapped_Overlapped_DisconnectEx_impl((OverlappedObject *)self, Socket, flags);
927
928 exit:
929 return return_value;
930 }
931
932 PyDoc_STRVAR(_overlapped_Overlapped_TransmitFile__doc__,
933 "TransmitFile($self, socket, file, offset, offset_high, count_to_write,\n"
934 " count_per_send, flags, /)\n"
935 "--\n"
936 "\n"
937 "Transmit file data over a connected socket.");
938
939 #define _OVERLAPPED_OVERLAPPED_TRANSMITFILE_METHODDEF \
940 {"TransmitFile", _PyCFunction_CAST(_overlapped_Overlapped_TransmitFile), METH_FASTCALL, _overlapped_Overlapped_TransmitFile__doc__},
941
942 static PyObject *
943 _overlapped_Overlapped_TransmitFile_impl(OverlappedObject *self,
944 HANDLE Socket, HANDLE File,
945 DWORD offset, DWORD offset_high,
946 DWORD count_to_write,
947 DWORD count_per_send, DWORD flags);
948
949 static PyObject *
950 _overlapped_Overlapped_TransmitFile(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
951 {
952 PyObject *return_value = NULL;
953 HANDLE Socket;
954 HANDLE File;
955 DWORD offset;
956 DWORD offset_high;
957 DWORD count_to_write;
958 DWORD count_per_send;
959 DWORD flags;
960
961 if (!_PyArg_CheckPositional("TransmitFile", nargs, 7, 7)) {
962 goto exit;
963 }
964 Socket = PyLong_AsVoidPtr(args[0]);
965 if (!Socket && PyErr_Occurred()) {
966 goto exit;
967 }
968 File = PyLong_AsVoidPtr(args[1]);
969 if (!File && PyErr_Occurred()) {
970 goto exit;
971 }
972 if (!_PyLong_UnsignedLong_Converter(args[2], &offset)) {
973 goto exit;
974 }
975 if (!_PyLong_UnsignedLong_Converter(args[3], &offset_high)) {
976 goto exit;
977 }
978 if (!_PyLong_UnsignedLong_Converter(args[4], &count_to_write)) {
979 goto exit;
980 }
981 if (!_PyLong_UnsignedLong_Converter(args[5], &count_per_send)) {
982 goto exit;
983 }
984 if (!_PyLong_UnsignedLong_Converter(args[6], &flags)) {
985 goto exit;
986 }
987 return_value = _overlapped_Overlapped_TransmitFile_impl((OverlappedObject *)self, Socket, File, offset, offset_high, count_to_write, count_per_send, flags);
988
989 exit:
990 return return_value;
991 }
992
993 PyDoc_STRVAR(_overlapped_Overlapped_ConnectNamedPipe__doc__,
994 "ConnectNamedPipe($self, handle, /)\n"
995 "--\n"
996 "\n"
997 "Start overlapped wait for a client to connect.");
998
999 #define _OVERLAPPED_OVERLAPPED_CONNECTNAMEDPIPE_METHODDEF \
1000 {"ConnectNamedPipe", (PyCFunction)_overlapped_Overlapped_ConnectNamedPipe, METH_O, _overlapped_Overlapped_ConnectNamedPipe__doc__},
1001
1002 static PyObject *
1003 _overlapped_Overlapped_ConnectNamedPipe_impl(OverlappedObject *self,
1004 HANDLE Pipe);
1005
1006 static PyObject *
1007 _overlapped_Overlapped_ConnectNamedPipe(PyObject *self, PyObject *arg)
1008 {
1009 PyObject *return_value = NULL;
1010 HANDLE Pipe;
1011
1012 Pipe = PyLong_AsVoidPtr(arg);
1013 if (!Pipe && PyErr_Occurred()) {
1014 goto exit;
1015 }
1016 return_value = _overlapped_Overlapped_ConnectNamedPipe_impl((OverlappedObject *)self, Pipe);
1017
1018 exit:
1019 return return_value;
1020 }
1021
1022 PyDoc_STRVAR(_overlapped_Overlapped_ConnectPipe__doc__,
1023 "ConnectPipe($self, addr, /)\n"
1024 "--\n"
1025 "\n"
1026 "Connect to the pipe for asynchronous I/O (overlapped).");
1027
1028 #define _OVERLAPPED_OVERLAPPED_CONNECTPIPE_METHODDEF \
1029 {"ConnectPipe", (PyCFunction)_overlapped_Overlapped_ConnectPipe, METH_O, _overlapped_Overlapped_ConnectPipe__doc__},
1030
1031 static PyObject *
1032 _overlapped_Overlapped_ConnectPipe_impl(OverlappedObject *self,
1033 const wchar_t *Address);
1034
1035 static PyObject *
1036 _overlapped_Overlapped_ConnectPipe(PyObject *self, PyObject *arg)
1037 {
1038 PyObject *return_value = NULL;
1039 const wchar_t *Address = NULL;
1040
1041 if (!PyUnicode_Check(arg)) {
1042 _PyArg_BadArgument("ConnectPipe", "argument", "str", arg);
1043 goto exit;
1044 }
1045 Address = PyUnicode_AsWideCharString(arg, NULL);
1046 if (Address == NULL) {
1047 goto exit;
1048 }
1049 return_value = _overlapped_Overlapped_ConnectPipe_impl((OverlappedObject *)self, Address);
1050
1051 exit:
1052 /* Cleanup for Address */
1053 PyMem_Free((void *)Address);
1054
1055 return return_value;
1056 }
1057
1058 PyDoc_STRVAR(_overlapped_WSAConnect__doc__,
1059 "WSAConnect($module, client_handle, address_as_bytes, /)\n"
1060 "--\n"
1061 "\n"
1062 "Bind a remote address to a connectionless (UDP) socket.");
1063
1064 #define _OVERLAPPED_WSACONNECT_METHODDEF \
1065 {"WSAConnect", _PyCFunction_CAST(_overlapped_WSAConnect), METH_FASTCALL, _overlapped_WSAConnect__doc__},
1066
1067 static PyObject *
1068 _overlapped_WSAConnect_impl(PyObject *module, HANDLE ConnectSocket,
1069 PyObject *AddressObj);
1070
1071 static PyObject *
1072 _overlapped_WSAConnect(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1073 {
1074 PyObject *return_value = NULL;
1075 HANDLE ConnectSocket;
1076 PyObject *AddressObj;
1077
1078 if (!_PyArg_CheckPositional("WSAConnect", nargs, 2, 2)) {
1079 goto exit;
1080 }
1081 ConnectSocket = PyLong_AsVoidPtr(args[0]);
1082 if (!ConnectSocket && PyErr_Occurred()) {
1083 goto exit;
1084 }
1085 if (!PyTuple_Check(args[1])) {
1086 _PyArg_BadArgument("WSAConnect", "argument 2", "tuple", args[1]);
1087 goto exit;
1088 }
1089 AddressObj = args[1];
1090 return_value = _overlapped_WSAConnect_impl(module, ConnectSocket, AddressObj);
1091
1092 exit:
1093 return return_value;
1094 }
1095
1096 PyDoc_STRVAR(_overlapped_Overlapped_WSASendTo__doc__,
1097 "WSASendTo($self, handle, buf, flags, address_as_bytes, /)\n"
1098 "--\n"
1099 "\n"
1100 "Start overlapped sendto over a connectionless (UDP) socket.");
1101
1102 #define _OVERLAPPED_OVERLAPPED_WSASENDTO_METHODDEF \
1103 {"WSASendTo", _PyCFunction_CAST(_overlapped_Overlapped_WSASendTo), METH_FASTCALL, _overlapped_Overlapped_WSASendTo__doc__},
1104
1105 static PyObject *
1106 _overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
1107 Py_buffer *bufobj, DWORD flags,
1108 PyObject *AddressObj);
1109
1110 static PyObject *
1111 _overlapped_Overlapped_WSASendTo(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
1112 {
1113 PyObject *return_value = NULL;
1114 HANDLE handle;
1115 Py_buffer bufobj = {NULL, NULL};
1116 DWORD flags;
1117 PyObject *AddressObj;
1118
1119 if (!_PyArg_CheckPositional("WSASendTo", nargs, 4, 4)) {
1120 goto exit;
1121 }
1122 handle = PyLong_AsVoidPtr(args[0]);
1123 if (!handle && PyErr_Occurred()) {
1124 goto exit;
1125 }
1126 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
1127 goto exit;
1128 }
1129 if (!_PyLong_UnsignedLong_Converter(args[2], &flags)) {
1130 goto exit;
1131 }
1132 if (!PyTuple_Check(args[3])) {
1133 _PyArg_BadArgument("WSASendTo", "argument 4", "tuple", args[3]);
1134 goto exit;
1135 }
1136 AddressObj = args[3];
1137 return_value = _overlapped_Overlapped_WSASendTo_impl((OverlappedObject *)self, handle, &bufobj, flags, AddressObj);
1138
1139 exit:
1140 /* Cleanup for bufobj */
1141 if (bufobj.obj) {
1142 PyBuffer_Release(&bufobj);
1143 }
1144
1145 return return_value;
1146 }
1147
1148 PyDoc_STRVAR(_overlapped_Overlapped_WSARecvFrom__doc__,
1149 "WSARecvFrom($self, handle, size, flags=0, /)\n"
1150 "--\n"
1151 "\n"
1152 "Start overlapped receive.");
1153
1154 #define _OVERLAPPED_OVERLAPPED_WSARECVFROM_METHODDEF \
1155 {"WSARecvFrom", _PyCFunction_CAST(_overlapped_Overlapped_WSARecvFrom), METH_FASTCALL, _overlapped_Overlapped_WSARecvFrom__doc__},
1156
1157 static PyObject *
1158 _overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self,
1159 HANDLE handle, DWORD size,
1160 DWORD flags);
1161
1162 static PyObject *
1163 _overlapped_Overlapped_WSARecvFrom(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
1164 {
1165 PyObject *return_value = NULL;
1166 HANDLE handle;
1167 DWORD size;
1168 DWORD flags = 0;
1169
1170 if (!_PyArg_CheckPositional("WSARecvFrom", nargs, 2, 3)) {
1171 goto exit;
1172 }
1173 handle = PyLong_AsVoidPtr(args[0]);
1174 if (!handle && PyErr_Occurred()) {
1175 goto exit;
1176 }
1177 if (!_PyLong_UnsignedLong_Converter(args[1], &size)) {
1178 goto exit;
1179 }
1180 if (nargs < 3) {
1181 goto skip_optional;
1182 }
1183 if (!_PyLong_UnsignedLong_Converter(args[2], &flags)) {
1184 goto exit;
1185 }
1186 skip_optional:
1187 return_value = _overlapped_Overlapped_WSARecvFrom_impl((OverlappedObject *)self, handle, size, flags);
1188
1189 exit:
1190 return return_value;
1191 }
1192
1193 PyDoc_STRVAR(_overlapped_Overlapped_WSARecvFromInto__doc__,
1194 "WSARecvFromInto($self, handle, buf, size, flags=0, /)\n"
1195 "--\n"
1196 "\n"
1197 "Start overlapped receive.");
1198
1199 #define _OVERLAPPED_OVERLAPPED_WSARECVFROMINTO_METHODDEF \
1200 {"WSARecvFromInto", _PyCFunction_CAST(_overlapped_Overlapped_WSARecvFromInto), METH_FASTCALL, _overlapped_Overlapped_WSARecvFromInto__doc__},
1201
1202 static PyObject *
1203 _overlapped_Overlapped_WSARecvFromInto_impl(OverlappedObject *self,
1204 HANDLE handle, Py_buffer *bufobj,
1205 DWORD size, DWORD flags);
1206
1207 static PyObject *
1208 _overlapped_Overlapped_WSARecvFromInto(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
1209 {
1210 PyObject *return_value = NULL;
1211 HANDLE handle;
1212 Py_buffer bufobj = {NULL, NULL};
1213 DWORD size;
1214 DWORD flags = 0;
1215
1216 if (!_PyArg_CheckPositional("WSARecvFromInto", nargs, 3, 4)) {
1217 goto exit;
1218 }
1219 handle = PyLong_AsVoidPtr(args[0]);
1220 if (!handle && PyErr_Occurred()) {
1221 goto exit;
1222 }
1223 if (PyObject_GetBuffer(args[1], &bufobj, PyBUF_SIMPLE) != 0) {
1224 goto exit;
1225 }
1226 if (!_PyLong_UnsignedLong_Converter(args[2], &size)) {
1227 goto exit;
1228 }
1229 if (nargs < 4) {
1230 goto skip_optional;
1231 }
1232 if (!_PyLong_UnsignedLong_Converter(args[3], &flags)) {
1233 goto exit;
1234 }
1235 skip_optional:
1236 return_value = _overlapped_Overlapped_WSARecvFromInto_impl((OverlappedObject *)self, handle, &bufobj, size, flags);
1237
1238 exit:
1239 /* Cleanup for bufobj */
1240 if (bufobj.obj) {
1241 PyBuffer_Release(&bufobj);
1242 }
1243
1244 return return_value;
1245 }
1246 /*[clinic end generated code: output=0ecaf45a09539599 input=a9049054013a1b77]*/