pywin32-checkins Mailing List for Python for Windows Extensions (Page 119)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2005-01-26 01:53:40
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25587 Modified Files: stdafx.h Log Message: Removing OleSetOleError from pythoncom.h Index: stdafx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src/stdafx.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stdafx.h 1 Sep 1999 23:09:05 -0000 1.1 --- stdafx.h 26 Jan 2005 01:53:03 -0000 1.2 *************** *** 15,18 **** --- 15,21 ---- #include "PythonCOMServer.h" + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException + #if _ATL_VER < 0x0200 typedef EXCEPINFO UserEXCEPINFO; |
From: Mark H. <mha...@us...> - 2005-01-25 13:41:57
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16706 Modified Files: win32gui_dialog.py Log Message: Demonstrate the "correct" way to implement a message loop for an application. Index: win32gui_dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_dialog.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32gui_dialog.py 22 Jul 2004 08:31:23 -0000 1.4 --- win32gui_dialog.py 25 Jan 2005 13:41:47 -0000 1.5 *************** *** 120,124 **** ] ! class DemoWindow: def __init__(self): win32gui.InitCommonControls() --- 120,124 ---- ] ! class DemoWindowBase: def __init__(self): win32gui.InitCommonControls() *************** *** 174,183 **** return dlg - def CreateWindow(self): - self._DoCreate(win32gui.CreateDialogIndirect) - - def DoModal(self): - return self._DoCreate(win32gui.DialogBoxIndirect) - def _DoCreate(self, fn): message_map = { --- 174,177 ---- *************** *** 263,273 **** self._DoSize(r-l,b-t, 1) - def OnClose(self, hwnd, msg, wparam, lparam): - win32gui.EndDialog(hwnd, 0) - - def OnDestroy(self, hwnd, msg, wparam, lparam): - print "OnDestroy" - win32gui.PostQuitMessage(0) # Terminate the app. - def _DoSize(self, cx, cy, repaint = 1): # right-justify the textbox. --- 257,260 ---- *************** *** 340,350 **** print "The selected item is", sel+1 def DemoModal(): ! w=DemoWindow() w.DoModal() - ## w.CreateWindow() - ## win32gui.PumpMessages() - ## # Not sure how to kill this loop. if __name__=='__main__': DemoModal() --- 327,372 ---- print "The selected item is", sel+1 + # These function differ based on how the window is used, so may be overridden + def OnClose(self, hwnd, msg, wparam, lparam): + raise NotImplementedError + + def OnDestroy(self, hwnd, msg, wparam, lparam): + pass + + # An implementation suitable for use with the Win32 Window functions (ie, not + # a true dialog) + class DemoWindow(DemoWindowBase): + def CreateWindow(self): + # Create the window via CreateDialogBoxIndirect - it can then + # work as a "normal" window, once a message loop is established. + self._DoCreate(win32gui.CreateDialogIndirect) + + def OnClose(self, hwnd, msg, wparam, lparam): + win32gui.DestroyWindow(hwnd) + + # We need to arrange to a WM_QUIT message to be sent to our + # PumpMessages() loop. + def OnDestroy(self, hwnd, msg, wparam, lparam): + win32gui.PostQuitMessage(0) # Terminate the app. + + # An implementation suitable for use with the Win32 Dialog functions. + class DemoDialog(DemoWindowBase): + def DoModal(self): + return self._DoCreate(win32gui.DialogBoxIndirect) + + def OnClose(self, hwnd, msg, wparam, lparam): + win32gui.EndDialog(hwnd, 0) + def DemoModal(): ! w=DemoDialog() w.DoModal() + def DemoCreateWindow(): + w=DemoWindow() + w.CreateWindow() + # PumpMessages runs until PostQuitMessage() is called by someone. + win32gui.PumpMessages() + if __name__=='__main__': DemoModal() + DemoCreateWindow() |
From: Mark H. <mha...@us...> - 2005-01-25 13:40:45
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16433 Modified Files: winperf.py Log Message: Replace 0x80000000 with -2147483648 to prevent a warning. Index: winperf.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winperf.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** winperf.py 2 Sep 1999 00:19:29 -0000 1.1 --- winperf.py 25 Jan 2005 13:40:37 -0000 1.2 *************** *** 127,131 **** (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED |\ PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS) ! PERF_COUNTER_HISTOGRAM_TYPE = 0x80000000 PERF_COUNTER_DELTA = \ (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_VALUE |\ --- 127,131 ---- (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED |\ PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS) ! PERF_COUNTER_HISTOGRAM_TYPE = -2147483648 # 0x80000000 PERF_COUNTER_DELTA = \ (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_VALUE |\ |
From: Mark H. <mha...@us...> - 2005-01-25 13:39:32
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16047 Modified Files: win32apimodule.cpp Log Message: Add comments for the console ctrl handler and autoduck corrections. Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** win32apimodule.cpp 10 Oct 2004 22:22:51 -0000 1.43 --- win32apimodule.cpp 25 Jan 2005 13:39:21 -0000 1.44 *************** *** 4168,4172 **** #endif // MAINWIN ! // @pymethod |GetFileVersionInfo||Retrieve version info for specified file PyObject *PyGetFileVersionInfo(PyObject *self, PyObject *args) { --- 4168,4172 ---- #endif // MAINWIN ! // @pymethod |win32api|GetFileVersionInfo|Retrieve version info for specified file PyObject *PyGetFileVersionInfo(PyObject *self, PyObject *args) { *************** *** 4402,4405 **** --- 4402,4408 ---- PyObject *ret = PyObject_Call(ob, args, NULL); if (ret == NULL) { + // EEK - this is printed in the case of SystemExit - but SystemExit + // *is* honoured by virtue of PyErr_Print() doing the termination. + // This will not be the main thread. I don't think we want this. PySys_WriteStderr("ConsoleCtrlHandler function failed"); PyErr_Print(); |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:17
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/mapi/src Modified Files: PyMAPIUtil.h Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: PyMAPIUtil.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/PyMAPIUtil.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyMAPIUtil.h 1 Sep 1999 23:17:16 -0000 1.1 --- PyMAPIUtil.h 25 Jan 2005 13:34:07 -0000 1.2 *************** *** 1,4 **** --- 1,7 ---- // PyMapiUtil.h + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException + PyObject *PyMAPIObject_FromTypedUnknown( ULONG typ, IUnknown *pUnk, BOOL bAddRef); |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:17
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/shell/src Modified Files: PyIShellLink.cpp Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: PyIShellLink.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellLink.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyIShellLink.cpp 7 Oct 2003 02:31:08 -0000 1.5 --- PyIShellLink.cpp 25 Jan 2005 13:34:08 -0000 1.6 *************** *** 5,8 **** --- 5,10 ---- #include "PyIShellLink.h" + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException PyObject *PyObject_FromWIN32_FIND_DATA(WIN32_FIND_DATA &findData); |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:17
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/internet/src Modified Files: internet_pch.h Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: internet_pch.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet_pch.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** internet_pch.h 1 Sep 1999 23:15:28 -0000 1.1 --- internet_pch.h 25 Jan 2005 13:34:07 -0000 1.2 *************** *** 15,16 **** --- 15,19 ---- BOOL PyObject_AsBINDINFO(PyObject *ob, BINDINFO *pPD); PyObject *PyObject_FromBINDINFO(BINDINFO *pPD); + + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:16
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/axcontrol/src Modified Files: PyIOleControl.cpp PyISpecifyPropertyPages.cpp axcontrol_pch.h Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: PyIOleControl.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/PyIOleControl.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIOleControl.cpp 4 Jun 2000 05:54:38 -0000 1.2 --- PyIOleControl.cpp 25 Jan 2005 13:34:07 -0000 1.3 *************** *** 144,152 **** PyObject *obAccel; if ( !PyArg_ParseTuple(result, "(Oi):GetControlInfo", &obAccel, &pCI->dwFlags)) ! hr = PyCom_HandlePythonFailureToCOM(); else { if (obAccel!= Py_None) { PyErr_SetString(PyExc_TypeError, "Only None is supported for ControlInfo."); ! hr = PyCom_HandlePythonFailureToCOM(); } } --- 144,152 ---- PyObject *obAccel; if ( !PyArg_ParseTuple(result, "(Oi):GetControlInfo", &obAccel, &pCI->dwFlags)) ! hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetControlInfo"); else { if (obAccel!= Py_None) { PyErr_SetString(PyExc_TypeError, "Only None is supported for ControlInfo."); ! hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetControlInfo"); } } Index: PyISpecifyPropertyPages.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/PyISpecifyPropertyPages.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyISpecifyPropertyPages.cpp 1 Sep 1999 23:05:45 -0000 1.1 --- PyISpecifyPropertyPages.cpp 25 Jan 2005 13:34:07 -0000 1.2 *************** *** 47,51 **** if ( FAILED(hr) ) ! return OleSetOleError(hr); PyObject *opages=PyTuple_New(pages.cElems); --- 47,51 ---- if ( FAILED(hr) ) ! return PyCom_BuildPyException(hr); PyObject *opages=PyTuple_New(pages.cElems); Index: axcontrol_pch.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/axcontrol_pch.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** axcontrol_pch.h 1 Sep 1999 23:05:45 -0000 1.1 --- axcontrol_pch.h 25 Jan 2005 13:34:07 -0000 1.2 *************** *** 15,16 **** --- 15,19 ---- extern void PyObject_FreeDVTARGETDEVICE( DVTARGETDEVICE *ptd ); extern PyObject *PyObject_FromDVTARGETDEVICE(DVTARGETDEVICE *pTD); + + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:16
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/axscript/src Modified Files: PyIActiveScriptParseProcedure.cpp Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: PyIActiveScriptParseProcedure.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/src/PyIActiveScriptParseProcedure.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIActiveScriptParseProcedure.cpp 26 Nov 1999 14:12:32 -0000 1.2 --- PyIActiveScriptParseProcedure.cpp 25 Jan 2005 13:34:07 -0000 1.3 *************** *** 79,83 **** if ( FAILED(hr) ) ! return OleSetOleError(hr); return PyCom_PyObjectFromIUnknown(ppdisp, IID_IDispatch, FALSE); --- 79,83 ---- if ( FAILED(hr) ) ! return PyCom_BuildPyException(hr); return PyCom_PyObjectFromIUnknown(ppdisp, IID_IDispatch, FALSE); |
From: Mark H. <mha...@us...> - 2005-01-25 13:34:16
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/adsi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14858/adsi/src Modified Files: PyADSIUtil.cpp Log Message: Fix error handling - mostly removing old OleSetOleError from pythoncom.h Index: PyADSIUtil.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/adsi/src/PyADSIUtil.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyADSIUtil.cpp 24 Sep 2004 07:25:12 -0000 1.2 --- PyADSIUtil.cpp 25 Jan 2005 13:34:06 -0000 1.3 *************** *** 76,80 **** } // Do the normal thing. ! return OleSetOleError(hr, pUnk, iid); } --- 76,80 ---- } // Do the normal thing. ! return PyCom_BuildPyException(hr, pUnk, iid); } |
From: Mark H. <mha...@us...> - 2005-01-25 13:33:25
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14371/extensions Modified Files: PyGStream.cpp PyIStorage.cpp Log Message: Move towards clearer error handling using the logging module features. Remove old deprecated methods, remove public declarations of private methods and add new MAKE_PYCOM_GATEWAY_FAILURE_CODE which all gateways should use. Index: PyGStream.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyGStream.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyGStream.cpp 19 Nov 1999 04:03:23 -0000 1.2 --- PyGStream.cpp 25 Jan 2005 13:33:16 -0000 1.3 *************** *** 33,37 **** Py_DECREF(result); ! return PyCom_SetCOMErrorFromPyException(GetIID()); } --- 33,37 ---- Py_DECREF(result); ! return MAKE_PYCOM_GATEWAY_FAILURE_CODE("Read"); } *************** *** 76,80 **** BOOL bPythonIsHappy = TRUE; if (!PyWinObject_AsULARGE_INTEGER(obplibNewPosition, plibNewPosition)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 76,80 ---- BOOL bPythonIsHappy = TRUE; if (!PyWinObject_AsULARGE_INTEGER(obplibNewPosition, plibNewPosition)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("Seek"); Py_DECREF(result); return hr; *************** *** 112,116 **** if (pcbRead && !PyWinObject_AsULARGE_INTEGER(obpcbRead, pcbRead)) bPythonIsHappy = FALSE; if (pcbWritten && !PyWinObject_AsULARGE_INTEGER(obpcbWritten, pcbWritten)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 112,116 ---- if (pcbRead && !PyWinObject_AsULARGE_INTEGER(obpcbRead, pcbRead)) bPythonIsHappy = FALSE; if (pcbWritten && !PyWinObject_AsULARGE_INTEGER(obpcbWritten, pcbWritten)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CopyTo"); Py_DECREF(result); return hr; *************** *** 174,178 **** BOOL bPythonIsHappy = TRUE; if (!PyCom_PyObjectAsSTATSTG(obpstatstg, pstatstg, 0/*flags*/)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 174,178 ---- BOOL bPythonIsHappy = TRUE; if (!PyCom_PyObjectAsSTATSTG(obpstatstg, pstatstg, 0/*flags*/)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("Stat"); Py_DECREF(result); return hr; *************** *** 193,197 **** if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 193,197 ---- if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("Clone"); Py_DECREF(result); return hr; Index: PyIStorage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIStorage.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIStorage.cpp 10 Dec 2000 00:55:31 -0000 1.3 --- PyIStorage.cpp 25 Jan 2005 13:33:16 -0000 1.4 *************** *** 557,565 **** // Process the Python results, and convert back to the real params PyObject *obppstm; ! if (!PyArg_Parse(result, "O" , &obppstm)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 557,566 ---- // Process the Python results, and convert back to the real params PyObject *obppstm; ! if (!PyArg_Parse(result, "O" , &obppstm)) return ! MAKE_PYCOM_GATEWAY_FAILURE_CODE("CreateStream"); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CreateStream"); Py_DECREF(result); return hr; *************** *** 582,590 **** // Process the Python results, and convert back to the real params PyObject *obppstm; ! if (!PyArg_Parse(result, "O" , &obppstm)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 583,592 ---- // Process the Python results, and convert back to the real params PyObject *obppstm; ! if (!PyArg_Parse(result, "O" , &obppstm)) return ! MAKE_PYCOM_GATEWAY_FAILURE_CODE("OpenStream"); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstm, IID_IStream, (void **)ppstm, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("OpenStream"); Py_DECREF(result); return hr; *************** *** 607,615 **** // Process the Python results, and convert back to the real params PyObject *obppstg; ! if (!PyArg_Parse(result, "O" , &obppstg)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstg, IID_IStorage, (void **)ppstg, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 609,618 ---- // Process the Python results, and convert back to the real params PyObject *obppstg; ! if (!PyArg_Parse(result, "O" , &obppstg)) ! return MAKE_PYCOM_GATEWAY_FAILURE_CODE("CreateStorage"); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstg, IID_IStorage, (void **)ppstg, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CreateStorage"); Py_DECREF(result); return hr; *************** *** 638,646 **** // Process the Python results, and convert back to the real params PyObject *obppstg; ! if (!PyArg_Parse(result, "O" , &obppstg)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstg, IID_IStorage, (void **)ppstg, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 641,650 ---- // Process the Python results, and convert back to the real params PyObject *obppstg; ! if (!PyArg_Parse(result, "O" , &obppstg)) ! return MAKE_PYCOM_GATEWAY_FAILURE_CODE("OpenStorage"); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppstg, IID_IStorage, (void **)ppstg, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("OpenStorage"); Py_DECREF(result); return hr; *************** *** 711,719 **** // Process the Python results, and convert back to the real params PyObject *obppenum; ! if (!PyArg_Parse(result, "O" , &obppenum)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppenum, IID_IEnumSTATSTG, (void **)ppenum, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 715,724 ---- // Process the Python results, and convert back to the real params PyObject *obppenum; ! if (!PyArg_Parse(result, "O" , &obppenum)) ! return MAKE_PYCOM_GATEWAY_FAILURE_CODE("Revert"); BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyObject(obppenum, IID_IEnumSTATSTG, (void **)ppenum, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("Revert"); Py_DECREF(result); return hr; *************** *** 791,798 **** // Process the Python results, and convert back to the real params PyObject *obpstatstg; ! if (!PyArg_Parse(result, "O" , &obpstatstg)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (!PyCom_PyObjectAsSTATSTG(obpstatstg, pstatstg, 0/*flags*/)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; --- 796,804 ---- // Process the Python results, and convert back to the real params PyObject *obpstatstg; ! if (!PyArg_Parse(result, "O" , &obpstatstg)) ! return MAKE_PYCOM_GATEWAY_FAILURE_CODE("Stat"); BOOL bPythonIsHappy = TRUE; if (!PyCom_PyObjectAsSTATSTG(obpstatstg, pstatstg, 0/*flags*/)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("Stat"); Py_DECREF(result); return hr; |
From: Mark H. <mha...@us...> - 2005-01-25 13:33:25
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14371 Modified Files: ErrorUtils.cpp PyFactory.cpp PyGatewayBase.cpp dllmain.cpp univgw.cpp Log Message: Move towards clearer error handling using the logging module features. Remove old deprecated methods, remove public declarations of private methods and add new MAKE_PYCOM_GATEWAY_FAILURE_CODE which all gateways should use. Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ErrorUtils.cpp 25 Jan 2005 11:11:40 -0000 1.22 --- ErrorUtils.cpp 25 Jan 2005 13:33:12 -0000 1.23 *************** *** 23,26 **** --- 23,29 ---- static const char *traceback_prefix = "Traceback (most recent call last):\n"; + // todo: nuke me! + PYCOM_EXPORT void PyCom_StreamMessage(const char *msg); + //////////////////////////////////////////////////////////////////////// // *************** *** 326,329 **** --- 329,337 ---- return S_OK; + // These errors are generally 'unexpected' (ie, errors converting args on + // the way into a gateway method. If not explicitly raised by the user, + // log it. + PyCom_LoggerNonServerException(NULL, "Unexpected gateway error"); + EXCEPINFO einfo; PyCom_ExcepInfoFromPyException(&einfo); *************** *** 344,348 **** // No error occurred return S_OK; ! PyCom_LogNonServerError("Unexpected exception in gateway method '%s'", methodName); return PyCom_SetCOMErrorFromPyException(riid); } --- 352,356 ---- // No error occurred return S_OK; ! PyCom_LoggerNonServerException(NULL, "Unexpected exception in gateway method '%s'", methodName); return PyCom_SetCOMErrorFromPyException(riid); } *************** *** 559,563 **** } ! void _DoLogError(const char *fmt, va_list argptr) { PyCom_StreamMessage("pythoncom error: "); --- 567,574 ---- } ! // XXX - _DoLogError() was a really bad name in retrospect, given ! // the "logger" module and my dumb choice of _DoLogger() for logger errors :) ! // Thankfully both are private. ! static void _DoLogError(const char *fmt, va_list argptr) { PyCom_StreamMessage("pythoncom error: "); *************** *** 575,613 **** } ! PYCOM_EXPORT ! void PyCom_LogError(const char *fmt, ...) ! { ! va_list marker; ! va_start(marker, fmt); ! _DoLogError(fmt, marker); ! } ! ! BOOL IsNonServerErrorCurrent() { ! BOOL rc = FALSE; ! PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; ! PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); ! if (exc_typ) { ! PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); ! rc = (!PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) || ! ((PyInstance_Check(exc_val) && ! (PyObject *)(((PyInstanceObject *)exc_val)->in_class)==PyWinExc_COMError))); ! } ! PyErr_Restore(exc_typ, exc_val, exc_tb); ! return rc; ! } ! ! PYCOM_EXPORT ! void PyCom_LogNonServerError(const char *fmt, ...) ! { ! // If any error other than our explicit 'com server error' is current, ! // assume it is unintended, and log it. ! if (IsNonServerErrorCurrent()) { ! va_list marker; ! va_start(marker, fmt); ! _DoLogError(fmt, marker); ! } ! } ! ! void _DoLogger(PyObject *logProvider, char *log_method, const char *fmt, va_list argptr) { PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; --- 586,590 ---- } ! static void _DoLogger(PyObject *logProvider, char *log_method, const char *fmt, va_list argptr) { PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; *************** *** 636,639 **** --- 613,638 ---- } + PYCOM_EXPORT + void PyCom_LogError(const char *fmt, ...) + { + va_list marker; + va_start(marker, fmt); + _DoLogger(NULL, "error", fmt, marker); + } + + BOOL IsNonServerErrorCurrent() { + BOOL rc = FALSE; + PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; + PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); + if (exc_typ) { + PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); + rc = (!PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) || + ((PyInstance_Check(exc_val) && + (PyObject *)(((PyInstanceObject *)exc_val)->in_class)==PyWinExc_COMError))); + } + PyErr_Restore(exc_typ, exc_val, exc_tb); + return rc; + } + PYCOM_EXPORT void PyCom_LoggerException(PyObject *logProvider, const char *fmt, ...) { Index: univgw.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/univgw.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** univgw.cpp 4 May 2004 06:46:24 -0000 1.10 --- univgw.cpp 25 Jan 2005 13:33:15 -0000 1.11 *************** *** 111,115 **** if ( result == NULL ) { ! PyCom_LogError("Failed to call the universal dispatcher"); return PyCom_SetCOMErrorFromPyException(vtbl->iid); } --- 111,115 ---- if ( result == NULL ) { ! PyCom_LoggerException(NULL, "Failed to call the universal dispatcher"); return PyCom_SetCOMErrorFromPyException(vtbl->iid); } Index: PyGatewayBase.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyGatewayBase.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyGatewayBase.cpp 7 Sep 2004 02:19:27 -0000 1.14 --- PyGatewayBase.cpp 25 Jan 2005 13:33:15 -0000 1.15 *************** *** 15,18 **** --- 15,23 ---- #define LogF PyCom_LogF + // Internal ErrorUtil helpers we reach in for. + // Free the strings from an excep-info. + extern void PyCom_CleanupExcepInfo(EXCEPINFO *pexcepinfo); + PYCOM_EXPORT BOOL PyCom_SetCOMErrorFromExcepInfo(const EXCEPINFO *pexcepinfo, REFIID riid); + // #define DEBUG_FULL static LONG cGateways = 0; Index: dllmain.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/dllmain.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dllmain.cpp 31 Oct 2003 02:46:29 -0000 1.10 --- dllmain.cpp 25 Jan 2005 13:33:15 -0000 1.11 *************** *** 194,200 **** if ( (hr != RPC_E_CHANGED_MODE) && FAILED(hr) ) { ! #ifdef _DEBUG ! PyCom_LogError(_T("OLE initialization failed! (0x%08lx)"), hr); ! #endif return hr; } --- 194,198 ---- if ( (hr != RPC_E_CHANGED_MODE) && FAILED(hr) ) { ! PyCom_LoggerException(NULL, "OLE initialization failed! (0x%08lx)", hr); return hr; } *************** *** 228,234 **** if ( (hr != RPC_E_CHANGED_MODE) && FAILED(hr) ) { ! #ifdef _DEBUG ! PyCom_LogError(_T("OLE initialization failed! (0x%08lx)"), hr); ! #endif return hr; } --- 226,230 ---- if ( (hr != RPC_E_CHANGED_MODE) && FAILED(hr) ) { ! PyCom_LoggerException(NULL, "OLE initialization failed! (0x%08lx)", hr); return hr; } Index: PyFactory.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyFactory.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyFactory.cpp 31 Oct 2003 02:43:03 -0000 1.6 --- PyFactory.cpp 25 Jan 2005 13:33:15 -0000 1.7 *************** *** 83,87 **** if ( FAILED(hr) ) { ! PyCom_LogError("CPyFactory::CreateInstance failed to create instance. (%lx)", hr); } else --- 83,87 ---- if ( FAILED(hr) ) { ! PyCom_LoggerException(NULL, "CPyFactory::CreateInstance failed to create instance. (%lx)", hr); } else *************** *** 90,94 **** // up (giving more flexibility to the Python programmer. if (!PyCom_InterfaceFromPyObject(pNewInstance, riid, ppv, FALSE)) { ! PyCom_LogError("CPyFactory::CreateInstance failed to get gateway to returned object"); hr = E_FAIL; } --- 90,94 ---- // up (giving more flexibility to the Python programmer. if (!PyCom_InterfaceFromPyObject(pNewInstance, riid, ppv, FALSE)) { ! PyCom_LoggerException(NULL, "CPyFactory::CreateInstance failed to get gateway to returned object"); hr = E_FAIL; } *************** *** 142,146 **** // change the error state. if ( !*ppNewInstance ) ! PyCom_LogError("ERROR: server.policy could not create an instance."); HRESULT hr = PyCom_SetCOMErrorFromPyException(IID_IClassFactory); Py_DECREF(obiid); --- 142,146 ---- // change the error state. if ( !*ppNewInstance ) ! PyCom_LoggerException(NULL, "ERROR: server.policy could not create an instance."); HRESULT hr = PyCom_SetCOMErrorFromPyException(IID_IClassFactory); Py_DECREF(obiid); *************** *** 162,166 **** if ( !pPyModule ) { ! PyCom_LogError("PythonCOM Server - The 'win32com.server.policy' module could not be loaded."); /* ### propagate the exception? */ PyErr_Clear(); --- 162,166 ---- if ( !pPyModule ) { ! PyCom_LoggerException(NULL, "PythonCOM Server - The 'win32com.server.policy' module could not be loaded."); /* ### propagate the exception? */ PyErr_Clear(); |
From: Mark H. <mha...@us...> - 2005-01-25 13:33:25
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14371/include Modified Files: PythonCOM.h PythonCOMServer.h Log Message: Move towards clearer error handling using the logging module features. Remove old deprecated methods, remove public declarations of private methods and add new MAKE_PYCOM_GATEWAY_FAILURE_CODE which all gateways should use. Index: PythonCOMServer.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOMServer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonCOMServer.h 20 Jan 2003 23:19:28 -0000 1.4 --- PythonCOMServer.h 25 Jan 2005 13:33:16 -0000 1.5 *************** *** 150,154 **** // B/W compat hack for gateways. ! #define PyCom_HandlePythonFailureToCOM() PyCom_SetCOMErrorFromPyException(GetIID()) --- 150,161 ---- // B/W compat hack for gateways. ! #define PyCom_HandlePythonFailureToCOM() \ ! PyCom_SetAndLogCOMErrorFromPyExceptionEx(this->m_pPyObject, "gateway method", GetIID()) ! ! // F/W compat hack for gateways! Must be careful about updating ! // PyGatewayBase vtable, so a slightly older pythoncomXX.dll will work ! // with slightly later extensions. So use a #define. ! #define MAKE_PYCOM_GATEWAY_FAILURE_CODE(method_name) \ ! PyCom_SetAndLogCOMErrorFromPyExceptionEx(this->m_pPyObject, method_name, GetIID()) Index: PythonCOM.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PythonCOM.h 7 Sep 2004 02:19:27 -0000 1.21 --- PythonCOM.h 25 Jan 2005 13:33:16 -0000 1.22 *************** *** 302,317 **** PYCOM_EXPORT PyObject* PyCom_BuildInternalPyException(char *msg); - // The old names, for b/w compat - but we have purged it - // from the COM core, so we may as well remove it completely from the core :-) - #ifndef BUILD_PYTHONCOM - #define OleSetOleError PyCom_BuildPyException - #endif - - // Log an internal error, including traceback. - PYCOM_EXPORT void PyCom_LogError(const char *fmt, ...); - - // Log an error if not a COM Server exception, including traceback. - PYCOM_EXPORT void PyCom_LogNonServerError(const char *fmt, ...); - // Log an error to a Python logger object if one can be found, or // to stderr if no log available. --- 302,305 ---- *************** *** 320,324 **** // If they do not exist, return None, or raise an error fetching them // (or even writing to them once fetched), the message still goes to stderr. ! // NOTE: By default, win32com does *not* provide a logger. PYCOM_EXPORT void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...); --- 308,313 ---- // If they do not exist, return None, or raise an error fetching them // (or even writing to them once fetched), the message still goes to stderr. ! // NOTE: By default, win32com does *not* provide a logger, so default is that ! // all errors are written to stdout. PYCOM_EXPORT void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...); *************** *** 326,333 **** PYCOM_EXPORT void PyCom_LoggerException(PyObject *logProvider, const char *fmt, ...); - // Write a raw string to the error device. - PYCOM_EXPORT void PyCom_StreamMessage(const char *msg); - - // Server related error functions // These are supplied so that any Python errors we detect can be --- 315,318 ---- *************** *** 347,352 **** PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromSimple(HRESULT hr, REFIID riid = IID_NULL, const char *description = NULL); ! // Used in gateways to SetErrorInfo() the current Python exception ! // NOTE: this function assumes it is operating within the Python context PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid = IID_NULL); --- 332,339 ---- PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromSimple(HRESULT hr, REFIID riid = IID_NULL, const char *description = NULL); ! // Used in gateways to SetErrorInfo() the current Python exception, and ! // (assuming not a server error explicitly raised) also logs an error ! // to stdout/win32com.logger. ! // NOTE: this function assumes GIL held PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid = IID_NULL); *************** *** 369,384 **** PYCOM_EXPORT PyObject *PyCom_PyObjectFromExcepInfo(const EXCEPINFO *pexcepInfo); - // Used by gateways to SetErrorInfo() from the data contained in an EXCEPINFO - // structure. Mainly used internally, but handy for functions that have special - // error requirements (particularly those with IDispatch::Invoke() semantics - - // ie, you have an EXCEPINFO structure, but it turns out you can't return it - // as the HRESULT will not be DISP_E_EXCEPTION - therefore you can make the - // EXCEPINFO data available via SetErrorInfo() just incase the client can use it - PYCOM_EXPORT BOOL PyCom_SetCOMErrorFromExcepInfo(const EXCEPINFO *pexcepinfo, REFIID riid); - - // Free the strings etc in an EXCEPINFO - PYCOM_EXPORT void PyCom_CleanupExcepInfo(EXCEPINFO *pexcepinfo); - - /////////////////////////////////////////////////////////////////// // --- 356,359 ---- |
From: Mark H. <mha...@us...> - 2005-01-25 13:30:05
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13944 Modified Files: PyIShellIcon.cpp Log Message: Correct args to GetIconOf Index: PyIShellIcon.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellIcon.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIShellIcon.cpp 25 Jan 2005 09:42:32 -0000 1.1 --- PyIShellIcon.cpp 25 Jan 2005 13:29:53 -0000 1.2 *************** *** 36,40 **** UINT flags; int index; ! if ( !PyArg_ParseTuple(args, "O:GetIconOf", &obpidl) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 36,40 ---- UINT flags; int index; ! if ( !PyArg_ParseTuple(args, "Oi:GetIconOf", &obpidl, &flags) ) return NULL; BOOL bPythonIsHappy = TRUE; |
From: Mark H. <mha...@us...> - 2005-01-25 12:14:57
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28978 Modified Files: PyIFilter.cpp Log Message: On the way to saner pythoncom error handling - We use the deprecated OleSetOleError Index: PyIFilter.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src/PyIFilter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIFilter.cpp 25 Jan 2005 09:47:00 -0000 1.2 --- PyIFilter.cpp 25 Jan 2005 12:14:47 -0000 1.3 *************** *** 6,9 **** --- 6,12 ---- #include "PythonCOMRegister.h" // For simpler registration of IIDs etc. + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException + // @doc - This file contains autoduck documentation // --------------------------------------------------- |
From: Mark H. <mha...@us...> - 2005-01-25 12:13:55
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28727 Modified Files: shell.cpp Log Message: On the way to saner error handling for pythoncom - we use the deprecated OleSetOleError Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** shell.cpp 25 Jan 2005 09:42:32 -0000 1.32 --- shell.cpp 25 Jan 2005 12:13:41 -0000 1.33 *************** *** 38,41 **** --- 38,44 ---- #include "PythonCOMRegister.h" // For simpler registration of IIDs etc. + // We should not be using this! + #define OleSetOleError PyCom_BuildPyException + void PyShell_FreeMem(void *p) { |
From: Mark H. <mha...@us...> - 2005-01-25 11:11:58
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14663 Modified Files: ErrorUtils.cpp Log Message: Only pass exc_info to the logger when there is an exception! Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ErrorUtils.cpp 7 Sep 2004 02:19:27 -0000 1.21 --- ErrorUtils.cpp 25 Jan 2005 11:11:40 -0000 1.22 *************** *** 490,497 **** // a logger from that package) PyObject *kw = PyDict_New(); ! PyObject *exc_info = Py_BuildValue("OOO", exc_typ, exc_val, exc_tb); ! if (kw) PyDict_SetItemString(kw, "exc_info", exc_info); ! Py_XDECREF(exc_info); PyObject *args = Py_BuildValue("(s)", buff); PyObject *method = PyObject_GetAttrString(logger, (char *)log_method); --- 490,498 ---- // a logger from that package) PyObject *kw = PyDict_New(); ! if (kw && exc_typ) { ! PyObject *exc_info = Py_BuildValue("OOO", exc_typ, exc_val, exc_tb); PyDict_SetItemString(kw, "exc_info", exc_info); ! Py_XDECREF(exc_info); ! } PyObject *args = Py_BuildValue("(s)", buff); PyObject *method = PyObject_GetAttrString(logger, (char *)log_method); |
From: Mark H. <mha...@us...> - 2005-01-25 10:52:53
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9788 Modified Files: testmakepy.py Log Message: Better makepy testing. Index: testmakepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testmakepy.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testmakepy.py 23 Oct 2003 07:08:18 -0000 1.3 --- testmakepy.py 25 Jan 2005 10:52:41 -0000 1.4 *************** *** 10,14 **** import win32com.test.util ! from win32com.client import makepy, selecttlb import pythoncom import winerror --- 10,14 ---- import win32com.test.util ! from win32com.client import makepy, selecttlb, gencache import pythoncom import winerror *************** *** 22,25 **** --- 22,26 ---- try: makepy.GenerateFromTypeLibSpec(info) + # sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind)) num += 1 except pythoncom.com_error, details: *************** *** 36,39 **** --- 37,47 ---- print "Failed:", info.desc traceback.print_exc() + if makepy.bForDemandDefault: + # This only builds enums etc by default - build each + # interface manually + tinfo = (info.clsid, info.lcid, info.major, info.minor) + mod = gencache.EnsureModule(info.clsid, info.lcid, info.major, info.minor) + for name in mod.NamesToIIDMap.keys(): + makepy.GenerateChildFromTypeLibSpec(name, tinfo) return num |
From: Mark H. <mha...@us...> - 2005-01-25 09:51:33
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27628 Modified Files: gencache.py makepy.py Log Message: Fix [ 1085454 ] Py 2.4 + MS Excel COM --> crash Avoid crashes on Python 2.4 by defaulting to bForDemand=True - ie, each typelib actually creates a "skeleton" Python package, and populates the package as each interface is requested. Cause of the underling crash is that the generated .py causes an overflow as the byte-code is generated - something in 2.4 bloated the byte-code for these modules. Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** makepy.py 27 Oct 2002 10:19:40 -0000 1.18 --- makepy.py 25 Jan 2005 09:51:23 -0000 1.19 *************** *** 51,55 **** from win32com.client import NeedUnicodeConversions ! bForDemandDefault = 0 # Default value of bForDemand - toggle this to change the world - see also gencache.py error = "makepy.error" --- 51,60 ---- from win32com.client import NeedUnicodeConversions ! # Python 2.4 will crash on a huge typelib (eg, Excel) if bForDemand is False. ! # That looks like a good excuse to try and move to that more efficient ! # (for large typelibs) scheme. ! # Default value of bForDemand - override this (also in gencache.py) to ! # change the world. ! bForDemandDefault = sys.hexversion >= 0x2040000 error = "makepy.error" *************** *** 180,190 **** sys.exit(1) ! def GenerateFromTypeLibSpec(typelibInfo, file = None, verboseLevel = None, progressInstance = None, bUnicodeToString=NeedUnicodeConversions, bQuiet = None, bGUIProgress = None, bForDemand = bForDemandDefault, bBuildHidden = 1): ! if bQuiet is not None or bGUIProgress is not None: ! print "Please dont use the bQuiet or bGUIProgress params" ! print "use the 'verboseLevel', and 'progressClass' params" if verboseLevel is None: ! verboseLevel = 0 # By default, we use a gui, and no verbose level! ! if bForDemand and file is not None: raise RuntimeError, "You can only perform a demand-build when the output goes to the gen_py directory" --- 185,191 ---- sys.exit(1) ! def GenerateFromTypeLibSpec(typelibInfo, file = None, verboseLevel = None, progressInstance = None, bUnicodeToString=NeedUnicodeConversions, bForDemand = bForDemandDefault, bBuildHidden = 1): if verboseLevel is None: ! verboseLevel = 0 if bForDemand and file is not None: raise RuntimeError, "You can only perform a demand-build when the output goes to the gen_py directory" Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** gencache.py 3 May 2004 01:55:25 -0000 1.29 --- gencache.py 25 Jan 2005 09:51:23 -0000 1.30 *************** *** 29,33 **** import operator ! bForDemandDefault = 0 # Default value of bForDemand - toggle this to change the world - see also makepy.py # The global dictionary --- 29,38 ---- import operator ! # Python 2.4 will crash on a huge typelib (eg, Excel) if bForDemand is False. ! # That looks like a good excuse to try and move to that more efficient ! # (for large typelibs) scheme. ! # Default value of bForDemand - override this (also in makepy.py) to ! # change the world. ! bForDemandDefault = sys.hexversion >= 0x2040000 # The global dictionary |
From: Mark H. <mha...@us...> - 2005-01-25 09:47:13
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27342 Modified Files: PyIFilter.cpp Log Message: Add BindIFilterFromStream Index: PyIFilter.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src/PyIFilter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIFilter.cpp 22 Jun 2004 00:53:56 -0000 1.1 --- PyIFilter.cpp 25 Jan 2005 09:47:00 -0000 1.2 *************** *** 94,100 **** stat.cwcStartSource, stat.cwcLenSource); - - - } --- 94,97 ---- *************** *** 231,234 **** --- 228,260 ---- } + static PyObject *pyBindIFilterFromStream(PyObject *self, PyObject *args) + { + HRESULT hr; + IUnknown *pOb = NULL; + PyObject *obStg; + + PyObject *ret; + long lres = 0; + if (!PyArg_ParseTuple(args, "O:BindIFilterFromStream", &obStg)) + return NULL; + + IStream *pstm; + BOOL bPythonIsHappy = TRUE; + if (!PyCom_InterfaceFromPyObject(obStg, IID_IStream, (void **)&pstm, FALSE /* bNoneOK */)) + bPythonIsHappy = FALSE; + + if (!bPythonIsHappy) + return NULL; + + Py_BEGIN_ALLOW_THREADS; + hr = BindIFilterFromStream( pstm , NULL , (void**)&pOb ); + pstm->Release(); + Py_END_ALLOW_THREADS; + if (FAILED(hr)) + ret = OleSetOleError(hr); + else + ret = PyCom_PyObjectFromIUnknown(pOb, IID_IFilter, FALSE); + return ret; + } static int AddConstant(PyObject *dict, const char *key, long value) *************** *** 275,279 **** { { "LoadIFilter", pyLoadIFilter, 1 }, // @pymeth Init|Description of Init ! { "BindIFilterFromStorage", pyBindIFilterFromStorage, 1 }, // @pymeth Init|Description of Init { NULL } }; --- 301,306 ---- { { "LoadIFilter", pyLoadIFilter, 1 }, // @pymeth Init|Description of Init ! { "BindIFilterFromStorage", pyBindIFilterFromStorage, 1 }, // @pymeth BindIFilterFromStorage| ! { "BindIFilterFromStream", pyBindIFilterFromStream, 1 }, // @pymeth BindIFilterFromStream| { NULL } }; |
From: Mark H. <mha...@us...> - 2005-01-25 09:42:45
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26197/win32comext/shell/src Modified Files: shell.cpp Added Files: PyIShellIcon.cpp PyIShellIcon.h PyIShellIconOverlay.cpp PyIShellIconOverlay.h PyIShellIconOverlayIdentifier.cpp PyIShellIconOverlayIdentifier.h PyIShellIconOverlayManager.cpp PyIShellIconOverlayManager.h Log Message: PyIShellIcon* interfaces added to win32com.shell.shell --- NEW FILE: PyIShellIcon.h --- // This file declares the IShellIcon Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellIcon : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellIcon); static IShellIcon *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *GetIconOf(PyObject *self, PyObject *args); protected: PyIShellIcon(IUnknown *pdisp); ~PyIShellIcon(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellIcon : public PyGatewayBase, public IShellIcon { protected: PyGShellIcon(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellIcon, IShellIcon, IID_IShellIcon, PyGatewayBase) // IShellIcon STDMETHOD(GetIconOf)( LPCITEMIDLIST pidl, UINT flags, int __RPC_FAR * index); }; --- NEW FILE: PyIShellIconOverlayIdentifier.cpp --- // This file implements the IShellIconOverlayIdentifier Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellIconOverlayIdentifier.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellIconOverlayIdentifier::PyIShellIconOverlayIdentifier(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellIconOverlayIdentifier::~PyIShellIconOverlayIdentifier() { } /* static */ IShellIconOverlayIdentifier *PyIShellIconOverlayIdentifier::GetI(PyObject *self) { return (IShellIconOverlayIdentifier *)PyIUnknown::GetI(self); } // @pymethod |PyIShellIconOverlayIdentifier|IsMemberOf|Description of IsMemberOf. PyObject *PyIShellIconOverlayIdentifier::IsMemberOf(PyObject *self, PyObject *args) { IShellIconOverlayIdentifier *pISIOI = GetI(self); if ( pISIOI == NULL ) return NULL; // @pyparm string/<o unicode>|path||Description for path // @pyparm int|attrib||Description for attrib PyObject *obpath; LPWSTR path; DWORD attrib; if ( !PyArg_ParseTuple(args, "Ol:IsMemberOf", &obpath, &attrib) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsWCHAR(obpath, &path)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOI->IsMemberOf( path, attrib ); PyWinObject_FreeWCHAR(path); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOI, IID_IShellIconOverlayIdentifier ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIShellIconOverlayIdentifier|GetOverlayInfo|Description of GetOverlayInfo. PyObject *PyIShellIconOverlayIdentifier::GetOverlayInfo(PyObject *self, PyObject *args) { IShellIconOverlayIdentifier *pISIOI = GetI(self); if ( pISIOI == NULL ) return NULL; WCHAR szIconFile[_MAX_PATH+1]; int pIndex; DWORD pFlags; if ( !PyArg_ParseTuple(args, ":GetOverlayInfo") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOI->GetOverlayInfo( szIconFile, sizeof(szIconFile)/sizeof(szIconFile[0]), &pIndex, &pFlags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOI, IID_IShellIconOverlayIdentifier ); PyObject *obiconFile; obiconFile = PyWinObject_FromWCHAR(szIconFile); PyObject *pyretval = Py_BuildValue("Nii", obiconFile, pIndex, pFlags); return pyretval; } // @pymethod |PyIShellIconOverlayIdentifier|GetPriority|Description of GetPriority. PyObject *PyIShellIconOverlayIdentifier::GetPriority(PyObject *self, PyObject *args) { IShellIconOverlayIdentifier *pISIOI = GetI(self); if ( pISIOI == NULL ) return NULL; int pri; if ( !PyArg_ParseTuple(args, ":GetPriority") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOI->GetPriority( &pri ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOI, IID_IShellIconOverlayIdentifier ); PyObject *pyretval = Py_BuildValue("i", pri); return pyretval; } // @object PyIShellIconOverlayIdentifier|Description of the interface static struct PyMethodDef PyIShellIconOverlayIdentifier_methods[] = { { "IsMemberOf", PyIShellIconOverlayIdentifier::IsMemberOf, 1 }, // @pymeth IsMemberOf|Description of IsMemberOf { "GetOverlayInfo", PyIShellIconOverlayIdentifier::GetOverlayInfo, 1 }, // @pymeth GetOverlayInfo|Description of GetOverlayInfo { "GetPriority", PyIShellIconOverlayIdentifier::GetPriority, 1 }, // @pymeth GetPriority|Description of GetPriority { NULL } }; PyComTypeObject PyIShellIconOverlayIdentifier::type("PyIShellIconOverlayIdentifier", &PyIUnknown::type, sizeof(PyIShellIconOverlayIdentifier), PyIShellIconOverlayIdentifier_methods, GET_PYCOM_CTOR(PyIShellIconOverlayIdentifier)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellIconOverlayIdentifier::IsMemberOf( /* [unique][in] */ LPCWSTR path, /* [unique][in] */ DWORD attrib) { PY_GATEWAY_METHOD; PyObject *obpath; obpath = PyWinObject_FromWCHAR(path); PyObject *ret; HRESULT hr=InvokeViaPolicy("IsMemberOf", &ret, "Ol", obpath, attrib); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) hr = PyInt_AsLong(ret); Py_XDECREF(ret); return hr; } STDMETHODIMP PyGShellIconOverlayIdentifier::GetOverlayInfo( LPWSTR iconFile, int maxChars, int __RPC_FAR * pIndex, DWORD __RPC_FAR * pFlags) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetOverlayInfo", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obiconFile; if (!PyArg_ParseTuple(result, "Oii" , &obiconFile, pIndex, pFlags)) return PyCom_SetAndLogCOMErrorFromPyException("GetOverlayInfo", GetIID()); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy) { WCHAR *retIconFile; if (PyWinObject_AsWCHAR(obiconFile, &retIconFile)) { wcsncpy(iconFile, retIconFile, maxChars); PyWinObject_FreeWCHAR(retIconFile); } else bPythonIsHappy = FALSE; } if (!bPythonIsHappy) hr = PyCom_SetAndLogCOMErrorFromPyException("GetOverlayInfo", GetIID()); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellIconOverlayIdentifier::GetPriority( /* [unique][out] */ int __RPC_FAR * pri) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetPriority", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , pri)) return PyCom_SetAndLogCOMErrorFromPyException("GetPriority", GetIID()); Py_DECREF(result); return hr; } --- NEW FILE: PyIShellIcon.cpp --- // This file implements the IShellIcon Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellIcon.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellIcon::PyIShellIcon(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellIcon::~PyIShellIcon() { } /* static */ IShellIcon *PyIShellIcon::GetI(PyObject *self) { return (IShellIcon *)PyIUnknown::GetI(self); } // @pymethod |PyIShellIcon|GetIconOf|Description of GetIconOf. PyObject *PyIShellIcon::GetIconOf(PyObject *self, PyObject *args) { IShellIcon *pISI = GetI(self); if ( pISI == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl PyObject *obpidl; LPITEMIDLIST pidl; UINT flags; int index; if ( !PyArg_ParseTuple(args, "O:GetIconOf", &obpidl) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISI->GetIconOf( pidl, flags, &index ); PyObject_FreePIDL(pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISI, IID_IShellIcon ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @object PyIShellIcon|Description of the interface static struct PyMethodDef PyIShellIcon_methods[] = { { "GetIconOf", PyIShellIcon::GetIconOf, 1 }, // @pymeth GetIconOf|Description of GetIconOf { NULL } }; PyComTypeObject PyIShellIcon::type("PyIShellIcon", &PyIUnknown::type, sizeof(PyIShellIcon), PyIShellIcon_methods, GET_PYCOM_CTOR(PyIShellIcon)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellIcon::GetIconOf( /* [unique][in] */ LPCITEMIDLIST pidl, /* [int] */ UINT flags, /* [unique][out] */ int __RPC_FAR * index) { PY_GATEWAY_METHOD; PyObject *obpidl; obpidl = PyObject_FromPIDL(pidl, FALSE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetIconOf", &result, "O", obpidl); Py_XDECREF(obpidl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetIconOf", GetIID()); Py_DECREF(result); return hr; } Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** shell.cpp 16 Dec 2004 05:02:21 -0000 1.31 --- shell.cpp 25 Jan 2005 09:42:32 -0000 1.32 *************** *** 23,26 **** --- 23,30 ---- #include "PyIOleWindow.h" #include "PyIShellView.h" + #include "PyIShellIcon.h" + #include "PyIShellIconOverlay.h" + #include "PyIShellIconOverlayManager.h" + #include "PyIShellIconOverlayIdentifier.h" #include "PyIShellBrowser.h" #include "PyIBrowserFrameOptions.h" *************** *** 1936,1940 **** } ! // @pymethod <o PyIQueryAssociations|shell|AssocCreate|Creates a <o PyIQueryAssociations> object static PyObject *PyAssocCreate(PyObject *self, PyObject *args) { --- 1940,1944 ---- } ! // @pymethod <o PyIQueryAssociations>|shell|AssocCreate|Creates a <o PyIQueryAssociations> object static PyObject *PyAssocCreate(PyObject *self, PyObject *args) { *************** *** 2010,2013 **** --- 2014,2021 ---- PYCOM_INTERFACE_FULL(ShellExtInit), PYCOM_INTERFACE_FULL(ShellFolder), + PYCOM_INTERFACE_FULL(ShellIcon), + PYCOM_INTERFACE_FULL(ShellIconOverlay), + PYCOM_INTERFACE_FULL(ShellIconOverlayIdentifier), + PYCOM_INTERFACE_FULL(ShellIconOverlayManager), PYCOM_INTERFACE_FULL(ShellView), PYCOM_INTERFACE_FULL(ShellBrowser), --- NEW FILE: PyIShellIconOverlay.cpp --- // This file implements the IShellIconOverlay Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellIconOverlay.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellIconOverlay::PyIShellIconOverlay(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellIconOverlay::~PyIShellIconOverlay() { } /* static */ IShellIconOverlay *PyIShellIconOverlay::GetI(PyObject *self) { return (IShellIconOverlay *)PyIUnknown::GetI(self); } // @pymethod |PyIShellIconOverlay|GetOverlayIndex|Description of GetOverlayIndex. PyObject *PyIShellIconOverlay::GetOverlayIndex(PyObject *self, PyObject *args) { IShellIconOverlay *pISIO = GetI(self); if ( pISIO == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl PyObject *obpidl; LPITEMIDLIST pidl; int index; if ( !PyArg_ParseTuple(args, "O:GetOverlayIndex", &obpidl) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIO->GetOverlayIndex( pidl, &index ); PyObject_FreePIDL(pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIO, IID_IShellIconOverlay ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @pymethod |PyIShellIconOverlay|GetOverlayIconIndex|Description of GetOverlayIconIndex. PyObject *PyIShellIconOverlay::GetOverlayIconIndex(PyObject *self, PyObject *args) { IShellIconOverlay *pISIO = GetI(self); if ( pISIO == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl PyObject *obpidl; LPITEMIDLIST pidl; int index; if ( !PyArg_ParseTuple(args, "O:GetOverlayIconIndex", &obpidl) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIO->GetOverlayIconIndex( pidl, &index ); PyObject_FreePIDL(pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIO, IID_IShellIconOverlay ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @object PyIShellIconOverlay|Description of the interface static struct PyMethodDef PyIShellIconOverlay_methods[] = { { "GetOverlayIndex", PyIShellIconOverlay::GetOverlayIndex, 1 }, // @pymeth GetOverlayIndex|Description of GetOverlayIndex { "GetOverlayIconIndex", PyIShellIconOverlay::GetOverlayIconIndex, 1 }, // @pymeth GetOverlayIconIndex|Description of GetOverlayIconIndex { NULL } }; PyComTypeObject PyIShellIconOverlay::type("PyIShellIconOverlay", &PyIUnknown::type, sizeof(PyIShellIconOverlay), PyIShellIconOverlay_methods, GET_PYCOM_CTOR(PyIShellIconOverlay)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellIconOverlay::GetOverlayIndex( /* [unique][in] */ LPCITEMIDLIST pidl, /* [out] */ int __RPC_FAR * index) { PY_GATEWAY_METHOD; PyObject *obpidl; obpidl = PyObject_FromPIDL(pidl, FALSE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetOverlayIndex", &result, "O", obpidl); Py_XDECREF(obpidl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetOverlayIndex", GetIID()); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellIconOverlay::GetOverlayIconIndex( /* [unique][in] */ LPCITEMIDLIST pidl, /* [out] */ int __RPC_FAR * index) { PY_GATEWAY_METHOD; PyObject *obpidl; obpidl = PyObject_FromPIDL(pidl, FALSE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetOverlayIconIndex", &result, "O", obpidl); Py_XDECREF(obpidl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetOverlayIconIndex", GetIID()); Py_DECREF(result); return hr; } --- NEW FILE: PyIShellIconOverlayIdentifier.h --- // This file declares the IShellIconOverlayIdentifier Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellIconOverlayIdentifier : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellIconOverlayIdentifier); static IShellIconOverlayIdentifier *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *IsMemberOf(PyObject *self, PyObject *args); static PyObject *GetOverlayInfo(PyObject *self, PyObject *args); static PyObject *GetPriority(PyObject *self, PyObject *args); protected: PyIShellIconOverlayIdentifier(IUnknown *pdisp); ~PyIShellIconOverlayIdentifier(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellIconOverlayIdentifier : public PyGatewayBase, public IShellIconOverlayIdentifier { protected: PyGShellIconOverlayIdentifier(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellIconOverlayIdentifier, IShellIconOverlayIdentifier, IID_IShellIconOverlayIdentifier, PyGatewayBase) // IShellIconOverlayIdentifier STDMETHOD(IsMemberOf)( LPCWSTR path, DWORD attrib); STDMETHOD(GetOverlayInfo)( LPWSTR pwszIconFile, int cchMax, int * pIndex, DWORD * pdwFlags); STDMETHOD(GetPriority)( int __RPC_FAR * pri); }; --- NEW FILE: PyIShellIconOverlayManager.h --- // This file declares the IShellIconOverlayManager Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellIconOverlayManager : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellIconOverlayManager); static IShellIconOverlayManager *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *GetFileOverlayInfo(PyObject *self, PyObject *args); static PyObject *GetReservedOverlayInfo(PyObject *self, PyObject *args); static PyObject *RefreshOverlayImages(PyObject *self, PyObject *args); static PyObject *LoadNonloadedOverlayIdentifiers(PyObject *self, PyObject *args); static PyObject *OverlayIndexFromImageIndex(PyObject *self, PyObject *args); protected: PyIShellIconOverlayManager(IUnknown *pdisp); ~PyIShellIconOverlayManager(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellIconOverlayManager : public PyGatewayBase, public IShellIconOverlayManager { protected: PyGShellIconOverlayManager(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellIconOverlayManager, IShellIconOverlayManager, IID_IShellIconOverlayManager, PyGatewayBase) // IShellIconOverlayManager STDMETHOD(GetFileOverlayInfo)( LPCWSTR path, DWORD attrib, int __RPC_FAR * index, DWORD flags); STDMETHOD(GetReservedOverlayInfo)( LPCWSTR path, DWORD attrib, int __RPC_FAR * index, DWORD flags, int ireservedID); STDMETHOD(RefreshOverlayImages)( DWORD flags); STDMETHOD(LoadNonloadedOverlayIdentifiers)( void); STDMETHOD(OverlayIndexFromImageIndex)( int iImage, int __RPC_FAR * index, BOOL fAdd); }; --- NEW FILE: PyIShellIconOverlayManager.cpp --- // This file implements the IShellIconOverlayManager Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellIconOverlayManager.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellIconOverlayManager::PyIShellIconOverlayManager(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellIconOverlayManager::~PyIShellIconOverlayManager() { } /* static */ IShellIconOverlayManager *PyIShellIconOverlayManager::GetI(PyObject *self) { return (IShellIconOverlayManager *)PyIUnknown::GetI(self); } // @pymethod |PyIShellIconOverlayManager|GetFileOverlayInfo|Description of GetFileOverlayInfo. PyObject *PyIShellIconOverlayManager::GetFileOverlayInfo(PyObject *self, PyObject *args) { IShellIconOverlayManager *pISIOM = GetI(self); if ( pISIOM == NULL ) return NULL; // @pyparm <o unicode>|path||Description for path // @pyparm int|attrib||Description for attrib // @pyparm int|flags||Description for flags PyObject *obpath; LPWSTR path; DWORD attrib; int index; DWORD flags; if ( !PyArg_ParseTuple(args, "Oll:GetFileOverlayInfo", &obpath, &attrib, &flags) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpath, &path)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOM->GetFileOverlayInfo( path, attrib, &index, flags ); SysFreeString(path); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @pymethod |PyIShellIconOverlayManager|GetReservedOverlayInfo|Description of GetReservedOverlayInfo. PyObject *PyIShellIconOverlayManager::GetReservedOverlayInfo(PyObject *self, PyObject *args) { IShellIconOverlayManager *pISIOM = GetI(self); if ( pISIOM == NULL ) return NULL; // @pyparm <o unicode>|path||Description for path // @pyparm int|attrib||Description for attrib // @pyparm int|flags||Description for flags // @pyparm int|ireservedID||Description for ireservedID PyObject *obpath; LPWSTR path; DWORD attrib; int index; DWORD flags; int ireservedID; if ( !PyArg_ParseTuple(args, "Olli:GetReservedOverlayInfo", &obpath, &attrib, &flags, &ireservedID) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsBstr(obpath, &path)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOM->GetReservedOverlayInfo( path, attrib, &index, flags, ireservedID ); SysFreeString(path); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @pymethod |PyIShellIconOverlayManager|RefreshOverlayImages|Description of RefreshOverlayImages. PyObject *PyIShellIconOverlayManager::RefreshOverlayImages(PyObject *self, PyObject *args) { IShellIconOverlayManager *pISIOM = GetI(self); if ( pISIOM == NULL ) return NULL; // @pyparm int|flags||Description for flags DWORD flags; if ( !PyArg_ParseTuple(args, "l:RefreshOverlayImages", &flags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOM->RefreshOverlayImages( flags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIShellIconOverlayManager|LoadNonloadedOverlayIdentifiers|Description of LoadNonloadedOverlayIdentifiers. PyObject *PyIShellIconOverlayManager::LoadNonloadedOverlayIdentifiers(PyObject *self, PyObject *args) { IShellIconOverlayManager *pISIOM = GetI(self); if ( pISIOM == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":LoadNonloadedOverlayIdentifiers") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOM->LoadNonloadedOverlayIdentifiers( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIShellIconOverlayManager|OverlayIndexFromImageIndex|Description of OverlayIndexFromImageIndex. PyObject *PyIShellIconOverlayManager::OverlayIndexFromImageIndex(PyObject *self, PyObject *args) { IShellIconOverlayManager *pISIOM = GetI(self); if ( pISIOM == NULL ) return NULL; // @pyparm int|iImage||Description for iImage // @pyparm int|fAdd||Description for fAdd int iImage; int index; BOOL fAdd; if ( !PyArg_ParseTuple(args, "ii:OverlayIndexFromImageIndex", &iImage, &fAdd) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIOM->OverlayIndexFromImageIndex( iImage, &index, fAdd ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIOM, IID_IShellIconOverlayManager ); PyObject *pyretval = Py_BuildValue("i", index); return pyretval; } // @object PyIShellIconOverlayManager|Description of the interface static struct PyMethodDef PyIShellIconOverlayManager_methods[] = { { "GetFileOverlayInfo", PyIShellIconOverlayManager::GetFileOverlayInfo, 1 }, // @pymeth GetFileOverlayInfo|Description of GetFileOverlayInfo { "GetReservedOverlayInfo", PyIShellIconOverlayManager::GetReservedOverlayInfo, 1 }, // @pymeth GetReservedOverlayInfo|Description of GetReservedOverlayInfo { "RefreshOverlayImages", PyIShellIconOverlayManager::RefreshOverlayImages, 1 }, // @pymeth RefreshOverlayImages|Description of RefreshOverlayImages { "LoadNonloadedOverlayIdentifiers", PyIShellIconOverlayManager::LoadNonloadedOverlayIdentifiers, 1 }, // @pymeth LoadNonloadedOverlayIdentifiers|Description of LoadNonloadedOverlayIdentifiers { "OverlayIndexFromImageIndex", PyIShellIconOverlayManager::OverlayIndexFromImageIndex, 1 }, // @pymeth OverlayIndexFromImageIndex|Description of OverlayIndexFromImageIndex { NULL } }; PyComTypeObject PyIShellIconOverlayManager::type("PyIShellIconOverlayManager", &PyIUnknown::type, sizeof(PyIShellIconOverlayManager), PyIShellIconOverlayManager_methods, GET_PYCOM_CTOR(PyIShellIconOverlayManager)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellIconOverlayManager::GetFileOverlayInfo( /* [unique][in] */ LPCWSTR path, /* [unique][in] */ DWORD attrib, /* [out] */ int __RPC_FAR * index, /* [in] */ DWORD flags) { PY_GATEWAY_METHOD; PyObject *obpath; obpath = MakeOLECHARToObj(path); PyObject *result; HRESULT hr=InvokeViaPolicy("GetFileOverlayInfo", &result, "Oll", obpath, attrib, flags); Py_XDECREF(obpath); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetFileOverlayInfo", GetIID()); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellIconOverlayManager::GetReservedOverlayInfo( /* [unique][in] */ LPCWSTR path, /* [unique][in] */ DWORD attrib, /* [out] */ int __RPC_FAR * index, /* [in] */ DWORD flags, /* [in] */ int ireservedID) { PY_GATEWAY_METHOD; PyObject *obpath; obpath = MakeOLECHARToObj(path); PyObject *result; HRESULT hr=InvokeViaPolicy("GetReservedOverlayInfo", &result, "Olli", obpath, attrib, flags, ireservedID); Py_XDECREF(obpath); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetReservedOverlayInfo", GetIID()); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellIconOverlayManager::RefreshOverlayImages( /* [in] */ DWORD flags) { PY_GATEWAY_METHOD; HRESULT hr=InvokeViaPolicy("RefreshOverlayImages", NULL, "l", flags); return hr; } STDMETHODIMP PyGShellIconOverlayManager::LoadNonloadedOverlayIdentifiers( void) { PY_GATEWAY_METHOD; HRESULT hr=InvokeViaPolicy("LoadNonloadedOverlayIdentifiers", NULL); return hr; } STDMETHODIMP PyGShellIconOverlayManager::OverlayIndexFromImageIndex( /* [unique][in] */ int iImage, /* [out] */ int __RPC_FAR * index, /* [in] */ BOOL fAdd) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("OverlayIndexFromImageIndex", &result, "ii", iImage, fAdd); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("OverlayIndexFromImageIndex", GetIID()); Py_DECREF(result); return hr; } --- NEW FILE: PyIShellIconOverlay.h --- // This file declares the IShellIconOverlay Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellIconOverlay : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellIconOverlay); static IShellIconOverlay *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *GetOverlayIndex(PyObject *self, PyObject *args); static PyObject *GetOverlayIconIndex(PyObject *self, PyObject *args); protected: PyIShellIconOverlay(IUnknown *pdisp); ~PyIShellIconOverlay(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellIconOverlay : public PyGatewayBase, public IShellIconOverlay { protected: PyGShellIconOverlay(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellIconOverlay, IShellIconOverlay, IID_IShellIconOverlay, PyGatewayBase) // IShellIconOverlay STDMETHOD(GetOverlayIndex)( LPCITEMIDLIST pidl, int __RPC_FAR * index); STDMETHOD(GetOverlayIconIndex)( LPCITEMIDLIST pidl, int __RPC_FAR * index); }; |
From: Mark H. <mha...@us...> - 2005-01-25 09:42:44
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26197 Modified Files: shell.dsp Log Message: PyIShellIcon* interfaces added to win32com.shell.shell Index: shell.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/shell.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shell.dsp 15 Dec 2004 01:09:11 -0000 1.12 --- shell.dsp 25 Jan 2005 09:42:32 -0000 1.13 *************** *** 147,150 **** --- 147,166 ---- # Begin Source File + SOURCE=.\win32comext\shell\src\PyIShellIcon.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlay.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlayIdentifier.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlayManager.cpp + # End Source File + # Begin Source File + SOURCE=.\win32comext\shell\src\PyIShellLink.cpp # End Source File *************** *** 215,218 **** --- 231,250 ---- # Begin Source File + SOURCE=.\win32comext\shell\src\PyIShellIcon.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlay.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlayIdentifier.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellIconOverlayManager.h + # End Source File + # Begin Source File + SOURCE=.\win32comext\shell\src\PyIShellLink.h # End Source File |
From: Mark H. <mha...@us...> - 2005-01-25 09:39:14
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25470 Modified Files: PyIShellView.cpp Log Message: PIDL param to IShellView.SelectItem() can be None Index: PyIShellView.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIShellView.cpp 9 Apr 2004 11:14:16 -0000 1.3 --- PyIShellView.cpp 25 Jan 2005 09:39:05 -0000 1.4 *************** *** 251,255 **** return NULL; BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyObject_AsPIDL(obpidlItem, &pidlItem)) bPythonIsHappy = FALSE; uFlags = iuFlags; if (!bPythonIsHappy) return NULL; --- 251,255 ---- return NULL; BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyObject_AsPIDL(obpidlItem, &pidlItem, TRUE)) bPythonIsHappy = FALSE; uFlags = iuFlags; if (!bPythonIsHappy) return NULL; |
From: Mark H. <mha...@us...> - 2005-01-25 07:53:44
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5461/src Modified Files: win32event.i Log Message: Add WaitableTimer functions, and a BOOLAPI_NL return type to optimize lock handling. Index: win32event.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32event.i,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** win32event.i 3 Oct 2002 23:19:36 -0000 1.5 --- win32event.i 25 Jan 2005 07:53:34 -0000 1.6 *************** *** 6,12 **** %{ //#define UNICODE #ifndef MS_WINCE ! #include "winsock2.h" ! #include "mswsock.h" #endif %} --- 6,14 ---- %{ //#define UNICODE + #define _WIN32_WINNT 0x0501 #ifndef MS_WINCE ! #include "windows.h" ! //#include "winsock2.h" ! //#include "mswsock.h" #endif %} *************** *** 15,18 **** --- 17,58 ---- %include "pywin32.i" + %typedef void *NULL_ONLY + + %typemap(python,in) NULL_ONLY { + if ($source != Py_None) { + PyErr_SetString(PyExc_TypeError, "This param must be None"); + return NULL; + } + $target = NULL; + } + + // only seem able to make this work with an incorrect level of + // indirection, and fixing it up inline with a temp. + %typemap(python,in) PTIMERAPCROUTINE *(PTIMERAPCROUTINE temp) { + if ($source != Py_None) { + PyErr_SetString(PyExc_TypeError, "This param must be None"); + return NULL; + } + temp = NULL; + $target = &temp; + } + + // We can get better perf from some of these functions that don't block + // by not releasing the Python lock as part of the call. + %typedef BOOL BOOLAPI_NL + + %typemap(python,out) BOOLAPI_NL { + $target = Py_None; + Py_INCREF(Py_None); + } + + %typemap(python,except) BOOLAPI { + $function + if (!$source) { + $cleanup + return PyWin_SetAPIError("$name"); + } + } + #define WAIT_FAILED WAIT_FAILED *************** *** 61,67 **** #define SYNCHRONIZE SYNCHRONIZE // Windows NT only: Enables use of the event handle in any of the wait functions to wait for the events state to be signaled. ! #if(_WIN32_WINNT >= 0x0400) ! // XXX - WTF? ! //BOOLAPI CancelWaitableTimer(HANDLE handle); #end --- 101,106 ---- #define SYNCHRONIZE SYNCHRONIZE // Windows NT only: Enables use of the event handle in any of the wait functions to wait for the events state to be signaled. ! // @pyswig |CancelWaitableTimer|Cancels a waiting timer. ! BOOLAPI CancelWaitableTimer(PyHANDLE handle); #end *************** *** 95,104 **** #endif // MS_WINCE ! /*PyHANDLE CreateWaitableTimer( SECURITY_ATTRIBUTES *inNullSA, // lpTimerAttributes, // pointer to security attributes BOOL bManualReset, // @pyparm int|bManualReset||flag for manual reset state TCHAR * INPUT_NULLOK // pointer to timer object name ); - */ // GetOverlappedResult --- 134,142 ---- #endif // MS_WINCE ! PyHANDLE CreateWaitableTimer( SECURITY_ATTRIBUTES *inNullSA, // lpTimerAttributes, // pointer to security attributes BOOL bManualReset, // @pyparm int|bManualReset||flag for manual reset state TCHAR * INPUT_NULLOK // pointer to timer object name ); // GetOverlappedResult *************** *** 248,258 **** #endif /* MS_WINCE */ ! /* PyHANDLE OpenWaitableTimer( ! DWORD dwDesiredAccess, // access flag ! BOOL bInheritHandle, // inherit flag ! TCHAR *lpTimerName // pointer to timer object name ! ); ! */ // @pyswig |PulseEvent|Provides a single operation that sets (to signaled) the state of the specified event object and then resets it (to nonsignaled) after releasing the appropriate number of waiting threads. --- 286,295 ---- #endif /* MS_WINCE */ ! //@pyswig handle|OpenWaitableTimer|Opens an existing named waitable timer object PyHANDLE OpenWaitableTimer( ! DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access flag ! BOOL bInheritHandle, // @pyparm bInheritHandle||inherit flag ! TCHAR *lpTimerName // @pyparm string|timerName||pointer to timer object name ! ); // @pyswig |PulseEvent|Provides a single operation that sets (to signaled) the state of the specified event object and then resets it (to nonsignaled) after releasing the appropriate number of waiting threads. *************** *** 262,266 **** // @pyswig |ReleaseMutex|Releases a mutex. ! BOOLAPI ReleaseMutex( PyHANDLE hMutex // @pyparm <o PyHANDLE>|hEvent||handle of mutex object ); --- 299,303 ---- // @pyswig |ReleaseMutex|Releases a mutex. ! BOOLAPI_NL ReleaseMutex( PyHANDLE hMutex // @pyparm <o PyHANDLE>|hEvent||handle of mutex object ); *************** *** 277,292 **** // @pyswig |ResetEvent|Resets an event ! BOOLAPI ResetEvent( PyHANDLE hEvent // @pyparm <o PyHANDLE>|hEvent||handle of event object ); // @pyswig |SetEvent|Sets an event ! BOOLAPI SetEvent( PyHANDLE hEvent // @pyparm <o PyHANDLE>|hEvent||handle of event object ); - // SetWaitableTimer - /* BOOLAPI SignalObjectAndWait( PyHANDLE hObjectToSignal, // handle of object to signal --- 314,335 ---- // @pyswig |ResetEvent|Resets an event ! BOOLAPI_NL ResetEvent( PyHANDLE hEvent // @pyparm <o PyHANDLE>|hEvent||handle of event object ); // @pyswig |SetEvent|Sets an event ! BOOLAPI_NL SetEvent( PyHANDLE hEvent // @pyparm <o PyHANDLE>|hEvent||handle of event object ); + // @pyswig |SetWaitableTimer|Sets a waitable timer. + BOOLAPI_NL SetWaitableTimer( + PyHANDLE hTimer, // @pyparm int|handle||handle to timer + LARGE_INTEGER *INPUT, // @pyparm long|dueTime||timer due time + long lPeriod, // @pyparm int|period||timer interval + PTIMERAPCROUTINE pfnCompletionRoutine, // @pyparm object|func||completion routine - must be None + NULL_ONLY lpArgToCompletionRoutine, // @pyparm object|param||completion routine parameter - must be None + BOOL fResume); // @pyparm bool|resume_state||resume state BOOLAPI SignalObjectAndWait( PyHANDLE hObjectToSignal, // handle of object to signal *************** *** 296,300 **** ); - */ %{ static PyObject *MyWaitForMultipleObjects( --- 339,342 ---- |
From: Mark H. <mha...@us...> - 2005-01-25 07:53:44
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5461/test Added Files: test_win32event.py Log Message: Add WaitableTimer functions, and a BOOLAPI_NL return type to optimize lock handling. --- NEW FILE: test_win32event.py --- import unittest import win32event import time import os import sys class TestWaitableTimer(unittest.TestCase): def testWaitableFire(self): h = win32event.CreateWaitableTimer(None, 0, None) dt = -160L # 160 ns. win32event.SetWaitableTimer(h, dt, 0, None, None, 0) rc = win32event.WaitForSingleObject(h, 1000) self.failUnlessEqual(rc, win32event.WAIT_OBJECT_0) def testWaitableTrigger(self): h = win32event.CreateWaitableTimer(None, 0, None) # for the sake of this, pass a long that doesn't fit in an int. dt = -2000000000L win32event.SetWaitableTimer(h, dt, 0, None, None, 0) rc = win32event.WaitForSingleObject(h, 10) # 10 ms. self.failUnlessEqual(rc, win32event.WAIT_TIMEOUT) if __name__=='__main__': unittest.main() |