Comments
Patch
@@ -178,6 +178,10 @@
ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, _LPSTR, _DWORD]
_kernel32.GetNamedPipeHandleStateA.restype = _BOOL
+_kernel32.SetNamedPipeHandleState.argtypes = [_HANDLE, ctypes.c_void_p,
+ ctypes.c_void_p, ctypes.c_void_p]
+_kernel32.SetNamedPipeHandleState.restype = _BOOL
+
_kernel32.CreateProcessA.argtypes = [_LPCSTR, _LPCSTR, ctypes.c_void_p,
ctypes.c_void_p, _BOOL, _DWORD, ctypes.c_void_p, _LPCSTR, ctypes.c_void_p,
ctypes.c_void_p]
@@ -252,6 +256,16 @@
return state.value
+def setpipestate(pipe, state):
+ handle = msvcrt.get_osfhandle(pipe.fileno())
+ if handle == -1:
+ raise ctypes.WinError()
+
+ status = _DWORD(state)
+ if not _kernel32.SetNamedPipeHandleState(handle, ctypes.byref(status), None,
+ None):
+ raise ctypes.WinError()
+
def oslink(src, dst):
try:
if not _kernel32.CreateHardLinkA(dst, src, None):