// @pymethod |PyIEmptyVolumeCache|GetSpaceUsed| STDMETHODIMP PyGEmptyVolumeCache::GetSpaceUsed( /* [out] */ DWORDLONG * pdwlSpaceUsed, /* [in] */ IEmptyVolumeCacheCallBack * picb) { PY_GATEWAY_METHOD; PyObject *obpicb; obpicb = PyCom_PyObjectFromIUnknown(picb, IID_IEmptyVolumeCacheCallBack, TRUE); if (!obpicb) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSpaceUsed"); PyObject *result; HRESULT hr=InvokeViaPolicy("GetSpaceUsed", &result, "O", obpicb); Py_XDECREF(obpicb); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsUPY_LONG_LONG(result, pdwlSpaceUsed)) { PyErr_Format(PyExc_TypeError, "GetSpaceUsed must return a long - got '%s'", result->ob_type->tp_name); hr = PyCom_SetAndLogCOMErrorFromPyException("GetSpaceUsed", IID_IEmptyVolumeCache); } Py_DECREF(result); return hr; }
STDMETHODIMP PyGExplorerCommand::EnumSubCommands( /* [out] */ IEnumExplorerCommand ** ppEnum) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("EnumSubCommands", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IEnumExplorerCommand, (void **)ppEnum, FALSE /* bNoneOK */)) hr = PyCom_SetAndLogCOMErrorFromPyException("EnumSubCommands", IID_IExplorerCommand); Py_DECREF(result); return hr; }
STDMETHODIMP PyGExplorerCommand::GetCanonicalName( /* [out] */ GUID * pguidCommandName) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetCanonicalName", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsIID(result, pguidCommandName)) hr = PyCom_SetAndLogCOMErrorFromPyException("GetCanonicalName", IID_IExplorerCommand); Py_DECREF(result); return hr; }
STDMETHODIMP PyGExplorerCommand::GetFlags( /* [out] */ EXPCMDFLAGS * pFlags) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetFlags", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params *pFlags = PyLong_AsUnsignedLongMask(result); hr = PyCom_SetAndLogCOMErrorFromPyException("GetFlags", IID_IExplorerCommand); Py_DECREF(result); return hr; }
STDMETHODIMP PyGShellItemArray::GetCount( /* [out] */ DWORD * pdwNumItems) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetCount", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params *pdwNumItems = PyLong_AsUnsignedLong(result); hr = PyCom_SetAndLogCOMErrorFromPyException("GetCount", IID_IShellItemArray); Py_DECREF(result); return hr; }
// IEmptyVolumeCache2 // @object PyIEmptyVolumeCache2|See also <o PyIEmptyVolumeCache> // @pymeth PyIEmptyVolumeCache|Deactivate // @pymethod |PyIEmptyVolumeCache2|InitializeEx| STDMETHODIMP PyGEmptyVolumeCache2::InitializeEx( /* [in] */ HKEY hkRegKey, /* [in] */ LPCWSTR pcwszVolume, /* [in] */ LPCWSTR pcwszKeyName, /* [out] */ LPWSTR * ppwszDisplayName, /* [out] */ LPWSTR * ppwszDescription, /* [out] */ LPWSTR * ppwszBtnText, /* [out] */ DWORD * pdwFlags) { PY_GATEWAY_METHOD; BOOL bPythonIsHappy = TRUE; ULONG dwFlags; HRESULT hr; PyObject *result; PyObject *obppwszDisplayName; PyObject *obppwszDescription; PyObject *obppwszBtnText; PyObject *obpcwszVolume = NULL; PyObject *obpcwszKeyName = NULL; PyObject *obhkRegKey = PyWinObject_FromHKEY(hkRegKey); if (!obhkRegKey) goto args_failed; if (!(obpcwszVolume = MakeOLECHARToObj(pcwszVolume))) goto args_failed; if (!(obpcwszKeyName = MakeOLECHARToObj(pcwszKeyName))) goto args_failed; hr=InvokeViaPolicy("InitializeEx", &result, "NNNk", obhkRegKey, obpcwszVolume, obpcwszKeyName, *pdwFlags); // NOTE: From here, do *not* exit via args_failed - the args have been cleaned up if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyTuple_Check(result)) { PyErr_Format(PyExc_TypeError, "Initialize must return a tuple of (unicode, unicode, unicode, long) - got '%s'", result->ob_type->tp_name); bPythonIsHappy = FALSE; } if (bPythonIsHappy && !PyArg_ParseTuple(result, "OOOl" , &obppwszDisplayName, &obppwszDescription, &obppwszBtnText, &dwFlags)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDisplayName, ppwszDisplayName)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDescription, ppwszDescription)) bPythonIsHappy = FALSE; if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszBtnText, ppwszBtnText)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) hr = PyCom_SetAndLogCOMErrorFromPyException("InitializeEx", IID_IEmptyVolumeCache); if (pdwFlags) *pdwFlags = dwFlags; Py_DECREF(result); return hr; args_failed: // only hit on error convering input args, not normal exit. Py_XDECREF(obhkRegKey); Py_XDECREF(obpcwszVolume); Py_XDECREF(obpcwszKeyName); return MAKE_PYCOM_GATEWAY_FAILURE_CODE("InitializeEx"); }
STDMETHODIMP PyGShellItem::GetAttributes( /* [in] */ SFGAOF sfgaoMask, /* [out] */ SFGAOF * psfgaoAttribs) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetAttributes", &result, "k", sfgaoMask); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params *psfgaoAttribs = PyLong_AsUnsignedLongMask(result); hr = PyCom_SetAndLogCOMErrorFromPyException("GetAttributes", IID_IShellItem); Py_DECREF(result); return hr; }
STDMETHODIMP PyGShellIconOverlayManager::OverlayIndexFromImageIndex( /* [unique][in] */ int iImage, /* [out] */ int __RPC_FAR * index, /* [in] */ BOOL fAdd) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("OverlayIndexFromImageIndex", &result, "ii", iImage, fAdd); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("OverlayIndexFromImageIndex", GetIID()); Py_DECREF(result); return hr; }
STDMETHODIMP PyGShellItem::GetDisplayName( /* [in] */ SIGDN sigdnName, /* [string][out] */ LPWSTR * ppszName) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetDisplayName", &result, "k", sigdnName); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsTaskAllocatedWCHAR(result, ppszName)) hr = PyCom_SetAndLogCOMErrorFromPyException("GetDisplayName", IID_IShellItem); Py_DECREF(result); return hr; }
STDMETHODIMP PyGShellItemArray::GetAttributes( /* [in] */ SIATTRIBFLAGS dwAttribFlags, /* [in] */ SFGAOF sfgaoMask, /* [out] */ SFGAOF * psfgaoAttribs) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetAttributes", &result, "kk", dwAttribFlags, sfgaoMask); if (FAILED(hr)) return hr; *psfgaoAttribs = PyLong_AsUnsignedLongMask(result); hr = PyCom_SetAndLogCOMErrorFromPyException("GetAttributes", IID_IShellItemArray); Py_DECREF(result); return hr; }
STDMETHODIMP PyGShellItem::Compare( /* [in] */ IShellItem * psi, /* [in] */ SICHINTF hint, /* [out] */ int * piOrder) { PY_GATEWAY_METHOD; PyObject *obpsi; obpsi = PyCom_PyObjectFromIUnknown(psi, IID_IShellItem, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("Compare", &result, "Ok", obpsi, hint); Py_XDECREF(obpsi); if (FAILED(hr)) return hr; *piOrder = PyInt_AsLong(result); hr = PyCom_SetAndLogCOMErrorFromPyException("Compare", IID_IShellItem); Py_DECREF(result); return hr; }
STDMETHODIMP PyGExplorerCommand::GetToolTip( /* [unique][in] */ IShellItemArray * psiItemArray, /* [string][out] */ LPWSTR * ppszInfotip) { PY_GATEWAY_METHOD; PyObject *obpsiItemArray; obpsiItemArray = PyCom_PyObjectFromIUnknown(psiItemArray, IID_IShellItemArray, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetToolTip", &result, "O", obpsiItemArray); Py_XDECREF(obpsiItemArray); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyWinObject_AsPfnAllocatedWCHAR(result, PyShell_AllocMem, ppszInfotip)) hr = PyCom_SetAndLogCOMErrorFromPyException("GetToolTip", IID_IExplorerCommand); Py_DECREF(result); return hr; }
// --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGShellIconOverlayManager::GetFileOverlayInfo( /* [unique][in] */ LPCWSTR path, /* [unique][in] */ DWORD attrib, /* [out] */ int __RPC_FAR * index, /* [in] */ DWORD flags) { PY_GATEWAY_METHOD; PyObject *obpath; obpath = MakeOLECHARToObj(path); PyObject *result; HRESULT hr=InvokeViaPolicy("GetFileOverlayInfo", &result, "Oll", obpath, attrib, flags); Py_XDECREF(obpath); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , index)) return PyCom_SetAndLogCOMErrorFromPyException("GetFileOverlayInfo", GetIID()); Py_DECREF(result); return hr; }
STDMETHODIMP PyGExplorerCommand::GetState( /* [in] */ IShellItemArray * psiItemArray, /* [in] */ BOOL fOkToBeSlow, /* [out] */ EXPCMDSTATE * pCmdState) { PY_GATEWAY_METHOD; PyObject *obpsiItemArray; obpsiItemArray = PyCom_PyObjectFromIUnknown(psiItemArray, IID_IShellItemArray, TRUE); PyObject *result; HRESULT hr=InvokeViaPolicy("GetState", &result, "Oi", obpsiItemArray, fOkToBeSlow); Py_XDECREF(obpsiItemArray); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params *pCmdState = PyLong_AsUnsignedLongMask(result); hr = PyCom_SetAndLogCOMErrorFromPyException("GetState", IID_IExplorerCommand); Py_DECREF(result); return hr; }
// @pymethod |PyIEmptyVolumeCache|Deactivate| STDMETHODIMP PyGEmptyVolumeCache::Deactivate( /* [out] */ DWORD * pdwFlags) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("Deactivate", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params BOOL bPythonIsHappy = TRUE; if (!PyWinObject_AsUPY_LONG_LONG(result, pdwFlags)) { PyErr_Format(PyExc_TypeError, "Deactivate must return a long - got '%s'", result->ob_type->tp_name); hr = PyCom_SetAndLogCOMErrorFromPyException("Deactivate", IID_IEmptyVolumeCache); } Py_DECREF(result); return hr; }
STDMETHODIMP PyGContextMenu3::HandleMenuMsg2( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult) { PY_GATEWAY_METHOD; PyObject *ret; HRESULT hr=InvokeViaPolicy("HandleMenuMsg2", &ret, "INN", uMsg, PyWinObject_FromPARAM(wParam), PyWinObject_FromPARAM(lParam)); if (FAILED(hr)) return hr; if (lpResult) { if (ret == Py_None) *lpResult = FALSE; else { PyWinObject_AsPARAM(ret, (WPARAM *)lpResult); hr = PyCom_SetAndLogCOMErrorFromPyException("HandleMenuMsg2", IID_IContextMenu3); } } Py_DECREF(ret); return hr; }