// @pymethod int|PyIDropTarget|DragEnter|Called when an object is initially dragged into a window
// @rdesc Your implementation of this function should return a shellcon.DROPEFFECT_* value indicating if the object can be accepted
PyObject *PyIDropTarget::DragEnter(PyObject *self, PyObject *args)
{
	IDropTarget *pIDT = GetI(self);
	if ( pIDT == NULL )
		return NULL;
	// @pyparm <o PyIDataObject>|pDataObj||IDataObject interface that contains the object being dragged
	// @pyparm int|grfKeyState||Combination of win32con.MK_* flags containing keyboard modifier state
	POINTL pt;
	PyObject *obpt;
	// @pyparm (int, int)|pt||(x,y) Screen coordinates of cursor
	PyObject *obpDataObj;
	IDataObject *pDataObj;
	DWORD grfKeyState;
        DWORD dwEffect;
	// @pyparm int|pdwEffect||shellcon.DROPEFFECT_* value
	if ( !PyArg_ParseTuple(args, "OlOl:DragEnter", &obpDataObj, &grfKeyState, &obpt, &dwEffect) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDataObj, IID_IDataObject, (void **)&pDataObj, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyObject_AsPOINTL( obpt, &pt )) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDT->DragEnter( pDataObj, grfKeyState, pt, &dwEffect );
	if (pDataObj) pDataObj->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIDT, IID_IDropTarget );
	return PyInt_FromLong(dwEffect);
}
Example #2
0
// @pymethod |PyIDebugApplication|HandleRuntimeError|Description of HandleRuntimeError.
PyObject *PyIDebugApplication::HandleRuntimeError(PyObject *self, PyObject *args)
{
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIActiveScriptErrorDebug>|pErrorDebug||Description for pErrorDebug
	// @pyparm <o PyIActiveScriptSite>|pScriptSite||Description for pScriptSite
	PyObject *obpErrorDebug;
	PyObject *obpScriptSite;
	IActiveScriptErrorDebug * pErrorDebug;
	IActiveScriptSite * pScriptSite;
	BREAKRESUMEACTION pbra;
	ERRORRESUMEACTION perra;
	BOOL pfCallOnScriptError;
	if ( !PyArg_ParseTuple(args, "OO:HandleRuntimeError", &obpErrorDebug, &obpScriptSite) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpErrorDebug, IID_IActiveScriptErrorDebug, (void **)&pErrorDebug, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpScriptSite, IID_IActiveScriptSite, (void **)&pScriptSite, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDA->HandleRuntimeError( pErrorDebug, pScriptSite, &pbra, &perra, &pfCallOnScriptError );
	if (pErrorDebug) pErrorDebug->Release();
	if (pScriptSite) pScriptSite->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);

	PyObject *pyretval = Py_BuildValue("iii", pbra, perra, pfCallOnScriptError);
	return pyretval;
}
// @pymethod (int, <o PyIShellItem>|PyITransferSource|RecycleItem|Moves an item to the recycle bin
PyObject *PyITransferSource::RecycleItem(PyObject *self, PyObject *args)
{
	ITransferSource *pITS = GetI(self);
	if ( pITS == NULL )
		return NULL;
	// @pyparm <o PyIShellItem>|Source||The item to be recycled
	// @pyparm <o PyIShellItem>|ParentDest||Shell item representing the recycle bin
	TRANSFER_SOURCE_FLAGS flags;
	// @pyparm int|flags||Combination of shellcon.TSF_* flags
	PyObject *obpsiSource;
	PyObject *obpsiParentDest;
	IShellItem * psiSource;
	IShellItem * psiParentDest;
	IShellItem * ppsiNewDest;
	if ( !PyArg_ParseTuple(args, "OOi:RecycleItem", &obpsiSource, &obpsiParentDest, &flags) )
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiSource, IID_IShellItem, (void **)&psiSource, FALSE))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiParentDest, IID_IShellItem, (void **)&psiParentDest, FALSE)){
		PYCOM_RELEASE(psiSource);
		return NULL;
		}
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pITS->RecycleItem( psiSource, psiParentDest, flags, &ppsiNewDest );
	psiSource->Release();
	psiParentDest->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pITS, IID_ITransferSource );
	return Py_BuildValue("lO", hr, PyCom_PyObjectFromIUnknown(ppsiNewDest, IID_IShellItem, FALSE));
}
STDMETHODIMP PyGEnumDebugStackFrames::Next( 
            /* [in] */ ULONG celt,
            /* [length_is][size_is][out] */ DebugStackFrameDescriptor __RPC_FAR *rgVar,
            /* [out] */ ULONG __RPC_FAR *pCeltFetched)
{
	PY_GATEWAY_METHOD;
	PyObject *result;
	Py_ssize_t len;
	HRESULT hr = InvokeViaPolicy("Next", &result, "i", celt);
	if ( FAILED(hr) )
		return hr;

	if ( !PySequence_Check(result) )
		goto error;
	len = PyObject_Length(result);
	if ( len == -1 )
		goto error;
	if ( len > (Py_ssize_t)celt)
		len = celt;

	if ( pCeltFetched )
		*pCeltFetched = PyWin_SAFE_DOWNCAST(len, Py_ssize_t, ULONG);

	Py_ssize_t i;
	for ( i = 0; i < len; ++i )
	{
		PyObject *ob = PySequence_GetItem(result, i);
		if ( ob == NULL )
			goto error;
		if (!PyTuple_Check(ob)) {
			Py_DECREF(ob);
			PyErr_SetString(PyExc_TypeError, "PyIEnumDebugStackFrames::Next must return a tuple.");
			goto error;
		}
		PyObject *obEnum, *obUnk;
		if (!PyArg_ParseTuple(ob, "OiiiO", &obEnum, &rgVar[i].dwMin, &rgVar[i].dwLim, &rgVar[i].fFinal, &obUnk)) {
			Py_DECREF(ob);
			goto error;
		}

		if ( !PyCom_InterfaceFromPyInstanceOrObject(obEnum, IID_IDebugStackFrame, (void **)&rgVar[i].pdsf, FALSE) ||
		     !PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&rgVar[i].punkFinal, TRUE) )
		{
			Py_DECREF(ob);
			Py_DECREF(result);
			return PyCom_SetCOMErrorFromPyException(IID_IEnumDebugStackFrames);
		}
		Py_DECREF(ob);
	}

	Py_DECREF(result);

	return len < (Py_ssize_t)celt ? S_FALSE : S_OK;

  error:
	hr = PyErr_Occurred() ? PyCom_SetCOMErrorFromPyException(IID_IEnumDebugStackFrames)
		                          : PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumDebugStackFrames);
	Py_DECREF(result);
	return hr;
}
// @pymethod |PyINameSpaceTreeControl|AppendRoot|Description of AppendRoot.
PyObject *PyINameSpaceTreeControl::AppendRoot(PyObject *self, PyObject *args)
{
	INameSpaceTreeControl *pINSTC = GetI(self);
	if ( pINSTC == NULL )
		return NULL;
	// @pyparm <o PyIShellItem>|psiRoot||Description for psiRoot
	// @pyparm int|grfEnumFlags||Description for grfEnumFlags
	// @pyparm int|grfRootStyle||Description for grfRootStyle
	// @pyparm <o PyIShellItemFilter>|pif||Description for pif
	PyObject *obpsiRoot;
	PyObject *obpif;
	IShellItem * psiRoot;
	DWORD grfEnumFlags;
	DWORD grfRootStyle;
	IShellItemFilter * pif;
	if ( !PyArg_ParseTuple(args, "OkkO:AppendRoot", &obpsiRoot, &grfEnumFlags, &grfRootStyle, &obpif) )
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsiRoot, IID_IShellItem, (void **)&psiRoot, TRUE /* bNoneOK */))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpif, IID_IShellItemFilter, (void **)&pif, TRUE /* bNoneOK */)) {
		if (pif) pif->Release();
		return NULL;
	}
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pINSTC->AppendRoot( psiRoot, grfEnumFlags, grfRootStyle, pif );
	if (psiRoot) psiRoot->Release();
	if (pif) pif->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pINSTC, IID_INameSpaceTreeControl );
	Py_INCREF(Py_None);
	return Py_None;
}
Example #6
0
// @pymethod <o PyIUnknown>|PyIMoniker|BindToStorage|Retrieves an interface object to the storage that contains the object identified by the moniker.
PyObject *PyIMoniker::BindToStorage(PyObject *self, PyObject *args)
{
	// @pyparm <o PyIBindCtx>|bindCtx||bind context object to be used.
	// @pyparm <o PyIMoniker>|moniker||If the moniker is part of a composite moniker, otherwise None
	// @pyparm <o IID>|iidResult||IID of the result object.
	PyObject *obBindCtx;
	PyObject *obMoniker;
	PyObject *obIID;

	if (!PyArg_ParseTuple(args, "OOO:BindToStorage", &obBindCtx, &obMoniker, &obIID))
		return NULL;

	IMoniker *pMy = GetI(self);
	if (pMy==NULL) return NULL;

	IBindCtx *pBindCtx;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obBindCtx, IID_IBindCtx, (void **)&pBindCtx, FALSE))
		return NULL;
	
	IMoniker *pMonLeft = NULL;
	if (obMoniker!=Py_None) {
		if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) {
			PY_INTERFACE_PRECALL;
			pBindCtx->Release();
			PY_INTERFACE_POSTCALL;

			return NULL;
		}
	}
	IID iid;
	if (!PyWinObject_AsIID(obIID, &iid)) {
		PY_INTERFACE_PRECALL;
		pBindCtx->Release();
		if (pMonLeft) pMonLeft->Release();
		PY_INTERFACE_POSTCALL;

		return NULL;
	}

	void *pResult = NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pMy->BindToStorage(pBindCtx, pMonLeft, iid, &pResult );
	pBindCtx->Release();
	if (pMonLeft) pMonLeft->Release();
	PY_INTERFACE_POSTCALL;

	if (S_OK!=hr) // S_OK only acceptable
		return PyCom_BuildPyException(hr, pMy, IID_IMoniker);
	return PyCom_PyObjectFromIUnknown((IUnknown *)pResult, iid, FALSE );
}
Example #7
0
// @pymethod |PyIFileOperation|CopyItem|Adds a copy operation to the configuration
PyObject *PyIFileOperation::CopyItem(PyObject *self, PyObject *args)
{
    IFileOperation *pIFO = GetI(self);
    if ( pIFO == NULL )
        return NULL;
    // @pyparm <o PyIShellItem>|Item||Item to be copied
    // @pyparm <o PyIShellItem>|DestinationFolder||Folder into which it will be copied
    // @pyparm str|CopyName|None|New name for the copied file, use None to keep original name
    // @pyparm <o PyGFileOperationProgressSink>|Sink|None|Progress sink for just this operation
    PyObject *obItem;
    PyObject *obDestinationFolder;
    PyObject *obCopyName = Py_None;
    PyObject *obSink = Py_None;
    IShellItem * pItem;
    IShellItem * pDestinationFolder;
    TmpWCHAR CopyName;
    IFileOperationProgressSink * pSink;

    if (!PyArg_ParseTuple(args, "OO|OO:CopyItem", &obItem, &obDestinationFolder, &obCopyName, &obSink))
        return NULL;
    if (!PyWinObject_AsWCHAR(obCopyName, &CopyName, TRUE))
        return NULL;
    if (!PyCom_InterfaceFromPyInstanceOrObject(obItem, IID_IShellItem, (void **)&pItem, FALSE))
        return NULL;
    if (!PyCom_InterfaceFromPyInstanceOrObject(obDestinationFolder, IID_IShellItem, (void **)&pDestinationFolder, FALSE)) {
        PYCOM_RELEASE(pItem);
        return NULL;
    }
    if (!PyCom_InterfaceFromPyInstanceOrObject(obSink, IID_IFileOperationProgressSink, (void **)&pSink, TRUE)) {
        PYCOM_RELEASE(pItem);
        PYCOM_RELEASE(pDestinationFolder);
        return NULL;
    }

    HRESULT hr;
    PY_INTERFACE_PRECALL;
    hr = pIFO->CopyItem( pItem, pDestinationFolder, CopyName, pSink);
    pItem->Release();
    pDestinationFolder->Release();
    if (pSink)
        pSink->Release();
    PY_INTERFACE_POSTCALL;

    if ( FAILED(hr) )
        return PyCom_BuildPyException(hr, pIFO, IID_IFileOperation );
    Py_INCREF(Py_None);
    return Py_None;
}
// @pymethod |PyIDebugApplication|FireDebuggerEvent|Fire a generic event to the IApplicationDebugger (if any)
PyObject *PyIDebugApplication::FireDebuggerEvent(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIIID>|guid||A GUID.
	// @pyparm <o PyIUnknown>|unknown||An unknown object.
	PyObject *obguid, *obunk;
	if ( !PyArg_ParseTuple(args, "OO:FireDebuggerEvent", &obguid, &obunk) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	IUnknown *punk;
	IID iid;
	if (!PyWinObject_AsIID(obguid, &iid))
		 bPythonIsHappy = FALSE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obunk, IID_IUnknown, (void **)&punk, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->FireDebuggerEvent( iid, punk );
	punk->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod int|PyIDebugApplication|AddStackFrameSniffer|Adds a stack frame sniffer to this application.
PyObject *PyIDebugApplication::AddStackFrameSniffer(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm Generally called by a language engine  
	// to expose its stack frames to the debugger. It is possible for other entities to  
	// expose stack frames.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugStackFrameSniffer>|pdsfs||Description for pdsfs
	PyObject *obpdsfs;
	IDebugStackFrameSniffer *pdsfs;
	DWORD pdwCookie;
	if ( !PyArg_ParseTuple(args, "O:AddStackFrameSniffer", &obpdsfs) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpdsfs, IID_IDebugStackFrameSniffer, (void **)&pdsfs, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->AddStackFrameSniffer( pdsfs, &pdwCookie );
	pdsfs->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("i", pdwCookie);
	return pyretval;
	// @rdesc The result is an integer cookie, to be passed to <om PyIDebugApplication.RemoveStackFrameSniffer>
}
Example #10
0
// @pymethod interface|PyIShellItem|BindToHandler|Creates an instance of one of the item's handlers
PyObject *PyIShellItem::BindToHandler(PyObject *self, PyObject *args)
{
	IShellItem *pISI = GetI(self);
	if ( pISI == NULL )
		return NULL;
	// @pyparm <o PyIBindCtx>|pbc||Used to pass parameters that influence the binding operation, can be None
	// @pyparm <o PyIID>|bhid||GUID that identifies a handler (shell.BHID_*)
	// @pyparm <o PyIID>|riid||The interface to return
	PyObject *obpbc;
	PyObject *obbhid;
	PyObject *obriid;
	IBindCtx *pbc;
	IID bhid;
	IID riid;
	void *pv;
	if ( !PyArg_ParseTuple(args, "OOO:BindToHandler", &obpbc, &obbhid, &obriid) )
		return NULL;
	if (!PyWinObject_AsIID(obbhid, &bhid))
		return NULL;
	if (!PyWinObject_AsIID(obriid, &riid))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISI->BindToHandler( pbc, bhid, riid, &pv );
	if (pbc) pbc->Release();

	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
	return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE);
}
Example #11
0
// @pymethod int|PyIShellItem|Compare|Compares another shell item with this item
// @rdesc Returns 0 if items compare as equal, nonzero otherwise
PyObject *PyIShellItem::Compare(PyObject *self, PyObject *args)
{
	IShellItem *pISI = GetI(self);
	if ( pISI == NULL )
		return NULL;
	// @pyparm <o PyIShellItem>|psi||A shell item to be compared with this item
	SICHINTF hint;
	// @pyparm int|hint||shellcon.SICHINT_* value indicating how the comparison is to be performed
	PyObject *obpsi;
	IShellItem *psi;
	if ( !PyArg_ParseTuple(args, "Oi:Compare", &obpsi, &hint) )
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsi, IID_IShellItem, (void **)&psi, FALSE))
		return NULL;
	HRESULT hr;
	int iOrder;
	PY_INTERFACE_PRECALL;
	hr = pISI->Compare( psi, hint, &iOrder );
	psi->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
	return PyInt_FromLong(iOrder);
}
// @pymethod int|PyIConnectionPoint|Advise|Establishes a connection between the connection point object and the client's sink.
PyObject *PyIConnectionPoint::Advise(PyObject *self, PyObject *args)
{
	PyObject *obUnk;
	// @pyparm <o PyIUnknown>|unk||The client's advise sink
	if ( !PyArg_ParseTuple(args, "O:Advise", &obUnk) )
		return NULL;

	IUnknown *pUnk;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&pUnk, FALSE))
		return NULL;

	IConnectionPoint *pICP = GetI(self);
	if ( pICP == NULL )
		return NULL;

	DWORD cookie;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pICP->Advise( pUnk, &cookie );
	pUnk->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	// @rdesc The result is the connection point identifier used by <om PyIConnectionPoint::Unadvise>
	return PyInt_FromLong(cookie);
}
Example #13
0
// @pymethod |PyIMachineDebugManager|AddApplication|Description of AddApplication.
PyObject *PyIMachineDebugManager::AddApplication(PyObject *self, PyObject *args)
{
	IMachineDebugManager *pIMDM = GetI(self);
	if ( pIMDM == NULL )
		return NULL;
	// @pyparm <o PyIRemoteDebugApplication>|pda||Description for pda
	PyObject *obpda;
	if ( !PyArg_ParseTuple(args, "O:AddApplication", &obpda) )
		return NULL;
	IRemoteDebugApplication *pda;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpda, IID_IRemoteDebugApplication, (void **)&pda, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	DWORD dwAppCookie;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIMDM->AddApplication( pda, &dwAppCookie );
	pda->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("i", dwAppCookie);
	return pyretval;
}
// @pymethod |PyIPersistStream|Load|Initializes an object from the stream where it was previously saved.
PyObject *PyIPersistStream::Load(PyObject *self, PyObject *args)
{
		IPersistStream *pMy = GetI(self);
	if (pMy==NULL) return NULL;

	PyObject *obStream;
	// @pyparm <o PyIStream>|stream||Stream object to load from.
	if (!PyArg_ParseTuple(args, "O:Load", &obStream))
		return NULL;

	IStream *pStream;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obStream, IID_IStream, (void **)&pStream, FALSE /*bNoneOK*/))
		return NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pMy->Load(pStream);
	pStream->Release();
	PY_INTERFACE_POSTCALL;
	if (FAILED(hr))
		return PyCom_BuildPyException(hr, pMy, IID_IPersistStream);
	Py_INCREF(Py_None);
	return Py_None;
	// @comm This method loads an object from its associated stream. The seek pointer is set as it was in the most recent <om PyIPersistStream.Save> method. This method can seek and read from the stream, but cannot write to it.
	// @comm On exit, the seek pointer must be in the same position it was in on entry, immediately past the end of the data.
}
// @pymethod |PyIRemoteDebugApplicationEvents|OnBreakFlagChange|Description of OnBreakFlagChange.
PyObject *PyIRemoteDebugApplicationEvents::OnBreakFlagChange(PyObject *self, PyObject *args)
{
	IRemoteDebugApplicationEvents *pIRDAE = GetI(self);
	if ( pIRDAE == NULL )
		return NULL;
	// @pyparm int|abf||Description for abf
	// @pyparm <o PyIRemoteDebugApplicationThread>|prdatSteppingThread||Description for prdatSteppingThread
	PyObject *obprdatSteppingThread;
	APPBREAKFLAGS abf;
	IRemoteDebugApplicationThread *prdatSteppingThread;
	if ( !PyArg_ParseTuple(args, "iO:OnBreakFlagChange", &abf, &obprdatSteppingThread) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obprdatSteppingThread, IID_IRemoteDebugApplicationThread, (void **)&prdatSteppingThread, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIRDAE->OnBreakFlagChange( abf, prdatSteppingThread );
	prdatSteppingThread->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
Example #16
0
// @pymethod int|PyIDataObject|DAdvise|Connects the object to an interface that will receive notifications when its data changes
// @rdesc Returns a unique number that is used to identify the connection
PyObject *PyIDataObject::DAdvise(PyObject *self, PyObject *args)
{
	IDataObject *pIDO = GetI(self);
	if ( pIDO == NULL )
		return NULL;
	FORMATETC formatetc;
	PyObject *obpformatetc;
	// @pyparm <o PyFORMATETC>|pformatetc||Defines the type of data for which the sink will receive notifications.
	// @pyparm int|advf||Combination of values from ADVF enum. (which currently do not appear in any of the constants modules!)
	// @pyparm <o PyIAdviseSink>|pAdvSink||Currently this interface is not wrapped.
	PyObject *obpAdvSink;
	DWORD advf;
	IAdviseSink *pAdvSink;
	if ( !PyArg_ParseTuple(args, "OlO:DAdvise", &obpformatetc, &advf, &obpAdvSink) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyObject_AsFORMATETC( obpformatetc, &formatetc )) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpAdvSink, IID_IAdviseSink, (void **)&pAdvSink, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	DWORD dwConnection;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDO->DAdvise( &formatetc, advf, pAdvSink, &dwConnection );
	PY_INTERFACE_POSTCALL;
	if (pAdvSink) pAdvSink->Release();
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIDO, IID_IDataObject );
	return PyInt_FromLong(dwConnection);
}
Example #17
0
// @pymethod |PyIContext|SetProperty|Sets a property on the context
PyObject *PyIContext::SetProperty(PyObject *self, PyObject *args)
{
	IContext *pIC = GetI(self);
	if ( pIC == NULL )
		return NULL;
	// @pyparm <o PyIID>|rpolicyId||GUID identifying the property to be set
	// @pyparm int|flags||Reserved, use only 0
	// @pyparm <o PyIUnknown>|pUnk||The property value
	CPFLAGS flags;
	PyObject *obrpolicyId;
	PyObject *obUnk;
	IID rpolicyId;
	IUnknown * pUnk;
	if ( !PyArg_ParseTuple(args, "OkO:SetProperty", &obrpolicyId, &flags, &obUnk) )
		return NULL;
	if (!PyWinObject_AsIID(obrpolicyId, &rpolicyId))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obUnk, IID_IUnknown, (void **)&pUnk, FALSE))
		return NULL;

	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIC->SetProperty( rpolicyId, flags, pUnk );
	pUnk->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIC, IID_IContext );
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod |PyICustomDestinationList|AppendCategory|Adds a custom category to the jump list
PyObject *PyICustomDestinationList::AppendCategory(PyObject *self, PyObject *args)
{
	ICustomDestinationList *pICDL = GetI(self);
	if ( pICDL == NULL )
		return NULL;
	
	TmpWCHAR Category;
	PyObject *obCategory, *obItems;
	IObjectArray *Items;
	// @pyparm str|Category||Display name of the category, can also be a dll and resource id for localization
	// @pyparm <o PyIObjectArray>|Items||Collection of IShellItem and/or IShellLink interfaces
	if ( !PyArg_ParseTuple(args, "OO:AppendCategory", &obCategory, &obItems))
		return NULL;
	if (!PyWinObject_AsWCHAR(obCategory, &Category, FALSE))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obItems, IID_IObjectArray, (void **)&Items, FALSE))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pICDL->AppendCategory(Category, Items);
	Items->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pICDL, IID_ICustomDestinationList );
	Py_INCREF(Py_None);
	return Py_None;
}
Example #19
0
// @pymethod <o PyIMoniker>|PyIMoniker|ComposeWith|Combines the current moniker with another moniker, creating a new composite moniker.
PyObject *PyIMoniker::ComposeWith(PyObject *self, PyObject *args)
{
	// @pyparm <o PyIMoniker>|mkRight||The IMoniker interface on the moniker to compose onto the end of this moniker.
	// @pyparm int|fOnlyIfNotGeneric||If TRUE, the caller requires a non-generic composition, so the operation should proceed only if pmkRight is a moniker class that this moniker can compose with in some way other than forming a generic composite. If FALSE, the method can create a generic composite if necessary.
	PyObject *obmkRight;
	int bOnlyIfNotGeneric;
	if (!PyArg_ParseTuple(args, "Oi:ComposeWith", &obmkRight, &bOnlyIfNotGeneric))
		return NULL;

	IMoniker *pMy = GetI(self);
	if (pMy==NULL) return NULL;

	IMoniker *pmkRight;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obmkRight, IID_IMoniker, (void **)&pmkRight, FALSE))
		return NULL;

	IMoniker *pResult = NULL;

	PY_INTERFACE_PRECALL;
	HRESULT hr = pMy->ComposeWith(pmkRight, bOnlyIfNotGeneric, &pResult);
	pmkRight->Release();
	PY_INTERFACE_POSTCALL;
	if (S_OK!=hr) // S_OK only acceptable
		return PyCom_BuildPyException(hr, pMy, IID_IMoniker);
	return PyCom_PyObjectFromIUnknown(pResult, IID_IMoniker, FALSE );
}
Example #20
0
// @pymethod int|PyIExplorerCommand|GetState|Description of GetState.
PyObject *PyIExplorerCommand::GetState(PyObject *self, PyObject *args)
{
	IExplorerCommand *pIEC = GetI(self);
	if ( pIEC == NULL )
		return NULL;
	// @pyparm <o PyIShellItemArray>|psiItemArray||Description for psiItemArray
	// @pyparm int|fOkToBeSlow||Description for fOkToBeSlow
	PyObject *obpsiItemArray;
	IShellItemArray* psiItemArray;
	BOOL fOkToBeSlow;
	if ( !PyArg_ParseTuple(args, "Oi:GetState", &obpsiItemArray, &fOkToBeSlow) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	DWORD cmdState;
	PY_INTERFACE_PRECALL;
	hr = pIEC->GetState(psiItemArray, fOkToBeSlow, &cmdState );
	if (psiItemArray) psiItemArray->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
	return PyLong_FromUnsignedLong(cmdState);
}
Example #21
0
// @pymethod |PyIDebugDocumentText|GetPositionOfContext|Description of GetPositionOfContext.
PyObject *PyIDebugDocumentText::GetPositionOfContext(PyObject *self, PyObject *args)
{
	IDebugDocumentText *pIDDT = GetI(self);
	if ( pIDDT == NULL )
		return NULL;
	// @pyparm <o PyIDebugDocumentContext>|psc||Description for psc
	PyObject *obpsc;
	IDebugDocumentContext *psc;
	ULONG pcCharacterPosition;
	ULONG cNumChars;
	if ( !PyArg_ParseTuple(args, "O:GetPositionOfContext", &obpsc) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsc, IID_IDebugDocumentContext, (void **)&psc, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDDT->GetPositionOfContext( psc, &pcCharacterPosition, &cNumChars );
	psc->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);

	PyObject *pyretval = Py_BuildValue("ii", pcCharacterPosition, cNumChars);
	return pyretval;
}
Example #22
0
// @pymethod unicode|PyIExplorerCommand|GetToolTip|Description of GetToolTip.
PyObject *PyIExplorerCommand::GetToolTip(PyObject *self, PyObject *args)
{
	IExplorerCommand *pIEC = GetI(self);
	if ( pIEC == NULL )
		return NULL;
	// @pyparm <o PyIShellItemArray>|psiItemArray||Description for psiItemArray
	PyObject *obpsiItemArray;
	IShellItemArray * psiItemArray;
	if ( !PyArg_ParseTuple(args, "O:GetToolTip", &obpsiItemArray) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	WCHAR *psz = 0;
	PY_INTERFACE_PRECALL;
	hr = pIEC->GetToolTip(psiItemArray, &psz);
	if (psiItemArray) psiItemArray->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
	PyObject *ret = PyWinObject_FromWCHAR(psz);
	CoTaskMemFree(psz);
	return ret;
}
Example #23
0
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGShellItem::BindToHandler(
		/* [unique][in] */ IBindCtx * pbc,
		/* [in] */ REFGUID bhid,
		/* [in] */ REFIID riid,
		/* [iid_is][out] */ void ** ppv)
{
	PY_GATEWAY_METHOD;
	PyObject *obpbc;
	PyObject *obbhid;
	PyObject *obriid;
	obpbc = PyCom_PyObjectFromIUnknown(pbc, IID_IBindCtx, TRUE);
	obbhid = PyWinObject_FromIID(bhid);
	obriid = PyWinObject_FromIID(riid);
	PyObject *result;
	HRESULT hr=InvokeViaPolicy("BindToHandler", &result, "OOO", obpbc, obbhid, obriid);
	Py_XDECREF(obpbc);
	Py_XDECREF(obbhid);
	Py_XDECREF(obriid);
	if (FAILED(hr)) return hr;
	// Process the Python results, and convert back to the real params
	PyObject *obppv;
	if (!PyArg_Parse(result, "O" , &obppv))
		return MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
	BOOL bPythonIsHappy = TRUE;
	if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppv, riid, (void **)ppv, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
	Py_DECREF(result);
	return hr;
}
// @pymethod |PyIOleObject|SetMoniker|Description of SetMoniker.
PyObject *PyIOleObject::SetMoniker(PyObject *self, PyObject *args)
{
	IOleObject *pIOO = GetI(self);
	if ( pIOO == NULL )
		return NULL;
	// @pyparm int|dwWhichMoniker||Description for dwWhichMoniker
	// @pyparm <o PyIMoniker>|pmk||Description for pmk
	PyObject *obpmk;
	DWORD dwWhichMoniker;
	IMoniker * pmk;
	if ( !PyArg_ParseTuple(args, "iO:SetMoniker", &dwWhichMoniker, &obpmk) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpmk, IID_IMoniker, (void **)&pmk, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOO->SetMoniker( dwWhichMoniker, pmk );
	if (pmk) pmk->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
// @pymethod |PyIDebugApplication|CreateAsyncDebugOperation|Creates an IDebugAsyncOperation object to wrap a provided <o PyIDebugSyncOperation> object.
PyObject *PyIDebugApplication::CreateAsyncDebugOperation(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm This provides a mechanism for language engines to implement asynchronous expression and 
	// evaluation, etc. without having to know the details of synchronization with the 
	// debugger thread. See the descriptions for <o PyIDebugSyncOperation> and <o PyIDebugAsyncOperation> 
	// for more details.  
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugSyncOperation>|psdo||Description for psdo
	PyObject *obpsdo;
	IDebugSyncOperation *psdo;
	IDebugAsyncOperation *ppado;
	if ( !PyArg_ParseTuple(args, "O:CreateAsyncDebugOperation", &obpsdo) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpsdo, IID_IDebugSyncOperation, (void **)&psdo, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->CreateAsyncDebugOperation( psdo, &ppado );
	psdo->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	return PyCom_PyObjectFromIUnknown(ppado, IID_IDebugAsyncOperation, FALSE);
}
// @pymethod |PyIOleObject|InitFromData|Description of InitFromData.
PyObject *PyIOleObject::InitFromData(PyObject *self, PyObject *args)
{
	IOleObject *pIOO = GetI(self);
	if ( pIOO == NULL )
		return NULL;
	// @pyparm <o PyIDataObject>|pDataObject||Description for pDataObject
	// @pyparm int|fCreation||Description for fCreation
	// @pyparm int|dwReserved||Description for dwReserved
	PyObject *obpDataObject;
	IDataObject * pDataObject;
	BOOL fCreation;
	DWORD dwReserved;
	if ( !PyArg_ParseTuple(args, "Oii:InitFromData", &obpDataObject, &fCreation, &dwReserved) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpDataObject, IID_IDataObject, (void **)&pDataObject, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOO->InitFromData( pDataObject, fCreation, dwReserved );
	if (pDataObject) pDataObject->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
// @pymethod |PyIDebugApplication|SynchronousCallInDebuggerThread|Provides a mechanism for the caller to run code in the debugger thread.
PyObject *PyIDebugApplication::SynchronousCallInDebuggerThread(PyObject *self, PyObject *args)
{
	PY_INTERFACE_METHOD;
	// @comm This is generally  
	// used so that language engines and hosts can implement free threaded objects on top  
	// of their single threaded implementations.
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIDebugThreadCall>|pptc||Description for pptc
	// @pyparm int|dwParam1||Description for dwParam1
	// @pyparm int|dwParam2||Description for dwParam2
	// @pyparm int|dwParam3||Description for dwParam3
	PyObject *obpptc;
	IDebugThreadCall *pptc;
	DWORD dwParam1;
	DWORD dwParam2;
	DWORD dwParam3;
	if ( !PyArg_ParseTuple(args, "Oiii:SynchronousCallInDebuggerThread", &obpptc, &dwParam1, &dwParam2, &dwParam3) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpptc, IID_IDebugThreadCall, (void **)&pptc, FALSE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	PY_INTERFACE_PRECALL;
	HRESULT hr = pIDA->SynchronousCallInDebuggerThread( pptc, dwParam1, dwParam2, dwParam3 );
	pptc->Release();
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return SetPythonCOMError(self,hr);
	Py_INCREF(Py_None);
	return Py_None;
}
// @pymethod |PyIOleObject|SetClientSite|Description of SetClientSite.
PyObject *PyIOleObject::SetClientSite(PyObject *self, PyObject *args)
{
	IOleObject *pIOO = GetI(self);
	if ( pIOO == NULL )
		return NULL;
	// @pyparm <o PyIOleClientSite>|pClientSite||Description for pClientSite
	PyObject *obpClientSite;
	IOleClientSite * pClientSite;
	if ( !PyArg_ParseTuple(args, "O:SetClientSite", &obpClientSite) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpClientSite, IID_IOleClientSite, (void **)&pClientSite, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOO->SetClientSite( pClientSite );
	if (pClientSite) pClientSite->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	Py_INCREF(Py_None);
	return Py_None;

}
// @pymethod |PyIDebugApplication|AddGlobalExpressionContextProvider|Description of AddGlobalExpressionContextProvider.
PyObject *PyIDebugApplication::AddGlobalExpressionContextProvider(PyObject *self, PyObject *args)
{
	IDebugApplication *pIDA = GetI(self);
	if ( pIDA == NULL )
		return NULL;
	// @pyparm <o PyIProvideExpressionContexts>|pdsfs||Description for pdsfs
	PyObject *obpdsfs;
	IProvideExpressionContexts * pdsfs;
#ifdef _WIN64
	DWORDLONG pdwCookie;
#else
	DWORD pdwCookie;
#endif
	if ( !PyArg_ParseTuple(args, "O:AddGlobalExpressionContextProvider", &obpdsfs) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpdsfs, IID_IProvideExpressionContexts, (void **)&pdsfs, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIDA->AddGlobalExpressionContextProvider( pdsfs, &pdwCookie );
	if (pdsfs) pdsfs->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);

	PyObject *pyretval = Py_BuildValue("i", pdwCookie);
	return pyretval;
}
// @pymethod |PyIOleObject|Advise|Description of Advise.
PyObject *PyIOleObject::Advise(PyObject *self, PyObject *args)
{
	IOleObject *pIOO = GetI(self);
	if ( pIOO == NULL )
		return NULL;
	// @pyparm <o PyIAdviseSink>|pAdvSink||Description for pAdvSink
	PyObject *obpAdvSink;
	IAdviseSink * pAdvSink;
	DWORD pdwConnection;
	if ( !PyArg_ParseTuple(args, "O:Advise", &obpAdvSink) )
		return NULL;
	BOOL bPythonIsHappy = TRUE;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obpAdvSink, IID_IAdviseSink, (void **)&pAdvSink, TRUE /* bNoneOK */))
		 bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIOO->Advise( pAdvSink, &pdwConnection );
	if (pAdvSink) pAdvSink->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);

	PyObject *pyretval = Py_BuildValue("i", pdwConnection);
	return pyretval;
}