From 175bb827f05fc0ab007705639fd654b563f040ca Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Oct 2020 19:24:16 +0530 Subject: [PATCH] Wrap ConnectNamedPipe --- src/calibre/utils/windows/winutil.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/utils/windows/winutil.cpp b/src/calibre/utils/windows/winutil.cpp index cbc45668e4..2d83f4f273 100644 --- a/src/calibre/utils/windows/winutil.cpp +++ b/src/calibre/utils/windows/winutil.cpp @@ -705,6 +705,14 @@ create_named_pipe(PyObject *self, PyObject *args) { return (PyObject*)Handle_create(h, NormalHandle, PyTuple_GET_ITEM(args, 0)); } +static PyObject * +connect_named_pipe(PyObject *self, PyObject *args) { + HANDLE handle; + if (!PyArg_ParseTuple(args, "O&", convert_handle, &handle)) return NULL; + if (!ConnectNamedPipe(handle, NULL)) return set_error_from_handle(args); + Py_RETURN_NONE; +} + static PyObject * set_handle_information(PyObject *self, PyObject *args) { unsigned long mask, flags; @@ -981,6 +989,7 @@ static PyMethodDef winutil_methods[] = { M(create_mutex, METH_VARARGS), M(get_async_key_state, METH_VARARGS), M(create_named_pipe, METH_VARARGS), + M(connect_named_pipe, METH_VARARGS), M(set_handle_information, METH_VARARGS), M(get_long_path_name, METH_VARARGS), M(get_process_times, METH_O),