pywin32-checkins Mailing List for Python for Windows Extensions (Page 155)
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: <mha...@us...> - 2003-10-06 13:01:56
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv27813/win32/src Modified Files: PythonService.cpp Log Message: Print a friendlier message when starting the service, indicating that you don't start the service directly via the executable. Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonService.cpp 9 May 2002 05:54:53 -0000 1.4 --- PythonService.cpp 6 Oct 2003 13:01:49 -0000 1.5 *************** *** 480,484 **** #endif printf(" -debug servicename [parms] - debug the Python service.\n"); ! printf("\nStarting service - this may take several seconds - please wait...\n"); if (!StartServiceCtrlDispatcher( DispatchTable)) { --- 480,486 ---- #endif printf(" -debug servicename [parms] - debug the Python service.\n"); ! printf("\nNOTE: You do not start the service using this program - start the\n"); ! printf("service using Control Panel, or 'net start %s'\n", svcName); ! printf("\nConnecting to the service control manager....\n"); if (!StartServiceCtrlDispatcher( DispatchTable)) { |
From: <mha...@us...> - 2003-10-06 13:00:37
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv27601/win32/src Modified Files: win32pdhmodule.cpp Log Message: Handle Windows XP differences in determining buffer sizes. Index: win32pdhmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** win32pdhmodule.cpp 1 Sep 2003 08:09:00 -0000 1.9 --- win32pdhmodule.cpp 6 Oct 2003 13:00:33 -0000 1.10 *************** *** 386,390 **** Py_END_ALLOW_THREADS ! if (pdhStatus != ERROR_SUCCESS) { PyWinObject_FreeTCHAR(strMachine); return PyWin_SetAPIError("EnumObjects for buffer size", pdhStatus); --- 386,392 ---- Py_END_ALLOW_THREADS ! // it appears NT/2k will return 0, while XP will return ! // PDH_MORE_DATA ! if (pdhStatus != ERROR_SUCCESS && pdhStatus != PDH_MORE_DATA) { PyWinObject_FreeTCHAR(strMachine); return PyWin_SetAPIError("EnumObjects for buffer size", pdhStatus); |
From: <mha...@us...> - 2003-10-06 12:58:53
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell In directory sc8-pr-cvs1:/tmp/cvs-serv27396 Modified Files: shellcon.py Log Message: New shell constants. Index: shellcon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/shellcon.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shellcon.py 2 Jul 2003 03:41:42 -0000 1.3 --- shellcon.py 6 Oct 2003 12:58:49 -0000 1.4 *************** *** 526,527 **** --- 526,541 ---- CSIDL_COMMON_APPDATA = 35 CSIDL_LOCAL_APPDATA = 28 + + SHCONTF_FOLDERS = 32 # for shell browser + SHCONTF_NONFOLDERS = 64 # for default view + SHCONTF_INCLUDEHIDDEN = 128 # for hidden/system objects + + SHGDN_NORMAL = 0 # default (display purpose) + SHGDN_INFOLDER = 1 # displayed under a folder (relative) + SHGDN_INCLUDE_NONFILESYS = 0x2000 # if not set, display names for shell name space items that are not in the file system will fail. + SHGDN_FORADDRESSBAR = 0x4000 # for displaying in the address (drives dropdown) bar + SHGDN_FORPARSING = 0x8000 # for ParseDisplayName or path + + SHCONTF_FOLDERS = 32 # for shell browser + SHCONTF_NONFOLDERS = 64 # for default view + SHCONTF_INCLUDEHIDDEN = 128 # for hidden/system objects |
From: <mha...@us...> - 2003-10-06 12:53:16
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers In directory sc8-pr-cvs1:/tmp/cvs-serv26692 Added Files: context_menu.py Log Message: Sample context menu handler. --- NEW FILE: context_menu.py --- # A sample context menu handler. # Adds a 'Hello from Python' menu entry to .py files. When clicked, a # simple message box is displayed. # # To demostrate: # * Execute this script to register the context menu. # * Open Windows Explorer, and browse to a directory with a .py file. # * Right-Click on a .py file - locate and click on 'Hello from Python' on # the context menu. import pythoncom from win32com.shell import shell, shellcon import win32gui import win32con IContextMenu_Methods = ["QueryContextMenu", "InvokeCommand", "GetCommandString"] IShellExtInit_Methods = ["Initialize"] class ShellExtension: _reg_progid_ = "Python.ShellExtension.ContextMenu" _reg_desc_ = "Python Sample Shell Extension (context menu)" _reg_clsid_ = "{CED0336C-C9EE-4a7f-8D7F-C660393C381F}" _com_interfaces_ = [shell.IID_IShellExtInit, shell.IID_IContextMenu, shell.IID_IExtractIcon, pythoncom.IID_IPersistFile] _public_methods_ = IContextMenu_Methods + IShellExtInit_Methods def Initialize(self, folder, dataobj, hkey): print "Init", folder, dataobj, hkey def QueryContextMenu(self, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags): print "QCM", hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags idCmd = idCmdFirst items = [] if (uFlags & 0x000F) == shellcon.CMF_NORMAL: # Check == here, since CMF_NORMAL=0 print "CMF_NORMAL..." items.append("&Hello from Python") elif uFlags & shellcon.CMF_VERBSONLY: print "CMF_VERBSONLY..." items.append("&Hello from Python - shortcut") elif uFlags & shellcon.CMF_EXPLORE: print "CMF_EXPLORE..." items.append("&Hello from Python - normal file, right-click in Explorer") elif uFlags & CMF_DEFAULTONLY: print "CMF_DEFAULTONLY...\r\n" else: print "** unknown flags", uFlags win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 for item in items: win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_STRING|win32con.MF_BYPOSITION, idCmd, item) indexMenu += 1 idCmd += 1 win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 return idCmd-idCmdFirst # Must return number of menu items we added. def InvokeCommand(self, ci): mask, hwnd, verb, params, dir, nShow, hotkey, hicon = ci win32gui.MessageBox(hwnd, "Hello", "Wow", win32con.MB_OK) def GetCommandString(self, cmd, typ): return "Hello from Python!!" def DllRegisterServer(): import _winreg key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Python.File\\shellex") subkey = _winreg.CreateKey(key, "ContextMenuHandlers") subkey2 = _winreg.CreateKey(subkey, "PythonSample") _winreg.SetValueEx(subkey2, None, 0, _winreg.REG_SZ, ShellExtension._reg_clsid_) print ShellExtension._reg_desc_, "registration complete." def DllUnregisterServer(): import _winreg try: key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT, "Python.File\\shellex\\ContextMenuHandlers\\PythonSample") except WindowsError, details: import errno if details.errno != errno.ENOENT: raise print ShellExtension._reg_desc_, "unregistration complete." if __name__=='__main__': from win32com.server import register register.UseCommandLine(ShellExtension, finalize_register = DllRegisterServer, finalize_unregister = DllUnregisterServer) |
From: <mha...@us...> - 2003-10-06 12:49:27
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers In directory sc8-pr-cvs1:/tmp/cvs-serv26060/servers Log Message: Directory /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers added to the repository |
From: <mha...@us...> - 2003-10-06 12:49:14
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos In directory sc8-pr-cvs1:/tmp/cvs-serv26024/demos Log Message: Directory /cvsroot/pywin32/pywin32/com/win32comext/shell/demos added to the repository |
From: <mha...@us...> - 2003-10-06 12:48:56
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1:/tmp/cvs-serv25914 Modified Files: shell.dsp Log Message: Add new shell interface files to the shell project. Index: shell.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/shell.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shell.dsp 27 Oct 2001 06:37:55 -0000 1.5 --- shell.dsp 6 Oct 2003 12:48:51 -0000 1.6 *************** *** 95,98 **** --- 95,118 ---- # Begin Source File + SOURCE=.\win32comext\shell\src\PyIContextMenu.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIEnumIDList.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIExtractIcon.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellExtInit.cpp + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellFolder.cpp + # End Source File + # Begin Source File + SOURCE=.\win32comext\shell\src\PyIShellLink.cpp # End Source File *************** *** 105,108 **** --- 125,148 ---- # PROP Default_Filter "h" + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIContextMenu.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIEnumIDList.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIExtractIcon.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellExtInit.h + # End Source File + # Begin Source File + + SOURCE=.\win32comext\shell\src\PyIShellFolder.h + # End Source File # Begin Source File |
From: <mha...@us...> - 2003-10-06 12:48:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1:/tmp/cvs-serv25779 Modified Files: PyIShellLink.cpp shell.cpp shell_pch.h Added Files: PyIContextMenu.cpp PyIContextMenu.h PyIEnumIDList.cpp PyIEnumIDList.h PyIExtractIcon.cpp PyIExtractIcon.h PyIShellExtInit.cpp PyIShellExtInit.h PyIShellFolder.cpp PyIShellFolder.h Log Message: Support lots of new shell interfaces, so we can be a shell extension! --- NEW FILE: PyIContextMenu.cpp --- // This file implements the IContextMenu Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIContextMenu.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIContextMenu::PyIContextMenu(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIContextMenu::~PyIContextMenu() { } /* static */ IContextMenu *PyIContextMenu::GetI(PyObject *self) { return (IContextMenu *)PyIUnknown::GetI(self); } // @pymethod |PyIContextMenu|QueryContextMenu|Description of QueryContextMenu. PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { IContextMenu *pICM = GetI(self); if ( pICM == NULL ) return NULL; // @pyparm int|hmenu||Description for hmenu // @pyparm int|indexMenu||Description for indexMenu // @pyparm int|idCmdFirst||Description for idCmdFirst // @pyparm int|idCmdLast||Description for idCmdLast // @pyparm int|uFlags||Description for uFlags INT hmenu; UINT indexMenu; UINT idCmdFirst; UINT idCmdLast; UINT uFlags; if ( !PyArg_ParseTuple(args, "iiiii:QueryContextMenu", &hmenu, &indexMenu, &idCmdFirst, &idCmdLast, &uFlags) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pICM->QueryContextMenu( (HMENU)hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pICM, IID_IContextMenu ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIContextMenu|InvokeCommand|Description of InvokeCommand. PyObject *PyIContextMenu::InvokeCommand(PyObject *self, PyObject *args) { IContextMenu *pICM = GetI(self); if ( pICM == NULL ) return NULL; CMINVOKECOMMANDINFO *lpici; PyObject *oblpici; if ( !PyArg_ParseTuple(args, "O:InvokeCommand", &oblpici) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsCMINVOKECOMMANDINFO( oblpici, &lpici )) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pICM->InvokeCommand( lpici ); PyObject_FreeCMINVOKECOMMANDINFO(lpici); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pICM, IID_IContextMenu ); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIContextMenu|GetCommandString|Description of GetCommandString. PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { IContextMenu *pICM = GetI(self); if ( pICM == NULL ) return NULL; // @pyparm int|idCmd||Description for idCmd // @pyparm int|uType||Description for uType // @pyparm int|cchMax|2048|Description for cchMax UINT idCmd; UINT uType; UINT cchMax = 2048; if ( !PyArg_ParseTuple(args, "ii|i:GetCommandString", &idCmd, &uType, &cchMax) ) return NULL; char *buf = (char *)malloc(cchMax); if (!buf) return PyErr_NoMemory(); HRESULT hr; PY_INTERFACE_PRECALL; hr = pICM->GetCommandString( idCmd, uType, NULL, buf, cchMax ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) { free(buf); return PyCom_BuildPyException(hr, pICM, IID_IContextMenu ); } PyObject *ret = PyString_FromString(buf); free(buf); return ret; } // @object PyIContextMenu|Description of the interface static struct PyMethodDef PyIContextMenu_methods[] = { { "QueryContextMenu", PyIContextMenu::QueryContextMenu, 1 }, // @pymeth QueryContextMenu|Description of QueryContextMenu { "InvokeCommand", PyIContextMenu::InvokeCommand, 1 }, // @pymeth InvokeCommand|Description of InvokeCommand { "GetCommandString", PyIContextMenu::GetCommandString, 1 }, // @pymeth GetCommandString|Description of GetCommandString { NULL } }; PyComTypeObject PyIContextMenu::type("PyIContextMenu", &PyIUnknown::type, sizeof(PyIContextMenu), PyIContextMenu_methods, GET_PYCOM_CTOR(PyIContextMenu)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGContextMenu::QueryContextMenu( /* [unique][in] */ HMENU hmenu, /* [unique][in] */ UINT indexMenu, /* [unique][in] */ UINT idCmdFirst, /* [unique][in] */ UINT idCmdLast, /* [unique][in] */ UINT uFlags) { PY_GATEWAY_METHOD; PyObject *ret; HRESULT hr=InvokeViaPolicy("QueryContextMenu", &ret, "iiiii", hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) hr = MAKE_HRESULT(SEVERITY_SUCCESS, 0, PyInt_AsLong(ret)); return hr; } STDMETHODIMP PyGContextMenu::InvokeCommand( /* [unique][in] */ CMINVOKECOMMANDINFO __RPC_FAR * lpici) { PY_GATEWAY_METHOD; // *** The input argument lpici of type "CMINVOKECOMMANDINFO __RPC_FAR *" was not processed *** // - Please ensure this conversion function exists, and is appropriate // - The type 'CMINVOKECOMMANDINFO' (lpici) is unknown. PyObject *oblpici = PyObject_FromCMINVOKECOMMANDINFO(lpici); if (oblpici==NULL) return PyCom_HandlePythonFailureToCOM(); HRESULT hr=InvokeViaPolicy("InvokeCommand", NULL, "(O)", oblpici); Py_DECREF(oblpici); return hr; } STDMETHODIMP PyGContextMenu::GetCommandString( /* [unique][in] */ UINT idCmd, /* [unique][in] */ UINT uFlags, /* [unique][in] */ UINT * pwReserved, /* [unique][in] */ LPSTR pszName, /* [unique][in] */ UINT cchMax) { PyObject *result; PY_GATEWAY_METHOD; HRESULT hr=InvokeViaPolicy("GetCommandString", &result, "ii", idCmd, uFlags); if (FAILED(hr)) return hr; if (result && (PyString_Check(result) || PyUnicode_Check(result))) { if (uFlags==GCS_HELPTEXTW || uFlags==GCS_VERBW) { WCHAR *szResult; if (PyWinObject_AsWCHAR(result, &szResult, FALSE, NULL)) { wcsncpy((WCHAR *)pszName, szResult, cchMax); PyWinObject_FreeWCHAR(szResult); } } else { char *szResult; if (PyWinObject_AsString(result, &szResult, FALSE, NULL)) { strncpy(pszName, szResult, cchMax); PyWinObject_FreeString(szResult); } } hr = S_OK; } else if (result && PyInt_Check(result)) { hr = PyInt_AsLong(result) ? S_OK : S_FALSE; } Py_DECREF(result); return hr; } --- NEW FILE: PyIContextMenu.h --- // This file declares the IContextMenu Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIContextMenu : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIContextMenu); static IContextMenu *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *QueryContextMenu(PyObject *self, PyObject *args); static PyObject *InvokeCommand(PyObject *self, PyObject *args); static PyObject *GetCommandString(PyObject *self, PyObject *args); protected: PyIContextMenu(IUnknown *pdisp); ~PyIContextMenu(); }; // --------------------------------------------------- // // Gateway Declaration class PyGContextMenu : public PyGatewayBase, public IContextMenu { protected: PyGContextMenu(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGContextMenu, IContextMenu, IID_IContextMenu, PyGatewayBase) // IContextMenu STDMETHOD(QueryContextMenu)( HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); STDMETHOD(InvokeCommand)( CMINVOKECOMMANDINFO __RPC_FAR * lpici); STDMETHOD(GetCommandString)( UINT idCmd, UINT uType, UINT __RPC_FAR * pwReserved, LPSTR pszName, UINT cchMax); }; --- NEW FILE: PyIEnumIDList.cpp --- // This file implements the IEnumIDList Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIEnumIDList.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIEnumIDList::PyIEnumIDList(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIEnumIDList::~PyIEnumIDList() { } /* static */ IEnumIDList *PyIEnumIDList::GetI(PyObject *self) { return (IEnumIDList *)PyIUnknown::GetI(self); } PyObject * PyIEnumIDList::iter() { Py_INCREF(this); return this; } PyObject * PyIEnumIDList::iternext() { ULONG celtFetched = 0; ITEMIDLIST *pRet; IEnumIDList *peidl = GetI(this); if ( peidl == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Next(1, &pRet, &celtFetched); PY_INTERFACE_POSTCALL; if ( HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) ) return PyCom_BuildPyException(hr,peidl, IID_IEnumIDList); if (celtFetched==0) { PyErr_SetNone(PyExc_StopIteration); return NULL; } return PyObject_FromPIDL(pRet, TRUE); } // @pymethod object|PyIEnumIDList|Next|Retrieves a specified number of items in the enumeration sequence. PyObject *PyIEnumIDList::Next(PyObject *self, PyObject *args) { long celt = 1; // @pyparm int|num|1|Number of items to retrieve. if ( !PyArg_ParseTuple(args, "|l:Next", &celt) ) return NULL; IEnumIDList *peidl = GetI(self); if ( peidl == NULL ) return NULL; ITEMIDLIST *rgVar = new ITEMIDLIST [celt]; if ( rgVar == NULL ) { PyErr_SetString(PyExc_MemoryError, "allocating result ITEMIDLISTs"); return NULL; } int i; /* for ( i = celt; i--; ) // *** possibly init each structure element??? */ ULONG celtFetched = 0; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Next(celt, &rgVar, &celtFetched); PY_INTERFACE_POSTCALL; if ( HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) ) { delete [] rgVar; return PyCom_BuildPyException(hr,peidl, IID_IEnumIDList); } PyObject *result = PyList_New(celtFetched); if ( result != NULL ) { for ( i = celtFetched; i--; ) { PyObject *ob = PyObject_FromPIDL(rgVar+i, TRUE); if ( ob == NULL ) { Py_DECREF(result); result = NULL; break; } PyList_SET_ITEM(result, i, ob); } } /* for ( i = celtFetched; i--; ) // *** possibly cleanup each structure element??? */ delete [] rgVar; return result; } // @pymethod |PyIEnumIDList|Skip|Skips over the next specified elementes. PyObject *PyIEnumIDList::Skip(PyObject *self, PyObject *args) { long celt; if ( !PyArg_ParseTuple(args, "l:Skip", &celt) ) return NULL; IEnumIDList *peidl = GetI(self); if ( peidl == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Skip(celt); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, peidl, IID_IEnumIDList); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIEnumIDList|Reset|Resets the enumeration sequence to the beginning. PyObject *PyIEnumIDList::Reset(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Reset") ) return NULL; IEnumIDList *peidl = GetI(self); if ( peidl == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Reset(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, peidl, IID_IEnumIDList); Py_INCREF(Py_None); return Py_None; } // @pymethod <o PyIEnumIDList>|PyIEnumIDList|Clone|Creates another enumerator that contains the same enumeration state as the current one PyObject *PyIEnumIDList::Clone(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Clone") ) return NULL; IEnumIDList *peidl = GetI(self); if ( peidl == NULL ) return NULL; IEnumIDList *pClone; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Clone(&pClone); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, peidl, IID_IEnumIDList); return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumIDList, FALSE); } // @object PyIEnumIDList|A Python interface to IEnumIDList static struct PyMethodDef PyIEnumIDList_methods[] = { { "Next", PyIEnumIDList::Next, 1 }, // @pymeth Next|Retrieves a specified number of items in the enumeration sequence. { "Skip", PyIEnumIDList::Skip, 1 }, // @pymeth Skip|Skips over the next specified elementes. { "Reset", PyIEnumIDList::Reset, 1 }, // @pymeth Reset|Resets the enumeration sequence to the beginning. { "Clone", PyIEnumIDList::Clone, 1 }, // @pymeth Clone|Creates another enumerator that contains the same enumeration state as the current one. { NULL } }; PyComTypeObject PyIEnumIDList::type("PyIEnumIDList", &PyIUnknown::type, sizeof(PyIEnumIDList), PyIEnumIDList_methods, GET_PYCOM_CTOR(PyIEnumIDList)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGEnumIDList::Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ LPITEMIDLIST *pi, /* [out] */ ULONG __RPC_FAR *pCeltFetched) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr = InvokeViaPolicy("Next", &result, "i", celt); if ( FAILED(hr) ) return hr; if ( !PySequence_Check(result) ) goto error; int len; len = PyObject_Length(result); if ( len == -1 ) goto error; if ( len > (int)celt) len = celt; if ( pCeltFetched ) *pCeltFetched = len; int i; for ( i = 0; i < len; ++i ) { PyObject *ob = PySequence_GetItem(result, i); if ( ob == NULL ) goto error; if ( !PyObject_AsPIDL(ob, &pi[i] )) { Py_DECREF(result); return PyCom_SetCOMErrorFromPyException(IID_IEnumIDList); } } Py_DECREF(result); return len < (int)celt ? S_FALSE : S_OK; error: PyErr_Clear(); // just in case Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumIDList, "Next() did not return a sequence of objects"); } STDMETHODIMP PyGEnumIDList::Skip( /* [in] */ ULONG celt) { PY_GATEWAY_METHOD; return InvokeViaPolicy("Skip", NULL, "i", celt); } STDMETHODIMP PyGEnumIDList::Reset(void) { PY_GATEWAY_METHOD; return InvokeViaPolicy("Reset"); } STDMETHODIMP PyGEnumIDList::Clone( /* [out] */ IEnumIDList __RPC_FAR *__RPC_FAR *ppEnum) { PY_GATEWAY_METHOD; PyObject * result; HRESULT hr = InvokeViaPolicy("Clone", &result); if ( FAILED(hr) ) return hr; /* ** Make sure we have the right kind of object: we should have some kind ** of IUnknown subclass wrapped into a PyIUnknown instance. */ if ( !PyIBase::is_object(result, &PyIUnknown::type) ) { /* the wrong kind of object was returned to us */ Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumIDList); } /* ** Get the IUnknown out of the thing. note that the Python ob maintains ** a reference, so we don't have to explicitly AddRef() here. */ IUnknown *punk = ((PyIUnknown *)result)->m_obj; if ( !punk ) { /* damn. the object was released. */ Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumIDList); } /* ** Get the interface we want. note it is returned with a refcount. ** This QI is actually going to instantiate a PyGEnumIDList. */ Py_BEGIN_ALLOW_THREADS hr = punk->QueryInterface(IID_IEnumIDList, (LPVOID *)ppEnum); Py_END_ALLOW_THREADS /* done with the result; this DECREF is also for <punk> */ Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(hr, IID_IEnumIDList, "Python could not convert the result from Next() into the required COM interface"); } --- NEW FILE: PyIEnumIDList.h --- // This file declares the IEnumIDList Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIEnumIDList : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIEnumIDList); static IEnumIDList *GetI(PyObject *self); static PyComTypeObject type; virtual PyObject *iter(); virtual PyObject *iternext(); // The Python methods static PyObject *Next(PyObject *self, PyObject *args); static PyObject *Skip(PyObject *self, PyObject *args); static PyObject *Reset(PyObject *self, PyObject *args); static PyObject *Clone(PyObject *self, PyObject *args); protected: PyIEnumIDList(IUnknown *pdisp); ~PyIEnumIDList(); }; // --------------------------------------------------- // // Gateway Declaration class PyGEnumIDList : public PyGatewayBase, public IEnumIDList { protected: PyGEnumIDList(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGEnumIDList, IEnumIDList, IID_IEnumIDList, PyGatewayBase) // IEnumIDList STDMETHOD(Next)( ULONG celt, LPITEMIDLIST *pi, ULONG __RPC_FAR * pcEltsfetched); STDMETHOD(Skip)( ULONG celt); STDMETHOD(Reset)( void); STDMETHOD(Clone)( IEnumIDList __RPC_FAR *__RPC_FAR * ppepi); }; --- NEW FILE: PyIExtractIcon.cpp --- // This file implements the IExtractIcon Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIExtractIcon.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIExtractIcon::PyIExtractIcon(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIExtractIcon::~PyIExtractIcon() { } /* static */ IExtractIcon *PyIExtractIcon::GetI(PyObject *self) { return (IExtractIcon *)PyIUnknown::GetI(self); } // @pymethod |PyIExtractIcon|Extract|Description of Extract. PyObject *PyIExtractIcon::Extract(PyObject *self, PyObject *args) { IExtractIcon *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; // @pyparm <o unicode>|pszFile||Description for pszFile // @pyparm int|nIconIndex||Description for nIconIndex // @pyparm int|nIconSize||Description for nIconIndex HICON hiconLarge; HICON hiconSmall; PyObject *obpszFile; TCHAR *pszFile; UINT nIconIndex; UINT nIconSize; if ( !PyArg_ParseTuple(args, "Oii:Extract", &obpszFile, &nIconIndex, &nIconSize) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyWinObject_AsTCHAR(obpszFile, &pszFile)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIEI->Extract( pszFile, nIconIndex, &hiconLarge, &hiconSmall, nIconSize ); PyWinObject_FreeTCHAR(pszFile); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIEI, IID_IExtractIcon ); return Py_BuildValue("ii", hiconLarge, hiconSmall); Py_INCREF(Py_None); return Py_None; } // @pymethod |PyIExtractIcon|GetIconLocation|Description of GetIconLocation. PyObject *PyIExtractIcon::GetIconLocation(PyObject *self, PyObject *args) { IExtractIcon *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; // @pyparm int|uFlags||Description for uFlags // @pyparm int|cchMax|MAX_PATH+MAX_FNAME|Buffer size to allocate for file name UINT uFlags; INT cchMax = MAX_PATH + _MAX_FNAME; if ( !PyArg_ParseTuple(args, "i|i:GetIconLocation", &uFlags, &cchMax)) return NULL; TCHAR *buf = (char *)malloc(cchMax * sizeof(TCHAR)); if (!buf) return PyErr_NoMemory(); INT iIndex; UINT flags; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIEI->GetIconLocation( uFlags, buf, cchMax, &iIndex, &flags); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) { free(buf); return PyCom_BuildPyException(hr, pIEI, IID_IExtractIcon ); } PyObject *retStr = PyWinObject_FromTCHAR(buf); free(buf); return Py_BuildValue("Nii", retStr, iIndex, flags); } // @object PyIExtractIcon|Description of the interface static struct PyMethodDef PyIExtractIcon_methods[] = { { "Extract", PyIExtractIcon::Extract, 1 }, // @pymeth Extract|Description of Extract { "GetIconLocation", PyIExtractIcon::GetIconLocation, 1 }, // @pymeth GetIconLocation|Description of GetIconLocation { NULL } }; PyComTypeObject PyIExtractIcon::type("PyIExtractIcon", &PyIUnknown::type, sizeof(PyIExtractIcon), PyIExtractIcon_methods, GET_PYCOM_CTOR(PyIExtractIcon)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGExtractIcon::Extract( /* [unique][in] */ LPCSTR pszFile, /* [unique][in] */ UINT nIconIndex, /* [out] */ HICON * phiconLarge, /* [out] */ HICON * phiconSmall, /* [unique][in] */ UINT nIconSize) { PY_GATEWAY_METHOD; PyObject *obpszFile; obpszFile = PyWinObject_FromTCHAR((LPSTR)pszFile); PyObject *result; HRESULT hr=InvokeViaPolicy("Extract", &result, "Oii", obpszFile, nIconIndex, nIconSize); Py_XDECREF(obpszFile); if (FAILED(hr)) return hr; PyArg_ParseTuple(result, "ii", phiconLarge, phiconSmall); return PyCom_HandlePythonFailureToCOM(); } STDMETHODIMP PyGExtractIcon::GetIconLocation( /* [unique][in] */ UINT uFlags, /* [unique][out] */ LPSTR szIconFile, /* [unique][in] */ UINT cchMax, /* [unique][out] */ LPINT piIndex, /* [unique][out] */ UINT *pflags) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetIconLocation", &result, "i", uFlags); if (FAILED(hr)) return hr; PyObject *obFileName; // Process the Python results, and convert back to the real params if (result==Py_None) hr = S_FALSE; else { if (PyArg_ParseTuple(result, "Oii", &obFileName, piIndex, pflags)) { TCHAR *filename; if (PyWinObject_AsTCHAR(obFileName, &filename)) { _tcsncpy(filename, szIconFile, cchMax); PyWinObject_FreeTCHAR(filename); } } hr = PyCom_HandlePythonFailureToCOM(); } Py_DECREF(result); return hr; } --- NEW FILE: PyIExtractIcon.h --- // This file declares the IExtractIcon Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIExtractIcon : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIExtractIcon); static IExtractIcon *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *Extract(PyObject *self, PyObject *args); static PyObject *GetIconLocation(PyObject *self, PyObject *args); protected: PyIExtractIcon(IUnknown *pdisp); ~PyIExtractIcon(); }; // --------------------------------------------------- // // Gateway Declaration class PyGExtractIcon : public PyGatewayBase, public IExtractIcon { protected: PyGExtractIcon(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGExtractIcon, IExtractIcon, IID_IExtractIcon, PyGatewayBase) // IExtractIcon STDMETHOD(Extract)( LPCSTR pszFile, UINT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIconSize); STDMETHOD(GetIconLocation)( UINT uFlags, LPSTR szIconFile, UINT cchMax, LPINT piIndex, UINT *pwFlags); }; --- NEW FILE: PyIShellExtInit.cpp --- // This file implements the IShellExtInit Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellExtInit.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellExtInit::PyIShellExtInit(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellExtInit::~PyIShellExtInit() { } /* static */ IShellExtInit *PyIShellExtInit::GetI(PyObject *self) { return (IShellExtInit *)PyIUnknown::GetI(self); } // @pymethod |PyIShellExtInit|Initialize|Description of Initialize. PyObject *PyIShellExtInit::Initialize(PyObject *self, PyObject *args) { IShellExtInit *pISEI = GetI(self); if ( pISEI == NULL ) return NULL; // @pyparm <o PyIDL>|pFolder||Description for pFolder // @pyparm <o PyIDataObject *>|pDataObject||Description for pDataObject // @pyparm <o PyHANDLE>|hkey||Description for hkey PyObject *obpFolder; PyObject *obpDataObject; PyObject *obhkey; LPITEMIDLIST pFolder; IDataObject *pDataObject; HKEY hkey; if ( !PyArg_ParseTuple(args, "OOO:Initialize", &obpFolder, &obpDataObject, &obhkey) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyObject_AsPIDL(obpFolder, &pFolder)) bPythonIsHappy = FALSE; // XXX - no IDataObject support if (!PyCom_InterfaceFromPyInstanceOrObject(obpDataObject, IID_IUnknown, (void **)&pDataObject, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!PyWinObject_AsHANDLE(obhkey, (HANDLE *)&hkey, FALSE)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISEI->Initialize( pFolder, pDataObject, hkey ); PyObject_FreePIDL(pFolder); if (pDataObject) pDataObject->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISEI, IID_IShellExtInit ); Py_INCREF(Py_None); return Py_None; } // @object PyIShellExtInit|Description of the interface static struct PyMethodDef PyIShellExtInit_methods[] = { { "Initialize", PyIShellExtInit::Initialize, 1 }, // @pymeth Initialize|Description of Initialize { NULL } }; PyComTypeObject PyIShellExtInit::type("PyIShellExtInit", &PyIUnknown::type, sizeof(PyIShellExtInit), PyIShellExtInit_methods, GET_PYCOM_CTOR(PyIShellExtInit)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellExtInit::Initialize( /* [unique][in] */ LPCITEMIDLIST pFolder, /* [unique][in] */ IDataObject * pDataObject, /* [unique][in] */ HKEY hkey) { PY_GATEWAY_METHOD; PyObject *obpFolder; PyObject *obpDataObject; obpFolder = PyObject_FromPIDL(pFolder, FALSE); // XXX - no IDataObject support obpDataObject = PyCom_PyObjectFromIUnknown(pDataObject, IID_IUnknown, TRUE); HRESULT hr=InvokeViaPolicy("Initialize", NULL, "OOi", obpFolder, obpDataObject, hkey); Py_XDECREF(obpFolder); Py_XDECREF(obpDataObject); return hr; } --- NEW FILE: PyIShellExtInit.h --- // This file declares the IShellExtInit Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellExtInit : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellExtInit); static IShellExtInit *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *Initialize(PyObject *self, PyObject *args); protected: PyIShellExtInit(IUnknown *pdisp); ~PyIShellExtInit(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellExtInit : public PyGatewayBase, public IShellExtInit { protected: PyGShellExtInit(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellExtInit, IShellExtInit, IID_IShellExtInit, PyGatewayBase) // IShellExtInit STDMETHOD(Initialize)( LPCITEMIDLIST pFolder, IDataObject * pDataObject, HKEY hkey); }; --- NEW FILE: PyIShellFolder.cpp --- // This file implements the IShellFolder Interface and Gateway for Python. // Generated by makegw.py #include "shell_pch.h" #include "PyIShellFolder.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIShellFolder::PyIShellFolder(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIShellFolder::~PyIShellFolder() { } /* static */ IShellFolder *PyIShellFolder::GetI(PyObject *self) { return (IShellFolder *)PyIUnknown::GetI(self); } // @pymethod |PyIShellFolder|ParseDisplayName|Description of ParseDisplayName. PyObject *PyIShellFolder::ParseDisplayName(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm HWND|hwndOwner||Description for hwndOwner // @pyparm <o PyIBindCtx>|pbcReserved||Description for pbcReserved // @pyparm <o unicode>|lpszDisplayName||Description for lpszDisplayName PyObject *obpbcReserved; PyObject *oblpszDisplayName; HWND hwndOwner; IBindCtx * pbcReserved; LPOLESTR lpszDisplayName; ULONG pchEaten; ITEMIDLIST *ppidl; ULONG pdwAttributes; if ( !PyArg_ParseTuple(args, "lOO:ParseDisplayName", &hwndOwner, &obpbcReserved, &oblpszDisplayName) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsBstr(oblpszDisplayName, &lpszDisplayName)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->ParseDisplayName( hwndOwner, pbcReserved, lpszDisplayName, &pchEaten, &ppidl, &pdwAttributes ); if (pbcReserved) pbcReserved->Release(); SysFreeString(lpszDisplayName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); PyObject *obppidl; obppidl = PyObject_FromPIDL(ppidl, TRUE); PyObject *pyretval = Py_BuildValue("lOl", pchEaten, obppidl, pdwAttributes); Py_XDECREF(obppidl); return pyretval; } // @pymethod |PyIShellFolder|EnumObjects|Description of EnumObjects. PyObject *PyIShellFolder::EnumObjects(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm HWND|hwndOwner||Description for hwndOwner // @pyparm int|grfFlags||Description for grfFlags HWND hwndOwner; DWORD grfFlags; IEnumIDList * ppeidl; if ( !PyArg_ParseTuple(args, "ll:EnumObjects", &hwndOwner, &grfFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->EnumObjects( hwndOwner, grfFlags, &ppeidl ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyCom_PyObjectFromIUnknown(ppeidl, IID_IEnumIDList, FALSE); } // @pymethod |PyIShellFolder|BindToObject|Description of BindToObject. PyObject *PyIShellFolder::BindToObject(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm <o PyIBindCtx>|pbcReserved||Description for pbcReserved // @pyparm <o PyIID>|riid||Description for riid PyObject *obpidl; PyObject *obpbcReserved; PyObject *obriid; ITEMIDLIST *pidl; IBindCtx * pbcReserved; IID riid; void * out; if ( !PyArg_ParseTuple(args, "OOO:BindToObject", &obpidl, &obpbcReserved, &obriid) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->BindToObject( pidl, pbcReserved, riid, &out ); PyObject_FreePIDL(pidl); if (pbcReserved) pbcReserved->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyCom_PyObjectFromIUnknown((IUnknown *)out, riid, FALSE); } // @pymethod |PyIShellFolder|BindToStorage|Description of BindToStorage. PyObject *PyIShellFolder::BindToStorage(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm <o PyIBindCtx>|pbcReserved||Description for pbcReserved // @pyparm <o PyIID>|riid||Description for riid PyObject *obpidl; PyObject *obpbcReserved; PyObject *obriid; ITEMIDLIST *pidl; IBindCtx * pbcReserved; IID riid; void * out; if ( !PyArg_ParseTuple(args, "OOO:BindToStorage", &obpidl, &obpbcReserved, &obriid) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->BindToStorage( pidl, pbcReserved, riid, &out ); PyObject_FreePIDL(pidl); if (pbcReserved) pbcReserved->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyCom_PyObjectFromIUnknown((IUnknown *)out, riid, FALSE); } // @pymethod int|PyIShellFolder|CompareIDs|Description of CompareIDs. PyObject *PyIShellFolder::CompareIDs(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm int|lparam||Description for lparam // @pyparm <o PyIDL>|pidl1||Description for pidl1 // @pyparm <o PyIDL>|pidl2||Description for pidl2 PyObject *obpidl1; PyObject *obpidl2; long lparam; ITEMIDLIST *pidl1; ITEMIDLIST *pidl2; if ( !PyArg_ParseTuple(args, "lOO:CompareIDs", &lparam, &obpidl1, &obpidl2) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl1, &pidl1)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl2, &pidl2)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->CompareIDs( lparam, pidl1, pidl2 ); PyObject_FreePIDL(pidl1); PyObject_FreePIDL(pidl2); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); // special handling of hresult if ((short)HRESULT_CODE(hr) < 0) /* pidl1 comes first */ return PyInt_FromLong(-1); else if ((short)HRESULT_CODE(hr) > 0) /* pidl2 comes first */ return PyInt_FromLong(1); else /* the two pidls are equal */ return PyInt_FromLong(0); } // @pymethod |PyIShellFolder|CreateViewObject|Description of CreateViewObject. PyObject *PyIShellFolder::CreateViewObject(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm HWND|hwndOwner||Description for hwndOwner // @pyparm <o PyIID>|riid||Description for riid PyObject *obriid; HWND hwndOwner; IID riid; void * out; if ( !PyArg_ParseTuple(args, "lO:CreateViewObject", &hwndOwner, &obriid) ) return NULL; BOOL bPythonIsHappy = TRUE; if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->CreateViewObject( hwndOwner, riid, &out ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyCom_PyObjectFromIUnknown((IUnknown *)out, riid, FALSE); } // @pymethod |PyIShellFolder|GetAttributesOf|Description of GetAttributesOf. PyObject *PyIShellFolder::GetAttributesOf(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm int|rgfInOut||Description for rgfInOut PyObject *obpidl; UINT cidl; LPCITEMIDLIST *pidl; ULONG rgfInOut; if ( !PyArg_ParseTuple(args, "Ol:GetAttributesOf", &obpidl, &rgfInOut) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDLArray(obpidl, &cidl, &pidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->GetAttributesOf( cidl, pidl, &rgfInOut ); PyObject_FreePIDLArray(cidl, pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyInt_FromLong(rgfInOut); } // @pymethod |PyIShellFolder|GetUIObjectOf|Description of GetUIObjectOf. PyObject *PyIShellFolder::GetUIObjectOf(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm HWND|hwndOwner||Description for hwndOwner // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm <o PyIID>|riid||Description for riid // @pyparm int|rgfInOut||Description for rgfInOut PyObject *obpidl; PyObject *obriid; HWND hwndOwner; UINT cidl; LPCITEMIDLIST *pidl; IID riid; UINT rgfInOut; void * out; if ( !PyArg_ParseTuple(args, "lOOl:GetUIObjectOf", &hwndOwner, &obpidl, &obriid, &rgfInOut) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDLArray(obpidl, &cidl, &pidl)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->GetUIObjectOf( hwndOwner, cidl, pidl, riid, &rgfInOut, &out ); PyObject_FreePIDLArray(cidl, pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); PyObject *obout; obout = PyCom_PyObjectFromIUnknown((IUnknown *)out, riid, FALSE); PyObject *pyretval = Py_BuildValue("lO", rgfInOut, obout); Py_XDECREF(obout); return pyretval; } // @pymethod |PyIShellFolder|GetDisplayNameOf|Description of GetDisplayNameOf. PyObject *PyIShellFolder::GetDisplayNameOf(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm int|uFlags||Description for uFlags PyObject *obpidl; ITEMIDLIST *pidl; DWORD uFlags; if ( !PyArg_ParseTuple(args, "Ol:GetDisplayNameOf", &obpidl, &uFlags) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; STRRET out; PY_INTERFACE_PRECALL; hr = pISF->GetDisplayNameOf( pidl, uFlags, &out ); PyObject_FreePIDL(pidl); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); return PyObject_FromSTRRET(&out, pidl, TRUE); } // @pymethod |PyIShellFolder|SetNameOf|Description of SetNameOf. PyObject *PyIShellFolder::SetNameOf(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); if ( pISF == NULL ) return NULL; // @pyparm HWND|hwndOwner||Description for hwndOwner // @pyparm <o PyIDL>|pidl||Description for pidl // @pyparm <o unicode>|lpszName||Description for lpszName PyObject *obpidl; PyObject *oblpszName; HWND hwndOwner; ITEMIDLIST *pidl; ITEMIDLIST *pidlRet; LPOLESTR lpszName; long flags; if ( !PyArg_ParseTuple(args, "lOOl:SetNameOf", &hwndOwner, &obpidl, &oblpszName, &flags) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsBstr(oblpszName, &lpszName)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->SetNameOf( hwndOwner, pidl, lpszName, (SHGDNF)flags, &pidlRet ); PyObject_FreePIDL(pidl); SysFreeString(lpszName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); PyObject *ret = PyObject_FromPIDL(pidlRet, TRUE); Py_INCREF(Py_None); return Py_None; } // @object PyIShellFolder|Description of the interface static struct PyMethodDef PyIShellFolder_methods[] = { { "ParseDisplayName", PyIShellFolder::ParseDisplayName, 1 }, // @pymeth ParseDisplayName|Description of ParseDisplayName { "EnumObjects", PyIShellFolder::EnumObjects, 1 }, // @pymeth EnumObjects|Description of EnumObjects { "BindToObject", PyIShellFolder::BindToObject, 1 }, // @pymeth BindToObject|Description of BindToObject { "BindToStorage", PyIShellFolder::BindToStorage, 1 }, // @pymeth BindToStorage|Description of BindToStorage { "CompareIDs", PyIShellFolder::CompareIDs, 1 }, // @pymeth CompareIDs|Description of CompareIDs { "CreateViewObject", PyIShellFolder::CreateViewObject, 1 }, // @pymeth CreateViewObject|Description of CreateViewObject { "GetAttributesOf", PyIShellFolder::GetAttributesOf, 1 }, // @pymeth GetAttributesOf|Description of GetAttributesOf { "GetUIObjectOf", PyIShellFolder::GetUIObjectOf, 1 }, // @pymeth GetUIObjectOf|Description of GetUIObjectOf { "GetDisplayNameOf", PyIShellFolder::GetDisplayNameOf, 1 }, // @pymeth GetDisplayNameOf|Description of GetDisplayNameOf { "SetNameOf", PyIShellFolder::SetNameOf, 1 }, // @pymeth SetNameOf|Description of SetNameOf { NULL } }; PyComTypeObject PyIShellFolder::type("PyIShellFolder", &PyIUnknown::type, sizeof(PyIShellFolder), PyIShellFolder_methods, GET_PYCOM_CTOR(PyIShellFolder)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellFolder::ParseDisplayName( /* [unique][in] */ HWND hwndOwner, /* [unique][in] */ LPBC pbcReserved, /* [unique][in] */ LPOLESTR lpszDisplayName, /* [out] */ ULONG __RPC_FAR * pchEaten, /* [out] */ LPITEMIDLIST *ppidl, /* [out] */ ULONG __RPC_FAR * pdwAttributes) { PY_GATEWAY_METHOD; *ppidl = NULL; PyObject *obpbcReserved; PyObject *oblpszDisplayName; obpbcReserved = PyCom_PyObjectFromIUnknown(pbcReserved, IID_IBindCtx, TRUE); oblpszDisplayName = MakeOLECHARToObj(lpszDisplayName); PyObject *result; HRESULT hr=InvokeViaPolicy("ParseDisplayName", &result, "lOO", hwndOwner, obpbcReserved, oblpszDisplayName); Py_XDECREF(obpbcReserved); Py_XDECREF(oblpszDisplayName); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obppidl; if (!PyArg_ParseTuple(result, "lOl" , pchEaten, &obppidl, pdwAttributes)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyObject_AsPIDL(obppidl, ppidl)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::EnumObjects( /* [unique][in] */ HWND hwndOwner, /* [unique][in] */ DWORD grfFlags, /* [out] */ IEnumIDList __RPC_FAR ** ppeidl) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("EnumObjects", &result, "ll", hwndOwner, grfFlags); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obppeidl; if (!PyArg_Parse(result, "O" , &obppeidl)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppeidl, IID_IEnumIDList, (void **)&ppeidl, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::BindToObject( /* [unique][in] */ LPCITEMIDLIST pidl, /* [unique][in] */ LPBC pbcReserved, /* [unique][in] */ REFIID riid, /* [out] */ void ** out) { PY_GATEWAY_METHOD; PyObject *obpidl; PyObject *obpbcReserved; PyObject *obriid; obpidl = PyObject_FromPIDL(pidl, FALSE); obpbcReserved = PyCom_PyObjectFromIUnknown(pbcReserved, IID_IBindCtx, TRUE); obriid = PyWinObject_FromIID(riid); PyObject *result; HRESULT hr=InvokeViaPolicy("BindToObject", &result, "OOO", obpidl, obpbcReserved, obriid); Py_XDECREF(obpidl); Py_XDECREF(obpbcReserved); Py_XDECREF(obriid); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obout; if (!PyArg_Parse(result, "O" , &obout)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obout, IID_IUnknown, (void **)&out, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::BindToStorage( /* [unique][in] */ LPCITEMIDLIST pidl, /* [unique][in] */ LPBC pbcReserved, /* [unique][in] */ REFIID riid, /* [out] */ void **ppRet) { PY_GATEWAY_METHOD; PyObject *obpidl; PyObject *obpbcReserved; PyObject *obriid; obpidl = PyObject_FromPIDL(pidl, FALSE); obpbcReserved = PyCom_PyObjectFromIUnknown(pbcReserved, IID_IBindCtx, TRUE); obriid = PyWinObject_FromIID(riid); PyObject *result; HRESULT hr=InvokeViaPolicy("BindToStorage", &result, "OOO", obpidl, obpbcReserved, obriid); Py_XDECREF(obpidl); Py_XDECREF(obpbcReserved); Py_XDECREF(obriid); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obout; if (!PyArg_Parse(result, "O" , &obout)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obout, riid, ppRet, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::CompareIDs( /* [unique][in] */ long lparam, /* [unique][in] */ const ITEMIDLIST __RPC_FAR * pidl1, /* [unique][in] */ const ITEMIDLIST __RPC_FAR * pidl2) { PY_GATEWAY_METHOD; PyObject *obpidl1; PyObject *obpidl2; obpidl1 = PyObject_FromPIDL(pidl1, FALSE); obpidl2 = PyObject_FromPIDL(pidl2, FALSE); HRESULT hr=InvokeViaPolicy("CompareIDs", NULL, "lOO", lparam, obpidl1, obpidl2); Py_XDECREF(obpidl1); Py_XDECREF(obpidl2); return hr; } STDMETHODIMP PyGShellFolder::CreateViewObject( /* [unique][in] */ HWND hwndOwner, /* [unique][in] */ REFIID riid, /* [out] */ void **ppRet) { PY_GATEWAY_METHOD; PyObject *obriid; obriid = PyWinObject_FromIID(riid); PyObject *result; HRESULT hr=InvokeViaPolicy("CreateViewObject", &result, "lO", hwndOwner, obriid); Py_XDECREF(obriid); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obout; if (!PyArg_Parse(result, "O" , &obout)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obout, riid, ppRet, FALSE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::GetAttributesOf( /* [unique][in] */ UINT cidl, /* [unique][in] */ LPCITEMIDLIST *apidl, /* [unique][in][out] */ ULONG __RPC_FAR * rgfInOut) { PY_GATEWAY_METHOD; PyObject *obpidl; obpidl = PyObject_FromPIDLArray(cidl, apidl); PyObject *result; HRESULT hr=InvokeViaPolicy("GetAttributesOf", &result, "Ol", obpidl, rgfInOut); Py_XDECREF(obpidl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "l" , rgfInOut)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::GetUIObjectOf( /* [unique][in] */ HWND hwndOwner, /* [unique][in] */ UINT cidl, /* [unique][in] */ LPCITEMIDLIST *apidl, /* [unique][in] */ REFIID riid, /* [unique][in][out] */ UINT * rgfInOut, /* [out] */ void ** ppRet) { PY_GATEWAY_METHOD; PyObject *obpidl; PyObject *obriid; obpidl = PyObject_FromPIDLArray(cidl, apidl); obriid = PyWinObject_FromIID(riid); PyObject *result; HRESULT hr=InvokeViaPolicy("GetUIObjectOf", &result, "lOOl", hwndOwner, obpidl, obriid, rgfInOut); Py_XDECREF(obpidl); Py_XDECREF(obriid); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params PyObject *obout; if (!PyArg_ParseTuple(result, "lO" , rgfInOut, &obout)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obout, IID_IUnknown, ppRet, FALSE/* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::GetDisplayNameOf( /* [unique][in] */ const ITEMIDLIST __RPC_FAR * pidl, /* [unique][in] */ DWORD uFlags, /* [out] */ STRRET __RPC_FAR * out) { PY_GATEWAY_METHOD; PyObject *obpidl; obpidl = PyObject_FromPIDL(pidl, FALSE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetDisplayNameOf", &result, "Ol", obpidl, uFlags); Py_XDECREF(obpidl); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params // *** The output argument out of type "STRRET __RPC_FAR *" was not processed *** // The type 'STRRET' (out) is unknown. Py_DECREF(result); return hr; } STDMETHODIMP PyGShellFolder::SetNameOf( /* [in] */ HWND hwnd, /* [in] */ LPCITEMIDLIST pidl, /* [string][in] */ LPCOLESTR pszName, /* [in] */ SHGDNF uFlags, /* [out] */ LPITEMIDLIST *ppidlOut) { PY_GATEWAY_METHOD; PyObject *obpidl; PyObject *oblpszName; obpidl = PyObject_FromPIDL(pidl, FALSE); oblpszName = MakeOLECHARToObj(pszName); PyObject *result; HRESULT hr=InvokeViaPolicy("SetNameOf", &result, "lOOl", hwnd, obpidl, oblpszName, uFlags); Py_XDECREF(obpidl); Py_XDECREF(oblpszName); PyObject_AsPIDL(result, ppidlOut, FALSE); return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); } --- NEW FILE: PyIShellFolder.h --- // This file declares the IShellFolder Interface and Gateway for Python. // Generated by makegw.py // --------------------------------------------------- // // Interface Declaration class PyIShellFolder : public PyIUnknown { public: MAKE_PYCOM_CTOR(PyIShellFolder); static IShellFolder *GetI(PyObject *self); static PyComTypeObject type; // The Python methods static PyObject *ParseDisplayName(PyObject *self, PyObject *args); static PyObject *EnumObjects(PyObject *self, PyObject *args); static PyObject *BindToObject(PyObject *self, PyObject *args); static PyObject *BindToStorage(PyObject *self, PyObject *args); static PyObject *CompareIDs(PyObject *self, PyObject *args); static PyObject *CreateViewObject(PyObject *self, PyObject *args); static PyObject *GetAttributesOf(PyObject *self, PyObject *args); static PyObject *GetUIObjectOf(PyObject *self, PyObject *args); static PyObject *GetDisplayNameOf(PyObject *self, PyObject *args); static PyObject *SetNameOf(PyObject *self, PyObject *args); protected: PyIShellFolder(IUnknown *pdisp); ~PyIShellFolder(); }; // --------------------------------------------------- // // Gateway Declaration class PyGShellFolder : public PyGatewayBase, public IShellFolder { protected: PyGShellFolder(PyObject *instance) : PyGatewayBase(instance) { ; } PYGATEWAY_MAKE_SUPPORT2(PyGShellFolder, IShellFolder, IID_IShellFolder, PyGatewayBase) // IShellFolder STDMETHOD(ParseDisplayName)( HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, ULONG * pchEaten, LPITEMIDLIST *ppidl, ULONG __RPC_FAR * pdwAttributes); STDMETHOD(EnumObjects)( HWND hwndOwner, DWORD grfFlags, IEnumIDList __RPC_FAR ** ppeidl); STDMETHOD(BindToObject)( LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void ** out); STDMETHOD(BindToStorage)( LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void **out); STDMETHOD(CompareIDs)( long lparam, const ITEMIDLIST __RPC_FAR * pidl1, const ITEMIDLIST __RPC_FAR * pidl2); STDMETHOD(CreateViewObject)( HWND hwndOwner, REFIID riid, void ** out); STDMETHOD(GetAttributesOf)( UINT cidl, LPCITEMIDLIST *apidl, ULONG __RPC_FAR * rgfInOut); STDMETHOD(GetUIObjectOf)( HWND hwndOwner, UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, UINT *rgfReserved, void ** out); STDMETHOD(GetDisplayNameOf)( const ITEMIDLIST __RPC_FAR * pidl, DWORD uFlags, STRRET __RPC_FAR * out); STDMETHOD(SetNameOf)( HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR pszName, SHGDNF uFlags, LPITEMIDLIST *ppidlOut); }; Index: PyIShellLink.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellLink.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIShellLink.cpp 18 Dec 1999 08:48:45 -0000 1.3 --- PyIShellLink.cpp 6 Oct 2003 12:47:57 -0000 1.4 *************** *** 5,11 **** #include "PyIShellLink.h" - extern BOOL PyObject_AsPIDL(PyObject *ob, LPCITEMIDLIST *ppidl, BOOL bNoneOK = FALSE); - extern PyObject *PyObject_FromPIDL(LPITEMIDLIST pidl); - void PyObject_FreePIDL( LPCITEMIDLIST pidl ); PyObject *PyObject_FromWIN32_FIND_DATA(WIN32_FIND_DATAA &findData); --- 5,8 ---- *************** *** 86,90 **** if ( FAILED(hr) ) return OleSetOleError(hr); ! return PyObject_FromPIDL(pidl); } --- 83,87 ---- if ( FAILED(hr) ) return OleSetOleError(hr); ! return PyObject_FromPIDL(pidl, TRUE); } *************** *** 95,99 **** if ( pISL == NULL ) return NULL; ! LPCITEMIDLIST pidl; PyObject *obpidl; if ( !PyArg_ParseTuple(args, "O:SetIDList", &obpidl) ) --- 92,96 ---- if ( pISL == NULL ) return NULL; ! LPITEMIDLIST pidl; PyObject *obpidl; if ( !PyArg_ParseTuple(args, "O:SetIDList", &obpidl) ) Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shell.cpp 28 Jun 2002 02:24:56 -0000 1.5 --- shell.cpp 6 Oct 2003 12:47:57 -0000 1.6 *************** *** 15,18 **** --- 15,23 ---- #include "shell_pch.h" #include "PyIShellLink.h" + #include "PyIContextMenu.h" + #include "PyIExtractIcon.h" + #include "PyIShellExtInit.h" + #include "PyIShellFolder.h" + #include "PyIEnumIDList.h" #include "PythonCOMRegister.h" // For simpler registration of IIDs etc. *************** *** 20,24 **** { IMalloc *pMalloc; ! if (SHGetMalloc(&pMalloc)==S_OK) { pMalloc->Free(p); pMalloc->Release(); --- 25,29 ---- { IMalloc *pMalloc; ! if (p && SHGetMalloc(&pMalloc)==S_OK) { pMalloc->Free(p); pMalloc->Release(); *************** *** 56,65 **** } ! PyObject *PyObject_FromPIDL(LPITEMIDLIST pidl) { ! return PyString_FromStringAndSize((char *)pidl, PyShell_ILGetSize(pidl) ); } // @object PyIDL|A Python representation of an IDL. Implemented as a Python string. ! BOOL PyObject_AsPIDL(PyObject *ob, LPCITEMIDLIST *ppidl, BOOL bNoneOK = FALSE) { if (ob==Py_None) { --- 61,73 ---- } ! PyObject *PyObject_FromPIDL(LPCITEMIDLIST pidl, BOOL bFreeSystemPIDL) { ! PyObject *ret = PyString_FromStringAndSize((char *)pidl, PyShell_ILGetSize(pidl) ); ! if (bFreeSystemPIDL) ! PyShell_FreeMem( (void *)pidl); ! return ret; } // @object PyIDL|A Python representation of an IDL. Implemented as a Python string. ! BOOL PyObject_AsPIDL(PyObject *ob, ITEMIDLIST **ppidl, BOOL bNoneOK /*= FALSE*/) { if (ob==Py_None) { *************** *** 82,86 **** } memcpy( buf, PyString_AsString(ob), cb); ! *ppidl = (LPCITEMIDLIST)buf; return TRUE; } --- 90,94 ---- } memcpy( buf, PyString_AsString(ob), cb); ! *ppidl = (LPITEMIDLIST)buf; return TRUE; } *************** *** 90,93 **** --- 98,255 ---- } + BOOL PyObject_AsPIDLArray(PyObject *obSeq, UINT *pcidl, LPCITEMIDLIST **ret) + { + // string is a seq - handle that + *pcidl = 0; + *ret = NULL; + if (PyString_Check(obSeq) || !PySequence_Check(obSeq)) { + PyErr_SetString(PyExc_TypeError, "Must be an array of IDLs"); + return FALSE; + } + int n = PySequence_Length(obSeq); + LPCITEMIDLIST *ppidl = (LPCITEMIDLIST *)malloc(n * sizeof(ITEMIDLIST *)); + if (!ppidl) { + PyErr_NoMemory(); + return FALSE; + } + for (int i=0;i<n;i++) { + PyObject *ob = PySequence_GetItem(obSeq, i); + if (!ob || !PyObject_AsPIDL(ob, (ITEMIDLIST **)&ppidl[i], FALSE )) { + Py_XDECREF(ob); + PyObject_FreePIDLArray(n, ppidl); + return FALSE; + } + Py_DECREF(ob); + } + *pcidl = n; + *ret = ppidl; + return TRUE; + } + + void PyObject_FreePIDLArray(UINT cidl, LPCITEMIDLIST *pidl) + { + for (UINT i=0;i<cidl;i++) + if (pidl[i]) + PyObject_FreePIDL(pidl[i]); + free(pidl); + } + + PyObject *PyObject_FromPIDLArray(UINT cidl, LPCITEMIDLIST *pidl) + { + PyObject *ob = PyList_New(cidl); + if (!ob) return NULL; + for (UINT i=0;i<cidl;i++) { + PyObject *n = PyObject_FromPIDL(pidl[i], FALSE); + if (!n) { + Py_DECREF(ob); + return NULL; + } + PyList_SET_ITEM(ob, i, n); // consumes ref to 'n' + } + return ob; + } + + + PyObject *PyWinObject_FromRESOURCESTRING(LPCSTR str) + { + if (!str) { + Py_INCREF(Py_None); + return Py_None; + } + if (HIWORD(str)==0) + return PyInt_FromLong(LOWORD(str)); + return PyString_FromString(str); + } + + BOOL PyObject_AsCMINVOKECOMMANDINFO(PyObject *ob, CMINVOKECOMMANDINFO **ppci) + { + *ppci = NULL; + PyErr_SetString(PyExc_NotImplementedError, "CMINVOKECOMMANDINFO not yet supported"); + return FALSE; + } + void PyObject_FreeCMINVOKECOMMANDINFO( CMINVOKECOMMANDINFO *pci ) + { + if (pci) + free(pci); + } + static PyObject *PyString_FromMaybeNullString(const char *sz) + { + if (sz) + return PyString_FromString(sz); + Py_INCREF(Py_None); + return Py_None; + } + + PyObject *PyObject_FromCMINVOKECOMMANDINFO(const CMINVOKECOMMANDINFO *pci) + { + if (!pci) { + Py_INCREF(Py_None); + return Py_None; + } + PyObject *obVerb = PyWinObject_FromRESOURCESTRING(pci->lpVerb); + if (!obVerb) return NULL; + PyObject *obParams = PyString_FromMaybeNullString(pci->lpParameters); + if (!obParams) { + Py_DECREF(obVerb); + return NULL; + } + PyObject *obDir = PyString_FromMaybeNullString(pci->lpDirectory); + if (!obDir) { + Py_DECREF(obVerb); + Py_DECREF(obParams); + return NULL; + } + return Py_BuildValue("iiNNNiii", pci->fMask, pci->hwnd, + obVerb, obParams, obDir, + pci->nShow, pci->dwHotKey, pci->hIcon); + } + + BOOL PyObject_AsSTRRET( PyObject *ob, STRRET &out ) + { + if (PyInt_Check(ob)) { + out.uType = STRRET_OFFSET; + out.uOffset = PyInt_AsLong(ob); + return TRUE; + } + if (PyString_Check(ob)) { + out.uType = STRRET_CSTR; + strncpy(out.cStr, PyString_AsString(ob), MAX_PATH); + return TRUE; + } + PyErr_Format(PyExc_TypeError, "Can't convert objects of type '%s' to STRRET", ob->ob_type->tp_name); + return FALSE; + } + + void PyObject_FreeSTRRET(STRRET &s) + { + if (s.uType==STRRET_WSTR) { + PyShell_FreeMem(s.pOleStr); + s.pOleStr = NULL; + } + } + + PyObject *PyObject_FromSTRRET(STRRET *ps, ITEMIDLIST *pidl, BOOL bFree) + { + PyObject *ret; + switch (ps->uType) { + case STRRET_CSTR: + ret = PyString_FromString(ps->cStr); + break; + case STRRET_OFFSET: + ret = PyString_FromString(((char *)pidl)+ps->uOffset); + break; + case STRRET_WSTR: + ret = PyWinObject_FromWCHAR(ps->pOleStr); + break; + default: + PyErr_SetString(PyExc_RuntimeError, "unknown uType"); + ret = NULL; + break; + } + if (bFree) + PyObject_FreeSTRRET(*ps); + return ret; + } + ////////////////////////////////////////////////// // *************** *** 150,154 **** goto done; } ! if (!PyObject_AsPIDL(obPIDL, &bi.pidlRoot, TRUE)) goto done; --- 312,316 ---- goto done; } ! if (!PyObject_AsPIDL(obPIDL, (LPITEMIDLIST *)&bi.pidlRoot, TRUE)) goto done; *************** *** 166,173 **** // a tuple of (PIDL, DisplayName, iImageList) if (pl){ ! PyObject *obPidl = PyObject_FromPIDL(pl); PyObject *obDisplayName = PyWinObject_FromTCHAR(bi.pszDisplayName); rc = Py_BuildValue("OOi", obPidl, obDisplayName, bi.iImage); - PyShell_FreeMem(pl); Py_XDECREF(obPidl); Py_XDECREF(obDisplayName); --- 328,334 ---- // a tuple of (PIDL, DisplayName, iImageList) if (pl){ ! PyObject *obPidl = PyObject_FromPIDL(pl, TRUE); PyObject *obDisplayName = PyWinObject_FromTCHAR(bi.pszDisplayName); rc = Py_BuildValue("OOi", obPidl, obDisplayName, bi.iImage); Py_XDECREF(obPidl); Py_XDECREF(obDisplayName); *************** *** 187,191 **** char buffer[MAX_PATH]; PyObject *rc; ! LPCITEMIDLIST pidl; PyObject *obPidl; --- 348,352 ---- char buffer[MAX_PATH]; PyObject *rc; ! LPITEMIDLIST pidl; PyObject *obPidl; *************** *** 256,261 **** if (FAILED(hr)) return OleSetOleError(hr); ! PyObject *rc = PyObject_FromPIDL(pidl); ! PyShell_FreeMem(pidl); return rc; } --- 417,421 ---- if (FAILED(hr)) return OleSetOleError(hr); ! PyObject *rc = PyObject_FromPIDL(pidl, TRUE); return rc; } *************** *** 339,344 **** if (FAILED(hr)) return OleSetOleError(hr); ! PyObject *rc = PyObject_FromPIDL(pidl); ! PyShell_FreeMem(pidl); return rc; } --- 499,503 ---- if (FAILED(hr)) return OleSetOleError(hr); ! PyObject *rc = PyObject_FromPIDL(pidl, TRUE); return rc; } *************** *** 362,386 **** - // @pymethod <o PyIDL>|shell|SHChangeNotify|Notifies the system of an event that an application has performed. An application should use this function if it performs an action that may affect the shell. - static PyObject *PySHChangeNotify(PyObject *self, PyObject *args) - { - int flags; - DWORD eventId; - void *whatever1; - void *whatever2; - if(!PyArg_ParseTuple(args, "lizz:SHChangeNotify", - &eventId, // @pyparm int|eventId||Describes the event that has occurred. One of the SHCNE_* constants. - &flags, // @pyparm int|flags||Flags that indicate the meaning of the other params. - &whatever1, // @pyparm string|whatever||A path or <o PyIDL> - &whatever2)) // @pyparm string|whatever||A path or <o PyIDL> - return NULL; - // @todo This function does not support integers - PY_INTERFACE_PRECALL; - SHChangeNotify(eventId, flags, whatever1, whatever2); - PY_INTERFACE_POSTCALL; - P... [truncated message content] |
From: <mha...@us...> - 2003-10-06 11:09:29
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1:/tmp/cvs-serv10020 Modified Files: dbgthread.cpp Log Message: Re-create the taskbar icons if explorer dies. Index: dbgthread.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/dbgthread.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbgthread.cpp 1 Sep 1999 23:32:59 -0000 1.1 --- dbgthread.cpp 6 Oct 2003 11:09:14 -0000 1.2 *************** *** 64,72 **** } } LRESULT CALLBACK DebuggerWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { ! ! switch( msg ) { case WM_COMMAND: break; --- 64,85 ---- } } + + static void AddIcons(HWND hwndDebug) + { + HICON hIcon = AfxGetApp()->LoadIcon( MAKEINTRESOURCE(IDR_MAINFRAME) ); + DWORD flags = NIF_ICON | NIF_MESSAGE | NIF_TIP; + NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA), hwndDebug, 0, flags, WM_USER+20, hIcon }; + _tcscpy(nid.szTip, "Pythonwin"); + Shell_NotifyIcon(NIM_ADD, &nid); + } + LRESULT CALLBACK DebuggerWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { ! static UINT s_uTaskbarRestart; ! switch( msg ) { ! case WM_CREATE: ! s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); ! break; case WM_COMMAND: break; *************** *** 84,87 **** --- 97,102 ---- \**************************************************************/ default: + if(msg==s_uTaskbarRestart) + AddIcons(hWnd); return( DefWindowProc( hWnd, msg, wParam, lParam )); } *************** *** 97,101 **** } - DWORD DebuggerThreadFunc( LPDWORD lpdwWhatever ) { --- 112,115 ---- *************** *** 121,129 **** NULL, NULL, AfxGetInstanceHandle(), NULL ); ! HICON hIcon = AfxGetApp()->LoadIcon( MAKEINTRESOURCE(IDR_MAINFRAME) ); ! DWORD flags = NIF_ICON | NIF_MESSAGE | NIF_TIP; ! NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA), hwndDebug, 0, flags, WM_USER+20, hIcon }; ! _tcscpy(nid.szTip, "Pythonwin"); ! Shell_NotifyIcon(NIM_ADD, &nid); while (GetMessage(&msg, 0, 0, NULL)) --- 135,139 ---- NULL, NULL, AfxGetInstanceHandle(), NULL ); ! AddIcons(hwndDebug); while (GetMessage(&msg, 0, 0, NULL)) |
From: <mha...@us...> - 2003-10-06 11:06:57
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv9329 Modified Files: win32gui.i Log Message: Add RegisterWindowMessage and ReplyMessage. Allow InsertMenu to specify a NULL string, and various autoduck corrections. Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** win32gui.i 1 Sep 2003 12:06:07 -0000 1.29 --- win32gui.i 6 Oct 2003 11:06:19 -0000 1.30 *************** *** 1135,1138 **** --- 1135,1145 ---- BOOLAPI PostThreadMessage(DWORD dwThreadId, UINT msg, WPARAM wParam, LPARAM lParam); + // @pyswig int|ReplyMessage|Used to reply to a message sent through the SendMessage function without returning control to the function that called SendMessage. + BOOLAPI ReplyMessage(int lResult); // @pyparm int|result||Specifies the result of the message processing. The possible values are based on the message sent. + + // @pyswig int|RegisterWindowMessage|Defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages. + // @pyparm string/unicode|name||The string + LRESULT RegisterWindowMessage(TCHAR *lpString); + // @pyswig int|DefWindowProc| // @pyparm int|hwnd||The handle to the Window *************** *** 1439,1444 **** // @pyswig HANDLE|LoadImage|Loads a bitmap, cursor or icon ! HANDLE LoadImage(HINSTANCE hInst, RESOURCE_ID name, UINT type, ! int cxDesired, int cyDesired, UINT fuLoad); #define IMAGE_BITMAP IMAGE_BITMAP --- 1446,1455 ---- // @pyswig HANDLE|LoadImage|Loads a bitmap, cursor or icon ! HANDLE LoadImage(HINSTANCE hInst, // @pyparm int|hinst||Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero. ! RESOURCE_ID name, // @pyparm int/string|name||Specifies the image to load. If the hInst parameter is non-zero and the fuLoad parameter omits LR_LOADFROMFILE, name specifies the image resource in the hInst module. If the image resource is to be loaded by name, the name parameter is a string that contains the name of the image resource. ! UINT type, // @pyparm int|type||Specifies the type of image to be loaded. ! int cxDesired, // @pyparm int|cxDesired||Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width. ! int cyDesired, // @pyparm int|cyDesired||Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height. ! UINT fuLoad); // @pyparm int|fuLoad|| #define IMAGE_BITMAP IMAGE_BITMAP *************** *** 1456,1460 **** #define LR_VGACOLOR LR_VGACOLOR ! // pyswig |DeleteObject||Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. BOOLAPI DeleteObject(HANDLE h); // @pyparm int|handle||handle to the object to delete. --- 1467,1471 ---- #define LR_VGACOLOR LR_VGACOLOR ! // @pyswig |DeleteObject|Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid. BOOLAPI DeleteObject(HANDLE h); // @pyparm int|handle||handle to the object to delete. *************** *** 2067,2071 **** #endif BOOLAPI AppendMenu(HMENU hMenu, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); ! BOOLAPI InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); /* --- 2078,2082 ---- #endif BOOLAPI AppendMenu(HMENU hMenu, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); ! BOOLAPI InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, TCHAR *INPUT_NULLOK); /* |
From: <mha...@us...> - 2003-10-06 11:04:00
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1:/tmp/cvs-serv9259 Modified Files: win32gui_taskbar.py Log Message: Re-create the taskbar icons if explorer dies. Index: win32gui_taskbar.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_taskbar.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32gui_taskbar.py 3 Feb 2003 00:30:29 -0000 1.6 --- win32gui_taskbar.py 6 Oct 2003 11:03:15 -0000 1.7 *************** *** 8,12 **** --- 8,14 ---- class MainWindow: def __init__(self): + msg_TaskbarRestart = RegisterWindowMessage("TaskbarCreated"); message_map = { + msg_TaskbarRestart: self.OnRestart, win32con.WM_DESTROY: self.OnDestroy, win32con.WM_COMMAND: self.OnCommand, *************** *** 28,33 **** 0, 0, hinst, None) UpdateWindow(self.hwnd) ! # Try and find a custom icon iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "pyc.ico" )) if not os.path.isfile(iconPathName): --- 30,37 ---- 0, 0, hinst, None) UpdateWindow(self.hwnd) ! self._DoCreateIcons() ! def _DoCreateIcons(self): # Try and find a custom icon + hinst = GetModuleHandle(None) iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "pyc.ico" )) if not os.path.isfile(iconPathName): *************** *** 44,47 **** --- 48,54 ---- nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Python Demo") Shell_NotifyIcon(NIM_ADD, nid) + + def OnRestart(self, hwnd, msg, wparam, lparam): + self._DoCreateIcons() def OnDestroy(self, hwnd, msg, wparam, lparam): |
From: <mha...@us...> - 2003-09-18 05:33:17
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2711 Modified Files: pywintypes.py Log Message: Ensure we load a local pywintypesxx.dll if we are frozen. Index: pywintypes.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/pywintypes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pywintypes.py 5 Oct 2002 02:37:53 -0000 1.1 --- pywintypes.py 18 Sep 2003 05:33:13 -0000 1.2 *************** *** 2,19 **** def __import(modname): ! import win32api, imp, sys suffix = "" if win32api.__file__.find("_d")>0: suffix = "_d" filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix) ! # win32 can find the DLL name. ! h = win32api.LoadLibrary(filename) ! found = win32api.GetModuleFileName(h) # Python can load the module mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION)) # and fill our namespace with it. globals().update(mod.__dict__) ! win32api.FreeLibrary(h) __import("pywintypes") ! del __import \ No newline at end of file --- 2,32 ---- def __import(modname): ! import win32api, imp, sys, os suffix = "" if win32api.__file__.find("_d")>0: suffix = "_d" filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix) ! if hasattr(sys, "frozen"): ! # If we are running from a frozen program (py2exe, McMillan, freeze) ! # then we try and load the DLL from our sys.path ! for look in sys.path: ! found = os.path.join(look, filename) ! if os.path.isfile(found): ! break ! else: ! raise ImportError, "Module '%s' isn't in frozen sys.path directories" % modname ! h = None ! else: ! # Normal Python needs these files in a directory somewhere on ! # %PATH%, so let Windows search it out for us ! h = win32api.LoadLibrary(filename) ! found = win32api.GetModuleFileName(h) # Python can load the module mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION)) # and fill our namespace with it. globals().update(mod.__dict__) ! if h is not None: ! win32api.FreeLibrary(h) __import("pywintypes") ! del __import |
From: <mha...@us...> - 2003-09-18 05:32:45
|
Update of /cvsroot/pywin32/pywin32/com In directory sc8-pr-cvs1:/tmp/cvs-serv2589 Modified Files: pythoncom.py Log Message: Ensure we load a local pythoncomxx.dll if we are frozen. Index: pythoncom.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/pythoncom.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pythoncom.py 27 Sep 2002 06:23:29 -0000 1.1 --- pythoncom.py 18 Sep 2003 05:32:35 -0000 1.2 *************** *** 2,19 **** def __import(modname): ! import win32api, imp, sys suffix = "" if win32api.__file__.find("_d")>0: suffix = "_d" filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix) ! # win32 can find the DLL name. ! h = win32api.LoadLibrary(filename) ! found = win32api.GetModuleFileName(h) # Python can load the module mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION)) # and fill our namespace with it. globals().update(mod.__dict__) ! win32api.FreeLibrary(h) __import("pythoncom") ! del __import \ No newline at end of file --- 2,32 ---- def __import(modname): ! import win32api, imp, sys, os suffix = "" if win32api.__file__.find("_d")>0: suffix = "_d" filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix) ! if hasattr(sys, "frozen"): ! # If we are running from a frozen program (py2exe, McMillan, freeze) ! # then we try and load the DLL from our sys.path ! for look in sys.path: ! found = os.path.join(look, filename) ! if os.path.isfile(found): ! break ! else: ! raise ImportError, "Module '%s' isn't in frozen sys.path directories" % modname ! h = None ! else: ! # Normal Python needs these files in a directory somewhere on ! # %PATH%, so let Windows search it out for us ! h = win32api.LoadLibrary(filename) ! found = win32api.GetModuleFileName(h) # Python can load the module mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION)) # and fill our namespace with it. globals().update(mod.__dict__) ! if h is not None: ! win32api.FreeLibrary(h) __import("pythoncom") ! del __import |
From: <mha...@us...> - 2003-09-16 04:57:36
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv27897 Modified Files: __init__.py Log Message: Cleanup some of the environment hacks we do. If a real module "win32com\gen_py" exists, just use that. This avoids most freeze utilities from doing anything special other than ensuring this module can be imported Ensure __gen_path__ is setup, even in a frozen distribution, and even if this points to a .zip file. Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 1 Sep 2003 08:16:33 -0000 1.4 --- __init__.py 16 Sep 2003 04:57:33 -0000 1.5 *************** *** 6,9 **** --- 6,14 ---- import pythoncom + # flag if we are in a "frozen" build. + _frozen = getattr(sys, "frozen", 1==0) + if _frozen and not hasattr(pythoncom, "frozen"): + pythoncom.frozen = sys.frozen + # Add support for an external "COM Extensions" path. # Concept is that you can register a seperate path to be used for *************** *** 13,17 **** # eg "win32com.mapi" or "win32com.axscript" both work, even though they do not # live under the main win32com directory. ! ### TODO - Load _all_ \\Extensions subkeys - for now, we only read the default ### Modules will work if loaded into "win32comext" path. --- 18,22 ---- # eg "win32com.mapi" or "win32com.axscript" both work, even though they do not # live under the main win32com directory. ! __gen_path__ = '' ### TODO - Load _all_ \\Extensions subkeys - for now, we only read the default ### Modules will work if loaded into "win32comext" path. *************** *** 54,83 **** # __build_path__ neednt be defined. pass - - found = 0 global __gen_path__ if key is not None: try: __gen_path__ = win32api.RegQueryValue(key, "GenPath") - found = 1 except win32api.error: pass - if not found: - # no key. - # We used to use a directory under win32com - but this sucks. - # If that directory exists, we still use it, but now we prefer - # a version specific directory under the user temp directory. - if os.path.isdir(win32api.GetFullPathName( __path__[0] + "\\gen_py")): - __gen_path__ = win32api.GetFullPathName( __path__[0] + "\\gen_py") - else: - __gen_path__ = os.path.join( - win32api.GetTempPath(), "gen_py", - "%d.%d" % (sys.version_info[0], sys.version_info[1])) - # Create a "win32com.gen_py", but with a custom __path__ - import new - global gen_py # Exists in the win32com namespace. - gen_py = new.module("win32com.gen_py") - gen_py.__path__ = [ __gen_path__ ] - sys.modules[gen_py.__name__]=gen_py finally: if key is not None: --- 59,68 ---- *************** *** 89,105 **** def __PackageSupportBuildPath__(package_path): # See if we have a special directory for the binaries (for developers) ! try: package_path.append(__build_path__) - except (NameError, AttributeError): - # AttributeError may be raised in a frozen EXE. - pass ! # pythoncom.frozen may already be set if ! # a special build. ! if hasattr(sys, "frozen"): ! pythoncom.frozen = sys.frozen ! ! if not pythoncom.frozen: SetupEnvironment() # get rid of these for module users --- 74,108 ---- def __PackageSupportBuildPath__(package_path): # See if we have a special directory for the binaries (for developers) ! if not _frozen: package_path.append(__build_path__) ! if not _frozen: SetupEnvironment() + + # If we don't have a special __gen_path__, see if we have a gen_py as a + # normal module and use that (ie, "win32com\gen_py" may already exist as + # a package. + if not __gen_path__: + try: + import win32com.gen_py + __gen_path__ = sys.modules["win32com.gen_py"].__path__[0] + except ImportError: + # We used to dynamically create a directory under win32com - + # but this sucks. Now we create a version specific directory + # under the user temp directory. + __gen_path__ = os.path.join( + win32api.GetTempPath(), "gen_py", + "%d.%d" % (sys.version_info[0], sys.version_info[1])) + + # we must have a __gen_path__, but may not have a gen_py module - + # set that up. + if not sys.modules.has_key("win32com.gen_py"): + # Create a "win32com.gen_py", but with a custom __path__ + import new + gen_py = new.module("win32com.gen_py") + gen_py.__path__ = [ __gen_path__ ] + sys.modules[gen_py.__name__]=gen_py + del new + gen_py = sys.modules["win32com.gen_py"] # get rid of these for module users |
From: <mha...@us...> - 2003-09-16 04:55:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv27520 Modified Files: gencache.py Log Message: * Support the gencache being in a .zip file. * If the gencache is readonly and we are requesting a typelib version we don't currently have, check if we have an earlier minor version. * Don't load the same typelib twice when checking version. Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gencache.py 2 Sep 2003 00:18:40 -0000 1.20 --- gencache.py 16 Sep 2003 04:55:27 -0000 1.21 *************** *** 33,36 **** --- 33,44 ---- clsidToTypelib = {} + # If we have a different version of the typelib generated, this + # maps the "requested version" to the "generated version". + versionRedirectMap = {} + + # There is no reason we *must* be readonly in a .zip, but we are now, + # and we really do need a "read-only" concept anyway. + is_readonly = not os.path.isdir(os.path.dirname(win32com.__gen_path__)) + # A dictionary of ITypeLibrary objects for demand generation explicitly handed to us # Keyed by usual clsid, lcid, major, minor *************** *** 46,49 **** --- 54,60 ---- pickleVersion = 1 def _SaveDicts(): + if is_readonly: + raise RuntimeError, "Trying to write to a readonly gencache ('%s')!" \ + % win32com.__gen_path__ import cPickle f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb") *************** *** 57,65 **** def _LoadDicts(): import cPickle ! try: # NOTE: IOError on file open must be caught by caller. f = open(os.path.join(win32com.__gen_path__, "dicts.dat"), "rb") - except AttributeError: # no __gen_path__ - return try: p = cPickle.Unpickler(f) --- 68,84 ---- def _LoadDicts(): import cPickle ! # Load the dictionary from a .zip file if that is where we live. ! zip_pos = win32com.__gen_path__.find(".zip\\") ! if zip_pos >= 0: ! import zipfile, cStringIO ! zip_file = win32com.__gen_path__[:zip_pos+4] ! zip_path = win32com.__gen_path__[zip_pos+5:] ! zip_path = os.path.join(zip_path, "dicts.dat").replace("\\", "/") ! zf = zipfile.ZipFile(zip_file) ! f = cStringIO.StringIO(zf.read(zip_path)) ! zf.close() ! else: # NOTE: IOError on file open must be caught by caller. f = open(os.path.join(win32com.__gen_path__, "dicts.dat"), "rb") try: p = cPickle.Unpickler(f) *************** *** 67,70 **** --- 86,90 ---- global clsidToTypelib clsidToTypelib = p.load() + versionRedirectMap.clear() finally: f.close() *************** *** 212,215 **** --- 232,256 ---- modName = GetGeneratedFileName(typelibCLSID, lcid, major, minor) return _GetModule(modName) + ############## + typelibCLSID = str(typelibCLSID) + args = typelibCLSID, lcid, major, minor + args = versionRedirectMap.get(args, args) + modName = GetGeneratedFileName(*args) + try: + return _GetModule(modName) + except ImportError: + # See if we can find a module with a different minor version. + items = [] + for desc in GetGeneratedInfos(): + if str(desc[0])==typelibCLSID and desc[1]==lcid and desc[2]==major: + items.append(desc) + if not items: + raise + # Items are all identical, except for last tuple element + # We want the latest minor version we have - so just sort and grab last + items.sort() + new_minor = items[-1][3] + versionRedirectMap[args] = typelibCLSID, lcid, major, new_minor + return GetModuleForTypelib(typelibCLSID, lcid, major, new_minor) def MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance = None, bGUIProgress = None, bForDemand = bForDemandDefault, bBuildHidden = 1): *************** *** 310,317 **** # Not worth raising an exception - maybe they dont know we only remember for demand generated, etc. print "ForgetAboutTypelibInterface:: Warning - type library with info %s is not being remembered!" % (info,) ! ! ! def EnsureModule(typelibCLSID, lcid, major, minor, progressInstance = None, bValidateFile=1, bForDemand = bForDemandDefault, bBuildHidden = 1): """Ensure Python support is loaded for a type library, generating if necessary. --- 351,360 ---- # Not worth raising an exception - maybe they dont know we only remember for demand generated, etc. print "ForgetAboutTypelibInterface:: Warning - type library with info %s is not being remembered!" % (info,) + # and drop any version redirects to it + for key, val in versionRedirectMap.items(): + if val==info: + del versionRedirectMap[key] ! def EnsureModule(typelibCLSID, lcid, major, minor, progressInstance = None, bValidateFile=not is_readonly, bForDemand = bForDemandDefault, bBuildHidden = 1): """Ensure Python support is loaded for a type library, generating if necessary. *************** *** 338,358 **** try: try: - #print "Try specified typelib" module = GetModuleForTypelib(typelibCLSID, lcid, major, minor) - #print module except ImportError: # If we get an ImportError # We may still find a valid cache file under a different MinorVersion # ! #print "Loading reg typelib" ! tlbAttr = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid).GetLibAttr() ! # if the above line doesn't throw a pythoncom.com_error ! # Let's suck it in ! #print "Trying 2nd minor #", tlbAttr[1], tlbAttr[3], tlbAttr[4] try: ! module = GetModuleForTypelib(typelibCLSID, tlbAttr[1], tlbAttr[3], tlbAttr[4]) ! except ImportError: ! module = None ! minor = tlbAttr[4] if module is not None and bValidateFile: try: typLibPath = pythoncom.QueryPathOfRegTypeLib(typelibCLSID, major, minor, lcid) --- 381,409 ---- try: try: module = GetModuleForTypelib(typelibCLSID, lcid, major, minor) except ImportError: # If we get an ImportError # We may still find a valid cache file under a different MinorVersion # ! # (which windows will search out for us) ! #print "Loading reg typelib", typelibCLSID, major, minor, lcid ! module = None try: ! tlbAttr = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid).GetLibAttr() ! # if the above line doesn't throw a pythoncom.com_error, check if ! # it is actually a different lib than we requested, and if so, suck it in ! if tlbAttr[1] != lcid or tlbAttr[4]!=minor: ! #print "Trying 2nd minor #", tlbAttr[1], tlbAttr[3], tlbAttr[4] ! try: ! module = GetModuleForTypelib(typelibCLSID, tlbAttr[1], tlbAttr[3], tlbAttr[4]) ! except ImportError: ! # We don't have a module, but we do have a better minor ! # version - remember that. ! minor = tlbAttr[4] ! # else module remains None ! except pythoncom.com_error: ! # couldn't load any typelib - mod remains None ! pass if module is not None and bValidateFile: + assert not is_readonly, "Can't validate in a read-only gencache" try: typLibPath = pythoncom.QueryPathOfRegTypeLib(typelibCLSID, major, minor, lcid) *************** *** 364,367 **** --- 415,419 ---- bValidateFile = 0 if module is not None and bValidateFile: + assert not is_readonly, "Can't validate in a read-only gencache" filePathPrefix = "%s\\%s" % (GetGeneratePath(), GetGeneratedFileName(typelibCLSID, lcid, major, minor)) filePath = filePathPrefix + ".py" *************** *** 417,421 **** #print "Trying stat typelib", pyModTime #print str(typLibPath) ! typLibModTime = os.stat(typLibPath[:-1])[8] if fModTimeSet and (typLibModTime > pyModTime): bReloadNeeded = 1 --- 469,473 ---- #print "Trying stat typelib", pyModTime #print str(typLibPath) ! typLibModTime = os.stat(str(typLibPath[:-1]))[8] if fModTimeSet and (typLibModTime > pyModTime): bReloadNeeded = 1 *************** *** 424,427 **** --- 476,505 ---- module = None if module is None: + # We need to build an item. If we are in a read-only cache, we + # can't/don't want to do this - so before giving up, check for + # a different minor version in our cache - according to COM, this is OK + if is_readonly: + key = str(typelibCLSID), lcid, major, minor + # If we have been asked before, get last result. + try: + return versionRedirectMap[key] + except KeyError: + pass + # Find other candidates. + items = [] + for desc in GetGeneratedInfos(): + if key[0]==desc[0] and key[1]==desc[1] and key[2]==desc[2]: + items.append(desc) + if items: + # Items are all identical, except for last tuple element + # We want the latest minor version we have - so just sort and grab last + items.sort() + new_minor = items[-1][3] + ret = GetModuleForTypelib(typelibCLSID, lcid, major, new_minor) + else: + ret = None + # remember and return + versionRedirectMap[key] = ret + return ret #print "Rebuilding: ", major, minor module = MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance, bForDemand = bForDemand, bBuildHidden = bBuildHidden) *************** *** 451,455 **** return disp ! def AddModuleToCache(typelibclsid, lcid, major, minor, verbose = 1, bFlushNow = 1): """Add a newly generated file to the cache dictionary. """ --- 529,533 ---- return disp ! def AddModuleToCache(typelibclsid, lcid, major, minor, verbose = 1, bFlushNow = not is_readonly): """Add a newly generated file to the cache dictionary. """ *************** *** 457,515 **** mod = _GetModule(fname) dict = mod.CLSIDToClassMap for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = (str(typelibclsid), mod.LCID, mod.MajorVersion, mod.MinorVersion) dict = mod.CLSIDToPackageMap for clsid, name in dict.items(): ! clsidToTypelib[clsid] = (str(typelibclsid), mod.LCID, mod.MajorVersion, mod.MinorVersion) dict = mod.VTablesToClassMap for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = (str(typelibclsid), mod.LCID, mod.MajorVersion, mod.MinorVersion) dict = mod.VTablesToPackageMap for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = (str(typelibclsid), mod.LCID, mod.MajorVersion, mod.MinorVersion) ! if bFlushNow: _SaveDicts() def _GetModule(fname): """Given the name of a module in the gen_py directory, import and return it. """ ! mod = __import__("win32com.gen_py.%s" % fname) ! return getattr( getattr(mod, "gen_py"), fname) ! def Rebuild(verbose = 1): """Rebuild the cache indexes from the file system. """ clsidToTypelib.clear() ! files = glob.glob(win32com.__gen_path__+ "\\*.py") ! if verbose and len(files): # Dont bother reporting this when directory is empty! print "Rebuilding cache of generated files for COM support..." ! for file in files: ! name = os.path.splitext(os.path.split(file)[1])[0] try: ! iid, lcid, major, minor = string.split(name, "x") ! ok = 1 ! except ValueError: ! ok = 0 ! if ok: ! try: ! iid = pywintypes.IID("{" + iid + "}") ! except pywintypes.com_error: ! ok = 0 ! if ok: ! if verbose: ! print "Checking", name ! try: ! AddModuleToCache(iid, lcid, major, minor, verbose, 0) ! except: ! print "Could not add module %s - %s: %s" % (name, sys.exc_info()[0],sys.exc_info()[1]) ! else: ! if verbose and name[0] != '_': ! print "Skipping module", name ! if verbose and len(files): # Dont bother reporting this when directory is empty! print "Done." _SaveDicts() --- 535,631 ---- mod = _GetModule(fname) dict = mod.CLSIDToClassMap + info = str(typelibclsid), lcid, major, minor for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = info dict = mod.CLSIDToPackageMap for clsid, name in dict.items(): ! clsidToTypelib[clsid] = info dict = mod.VTablesToClassMap for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = info dict = mod.VTablesToPackageMap for clsid, cls in dict.items(): ! clsidToTypelib[clsid] = info + # If this lib was previously redirected, drop it + if versionRedirectMap.has_key(info): + del versionRedirectMap[info] if bFlushNow: _SaveDicts() + def GetGeneratedInfos(): + zip_pos = win32com.__gen_path__.find(".zip\\") + if zip_pos >= 0: + import zipfile, cStringIO + zip_file = win32com.__gen_path__[:zip_pos+4] + zip_path = win32com.__gen_path__[zip_pos+5:].replace("\\", "/") + zf = zipfile.ZipFile(zip_file) + infos = {} + for n in zf.namelist(): + if not n.startswith(zip_path): + continue + base = n[len(zip_path)+1:].split("/")[0] + try: + iid, lcid, major, minor = base.split("x") + lcid = int(lcid) + major = int(major) + minor = int(minor) + iid = pywintypes.IID("{" + iid + "}") + except ValueError: + continue + except pywintypes.com_error: + # invalid IID + continue + infos[(iid, lcid, major, minor)] = 1 + zf.close() + return infos.keys() + else: + # on the file system + files = glob.glob(win32com.__gen_path__+ "\\*") + ret = [] + for file in files: + if not os.path.isdir(file) and not os.path.splitext(file)==".py": + continue + name = os.path.splitext(os.path.split(file)[1])[0] + try: + iid, lcid, major, minor = string.split(name, "x") + iid = pywintypes.IID("{" + iid + "}") + lcid = int(lcid) + major = int(major) + minor = int(minor) + except ValueError: + continue + except pywintypes.com_error: + # invalid IID + continue + ret.append((iid, lcid, major, minor)) + return ret + def _GetModule(fname): """Given the name of a module in the gen_py directory, import and return it. """ ! mod_name = "win32com.gen_py.%s" % fname ! mod = __import__(mod_name) ! return sys.modules[mod_name] ! def Rebuild(verbose = 1): """Rebuild the cache indexes from the file system. """ clsidToTypelib.clear() ! infos = GetGeneratedInfos() ! if verbose and len(infos): # Dont bother reporting this when directory is empty! print "Rebuilding cache of generated files for COM support..." ! for info in infos: ! iid, lcid, major, minor = info ! if verbose: ! print "Checking", GetGeneratedFileName(*info) try: ! AddModuleToCache(iid, lcid, major, minor, verbose, 0) ! except: ! print "Could not add module %s - %s: %s" % (name, sys.exc_info()[0],sys.exc_info()[1]) ! if verbose and len(infos): # Dont bother reporting this when directory is empty! print "Done." _SaveDicts() |
From: <mha...@us...> - 2003-09-02 00:38:01
|
Update of /cvsroot/pywin32/pywin32/Wise In directory sc8-pr-cvs1:/tmp/cvs-serv3592 Modified Files: win32all.wse Log Message: Add win32\test files, and correct last checkin which removed installation of pythoncomxx.dll Index: win32all.wse =================================================================== RCS file: /cvsroot/pywin32/pywin32/Wise/win32all.wse,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** win32all.wse 1 Sep 2003 12:49:26 -0000 1.33 --- win32all.wse 2 Sep 2003 00:37:53 -0000 1.34 *************** *** 18,22 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=win32all-20030901.exe Code Sign Name=Python Win32 combined extensions Code Sign Info=skippinet.com.au --- 18,22 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=win32all-158.exe Code Sign Name=Python Win32 combined extensions Code Sign Info=skippinet.com.au *************** *** 1324,1327 **** --- 1324,1333 ---- end item: Install File + Source=e:\src\pythonex\win32\test\*.py + Destination=%INSTDIR%\test + Description=win32 extension demos + Flags=0000000100000010 + end + item: Install File Source=e:\src\pythonex\win32\demos\service\install\*.* Destination=%INSTDIR%\demos\service\install *************** *** 1943,1954 **** end item: Install File ! Source=e:\src\pythonex\win32\Build\System\PyWinTypes%PYVER_NODOT%.lib ! Destination=%PY_INST_PATH%\libs\PyWinTypes%PYVER_NODOT%.lib Description=Core COM Extension DLL Flags=0000000000000010 end item: Install File ! Source=e:\src\pythonex\com\Build\System\PythonCOM%PYVER_NODOT%.lib ! Destination=%PY_INST_PATH%\libs\PythonCOM%PYVER_NODOT%.lib Description=Core COM Extension DLL Flags=0000000000000010 --- 1949,1966 ---- end item: Install File ! Source=e:\src\pythonex\win32\Build\System\PyWinTypes.lib ! Destination=%PY_INST_PATH%\libs\PyWinTypes.lib Description=Core COM Extension DLL Flags=0000000000000010 end item: Install File ! Source=e:\src\pythonex\com\Build\System\PythonCOM%PYVER_NODOT%.dll ! Destination=%SYSDLL_PATH%\PythonCOM%PYVER_NODOT%.dll ! Description=Core COM Extension DLL ! Flags=0000000000000010 ! end ! item: Install File ! Source=e:\src\pythonex\com\Build\System\PythonCOM.lib ! Destination=%PY_INST_PATH%\libs\PythonCOM.lib Description=Core COM Extension DLL Flags=0000000000000010 |
From: <mha...@us...> - 2003-09-02 00:18:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv753 Modified Files: gencache.py Log Message: Don't str() the arg to os.stat Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** gencache.py 26 Jul 2003 00:53:02 -0000 1.19 --- gencache.py 2 Sep 2003 00:18:40 -0000 1.20 *************** *** 417,421 **** #print "Trying stat typelib", pyModTime #print str(typLibPath) ! typLibModTime = os.stat(str(typLibPath[:-1]))[8] if fModTimeSet and (typLibModTime > pyModTime): bReloadNeeded = 1 --- 417,421 ---- #print "Trying stat typelib", pyModTime #print str(typLibPath) ! typLibModTime = os.stat(typLibPath[:-1])[8] if fModTimeSet and (typLibModTime > pyModTime): bReloadNeeded = 1 |
From: <mha...@us...> - 2003-09-02 00:16:27
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv506 Added Files: test_clipboard.py test_security.py Log Message: Couple of new test cases. --- NEW FILE: test_clipboard.py --- # General test module for win32api - please add some :) import unittest import win32clipboard class CrashingTestCase(unittest.TestCase): def test_722082(self): class crasher(object): pass obj = crasher() win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() # This used to crash - now correctly raises type error. self.assertRaises(TypeError, win32clipboard.SetClipboardData, 0, obj ) if __name__ == '__main__': unittest.main() --- NEW FILE: test_security.py --- import win32api, win32con, win32security pwr_sid=win32security.LookupAccountName('','Power Users')[0] admin_sid=win32security.LookupAccountName('','Administrator')[0] sd=win32security.SECURITY_DESCRIPTOR() for x in xrange(0,100000): sd.SetSecurityDescriptorOwner(admin_sid,0) sd=win32security.SECURITY_DESCRIPTOR() for x in xrange(0,100000): sd.SetSecurityDescriptorGroup(pwr_sid,0) sd=win32security.SECURITY_DESCRIPTOR() dacl=win32security.ACL() dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_READ,pwr_sid) dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,admin_sid) for x in xrange(0,1000000): sd.SetSecurityDescriptorDacl(1,dacl,0) sd=win32security.SECURITY_DESCRIPTOR() sacl=win32security.ACL() sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.DELETE,admin_sid,1,1) sacl.AddAuditAccessAce(win32security.ACL_REVISION,win32con.GENERIC_ALL,pwr_sid,1,1) for x in xrange(0,1000000): sd.SetSecurityDescriptorSacl(1,sacl,0) |
From: <mha...@us...> - 2003-09-02 00:09:47
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv31942 Modified Files: __init__.py Log Message: When loading a gencache module for event support, don't bother validating it against the typelib (only the functions that explicity imply generation should validate) Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/__init__.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** __init__.py 18 Mar 2003 07:11:49 -0000 1.29 --- __init__.py 2 Sep 2003 00:09:41 -0000 1.30 *************** *** 248,252 **** tlb, index = ti.GetContainingTypeLib() tla = tlb.GetLibAttr() ! gencache.EnsureModule(tla[0], tla[1], tla[3], tla[4]) # Get the class from the module. disp_class = gencache.GetClassForProgID(str(disp_clsid)) --- 248,252 ---- tlb, index = ti.GetContainingTypeLib() tla = tlb.GetLibAttr() ! gencache.EnsureModule(tla[0], tla[1], tla[3], tla[4], bValidateFile=0) # Get the class from the module. disp_class = gencache.GetClassForProgID(str(disp_clsid)) *************** *** 300,304 **** tlb, index = ti.GetContainingTypeLib() tla = tlb.GetLibAttr() ! gencache.EnsureModule(tla[0], tla[1], tla[3], tla[4]) # Get the class from the module. disp_class = gencache.GetClassForProgID(str(disp_clsid)) --- 300,304 ---- tlb, index = ti.GetContainingTypeLib() tla = tlb.GetLibAttr() ! gencache.EnsureModule(tla[0], tla[1], tla[3], tla[4], bValidateFile=0) # Get the class from the module. disp_class = gencache.GetClassForProgID(str(disp_clsid)) |
From: <mha...@us...> - 2003-09-01 12:49:32
|
Update of /cvsroot/pywin32/pywin32/Wise In directory sc8-pr-cvs1:/tmp/cvs-serv6732 Modified Files: win32all.wse Log Message: Install pywintypes/pythoncom.lib - but they didn't make the win32all I just put out :( Index: win32all.wse =================================================================== RCS file: /cvsroot/pywin32/pywin32/Wise/win32all.wse,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** win32all.wse 1 Sep 2003 08:20:16 -0000 1.32 --- win32all.wse 1 Sep 2003 12:49:26 -0000 1.33 *************** *** 18,22 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=win32all-20030731.exe Code Sign Name=Python Win32 combined extensions Code Sign Info=skippinet.com.au --- 18,22 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=win32all-20030901.exe Code Sign Name=Python Win32 combined extensions Code Sign Info=skippinet.com.au *************** *** 1943,1948 **** end item: Install File ! Source=e:\src\pythonex\com\Build\System\PythonCOM%PYVER_NODOT%.dll ! Destination=%SYSDLL_PATH%\PythonCOM%PYVER_NODOT%.dll Description=Core COM Extension DLL Flags=0000000000000010 --- 1943,1954 ---- end item: Install File ! Source=e:\src\pythonex\win32\Build\System\PyWinTypes%PYVER_NODOT%.lib ! Destination=%PY_INST_PATH%\libs\PyWinTypes%PYVER_NODOT%.lib ! Description=Core COM Extension DLL ! Flags=0000000000000010 ! end ! item: Install File ! Source=e:\src\pythonex\com\Build\System\PythonCOM%PYVER_NODOT%.lib ! Destination=%PY_INST_PATH%\libs\PythonCOM%PYVER_NODOT%.lib Description=Core COM Extension DLL Flags=0000000000000010 |
From: <mha...@us...> - 2003-09-01 12:10:32
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi/src In directory sc8-pr-cvs1:/tmp/cvs-serv32746 Modified Files: mapi.i Log Message: autoduck corrections Index: mapi.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/mapi.i,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mapi.i 1 Sep 2003 08:05:36 -0000 1.3 --- mapi.i 1 Sep 2003 12:10:28 -0000 1.4 *************** *** 482,486 **** ); ! // @pyswig <PyIStream>|WrapCompressedRTFStream| HRESULT WrapCompressedRTFStream( IStream *INPUT, // @pyparm <o PyIStream>|stream||Message stream --- 482,486 ---- ); ! // @pyswig <o PyIStream>|WrapCompressedRTFStream| HRESULT WrapCompressedRTFStream( IStream *INPUT, // @pyparm <o PyIStream>|stream||Message stream |
From: <mha...@us...> - 2003-09-01 12:09:53
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv32592 Modified Files: win32security.i Log Message: autoduck corrections. Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32security.i 8 Aug 2003 04:02:48 -0000 1.10 --- win32security.i 1 Sep 2003 12:09:50 -0000 1.11 *************** *** 1261,1265 **** &obth, // @pyparm <o PyHANDLE>|handle||Handle to an access token to be modified (long *)&typ, // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves. ! &obinfo)) // @pyparm <o>|obinfo||PyACL, PySID, or int depending on type parm return NULL; --- 1261,1265 ---- &obth, // @pyparm <o PyHANDLE>|handle||Handle to an access token to be modified (long *)&typ, // @pyparm int|TokenInformationClass||Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type identifying the type of information the function retrieves. ! &obinfo)) // @pyparm <o PyACL>|obinfo||PyACL, PySID, or int depending on type parm return NULL; |
From: <mha...@us...> - 2003-09-01 12:06:11
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv31783 Modified Files: win32gui.i Log Message: Autoduck corrections. Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** win32gui.i 27 Aug 2003 05:13:46 -0000 1.28 --- win32gui.i 1 Sep 2003 12:06:07 -0000 1.29 *************** *** 1461,1467 **** // @pyswig int|ImageList_Add|Adds an image or images to an image list. // @rdesc Returns the index of the first new image if successful, or -1 otherwise. ! int ImageList_Add(HIMAGELIST himl, // @pyswig int|himl||Handle to the image list. ! HBITMAP hbmImage, // @pyswig int|hbmImage||Handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap. ! HBITMAP hbmMask); // @pyswig int|hbmMask||Handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored --- 1461,1467 ---- // @pyswig int|ImageList_Add|Adds an image or images to an image list. // @rdesc Returns the index of the first new image if successful, or -1 otherwise. ! int ImageList_Add(HIMAGELIST himl, // @pyparm int|himl||Handle to the image list. ! HBITMAP hbmImage, // @pyparm int|hbmImage||Handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap. ! HBITMAP hbmMask); // @pyparm int|hbmMask||Handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored |
From: <mha...@us...> - 2003-09-01 08:23:30
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv30630 Modified Files: set_for_version.py Log Message: Support python 2.4 Index: set_for_version.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/set_for_version.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** set_for_version.py 6 Mar 2003 03:18:44 -0000 1.1 --- set_for_version.py 1 Sep 2003 08:23:27 -0000 1.2 *************** *** 4,8 **** "2.1" : (r"..\python-2.1","Python21"), "2.2" : (r"..\python-2.2-cvs", "Python22"), ! "2.3" : (r"..\python-cvs", None), } --- 4,9 ---- "2.1" : (r"..\python-2.1","Python21"), "2.2" : (r"..\python-2.2-cvs", "Python22"), ! "2.3" : (r"..\python-2.3-cvs", "Python23"), ! "2.4" : (r"..\python-cvs", None), } |
From: <mha...@us...> - 2003-09-01 08:22:06
|
Update of /cvsroot/pywin32/pywin32/Wise In directory sc8-pr-cvs1:/tmp/cvs-serv30005 Modified Files: desc.txt Log Message: Python 2.4 descriptions. Index: desc.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/Wise/desc.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** desc.txt 23 Feb 2001 03:01:16 -0000 1.6 --- desc.txt 1 Sep 2003 08:22:02 -0000 1.7 *************** *** 14,17 **** --- 14,18 ---- pywintypes22.dll Common Python 2.2 types for win32 pywintypes23.dll Common Python 2.3 types for win32 + pywintypes24.dll Common Python 2.4 types for win32 dbi.dll Database utilities for the ODBC module dde.pyd Python Dynamic Data Exchange extensions *************** *** 51,54 **** --- 52,56 ---- pythoncom22.dll Python 2.2 COM Extensions core pythoncom23.dll Python 2.3 COM Extensions core + pythoncom24.dll Python 2.4 COM Extensions core dcom.pyd Temporary DCOM test exchdapi.pyd Python MS-Exchange Directory extension |