Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12823/win32/src
Modified Files:
win32pipe.i
Log Message:
Add GetNamedPipeClientSessionId, GetNamedPipeServerSessionId, and GetNamedPipeInfo
Index: win32pipe.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pipe.i,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** win32pipe.i 9 Sep 2007 01:38:09 -0000 1.16
--- win32pipe.i 9 Sep 2007 05:32:54 -0000 1.17
***************
*** 18,21 ****
--- 18,24 ----
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeClientProcessId = NULL;
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeServerProcessId = NULL;
+ static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeClientSessionId = NULL;
+ static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeServerSessionId = NULL;
+
// Global used to determine if Win9x win32pipe hack is necessary.
***************
*** 123,126 ****
--- 126,131 ----
pfnGetNamedPipeClientProcessId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeClientProcessId");
pfnGetNamedPipeServerProcessId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeServerProcessId");
+ pfnGetNamedPipeClientSessionId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeClientSessionId");
+ pfnGetNamedPipeServerSessionId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeServerSessionId");
}
%}
***************
*** 431,435 ****
// @flag NMPWAIT_USE_DEFAULT_WAIT|The time-out interval is the default value specified by the server process in the CreateNamedPipe function.
// @flag NMPWAIT_WAIT_FOREVER|The function does not return until an instance of the named pipe is available
!
%{
--- 436,448 ----
// @flag NMPWAIT_USE_DEFAULT_WAIT|The time-out interval is the default value specified by the server process in the CreateNamedPipe function.
// @flag NMPWAIT_WAIT_FOREVER|The function does not return until an instance of the named pipe is available
!
! // @pyswig (int, int, int, int)|GetNamedPipeInfo|Returns pipe's flags, buffer sizes, and max instances
! BOOLAPI GetNamedPipeInfo(
! HANDLE hNamedPipe, // @pyparm <o PyHANDLE>|hNamedPipe||Handle to a named pipe
! DWORD *OUTPUT,
! DWORD *OUTPUT,
! DWORD *OUTPUT,
! DWORD *OUTPUT);
!
%{
***************
*** 504,509 ****
return PyLong_FromUnsignedLong(pid);
}
%}
%native(GetNamedPipeClientProcessId) MyGetNamedPipeClientProcessId;
%native(GetNamedPipeServerProcessId) MyGetNamedPipeServerProcessId;
!
--- 517,559 ----
return PyLong_FromUnsignedLong(pid);
}
+
+ // @pyswig int|GetNamedPipeClientSessionId|Returns the session id of client that is connected to a named pipe
+ // @comm Requires Vista or later
+ PyObject *MyGetNamedPipeClientSessionId(PyObject *self, PyObject *args)
+ {
+ CHECK_PFN(GetNamedPipeClientSessionId);
+ HANDLE hNamedPipe;
+ DWORD pid;
+ PyObject *obhNamedPipe;
+ // @pyparm <o PyHANDLE>|hPipe||The handle to the pipe.
+ if (!PyArg_ParseTuple(args, "O:GetNamedPipeClientSessionId", &obhNamedPipe))
+ return NULL;
+ if (!PyWinObject_AsHANDLE(obhNamedPipe, &hNamedPipe))
+ return NULL;
+ if (!(*pfnGetNamedPipeClientSessionId)(hNamedPipe, &pid))
+ return PyWin_SetAPIError("GetNamedPipeClientSessionId");
+ return PyLong_FromUnsignedLong(pid);
+ }
+
+ // @pyswig int|GetNamedPipeServerSessionId|Returns session id of server process that created a named pipe
+ // @comm Requires Vista or later
+ PyObject *MyGetNamedPipeServerSessionId(PyObject *self, PyObject *args)
+ {
+ CHECK_PFN(GetNamedPipeServerSessionId);
+ HANDLE hNamedPipe;
+ DWORD pid;
+ PyObject *obhNamedPipe;
+ // @pyparm <o PyHANDLE>|hPipe||The handle to the pipe.
+ if (!PyArg_ParseTuple(args, "O:GetNamedPipeServerSessionId", &obhNamedPipe))
+ return NULL;
+ if (!PyWinObject_AsHANDLE(obhNamedPipe, &hNamedPipe))
+ return NULL;
+ if (!(*pfnGetNamedPipeServerSessionId)(hNamedPipe, &pid))
+ return PyWin_SetAPIError("GetNamedPipeServerSessionId");
+ return PyLong_FromUnsignedLong(pid);
+ }
%}
%native(GetNamedPipeClientProcessId) MyGetNamedPipeClientProcessId;
%native(GetNamedPipeServerProcessId) MyGetNamedPipeServerProcessId;
! %native(GetNamedPipeClientSessionId) MyGetNamedPipeClientSessionId;
! %native(GetNamedPipeServerSessionId) MyGetNamedPipeServerSessionId;
|