[pywin32-checkins] pywin32/com/win32comext/shell/src PyICopyHook.cpp, 1.2, 1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-01-20 22:46:31
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1387/com/win32comext/shell/src Modified Files: PyICopyHook.cpp Log Message: Fix place where HWND treated as int Check if destFile is NULL CopyCallback return value type check always failed Index: PyICopyHook.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyICopyHook.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyICopyHook.cpp 26 Jan 2005 22:31:09 -0000 1.2 --- PyICopyHook.cpp 20 Jan 2007 22:46:30 -0000 1.3 *************** *** 41,44 **** --- 41,45 ---- PyObject *obdestFile; HWND hwnd; + PyObject *obhwnd; UINT wFunc; UINT wFlags; *************** *** 47,51 **** LPTSTR destFile; DWORD destAttribs; ! if ( !PyArg_ParseTuple(args, "liiOlOl:CopyCallback", &hwnd, &wFunc, &wFlags, &obsrcFile, &srcAttribs, &obdestFile, &destAttribs) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 48,54 ---- LPTSTR destFile; DWORD destAttribs; ! if ( !PyArg_ParseTuple(args, "OiiOlOl:CopyCallback", &obhwnd, &wFunc, &wFlags, &obsrcFile, &srcAttribs, &obdestFile, &destAttribs) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; BOOL bPythonIsHappy = TRUE; *************** *** 96,110 **** PyObject *obdestFile; obsrcFile = PyWinObject_FromTCHAR((LPTSTR)srcFile); ! obdestFile = PyWinObject_FromTCHAR((LPTSTR)destFile); PyObject *result; ! HRESULT hr=InvokeViaPolicy("CopyCallback", &result, "liiOlOl", hwnd, wFunc, wFlags, obsrcFile, srcAttribs, obdestFile, destAttribs); Py_XDECREF(obsrcFile); Py_XDECREF(obdestFile); if (FAILED(hr)) return hr; ! if (!PyInt_Check(result) || !PyLong_Check(result)) { ! PyErr_Format(PyExc_TypeError, "CopyCallBack should return an int, not a '%s'", result->ob_type->tp_name); hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CopyCallBack"); - } else - hr = PyInt_AsLong(result); Py_DECREF(result); return hr; --- 99,117 ---- PyObject *obdestFile; obsrcFile = PyWinObject_FromTCHAR((LPTSTR)srcFile); ! // Dest file can be NULL for FO_DELETE ! if (destFile!=NULL) ! obdestFile = PyWinObject_FromTCHAR((LPTSTR)destFile); ! else{ ! obdestFile=Py_None; ! Py_INCREF(Py_None); ! } PyObject *result; ! HRESULT hr=InvokeViaPolicy("CopyCallback", &result, "NiiOlOl", PyWinLong_FromHANDLE(hwnd), wFunc, wFlags, obsrcFile, srcAttribs, obdestFile, destAttribs); Py_XDECREF(obsrcFile); Py_XDECREF(obdestFile); if (FAILED(hr)) return hr; ! hr = PyInt_AsLong(result); ! if ((hr==-1) && PyErr_Occurred()) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CopyCallBack"); Py_DECREF(result); return hr; |