!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/lib/python2.5/site-packages/twisted/internet/iocpreactor/iocpsupport/   drwxr-xr-x
Free 129.59 GB of 142.11 GB (91.19%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     iocpsupport.c (186.37 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* Generated by Cython 0.11.2 on Fri Jan 08 20:14:16 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
       void *buf;
       PyObject *obj;
       Py_ssize_t len;
       Py_ssize_t itemsize;
       int readonly;
       int ndim;
       char *format;
       Py_ssize_t *shape;
       Py_ssize_t *strides;
       Py_ssize_t *suboffsets;
       void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyBytes_Type
  #define PyString_CheckExact          PyBytes_CheckExact
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define PyBytes_Type                 PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#else
  #define _USE_MATH_DEFINES
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__iocpsupport
#include "io.h"
#include "errno.h"
#include "winsock2.h"
#include "windows.h"
#include "python.h"
#include "string.h"
#include "winsock_pointers.h"
#define __PYX_USE_C99_COMPLEX defined(_Complex_I)


#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE 
#endif

typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/



static int __pyx_skip_dispatch = 0;


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;


#ifdef CYTHON_REFNANNY
typedef struct {
  void (*INCREF)(void*, PyObject*, int);
  void (*DECREF)(void*, PyObject*, int);
  void (*GOTREF)(void*, PyObject*, int);
  void (*GIVEREF)(void*, PyObject*, int);
  void* (*NewContext)(const char*, int, const char*);
  void (*FinishContext)(void**);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
#else
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_SetupRefcountContext(name)
#define __Pyx_FinishRefcountContext()
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static INLINE void __Pyx_RaiseTooManyValuesError(void);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static INLINE char __Pyx_PyInt_AsChar(PyObject *);

static INLINE short __Pyx_PyInt_AsShort(PyObject *);

static INLINE int __Pyx_PyInt_AsInt(PyObject *);

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static INLINE long __Pyx_PyInt_AsLong(PyObject *);

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

/* Type declarations */

typedef int __pyx_t_11iocpsupport_size_t;

typedef unsigned long __pyx_t_11iocpsupport_HANDLE;

typedef unsigned long __pyx_t_11iocpsupport_SOCKET;

typedef unsigned long __pyx_t_11iocpsupport_DWORD;

typedef unsigned long __pyx_t_11iocpsupport_ULONG_PTR;

typedef int __pyx_t_11iocpsupport_BOOL;

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":104
 * #    BOOL (*lpTransmitFile)(SOCKET s, HANDLE hFile, DWORD size, DWORD buffer_size, OVERLAPPED *ov, TRANSMIT_FILE_BUFFERS *buff, DWORD flags)
 * 
 * cdef struct myOVERLAPPED:             # <<<<<<<<<<<<<<
 *     OVERLAPPED ov
 *     PyObject *obj
 */

struct __pyx_t_11iocpsupport_myOVERLAPPED {
  OVERLAPPED ov;
  struct PyObject *obj;
};

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":129
 *             setattr(self, k, v)
 * 
 * cdef class CompletionPort:             # <<<<<<<<<<<<<<
 *     cdef HANDLE port
 *     def __init__(self):
 */

struct __pyx_obj_11iocpsupport_CompletionPort {
  PyObject_HEAD
  __pyx_t_11iocpsupport_HANDLE port;
};
/* Module declarations from iocpsupport */

static PyTypeObject *__pyx_ptype_11iocpsupport_CompletionPort = 0;
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void); /*proto*/
static void __pyx_f_11iocpsupport_raise_error(int, PyObject *); /*proto*/
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *, int); /*proto*/
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *, PyObject *); /*proto*/
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/
#define __Pyx_MODULE_NAME "iocpsupport"
int __pyx_module_is_main_iocpsupport = 0;

/* Implementation of iocpsupport */
static char __pyx_k_1[] = "Failed to initialize Winsock function vectors";
static PyObject *__pyx_int_0;
static char __pyx_k___main__[] = "__main__";
static PyObject *__pyx_kp___main__;
static char __pyx_k___init__[] = "__init__";
static PyObject *__pyx_kp___init__;
static char __pyx_k_addHandle[] = "addHandle";
static PyObject *__pyx_kp_addHandle;
static char __pyx_k_getEvent[] = "getEvent";
static PyObject *__pyx_kp_getEvent;
static char __pyx_k_postEvent[] = "postEvent";
static PyObject *__pyx_kp_postEvent;
static char __pyx_k___del__[] = "__del__";
static PyObject *__pyx_kp___del__;
static char __pyx_k_self[] = "self";
static PyObject *__pyx_kp_self;
static char __pyx_k_callback[] = "callback";
static PyObject *__pyx_kp_callback;
static char __pyx_k_owner[] = "owner";
static PyObject *__pyx_kp_owner;
static char __pyx_k_handle[] = "handle";
static PyObject *__pyx_kp_handle;
static char __pyx_k_key[] = "key";
static PyObject *__pyx_kp_key;
static char __pyx_k_timeout[] = "timeout";
static PyObject *__pyx_kp_timeout;
static char __pyx_k_bytes[] = "bytes";
static PyObject *__pyx_kp_bytes;
static char __pyx_k_obj[] = "obj";
static PyObject *__pyx_kp_obj;
static char __pyx_k_buff[] = "buff";
static PyObject *__pyx_kp_buff;
static char __pyx_k_size[] = "size";
static PyObject *__pyx_kp_size;
static char __pyx_k_s[] = "s";
static PyObject *__pyx_kp_s;
static char __pyx_k_listening[] = "listening";
static PyObject *__pyx_kp_listening;
static char __pyx_k_accepting[] = "accepting";
static PyObject *__pyx_kp_accepting;
static char __pyx_k_addr[] = "addr";
static PyObject *__pyx_kp_addr;
static char __pyx_k_bufflist[] = "bufflist";
static PyObject *__pyx_kp_bufflist;
static char __pyx_k_flags[] = "flags";
static PyObject *__pyx_kp_flags;
static char __pyx_k_addr_buff[] = "addr_buff";
static PyObject *__pyx_kp_addr_buff;
static char __pyx_k_addr_len_buff[] = "addr_len_buff";
static PyObject *__pyx_kp_addr_len_buff;
static char __pyx_k_Event[] = "Event";
static PyObject *__pyx_kp_Event;
static char __pyx_k_socket[] = "socket";
static PyObject *__pyx_kp_socket;
static char __pyx_k_ValueError[] = "ValueError";
static PyObject *__pyx_kp_ValueError;
static char __pyx_k_have_connectex[] = "have_connectex";
static PyObject *__pyx_kp_have_connectex;
static char __pyx_k_MemoryError[] = "MemoryError";
static PyObject *__pyx_kp_MemoryError;
static char __pyx_k_WindowsError[] = "WindowsError";
static PyObject *__pyx_kp_WindowsError;
static char __pyx_k_ignore[] = "ignore";
static PyObject *__pyx_kp_ignore;
static char __pyx_k_items[] = "items";
static PyObject *__pyx_kp_items;
static char __pyx_k_2[] = "CreateIoCompletionPort";
static PyObject *__pyx_kp_2;
static char __pyx_k_3[] = "CreateIoCompletionPort";
static PyObject *__pyx_kp_3;
static char __pyx_k_4[] = "PostQueuedCompletionStatus";
static PyObject *__pyx_kp_4;
static char __pyx_k_6[] = "getsockopt";
static PyObject *__pyx_kp_6;
static char __pyx_k_7[] = "getsockopt";
static PyObject *__pyx_kp_7;
static PyObject *__pyx_kp_1;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_WindowsError;
static PyObject *__pyx_kp_5;
static char __pyx_k_5[] = "invalid IP address";
static PyObject *__pyx_kp_8;
static PyObject *__pyx_kp_9;
static char __pyx_k_8[] = "ConnectEx is not available on this system";
static char __pyx_k_9[] = "unsupported address family";
static char __pyx_k_10[] = "second argument needs to be a list";
static PyObject *__pyx_kp_11;
static char __pyx_k_11[] = "length of address length buffer needs to be sizeof(int)";

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":108
 *     PyObject *obj
 * 
 * cdef myOVERLAPPED *makeOV() except NULL:             # <<<<<<<<<<<<<<
 *     cdef myOVERLAPPED *res
 *     res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
 */

static  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void) {
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_res;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_r;
  void *__pyx_t_1;
  int __pyx_t_2;
  __Pyx_SetupRefcountContext("makeOV");

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":110
 * cdef myOVERLAPPED *makeOV() except NULL:
 *     cdef myOVERLAPPED *res
 *     res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))             # <<<<<<<<<<<<<<
 *     if not res:
 *         raise MemoryError
 */
  __pyx_t_1 = PyMem_Malloc((sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_t_1);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":111
 *     cdef myOVERLAPPED *res
 *     res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
 *     if not res:             # <<<<<<<<<<<<<<
 *         raise MemoryError
 *     memset(res, 0, sizeof(myOVERLAPPED))
 */
  __pyx_t_2 = (!(__pyx_v_res != 0));
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":112
 *     res = <myOVERLAPPED *>PyMem_Malloc(sizeof(myOVERLAPPED))
 *     if not res:
 *         raise MemoryError             # <<<<<<<<<<<<<<
 *     memset(res, 0, sizeof(myOVERLAPPED))
 *     return res
 */
    __Pyx_Raise(__pyx_builtin_MemoryError, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":113
 *     if not res:
 *         raise MemoryError
 *     memset(res, 0, sizeof(myOVERLAPPED))             # <<<<<<<<<<<<<<
 *     return res
 * 
 */
  memset(__pyx_v_res, 0, (sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED)));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":114
 *         raise MemoryError
 *     memset(res, 0, sizeof(myOVERLAPPED))
 *     return res             # <<<<<<<<<<<<<<
 * 
 * cdef void raise_error(int err, object message) except *:
 */
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iocpsupport.makeOV");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":116
 *     return res
 * 
 * cdef void raise_error(int err, object message) except *:             # <<<<<<<<<<<<<<
 *     if not err:
 *         err = GetLastError()
 */

static  void __pyx_f_11iocpsupport_raise_error(int __pyx_v_err, PyObject *__pyx_v_message) {
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_SetupRefcountContext("raise_error");

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":117
 * 
 * cdef void raise_error(int err, object message) except *:
 *     if not err:             # <<<<<<<<<<<<<<
 *         err = GetLastError()
 *     raise WindowsError(message, err)
 */
  __pyx_t_1 = (!__pyx_v_err);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":118
 * cdef void raise_error(int err, object message) except *:
 *     if not err:
 *         err = GetLastError()             # <<<<<<<<<<<<<<
 *     raise WindowsError(message, err)
 * 
 */
    __pyx_v_err = GetLastError();
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":119
 *     if not err:
 *         err = GetLastError()
 *     raise WindowsError(message, err)             # <<<<<<<<<<<<<<
 * 
 * class Event:
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_err); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_message);
  __Pyx_GIVEREF(__pyx_v_message);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_WindowsError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iocpsupport.raise_error");
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":122
 * 
 * class Event:
 *     def __init__(self, callback, owner, **kw):             # <<<<<<<<<<<<<<
 *         self.callback = callback
 *         self.owner = owner
 */

static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11iocpsupport_5Event___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_11iocpsupport_5Event___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_callback = 0;
  PyObject *__pyx_v_owner = 0;
  PyObject *__pyx_v_kw = 0;
  PyObject *__pyx_v_k;
  PyObject *__pyx_v_v;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_self,&__pyx_kp_callback,&__pyx_kp_owner,0};
  __Pyx_SetupRefcountContext("__init__");
  __pyx_self = __pyx_self;
  __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
  __Pyx_GOTREF(__pyx_v_kw);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_callback);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_owner);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_callback = values[1];
    __pyx_v_owner = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_owner = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_AddTraceback("iocpsupport.Event.__init__");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":123
 * class Event:
 *     def __init__(self, callback, owner, **kw):
 *         self.callback = callback             # <<<<<<<<<<<<<<
 *         self.owner = owner
 *         self.ignore = False
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":124
 *     def __init__(self, callback, owner, **kw):
 *         self.callback = callback
 *         self.owner = owner             # <<<<<<<<<<<<<<
 *         self.ignore = False
 *         for k, v in kw.items():
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_owner, __pyx_v_owner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":125
 *         self.callback = callback
 *         self.owner = owner
 *         self.ignore = False             # <<<<<<<<<<<<<<
 *         for k, v in kw.items():
 *             setattr(self, k, v)
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_v_self, __pyx_kp_ignore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":126
 *         self.owner = owner
 *         self.ignore = False
 *         for k, v in kw.items():             # <<<<<<<<<<<<<<
 *             setattr(self, k, v)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_kw, __pyx_kp_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1);
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_1);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) {
      PyObject* tuple = __pyx_t_3;
      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_2;
      __pyx_2 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_3;
      __pyx_3 = 0;
    } else {
      __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_2);
      __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_3);
      if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
      __Pyx_DECREF(__pyx_v_k);
      __pyx_v_k = __pyx_2;
      __pyx_2 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_3;
      __pyx_3 = 0;
    }

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":127
 *         self.ignore = False
 *         for k, v in kw.items():
 *             setattr(self, k, v)             # <<<<<<<<<<<<<<
 * 
 * cdef class CompletionPort:
 */
    __pyx_t_4 = PyObject_SetAttr(__pyx_v_self, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_3);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("iocpsupport.Event.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_kw);
  __Pyx_DECREF(__pyx_v_k);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":131
 * cdef class CompletionPort:
 *     cdef HANDLE port
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
 */

static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __pyx_t_11iocpsupport_HANDLE __pyx_v_res;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_SetupRefcountContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":133
 *     def __init__(self):
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)             # <<<<<<<<<<<<<<
 *         if not res:
 *             raise_error(0, 'CreateIoCompletionPort')
 */
  __pyx_v_res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":134
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
 *         if not res:             # <<<<<<<<<<<<<<
 *             raise_error(0, 'CreateIoCompletionPort')
 *         self.port = res
 */
  __pyx_t_1 = (!__pyx_v_res);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":135
 *         res = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0)
 *         if not res:
 *             raise_error(0, 'CreateIoCompletionPort')             # <<<<<<<<<<<<<<
 *         self.port = res
 * 
 */
    __pyx_f_11iocpsupport_raise_error(0, __pyx_kp_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":136
 *         if not res:
 *             raise_error(0, 'CreateIoCompletionPort')
 *         self.port = res             # <<<<<<<<<<<<<<
 * 
 *     def addHandle(self, long handle, long key=0):
 */
  ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port = __pyx_v_res;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":138
 *         self.port = res
 * 
 *     def addHandle(self, long handle, long key=0):             # <<<<<<<<<<<<<<
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(handle, self.port, key, 0)
 */

static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_handle;
  long __pyx_v_key;
  __pyx_t_11iocpsupport_HANDLE __pyx_v_res;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_handle,&__pyx_kp_key,0};
  __Pyx_SetupRefcountContext("addHandle");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_handle);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_key);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "addHandle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_handle = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[1]) {
      __pyx_v_key = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_key = 0;
    }
  } else {
    __pyx_v_key = 0;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_key = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_handle = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_handle == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addHandle", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":140
 *     def addHandle(self, long handle, long key=0):
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(handle, self.port, key, 0)             # <<<<<<<<<<<<<<
 *         if not res:
 *             raise_error(0, 'CreateIoCompletionPort')
 */
  __pyx_v_res = CreateIoCompletionPort(__pyx_v_handle, ((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_key, 0);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":141
 *         cdef HANDLE res
 *         res = CreateIoCompletionPort(handle, self.port, key, 0)
 *         if not res:             # <<<<<<<<<<<<<<
 *             raise_error(0, 'CreateIoCompletionPort')
 * 
 */
  __pyx_t_1 = (!__pyx_v_res);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":142
 *         res = CreateIoCompletionPort(handle, self.port, key, 0)
 *         if not res:
 *             raise_error(0, 'CreateIoCompletionPort')             # <<<<<<<<<<<<<<
 * 
 *     def getEvent(self, long timeout):
 */
    __pyx_f_11iocpsupport_raise_error(0, __pyx_kp_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":144
 *             raise_error(0, 'CreateIoCompletionPort')
 * 
 *     def getEvent(self, long timeout):             # <<<<<<<<<<<<<<
 *         cdef PyThreadState *_save
 *         cdef unsigned long bytes, key, rc
 */

static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_arg_timeout) {
  long __pyx_v_timeout;
  struct PyThreadState *__pyx_v__save;
  unsigned long __pyx_v_bytes;
  unsigned long __pyx_v_key;
  unsigned long __pyx_v_rc;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  PyObject *__pyx_v_obj;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_SetupRefcountContext("getEvent");
  assert(__pyx_arg_timeout); {
    __pyx_v_timeout = __Pyx_PyInt_AsLong(__pyx_arg_timeout); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":149
 *         cdef myOVERLAPPED *ov
 * 
 *         _save = PyEval_SaveThread()             # <<<<<<<<<<<<<<
 *         rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
 *         PyEval_RestoreThread(_save)
 */
  __pyx_v__save = PyEval_SaveThread();

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":150
 * 
 *         _save = PyEval_SaveThread()
 *         rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)             # <<<<<<<<<<<<<<
 *         PyEval_RestoreThread(_save)
 * 
 */
  __pyx_v_rc = GetQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, (&__pyx_v_bytes), (&__pyx_v_key), ((OVERLAPPED **)(&__pyx_v_ov)), __pyx_v_timeout);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":151
 *         _save = PyEval_SaveThread()
 *         rc = GetQueuedCompletionStatus(self.port, &bytes, &key, <OVERLAPPED **>&ov, timeout)
 *         PyEval_RestoreThread(_save)             # <<<<<<<<<<<<<<
 * 
 *         if not rc:
 */
  PyEval_RestoreThread(__pyx_v__save);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":153
 *         PyEval_RestoreThread(_save)
 * 
 *         if not rc:             # <<<<<<<<<<<<<<
 *             rc = GetLastError()
 *         else:
 */
  __pyx_t_1 = (!__pyx_v_rc);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":154
 * 
 *         if not rc:
 *             rc = GetLastError()             # <<<<<<<<<<<<<<
 *         else:
 *             rc = 0
 */
    __pyx_v_rc = GetLastError();
    goto __pyx_L5;
  }
  /*else*/ {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":156
 *             rc = GetLastError()
 *         else:
 *             rc = 0             # <<<<<<<<<<<<<<
 * 
 *         obj = None
 */
    __pyx_v_rc = 0;
  }
  __pyx_L5:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":158
 *             rc = 0
 * 
 *         obj = None             # <<<<<<<<<<<<<<
 *         if ov:
 *             if ov.obj:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_DECREF(__pyx_v_obj);
  __pyx_v_obj = Py_None;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":159
 * 
 *         obj = None
 *         if ov:             # <<<<<<<<<<<<<<
 *             if ov.obj:
 *                 obj = <object>ov.obj
 */
  __pyx_t_1 = (__pyx_v_ov != 0);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":160
 *         obj = None
 *         if ov:
 *             if ov.obj:             # <<<<<<<<<<<<<<
 *                 obj = <object>ov.obj
 *                 Py_DECREF(obj) # we are stealing a reference here
 */
    __pyx_t_1 = (__pyx_v_ov->obj != 0);
    if (__pyx_t_1) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":161
 *         if ov:
 *             if ov.obj:
 *                 obj = <object>ov.obj             # <<<<<<<<<<<<<<
 *                 Py_DECREF(obj) # we are stealing a reference here
 *             PyMem_Free(ov)
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_ov->obj));
      __Pyx_DECREF(__pyx_v_obj);
      __pyx_v_obj = ((PyObject *)__pyx_v_ov->obj);

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":162
 *             if ov.obj:
 *                 obj = <object>ov.obj
 *                 Py_DECREF(obj) # we are stealing a reference here             # <<<<<<<<<<<<<<
 *             PyMem_Free(ov)
 * 
 */
      Py_DECREF(__pyx_v_obj);
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":163
 *                 obj = <object>ov.obj
 *                 Py_DECREF(obj) # we are stealing a reference here
 *             PyMem_Free(ov)             # <<<<<<<<<<<<<<
 * 
 *         return (rc, bytes, key, obj)
 */
    PyMem_Free(__pyx_v_ov);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":165
 *             PyMem_Free(ov)
 * 
 *         return (rc, bytes, key, obj)             # <<<<<<<<<<<<<<
 * 
 *     def postEvent(self, unsigned long bytes, unsigned long key, obj):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_rc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_obj);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":167
 *         return (rc, bytes, key, obj)
 * 
 *     def postEvent(self, unsigned long bytes, unsigned long key, obj):             # <<<<<<<<<<<<<<
 *         cdef myOVERLAPPED *ov
 *         cdef unsigned long rc
 */

static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_bytes;
  unsigned long __pyx_v_key;
  PyObject *__pyx_v_obj = 0;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  unsigned long __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_bytes,&__pyx_kp_key,&__pyx_kp_obj,0};
  __Pyx_SetupRefcountContext("postEvent");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bytes);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_key);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "postEvent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_key = __Pyx_PyInt_AsUnsignedLong(values[1]); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_obj = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_bytes = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_bytes == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_key = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_key == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("postEvent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":171
 *         cdef unsigned long rc
 * 
 *         if obj is not None:             # <<<<<<<<<<<<<<
 *             ov = makeOV()
 *             Py_INCREF(obj) # give ov its own reference to obj
 */
  __pyx_t_1 = (__pyx_v_obj != Py_None);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":172
 * 
 *         if obj is not None:
 *             ov = makeOV()             # <<<<<<<<<<<<<<
 *             Py_INCREF(obj) # give ov its own reference to obj
 *             ov.obj = <PyObject *>obj
 */
    __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ov = __pyx_t_2;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":173
 *         if obj is not None:
 *             ov = makeOV()
 *             Py_INCREF(obj) # give ov its own reference to obj             # <<<<<<<<<<<<<<
 *             ov.obj = <PyObject *>obj
 *         else:
 */
    Py_INCREF(__pyx_v_obj);

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":174
 *             ov = makeOV()
 *             Py_INCREF(obj) # give ov its own reference to obj
 *             ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 *         else:
 *             ov = NULL
 */
    __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":176
 *             ov.obj = <PyObject *>obj
 *         else:
 *             ov = NULL             # <<<<<<<<<<<<<<
 * 
 *         rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
 */
    __pyx_v_ov = NULL;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":178
 *             ov = NULL
 * 
 *         rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)             # <<<<<<<<<<<<<<
 *         if not rc:
 *             raise_error(0, 'PostQueuedCompletionStatus')
 */
  __pyx_v_rc = PostQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port, __pyx_v_bytes, __pyx_v_key, ((OVERLAPPED *)__pyx_v_ov));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":179
 * 
 *         rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
 *         if not rc:             # <<<<<<<<<<<<<<
 *             raise_error(0, 'PostQueuedCompletionStatus')
 * 
 */
  __pyx_t_1 = (!__pyx_v_rc);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":180
 *         rc = PostQueuedCompletionStatus(self.port, bytes, key, <OVERLAPPED *>ov)
 *         if not rc:
 *             raise_error(0, 'PostQueuedCompletionStatus')             # <<<<<<<<<<<<<<
 * 
 *     def __del__(self):
 */
    __pyx_f_11iocpsupport_raise_error(0, __pyx_kp_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":182
 *             raise_error(0, 'PostQueuedCompletionStatus')
 * 
 *     def __del__(self):             # <<<<<<<<<<<<<<
 *         CloseHandle(self.port)
 * 
 */

static PyObject *__pyx_pf_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_SetupRefcountContext("__del__");

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":183
 * 
 *     def __del__(self):
 *         CloseHandle(self.port)             # <<<<<<<<<<<<<<
 * 
 * def makesockaddr(object buff):
 */
  CloseHandle(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":185
 *         CloseHandle(self.port)
 * 
 * def makesockaddr(object buff):             # <<<<<<<<<<<<<<
 *     cdef void *mem_buffer
 *     cdef int size
 */

static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_v_buff) {
  void *__pyx_v_mem_buffer;
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_SetupRefcountContext("makesockaddr");
  __pyx_self = __pyx_self;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":189
 *     cdef int size
 * 
 *     PyObject_AsReadBuffer(buff, &mem_buffer, &size)             # <<<<<<<<<<<<<<
 *     # XXX: this should really return the address family as well
 *     return _makesockaddr(<sockaddr *>mem_buffer, size)
 */
  __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":191
 *     PyObject_AsReadBuffer(buff, &mem_buffer, &size)
 *     # XXX: this should really return the address family as well
 *     return _makesockaddr(<sockaddr *>mem_buffer, size)             # <<<<<<<<<<<<<<
 * 
 * cdef object _makesockaddr(sockaddr *addr, int len):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_11iocpsupport__makesockaddr(((struct sockaddr *)__pyx_v_mem_buffer), __pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("iocpsupport.makesockaddr");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":193
 *     return _makesockaddr(<sockaddr *>mem_buffer, size)
 * 
 * cdef object _makesockaddr(sockaddr *addr, int len):             # <<<<<<<<<<<<<<
 *     cdef sockaddr_in *sin
 *     if not len:
 */

static  PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr, int __pyx_v_len) {
  struct sockaddr_in *__pyx_v_sin;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_SetupRefcountContext("_makesockaddr");

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":195
 * cdef object _makesockaddr(sockaddr *addr, int len):
 *     cdef sockaddr_in *sin
 *     if not len:             # <<<<<<<<<<<<<<
 *         return None
 *     if addr.sa_family == AF_INET:
 */
  __pyx_t_1 = (!__pyx_v_len);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":196
 *     cdef sockaddr_in *sin
 *     if not len:
 *         return None             # <<<<<<<<<<<<<<
 *     if addr.sa_family == AF_INET:
 *         sin = <sockaddr_in *>addr
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":197
 *     if not len:
 *         return None
 *     if addr.sa_family == AF_INET:             # <<<<<<<<<<<<<<
 *         sin = <sockaddr_in *>addr
 *         return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
 */
  __pyx_t_1 = (__pyx_v_addr->sa_family == AF_INET);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":198
 *         return None
 *     if addr.sa_family == AF_INET:
 *         sin = <sockaddr_in *>addr             # <<<<<<<<<<<<<<
 *         return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
 *     else:
 */
    __pyx_v_sin = ((struct sockaddr_in *)__pyx_v_addr);

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":199
 *     if addr.sa_family == AF_INET:
 *         sin = <sockaddr_in *>addr
 *         return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)             # <<<<<<<<<<<<<<
 *     else:
 *         return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyString_FromString(inet_ntoa(__pyx_v_sin->sin_addr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromLong(ntohs(__pyx_v_sin->sin_port)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":201
 *         return PyString_FromString(inet_ntoa(sin.sin_addr)), ntohs(sin.sin_port)
 *     else:
 *         return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))             # <<<<<<<<<<<<<<
 * 
 * cdef object fillinetaddr(sockaddr_in *dest, object addr):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_addr->sa_data, (sizeof(__pyx_v_addr->sa_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("iocpsupport._makesockaddr");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":203
 *         return PyString_FromStringAndSize(addr.sa_data, sizeof(addr.sa_data))
 * 
 * cdef object fillinetaddr(sockaddr_in *dest, object addr):             # <<<<<<<<<<<<<<
 *     cdef unsigned short port
 *     cdef unsigned long res
 */

static  PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *__pyx_v_dest, PyObject *__pyx_v_addr) {
  unsigned short __pyx_v_port;
  unsigned long __pyx_v_res;
  char *__pyx_v_hoststr;
  PyObject *__pyx_v_host;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  unsigned short __pyx_t_1;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_SetupRefcountContext("fillinetaddr");
  __pyx_v_host = Py_None; __Pyx_INCREF(Py_None);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":207
 *     cdef unsigned long res
 *     cdef char *hoststr
 *     host, port = addr             # <<<<<<<<<<<<<<
 * 
 *     hoststr = PyString_AsString(host)
 */
  if (PyTuple_CheckExact(__pyx_v_addr) && likely(PyTuple_GET_SIZE(__pyx_v_addr) == 2)) {
    PyObject* tuple = __pyx_v_addr;
    __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
    __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
    __pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_3); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_DECREF(__pyx_v_host);
    __pyx_v_host = __pyx_2;
    __pyx_2 = 0;
    __pyx_v_port = __pyx_t_1;
  } else {
    __pyx_1 = PyObject_GetIter(__pyx_v_addr); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_1);
    __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_2);
    __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_3);
    __pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_3); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
    if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
    __Pyx_DECREF(__pyx_v_host);
    __pyx_v_host = __pyx_2;
    __pyx_2 = 0;
    __pyx_v_port = __pyx_t_1;
  }

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":209
 *     host, port = addr
 * 
 *     hoststr = PyString_AsString(host)             # <<<<<<<<<<<<<<
 *     res = inet_addr(hoststr)
 *     if res == INADDR_ANY:
 */
  __pyx_t_2 = PyString_AsString(__pyx_v_host); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_hoststr = __pyx_t_2;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":210
 * 
 *     hoststr = PyString_AsString(host)
 *     res = inet_addr(hoststr)             # <<<<<<<<<<<<<<
 *     if res == INADDR_ANY:
 *         raise ValueError, 'invalid IP address'
 */
  __pyx_v_res = inet_addr(__pyx_v_hoststr);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":211
 *     hoststr = PyString_AsString(host)
 *     res = inet_addr(hoststr)
 *     if res == INADDR_ANY:             # <<<<<<<<<<<<<<
 *         raise ValueError, 'invalid IP address'
 *     dest.sin_addr.s_addr = res
 */
  __pyx_t_3 = (__pyx_v_res == INADDR_ANY);
  if (__pyx_t_3) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":212
 *     res = inet_addr(hoststr)
 *     if res == INADDR_ANY:
 *         raise ValueError, 'invalid IP address'             # <<<<<<<<<<<<<<
 *     dest.sin_addr.s_addr = res
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_5, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":213
 *     if res == INADDR_ANY:
 *         raise ValueError, 'invalid IP address'
 *     dest.sin_addr.s_addr = res             # <<<<<<<<<<<<<<
 * 
 *     dest.sin_port = htons(port)
 */
  __pyx_v_dest->sin_addr.s_addr = __pyx_v_res;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":215
 *     dest.sin_addr.s_addr = res
 * 
 *     dest.sin_port = htons(port)             # <<<<<<<<<<<<<<
 * 
 * def AllocateReadBuffer(int size):
 */
  __pyx_v_dest->sin_port = htons(__pyx_v_port);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_3);
  __Pyx_AddTraceback("iocpsupport.fillinetaddr");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_host);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":217
 *     dest.sin_port = htons(port)
 * 
 * def AllocateReadBuffer(int size):             # <<<<<<<<<<<<<<
 *     return PyBuffer_New(size)
 * 
 */

static PyObject *__pyx_pf_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_arg_size) {
  int __pyx_v_size;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_SetupRefcountContext("AllocateReadBuffer");
  __pyx_self = __pyx_self;
  assert(__pyx_arg_size); {
    __pyx_v_size = __Pyx_PyInt_AsInt(__pyx_arg_size); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":218
 * 
 * def AllocateReadBuffer(int size):
 *     return PyBuffer_New(size)             # <<<<<<<<<<<<<<
 * 
 * def maxAddrLen(long s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyBuffer_New(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":220
 *     return PyBuffer_New(size)
 * 
 * def maxAddrLen(long s):             # <<<<<<<<<<<<<<
 *     cdef WSAPROTOCOL_INFO wsa_pi
 *     cdef int size, rc
 */

static PyObject *__pyx_pf_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_arg_s) {
  long __pyx_v_s;
  WSAPROTOCOL_INFO __pyx_v_wsa_pi;
  int __pyx_v_size;
  int __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_SetupRefcountContext("maxAddrLen");
  __pyx_self = __pyx_self;
  assert(__pyx_arg_s); {
    __pyx_v_s = __Pyx_PyInt_AsLong(__pyx_arg_s); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.maxAddrLen");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":224
 *     cdef int size, rc
 * 
 *     size = sizeof(wsa_pi)             # <<<<<<<<<<<<<<
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:
 */
  __pyx_v_size = (sizeof(__pyx_v_wsa_pi));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":225
 * 
 *     size = sizeof(wsa_pi)
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)             # <<<<<<<<<<<<<<
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')
 */
  __pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":226
 *     size = sizeof(wsa_pi)
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:             # <<<<<<<<<<<<<<
 *         raise_error(WSAGetLastError(), 'getsockopt')
 *     return wsa_pi.iMaxSockAddr
 */
  __pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":227
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')             # <<<<<<<<<<<<<<
 *     return wsa_pi.iMaxSockAddr
 * 
 */
    __pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_kp_6); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":228
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')
 *     return wsa_pi.iMaxSockAddr             # <<<<<<<<<<<<<<
 * 
 * cdef int getAddrFamily(SOCKET s) except *:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("iocpsupport.maxAddrLen");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":230
 *     return wsa_pi.iMaxSockAddr
 * 
 * cdef int getAddrFamily(SOCKET s) except *:             # <<<<<<<<<<<<<<
 *     cdef WSAPROTOCOL_INFO wsa_pi
 *     cdef int size, rc
 */

static  int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET __pyx_v_s) {
  WSAPROTOCOL_INFO __pyx_v_wsa_pi;
  int __pyx_v_size;
  int __pyx_v_rc;
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_SetupRefcountContext("getAddrFamily");

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":234
 *     cdef int size, rc
 * 
 *     size = sizeof(wsa_pi)             # <<<<<<<<<<<<<<
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:
 */
  __pyx_v_size = (sizeof(__pyx_v_wsa_pi));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":235
 * 
 *     size = sizeof(wsa_pi)
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)             # <<<<<<<<<<<<<<
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')
 */
  __pyx_v_rc = getsockopt(__pyx_v_s, SOL_SOCKET, SO_PROTOCOL_INFO, ((char *)(&__pyx_v_wsa_pi)), (&__pyx_v_size));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":236
 *     size = sizeof(wsa_pi)
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:             # <<<<<<<<<<<<<<
 *         raise_error(WSAGetLastError(), 'getsockopt')
 *     return wsa_pi.iAddressFamily
 */
  __pyx_t_1 = (__pyx_v_rc == SOCKET_ERROR);
  if (__pyx_t_1) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":237
 *     rc = getsockopt(s, SOL_SOCKET, SO_PROTOCOL_INFO, <char *>&wsa_pi, &size)
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')             # <<<<<<<<<<<<<<
 *     return wsa_pi.iAddressFamily
 * 
 */
    __pyx_f_11iocpsupport_raise_error(WSAGetLastError(), __pyx_kp_7); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":238
 *     if rc == SOCKET_ERROR:
 *         raise_error(WSAGetLastError(), 'getsockopt')
 *     return wsa_pi.iAddressFamily             # <<<<<<<<<<<<<<
 * 
 * import socket # for WSAStartup
 */
  __pyx_r = __pyx_v_wsa_pi.iAddressFamily;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("iocpsupport.getAddrFamily");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":5
 * 
 * 
 * def accept(long listening, long accepting, object buff, object obj):             # <<<<<<<<<<<<<<
 *     cdef unsigned long bytes
 *     cdef int size, rc
 */

static PyObject *__pyx_pf_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_listening;
  long __pyx_v_accepting;
  PyObject *__pyx_v_buff = 0;
  PyObject *__pyx_v_obj = 0;
  unsigned long __pyx_v_bytes;
  int __pyx_v_size;
  int __pyx_v_rc;
  void *__pyx_v_mem_buffer;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_listening,&__pyx_kp_accepting,&__pyx_kp_buff,&__pyx_kp_obj,0};
  __Pyx_SetupRefcountContext("accept");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_listening);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_accepting);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "accept") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_listening = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_accepting = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = values[2];
    __pyx_v_obj = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_listening = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_listening == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_accepting = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_accepting == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accept", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.accept");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":11
 *     cdef myOVERLAPPED *ov
 * 
 *     PyObject_AsWriteBuffer(buff, &mem_buffer, &size)             # <<<<<<<<<<<<<<
 * 
 *     ov = makeOV()
 */
  __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":13
 *     PyObject_AsWriteBuffer(buff, &mem_buffer, &size)
 * 
 *     ov = makeOV()             # <<<<<<<<<<<<<<
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj
 */
  __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ov = __pyx_t_2;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":14
 * 
 *     ov = makeOV()
 *     if obj is not None:             # <<<<<<<<<<<<<<
 *         ov.obj = <PyObject *>obj
 * 
 */
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  if (__pyx_t_3) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":15
 *     ov = makeOV()
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 * 
 *     rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
 */
    __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":18
 * 
 *     rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
 *                     &bytes, <OVERLAPPED *>ov)             # <<<<<<<<<<<<<<
 *     if not rc:
 *         rc = WSAGetLastError()
 */
  __pyx_v_rc = lpAcceptEx(__pyx_v_listening, __pyx_v_accepting, __pyx_v_mem_buffer, 0, (__pyx_v_size / 2), (__pyx_v_size / 2), (&__pyx_v_bytes), ((OVERLAPPED *)__pyx_v_ov));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":19
 *     rc = lpAcceptEx(listening, accepting, mem_buffer, 0, size / 2, size / 2,
 *                     &bytes, <OVERLAPPED *>ov)
 *     if not rc:             # <<<<<<<<<<<<<<
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 */
  __pyx_t_3 = (!__pyx_v_rc);
  if (__pyx_t_3) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":20
 *                     &bytes, <OVERLAPPED *>ov)
 *     if not rc:
 *         rc = WSAGetLastError()             # <<<<<<<<<<<<<<
 *         if rc != ERROR_IO_PENDING:
 *             return rc
 */
    __pyx_v_rc = WSAGetLastError();

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":21
 *     if not rc:
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:             # <<<<<<<<<<<<<<
 *             return rc
 * 
 */
    __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
    if (__pyx_t_3) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":22
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 *             return rc             # <<<<<<<<<<<<<<
 * 
 *     # operation is in progress
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25
 * 
 *     # operation is in progress
 *     Py_XINCREF(obj)             # <<<<<<<<<<<<<<
 *     return rc
 * 
 */
  Py_XINCREF(__pyx_v_obj);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":26
 *     # operation is in progress
 *     Py_XINCREF(obj)
 *     return rc             # <<<<<<<<<<<<<<
 * 
 * def get_accept_addrs(long s, object buff):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("iocpsupport.accept");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":28
 *     return rc
 * 
 * def get_accept_addrs(long s, object buff):             # <<<<<<<<<<<<<<
 *     cdef WSAPROTOCOL_INFO wsa_pi
 *     cdef int size, locallen, remotelen
 */

static PyObject *__pyx_pf_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_s;
  PyObject *__pyx_v_buff = 0;
  int __pyx_v_size;
  int __pyx_v_locallen;
  int __pyx_v_remotelen;
  void *__pyx_v_mem_buffer;
  struct sockaddr *__pyx_v_localaddr;
  struct sockaddr *__pyx_v_remoteaddr;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,0};
  __Pyx_SetupRefcountContext("get_accept_addrs");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_accept_addrs") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_accept_addrs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.get_accept_addrs");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":34
 *     cdef sockaddr *localaddr, *remoteaddr
 * 
 *     PyObject_AsReadBuffer(buff, &mem_buffer, &size)             # <<<<<<<<<<<<<<
 * 
 *     lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
 */
  __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, (&__pyx_v_mem_buffer), (&__pyx_v_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":36
 *     PyObject_AsReadBuffer(buff, &mem_buffer, &size)
 * 
 *     lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)             # <<<<<<<<<<<<<<
 *     return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen)
 * 
 */
  lpGetAcceptExSockaddrs(__pyx_v_mem_buffer, 0, (__pyx_v_size / 2), (__pyx_v_size / 2), (&__pyx_v_localaddr), (&__pyx_v_locallen), (&__pyx_v_remoteaddr), (&__pyx_v_remotelen));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":37
 * 
 *     lpGetAcceptExSockaddrs(mem_buffer, 0, size / 2, size / 2, &localaddr, &locallen, &remoteaddr, &remotelen)
 *     return remoteaddr.sa_family, _makesockaddr(localaddr, locallen), _makesockaddr(remoteaddr, remotelen)             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_remoteaddr->sa_family); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_localaddr, __pyx_v_locallen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_remoteaddr, __pyx_v_remotelen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("iocpsupport.get_accept_addrs");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":5
 * 
 * 
 * def connect(long s, object addr, object obj):             # <<<<<<<<<<<<<<
 *     cdef int family, rc
 *     cdef myOVERLAPPED *ov
 */

static PyObject *__pyx_pf_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_s;
  PyObject *__pyx_v_addr = 0;
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_family;
  int __pyx_v_rc;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  struct sockaddr __pyx_v_name;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_1 = 0;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_addr,&__pyx_kp_obj,0};
  __Pyx_SetupRefcountContext("connect");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "connect") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_addr = values[1];
    __pyx_v_obj = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.connect");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":10
 *     cdef sockaddr name
 * 
 *     if not have_connectex:             # <<<<<<<<<<<<<<
 *         raise ValueError, 'ConnectEx is not available on this system'
 * 
 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_have_connectex); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_1);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":11
 * 
 *     if not have_connectex:
 *         raise ValueError, 'ConnectEx is not available on this system'             # <<<<<<<<<<<<<<
 * 
 *     family = getAddrFamily(s)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_8, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":13
 *         raise ValueError, 'ConnectEx is not available on this system'
 * 
 *     family = getAddrFamily(s)             # <<<<<<<<<<<<<<
 *     if family == AF_INET:
 *         fillinetaddr(<sockaddr_in *>&name, addr)
 */
  __pyx_t_3 = __pyx_f_11iocpsupport_getAddrFamily(__pyx_v_s); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_family = __pyx_t_3;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":14
 * 
 *     family = getAddrFamily(s)
 *     if family == AF_INET:             # <<<<<<<<<<<<<<
 *         fillinetaddr(<sockaddr_in *>&name, addr)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_family == AF_INET);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":15
 *     family = getAddrFamily(s)
 *     if family == AF_INET:
 *         fillinetaddr(<sockaddr_in *>&name, addr)             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError, 'unsupported address family'
 */
    __pyx_t_4 = __pyx_f_11iocpsupport_fillinetaddr(((struct sockaddr_in *)(&__pyx_v_name)), __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":17
 *         fillinetaddr(<sockaddr_in *>&name, addr)
 *     else:
 *         raise ValueError, 'unsupported address family'             # <<<<<<<<<<<<<<
 *     name.sa_family = family
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_9, 0);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":18
 *     else:
 *         raise ValueError, 'unsupported address family'
 *     name.sa_family = family             # <<<<<<<<<<<<<<
 * 
 *     ov = makeOV()
 */
  __pyx_v_name.sa_family = __pyx_v_family;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20
 *     name.sa_family = family
 * 
 *     ov = makeOV()             # <<<<<<<<<<<<<<
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj
 */
  __pyx_t_5 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ov = __pyx_t_5;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21
 * 
 *     ov = makeOV()
 *     if obj is not None:             # <<<<<<<<<<<<<<
 *         ov.obj = <PyObject *>obj
 * 
 */
  __pyx_t_2 = (__pyx_v_obj != Py_None);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":22
 *     ov = makeOV()
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 * 
 *     rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
 */
    __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24
 *         ov.obj = <PyObject *>obj
 * 
 *     rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)             # <<<<<<<<<<<<<<
 * 
 *     if not rc:
 */
  __pyx_v_rc = lpConnectEx(__pyx_v_s, (&__pyx_v_name), (sizeof(__pyx_v_name)), NULL, 0, NULL, ((OVERLAPPED *)__pyx_v_ov));

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":26
 *     rc = lpConnectEx(s, &name, sizeof(name), NULL, 0, NULL, <OVERLAPPED *>ov)
 * 
 *     if not rc:             # <<<<<<<<<<<<<<
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 */
  __pyx_t_2 = (!__pyx_v_rc);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27
 * 
 *     if not rc:
 *         rc = WSAGetLastError()             # <<<<<<<<<<<<<<
 *         if rc != ERROR_IO_PENDING:
 *             return rc
 */
    __pyx_v_rc = WSAGetLastError();

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":28
 *     if not rc:
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:             # <<<<<<<<<<<<<<
 *             return rc
 * 
 */
    __pyx_t_2 = (__pyx_v_rc != ERROR_IO_PENDING);
    if (__pyx_t_2) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":29
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 *             return rc             # <<<<<<<<<<<<<<
 * 
 *     # operation is in progress
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32
 * 
 *     # operation is in progress
 *     Py_XINCREF(obj)             # <<<<<<<<<<<<<<
 *     return rc
 * 
 */
  Py_XINCREF(__pyx_v_obj);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":33
 *     # operation is in progress
 *     Py_XINCREF(obj)
 *     return rc             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("iocpsupport.connect");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5
 * 
 * 
 * def recv(long s, object bufflist, object obj, unsigned long flags = 0):             # <<<<<<<<<<<<<<
 *     cdef int rc, buffcount, i, res
 *     cdef myOVERLAPPED *ov
 */

static PyObject *__pyx_pf_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_s;
  PyObject *__pyx_v_bufflist = 0;
  PyObject *__pyx_v_obj = 0;
  unsigned long __pyx_v_flags;
  int __pyx_v_rc;
  int __pyx_v_buffcount;
  int __pyx_v_i;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  WSABUF *__pyx_v_ws_buf;
  unsigned long __pyx_v_bytes;
  struct PyObject **__pyx_v_buffers;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  void *__pyx_t_2;
  int __pyx_t_3;
  struct PyObject *__pyx_t_4;
  int __pyx_t_5;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_bufflist,&__pyx_kp_obj,&__pyx_kp_flags,0};
  __Pyx_SetupRefcountContext("recv");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_bufflist);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_bufflist = values[1];
    __pyx_v_obj = values[2];
    if (values[3]) {
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = 0;
    }
  } else {
    __pyx_v_flags = 0;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  3:
      __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_bufflist = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recv", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.recv");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_bufflist);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":12
 *     cdef PyObject **buffers
 * 
 *     bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')             # <<<<<<<<<<<<<<
 *     buffcount = PySequence_Fast_GET_SIZE(bufflist)
 *     buffers = PySequence_Fast_ITEMS(bufflist)
 */
  __pyx_t_1 = PySequence_Fast(__pyx_v_bufflist, __pyx_k_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_bufflist);
  __pyx_v_bufflist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13
 * 
 *     bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
 *     buffcount = PySequence_Fast_GET_SIZE(bufflist)             # <<<<<<<<<<<<<<
 *     buffers = PySequence_Fast_ITEMS(bufflist)
 * 
 */
  __pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_v_bufflist);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":14
 *     bufflist = PySequence_Fast(bufflist, 'second argument needs to be a list')
 *     buffcount = PySequence_Fast_GET_SIZE(bufflist)
 *     buffers = PySequence_Fast_ITEMS(bufflist)             # <<<<<<<<<<<<<<
 * 
 *     ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
 */
  __pyx_v_buffers = PySequence_Fast_ITEMS(__pyx_v_bufflist);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":16
 *     buffers = PySequence_Fast_ITEMS(bufflist)
 * 
 *     ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __pyx_t_2 = PyMem_Malloc((__pyx_v_buffcount * (sizeof(WSABUF)))); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ws_buf = ((WSABUF *)__pyx_t_2);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":18
 *     ws_buf = <WSABUF *>PyMem_Malloc(buffcount*sizeof(WSABUF))
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < buffcount:
 *             PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
 */
  /*try:*/ {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19
 * 
 *     try:
 *         for i from 0 <= i < buffcount:             # <<<<<<<<<<<<<<
 *             PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
 * 
 */
    __pyx_t_3 = __pyx_v_buffcount;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":20
 *     try:
 *         for i from 0 <= i < buffcount:
 *             PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)             # <<<<<<<<<<<<<<
 * 
 *         ov = makeOV()
 */
      __pyx_t_4 = (__pyx_v_buffers[__pyx_v_i]);
      __pyx_t_5 = PyObject_AsWriteBuffer(((PyObject *)__pyx_t_4), ((void **)(&(__pyx_v_ws_buf[__pyx_v_i]).buf)), ((int *)(&(__pyx_v_ws_buf[__pyx_v_i]).len))); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L7;}
    }

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22
 *             PyObject_AsWriteBuffer(<object>buffers[i], <void **>&ws_buf[i].buf, <int *>&ws_buf[i].len)
 * 
 *         ov = makeOV()             # <<<<<<<<<<<<<<
 *         if obj is not None:
 *             ov.obj = <PyObject *>obj
 */
    __pyx_t_6 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_v_ov = __pyx_t_6;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":23
 * 
 *         ov = makeOV()
 *         if obj is not None:             # <<<<<<<<<<<<<<
 *             ov.obj = <PyObject *>obj
 * 
 */
    __pyx_t_7 = (__pyx_v_obj != Py_None);
    if (__pyx_t_7) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":24
 *         ov = makeOV()
 *         if obj is not None:
 *             ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 * 
 *         rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
 */
      __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26
 *             ov.obj = <PyObject *>obj
 * 
 *         rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)             # <<<<<<<<<<<<<<
 * 
 *         if rc == SOCKET_ERROR:
 */
    __pyx_v_rc = WSARecv(__pyx_v_s, __pyx_v_ws_buf, __pyx_v_buffcount, (&__pyx_v_bytes), (&__pyx_v_flags), ((OVERLAPPED *)__pyx_v_ov), NULL);

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28
 *         rc = WSARecv(s, ws_buf, buffcount, &bytes, &flags, <OVERLAPPED *>ov, NULL)
 * 
 *         if rc == SOCKET_ERROR:             # <<<<<<<<<<<<<<
 *             rc = WSAGetLastError()
 *             if rc != ERROR_IO_PENDING:
 */
    __pyx_t_7 = (__pyx_v_rc == SOCKET_ERROR);
    if (__pyx_t_7) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":29
 * 
 *         if rc == SOCKET_ERROR:
 *             rc = WSAGetLastError()             # <<<<<<<<<<<<<<
 *             if rc != ERROR_IO_PENDING:
 *                 return rc, 0
 */
      __pyx_v_rc = WSAGetLastError();

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30
 *         if rc == SOCKET_ERROR:
 *             rc = WSAGetLastError()
 *             if rc != ERROR_IO_PENDING:             # <<<<<<<<<<<<<<
 *                 return rc, 0
 * 
 */
      __pyx_t_7 = (__pyx_v_rc != ERROR_IO_PENDING);
      if (__pyx_t_7) {

        /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":31
 *             rc = WSAGetLastError()
 *             if rc != ERROR_IO_PENDING:
 *                 return rc, 0             # <<<<<<<<<<<<<<
 * 
 *         Py_XINCREF(obj)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L7;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_1 = 0;
        __pyx_r = ((PyObject *)__pyx_t_8);
        __pyx_t_8 = 0;
        goto __pyx_L6;
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33
 *                 return rc, 0
 * 
 *         Py_XINCREF(obj)             # <<<<<<<<<<<<<<
 *         return rc, bytes
 *     finally:
 */
    Py_XINCREF(__pyx_v_obj);

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34
 * 
 *         Py_XINCREF(obj)
 *         return rc, bytes             # <<<<<<<<<<<<<<
 *     finally:
 *         PyMem_Free(ws_buf)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_8 = 0;
    __pyx_t_1 = 0;
    __pyx_r = ((PyObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    goto __pyx_L6;
  }
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L6: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 3; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":36
 *         return rc, bytes
 *     finally:
 *         PyMem_Free(ws_buf)             # <<<<<<<<<<<<<<
 * 
 * def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0):
 */
    PyMem_Free(__pyx_v_ws_buf);
    switch (__pyx_why) {
      case 3: goto __pyx_L0;
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("iocpsupport.recv");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_bufflist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38
 *         PyMem_Free(ws_buf)
 * 
 * def recvfrom(long s, object buff, object addr_buff, object addr_len_buff, object obj, unsigned long flags = 0):             # <<<<<<<<<<<<<<
 *     cdef int rc, c_addr_buff_len, c_addr_len_buff_len
 *     cdef myOVERLAPPED *ov
 */

static PyObject *__pyx_pf_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_s;
  PyObject *__pyx_v_buff = 0;
  PyObject *__pyx_v_addr_buff = 0;
  PyObject *__pyx_v_addr_len_buff = 0;
  PyObject *__pyx_v_obj = 0;
  unsigned long __pyx_v_flags;
  int __pyx_v_rc;
  int __pyx_v_c_addr_buff_len;
  int __pyx_v_c_addr_len_buff_len;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  WSABUF __pyx_v_ws_buf;
  unsigned long __pyx_v_bytes;
  struct sockaddr *__pyx_v_c_addr_buff;
  int *__pyx_v_c_addr_len_buff;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,&__pyx_kp_addr_buff,&__pyx_kp_addr_len_buff,&__pyx_kp_obj,&__pyx_kp_flags,0};
  __Pyx_SetupRefcountContext("recvfrom");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr_buff);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_addr_len_buff);
      if (likely(values[3])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  4:
      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[4])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
        if (unlikely(value)) { values[5] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recvfrom") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = values[1];
    __pyx_v_addr_buff = values[2];
    __pyx_v_addr_len_buff = values[3];
    __pyx_v_obj = values[4];
    if (values[5]) {
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[5]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = 0;
    }
  } else {
    __pyx_v_flags = 0;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6:
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  5:
      __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 4);
      __pyx_v_addr_len_buff = PyTuple_GET_ITEM(__pyx_args, 3);
      __pyx_v_addr_buff = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recvfrom", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.recvfrom");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":46
 *     cdef int *c_addr_len_buff
 * 
 *     PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)             # <<<<<<<<<<<<<<
 *     PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
 *     PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
 */
  __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":47
 * 
 *     PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
 *     PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)             # <<<<<<<<<<<<<<
 *     PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
 * 
 */
  __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_buff, ((void **)(&__pyx_v_c_addr_buff)), (&__pyx_v_c_addr_buff_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":48
 *     PyObject_AsWriteBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
 *     PyObject_AsWriteBuffer(addr_buff, <void **>&c_addr_buff, &c_addr_buff_len)
 *     PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)             # <<<<<<<<<<<<<<
 * 
 *     if c_addr_len_buff_len != sizeof(int):
 */
  __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_addr_len_buff, ((void **)(&__pyx_v_c_addr_len_buff)), (&__pyx_v_c_addr_len_buff_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":50
 *     PyObject_AsWriteBuffer(addr_len_buff, <void **>&c_addr_len_buff, &c_addr_len_buff_len)
 * 
 *     if c_addr_len_buff_len != sizeof(int):             # <<<<<<<<<<<<<<
 *         raise ValueError, 'length of address length buffer needs to be sizeof(int)'
 * 
 */
  __pyx_t_2 = (__pyx_v_c_addr_len_buff_len != (sizeof(int)));
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":51
 * 
 *     if c_addr_len_buff_len != sizeof(int):
 *         raise ValueError, 'length of address length buffer needs to be sizeof(int)'             # <<<<<<<<<<<<<<
 * 
 *     c_addr_len_buff[0] = c_addr_buff_len
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_11, 0);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":53
 *         raise ValueError, 'length of address length buffer needs to be sizeof(int)'
 * 
 *     c_addr_len_buff[0] = c_addr_buff_len             # <<<<<<<<<<<<<<
 * 
 *     ov = makeOV()
 */
  (__pyx_v_c_addr_len_buff[0]) = __pyx_v_c_addr_buff_len;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55
 *     c_addr_len_buff[0] = c_addr_buff_len
 * 
 *     ov = makeOV()             # <<<<<<<<<<<<<<
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj
 */
  __pyx_t_3 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ov = __pyx_t_3;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":56
 * 
 *     ov = makeOV()
 *     if obj is not None:             # <<<<<<<<<<<<<<
 *         ov.obj = <PyObject *>obj
 * 
 */
  __pyx_t_2 = (__pyx_v_obj != Py_None);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":57
 *     ov = makeOV()
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 * 
 *     rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
 */
    __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":59
 *         ov.obj = <PyObject *>obj
 * 
 *     rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)             # <<<<<<<<<<<<<<
 * 
 *     if rc == SOCKET_ERROR:
 */
  __pyx_v_rc = WSARecvFrom(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), (&__pyx_v_flags), __pyx_v_c_addr_buff, __pyx_v_c_addr_len_buff, ((OVERLAPPED *)__pyx_v_ov), NULL);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":61
 *     rc = WSARecvFrom(s, &ws_buf, 1, &bytes, &flags, c_addr_buff, c_addr_len_buff, <OVERLAPPED *>ov, NULL)
 * 
 *     if rc == SOCKET_ERROR:             # <<<<<<<<<<<<<<
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 */
  __pyx_t_2 = (__pyx_v_rc == SOCKET_ERROR);
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":62
 * 
 *     if rc == SOCKET_ERROR:
 *         rc = WSAGetLastError()             # <<<<<<<<<<<<<<
 *         if rc != ERROR_IO_PENDING:
 *             return rc, 0
 */
    __pyx_v_rc = WSAGetLastError();

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":63
 *     if rc == SOCKET_ERROR:
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:             # <<<<<<<<<<<<<<
 *             return rc, 0
 * 
 */
    __pyx_t_2 = (__pyx_v_rc != ERROR_IO_PENDING);
    if (__pyx_t_2) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":64
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 *             return rc, 0             # <<<<<<<<<<<<<<
 * 
 *     Py_XINCREF(obj)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":66
 *             return rc, 0
 * 
 *     Py_XINCREF(obj)             # <<<<<<<<<<<<<<
 *     return rc, bytes
 * 
 */
  Py_XINCREF(__pyx_v_obj);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":67
 * 
 *     Py_XINCREF(obj)
 *     return rc, bytes             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("iocpsupport.recvfrom");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

/* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
 * 
 * 
 * def send(long s, object buff, object obj, unsigned long flags = 0):             # <<<<<<<<<<<<<<
 *     cdef int rc
 *     cdef myOVERLAPPED *ov
 */

static PyObject *__pyx_pf_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_s;
  PyObject *__pyx_v_buff = 0;
  PyObject *__pyx_v_obj = 0;
  unsigned long __pyx_v_flags;
  int __pyx_v_rc;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
  WSABUF __pyx_v_ws_buf;
  unsigned long __pyx_v_bytes;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_buff,&__pyx_kp_obj,&__pyx_kp_flags,0};
  __Pyx_SetupRefcountContext("send");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_buff);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flags);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_s = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_buff = values[1];
    __pyx_v_obj = values[2];
    if (values[3]) {
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = 0;
    }
  } else {
    __pyx_v_flags = 0;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_flags = __Pyx_PyInt_AsUnsignedLong(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_flags == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  3:
      __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_buff = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_s = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("iocpsupport.send");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":11
 *     cdef unsigned long bytes
 * 
 *     PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)             # <<<<<<<<<<<<<<
 * 
 *     ov = makeOV()
 */
  __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_buff, ((void **)(&__pyx_v_ws_buf.buf)), ((int *)(&__pyx_v_ws_buf.len))); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13
 *     PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len)
 * 
 *     ov = makeOV()             # <<<<<<<<<<<<<<
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj
 */
  __pyx_t_2 = __pyx_f_11iocpsupport_makeOV(); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ov = __pyx_t_2;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":14
 * 
 *     ov = makeOV()
 *     if obj is not None:             # <<<<<<<<<<<<<<
 *         ov.obj = <PyObject *>obj
 * 
 */
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  if (__pyx_t_3) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":15
 *     ov = makeOV()
 *     if obj is not None:
 *         ov.obj = <PyObject *>obj             # <<<<<<<<<<<<<<
 * 
 *     rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
 */
    __pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17
 *         ov.obj = <PyObject *>obj
 * 
 *     rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)             # <<<<<<<<<<<<<<
 * 
 *     if rc == SOCKET_ERROR:
 */
  __pyx_v_rc = WSASend(__pyx_v_s, (&__pyx_v_ws_buf), 1, (&__pyx_v_bytes), __pyx_v_flags, ((OVERLAPPED *)__pyx_v_ov), NULL);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19
 *     rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL)
 * 
 *     if rc == SOCKET_ERROR:             # <<<<<<<<<<<<<<
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 */
  __pyx_t_3 = (__pyx_v_rc == SOCKET_ERROR);
  if (__pyx_t_3) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":20
 * 
 *     if rc == SOCKET_ERROR:
 *         rc = WSAGetLastError()             # <<<<<<<<<<<<<<
 *         if rc != ERROR_IO_PENDING:
 *             return rc, bytes
 */
    __pyx_v_rc = WSAGetLastError();

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21
 *     if rc == SOCKET_ERROR:
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:             # <<<<<<<<<<<<<<
 *             return rc, bytes
 * 
 */
    __pyx_t_3 = (__pyx_v_rc != ERROR_IO_PENDING);
    if (__pyx_t_3) {

      /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":22
 *         rc = WSAGetLastError()
 *         if rc != ERROR_IO_PENDING:
 *             return rc, bytes             # <<<<<<<<<<<<<<
 * 
 *     Py_XINCREF(obj)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24
 *             return rc, bytes
 * 
 *     Py_XINCREF(obj)             # <<<<<<<<<<<<<<
 *     return rc, bytes
 * 
 */
  Py_XINCREF(__pyx_v_obj);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25
 * 
 *     Py_XINCREF(obj)
 *     return rc, bytes             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyInt_FromLong(__pyx_v_rc); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("iocpsupport.send");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_FinishRefcountContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_11iocpsupport_CompletionPort(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_11iocpsupport_CompletionPort(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_11iocpsupport_CompletionPort[] = {
  {__Pyx_NAMESTR("addHandle"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_addHandle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("getEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_getEvent, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("postEvent"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort_postEvent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_11iocpsupport_14CompletionPort___del__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CompletionPort = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CompletionPort = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CompletionPort = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CompletionPort = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_11iocpsupport_CompletionPort = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("iocpsupport.CompletionPort"), /*tp_name*/
  sizeof(struct __pyx_obj_11iocpsupport_CompletionPort), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_11iocpsupport_CompletionPort, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_CompletionPort, /*tp_as_number*/
  &__pyx_tp_as_sequence_CompletionPort, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CompletionPort, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CompletionPort, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_11iocpsupport_CompletionPort, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_11iocpsupport_14CompletionPort___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_11iocpsupport_CompletionPort, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("makesockaddr"), (PyCFunction)__pyx_pf_11iocpsupport_makesockaddr, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("AllocateReadBuffer"), (PyCFunction)__pyx_pf_11iocpsupport_AllocateReadBuffer, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("maxAddrLen"), (PyCFunction)__pyx_pf_11iocpsupport_maxAddrLen, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("accept"), (PyCFunction)__pyx_pf_11iocpsupport_accept, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_accept_addrs"), (PyCFunction)__pyx_pf_11iocpsupport_get_accept_addrs, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_11iocpsupport_connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_11iocpsupport_recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("recvfrom"), (PyCFunction)__pyx_pf_11iocpsupport_recvfrom, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_11iocpsupport_send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("iocpsupport"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
  {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1},
  {&__pyx_kp_addHandle, __pyx_k_addHandle, sizeof(__pyx_k_addHandle), 1, 1, 1},
  {&__pyx_kp_getEvent, __pyx_k_getEvent, sizeof(__pyx_k_getEvent), 1, 1, 1},
  {&__pyx_kp_postEvent, __pyx_k_postEvent, sizeof(__pyx_k_postEvent), 1, 1, 1},
  {&__pyx_kp___del__, __pyx_k___del__, sizeof(__pyx_k___del__), 1, 1, 1},
  {&__pyx_kp_self, __pyx_k_self, sizeof(__pyx_k_self), 1, 1, 1},
  {&__pyx_kp_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 1, 1, 1},
  {&__pyx_kp_owner, __pyx_k_owner, sizeof(__pyx_k_owner), 1, 1, 1},
  {&__pyx_kp_handle, __pyx_k_handle, sizeof(__pyx_k_handle), 1, 1, 1},
  {&__pyx_kp_key, __pyx_k_key, sizeof(__pyx_k_key), 1, 1, 1},
  {&__pyx_kp_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 1, 1, 1},
  {&__pyx_kp_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 1, 1, 1},
  {&__pyx_kp_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 1, 1, 1},
  {&__pyx_kp_buff, __pyx_k_buff, sizeof(__pyx_k_buff), 1, 1, 1},
  {&__pyx_kp_size, __pyx_k_size, sizeof(__pyx_k_size), 1, 1, 1},
  {&__pyx_kp_s, __pyx_k_s, sizeof(__pyx_k_s), 1, 1, 1},
  {&__pyx_kp_listening, __pyx_k_listening, sizeof(__pyx_k_listening), 1, 1, 1},
  {&__pyx_kp_accepting, __pyx_k_accepting, sizeof(__pyx_k_accepting), 1, 1, 1},
  {&__pyx_kp_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 1, 1, 1},
  {&__pyx_kp_bufflist, __pyx_k_bufflist, sizeof(__pyx_k_bufflist), 1, 1, 1},
  {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1},
  {&__pyx_kp_addr_buff, __pyx_k_addr_buff, sizeof(__pyx_k_addr_buff), 1, 1, 1},
  {&__pyx_kp_addr_len_buff, __pyx_k_addr_len_buff, sizeof(__pyx_k_addr_len_buff), 1, 1, 1},
  {&__pyx_kp_Event, __pyx_k_Event, sizeof(__pyx_k_Event), 0, 1, 1},
  {&__pyx_kp_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 1, 1, 1},
  {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
  {&__pyx_kp_have_connectex, __pyx_k_have_connectex, sizeof(__pyx_k_have_connectex), 1, 1, 1},
  {&__pyx_kp_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 1, 1, 1},
  {&__pyx_kp_WindowsError, __pyx_k_WindowsError, sizeof(__pyx_k_WindowsError), 1, 1, 1},
  {&__pyx_kp_ignore, __pyx_k_ignore, sizeof(__pyx_k_ignore), 1, 1, 1},
  {&__pyx_kp_items, __pyx_k_items, sizeof(__pyx_k_items), 1, 1, 1},
  {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0},
  {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0},
  {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0},
  {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0},
  {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0},
  {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0},
  {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
  {&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 0},
  {&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 0},
  {&__pyx_kp_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 0},
  {0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_kp_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_WindowsError = __Pyx_GetName(__pyx_b, __pyx_kp_WindowsError); if (!__pyx_builtin_WindowsError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initiocpsupport(void); /*proto*/
PyMODINIT_FUNC initiocpsupport(void)
#else
PyMODINIT_FUNC PyInit_iocpsupport(void); /*proto*/
PyMODINIT_FUNC PyInit_iocpsupport(void)
#endif
{
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  #ifdef CYTHON_REFNANNY
  void* __pyx_refchk = NULL;
  __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
  if (!__Pyx_Refnanny) {
      PyErr_Clear();
      __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
      if (!__Pyx_Refnanny)
          Py_FatalError("failed to import refnanny module");
  }
  __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_iocpsupport(void)", __LINE__, __FILE__);
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Library function declarations ---*/
  __pyx_init_filenames();
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("iocpsupport"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__pyx_module_is_main_iocpsupport) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_skip_dispatch = 0;
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CompletionPort", (PyObject *)&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":121
 *     raise WindowsError(message, err)
 * 
 * class Event:             # <<<<<<<<<<<<<<
 *     def __init__(self, callback, owner, **kw):
 *         self.callback = callback
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_1));
  __pyx_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1), __pyx_kp_Event, "iocpsupport"); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_2);

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":122
 * 
 * class Event:
 *     def __init__(self, callback, owner, **kw):             # <<<<<<<<<<<<<<
 *         self.callback = callback
 *         self.owner = owner
 */
  __pyx_t_1 = PyCFunction_New(&__pyx_mdef_11iocpsupport_5Event___init__, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_3 = PyMethod_New(__pyx_t_1, 0, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_2, __pyx_kp___init__, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_Event, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":240
 *     return wsa_pi.iAddressFamily
 * 
 * import socket # for WSAStartup             # <<<<<<<<<<<<<<
 * if not initWinsockPointers():
 *     raise ValueError, 'Failed to initialize Winsock function vectors'
 */
  __pyx_3 = __Pyx_Import(__pyx_kp_socket, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_socket, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":241
 * 
 * import socket # for WSAStartup
 * if not initWinsockPointers():             # <<<<<<<<<<<<<<
 *     raise ValueError, 'Failed to initialize Winsock function vectors'
 * 
 */
  __pyx_t_2 = (!initWinsockPointers());
  if (__pyx_t_2) {

    /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":242
 * import socket # for WSAStartup
 * if not initWinsockPointers():
 *     raise ValueError, 'Failed to initialize Winsock function vectors'             # <<<<<<<<<<<<<<
 * 
 * have_connectex = (lpConnectEx != NULL)
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_1, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":244
 *     raise ValueError, 'Failed to initialize Winsock function vectors'
 * 
 * have_connectex = (lpConnectEx != NULL)             # <<<<<<<<<<<<<<
 * 
 * include 'acceptex.pxi'
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong((lpConnectEx != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_kp_have_connectex, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "E:\Twisted\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5
 * 
 * 
 * def send(long s, object buff, object obj, unsigned long flags = 0):             # <<<<<<<<<<<<<<
 *     cdef int rc
 *     cdef myOVERLAPPED *ov
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_1);
  __Pyx_XDECREF(__pyx_2);
  __Pyx_XDECREF(__pyx_3);
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("iocpsupport");
  Py_DECREF(__pyx_m); __pyx_m = 0;
  __pyx_L0:;
  __Pyx_FinishRefcountContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "iocpsupport.pyx",
  "acceptex.pxi",
  "connectex.pxi",
  "wsarecv.pxi",
  "wsasend.pxi",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #else
        if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
        #endif
            goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

#if PY_MAJOR_VERSION >= 3
    /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */
    if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) {
        tmp_type = tstate->exc_type;
        tmp_value = tstate->exc_value;
        tmp_tb = tstate->exc_traceback;
        PyErr_NormalizeException(&type, &value, &tb);
        PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb);
        tstate->exc_type = 0;
        tstate->exc_value = 0;
        tstate->exc_traceback = 0;
        PyException_SetContext(value, tmp_value);
        Py_DECREF(tmp_type);
        Py_XDECREF(tmp_tb);
    }
#endif

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;

    #if PY_MAJOR_VERSION < 3
    py_modname = PyString_FromString(modname);
    #else
    py_modname = PyUnicode_FromString(modname);
    #endif
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    result = PyClass_New(bases, dict, name);
    #else
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
    #endif
bad:
    Py_XDECREF(py_modname);
    return result;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static INLINE void __Pyx_RaiseTooManyValuesError(void) {
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
     return *s1 == *s2;
}

static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned char)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned char");
                return (unsigned char)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned char");
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned short)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned short");
                return (unsigned short)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned short");
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (unsigned int)-1;
            if (unlikely(val < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned int");
                return (unsigned int)-1;
            }
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to unsigned int");
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to char");
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to short");
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to int");
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed char)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed char");
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed short)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed short");
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (unlikely(val == -1 && PyErr_Occurred()))
                return (signed int)-1;
            PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to signed int");
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return PyLong_AsUnsignedLong(x);
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        if (unlikely(Py_SIZE(x) < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return PyLong_AsUnsignedLongLong(x);
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLong(x);
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) {
        return PyLong_AsLongLong(x);
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    #if PY_MAJOR_VERSION < 3
    empty_string = PyString_FromStringAndSize("", 0);
    #else
    empty_string = PyBytes_FromStringAndSize("", 0);
    #endif
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode && (!t->is_identifier)) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_identifier || (t->is_unicode && t->intern)) {
            *t->p = PyUnicode_InternFromString(t->s);
        } else if (t->is_unicode) {
            *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   else return PyObject_IsTrue(x);
}

static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}



:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0146 ]--