Update of /cvsroot/pywin32/pywin32/com/win32comext/internet/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22835/com/win32comext/internet/src
Modified Files:
internet.cpp
Added Files:
PyIDocHostUIHandler.cpp PyIDocHostUIHandler.h
PyIHTMLOMWindowServices.cpp PyIHTMLOMWindowServices.h
PyIInternetSecurityManager.cpp PyIInternetSecurityManager.h
Log Message:
win32com.internet gets support for IDocHostUIHandler, IHTMLOMWindowServices
and IInternetSecurityManager interfaces, and CoInternetCreateSecurityManager
function.
--- NEW FILE: PyIHTMLOMWindowServices.cpp ---
// This file implements the IHTMLOMWindowServices Interface and Gateway for Python.
// Generated by makegw.py
#include "internet_pch.h"
#include "MsHtmHst.h"
#include "PyIHTMLOMWindowServices.h"
// @doc - This file contains autoduck documentation
// Gateway Implementation
STDMETHODIMP PyGHTMLOMWindowServices::moveTo(
/* [in] */ LONG x,
/* [in] */ LONG y)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("moveTo", NULL, "ll", x, y);
}
STDMETHODIMP PyGHTMLOMWindowServices::moveBy(
/* [in] */ LONG x,
/* [in] */ LONG y)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("moveBy", NULL, "ll", x, y);
}
STDMETHODIMP PyGHTMLOMWindowServices::resizeTo(
/* [in] */ LONG x,
/* [in] */ LONG y)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("resizeTo", NULL, "ll", x, y);
}
STDMETHODIMP PyGHTMLOMWindowServices::resizeBy(
/* [in] */ LONG x,
/* [in] */ LONG y)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("resizeBy", NULL, "ll", x, y);
}
Index: internet.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/internet/src/internet.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** internet.cpp 22 Oct 2007 04:35:24 -0000 1.4
--- internet.cpp 2 Nov 2008 12:50:01 -0000 1.5
***************
*** 14,20 ****
--- 14,23 ----
#include "internet_pch.h"
+ #include "MsHtmHst.h"
#include "stddef.h" // for offsetof
#include "PythonCOMRegister.h" // For simpler registration of IIDs etc.
+ #include "PyIDocHostUIHandler.h"
+ #include "PyIHTMLOMWindowServices.h"
#include "PyIInternetProtocolRoot.h"
#include "PyIInternetProtocol.h"
***************
*** 23,26 ****
--- 26,30 ----
#include "PyIInternetPriority.h"
#include "PyIInternetBindInfo.h"
+ #include "PyIInternetSecurityManager.h"
// Check a function pointer that is supplied by a specific IE version (ie,
***************
*** 34,37 ****
--- 38,46 ----
static CoInternetIsFeatureEnabled_func pfnCoInternetIsFeatureEnabled=NULL;
+ typedef HRESULT (WINAPI *CoInternetCreateSecurityManager_func)(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved);
+ static CoInternetCreateSecurityManager_func pfnCoInternetCreateSecurityManager=NULL;
+
+ // STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved);
+
HMODULE loadmodule(TCHAR *dllname)
{
***************
*** 185,188 ****
--- 194,226 ----
}
+ // @pymethod <o PyIInternetSecurityManager>|internet|CoInternetCreateSecurityManager|
+ static PyObject *PyCoInternetCreateSecurityManager(PyObject *self, PyObject *args)
+ {
+ CHECK_IE_PFN(CoInternetCreateSecurityManager);
+ PyObject *obprov;
+ DWORD reserved;
+ if (!PyArg_ParseTuple(args, "Oi",
+ &obprov, // &pyparm <o PyIServiceProvider>|serviceProvider||
+ &reserved)) // @pyparm int|reserved||
+ return NULL;
+ IServiceProvider *prov;
+ if (!PyCom_InterfaceFromPyInstanceOrObject(obprov, IID_IServiceProvider, (void **)&prov, TRUE /* bNoneOK */))
+ return NULL;
+ HRESULT hr;
+ IInternetSecurityManager *sm = 0;
+ PY_INTERFACE_PRECALL;
+ hr = (*pfnCoInternetCreateSecurityManager)(prov, &sm, reserved);
+ prov->Release();
+ PY_INTERFACE_POSTCALL;
+ if (FAILED(hr))
+ return PyCom_BuildPyException(hr);
+ return PyCom_PyObjectFromIUnknown(sm, IID_IInternetSecurityManager, FALSE);
+
+ }
+
+ STDAPI CoInternetCreateSecurityManager(IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved);
+
+ STDAPI CoInternetCreateZoneManager(IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved);
+
/* List of module functions */
***************
*** 190,193 ****
--- 228,232 ----
static struct PyMethodDef internet_methods[]=
{
+ { "CoInternetCreateSecurityManager", PyCoInternetCreateSecurityManager}, // @pymeth CoInternetCreateSecurityManager|
{ "CoInternetIsFeatureEnabled", PyCoInternetIsFeatureEnabled}, // @pymeth CoInternetIsFeatureEnabled|
{ "CoInternetSetFeatureEnabled", PyCoInternetSetFeatureEnabled}, // @pymeth CoInternetSetFeatureEnabled|
***************
*** 211,214 ****
--- 250,255 ----
static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] =
{
+ PYCOM_INTERFACE_FULL (DocHostUIHandler),
+ PYCOM_INTERFACE_SERVER_ONLY(HTMLOMWindowServices),
PYCOM_INTERFACE_FULL (InternetProtocolRoot),
PYCOM_INTERFACE_FULL (InternetProtocol),
***************
*** 217,220 ****
--- 258,262 ----
PYCOM_INTERFACE_FULL (InternetPriority),
PYCOM_INTERFACE_FULL (InternetBindInfo),
+ PYCOM_INTERFACE_FULL (InternetSecurityManager),
};
***************
*** 239,242 ****
--- 281,285 ----
pfnCoInternetSetFeatureEnabled=(CoInternetSetFeatureEnabled_func)loadapifunc("CoInternetSetFeatureEnabled", urlmon_dll);
pfnCoInternetIsFeatureEnabled=(CoInternetIsFeatureEnabled_func)loadapifunc("CoInternetIsFeatureEnabled", urlmon_dll);
+ pfnCoInternetCreateSecurityManager=(CoInternetCreateSecurityManager_func)loadapifunc("CoInternetCreateSecurityManager", urlmon_dll);
ADD_CONSTANT(FEATURE_OBJECT_CACHING); // @const internet|FEATURE_OBJECT_CACHING|
--- NEW FILE: PyIDocHostUIHandler.h ---
// This file declares the IDocHostUIHandler Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
class PyIDocHostUIHandler : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIDocHostUIHandler);
static IDocHostUIHandler *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *ShowContextMenu(PyObject *self, PyObject *args);
static PyObject *GetHostInfo(PyObject *self, PyObject *args);
static PyObject *ShowUI(PyObject *self, PyObject *args);
static PyObject *HideUI(PyObject *self, PyObject *args);
static PyObject *UpdateUI(PyObject *self, PyObject *args);
static PyObject *EnableModeless(PyObject *self, PyObject *args);
static PyObject *OnDocWindowActivate(PyObject *self, PyObject *args);
static PyObject *OnFrameWindowActivate(PyObject *self, PyObject *args);
static PyObject *ResizeBorder(PyObject *self, PyObject *args);
static PyObject *TranslateAccelerator(PyObject *self, PyObject *args);
static PyObject *GetOptionKeyPath(PyObject *self, PyObject *args);
static PyObject *GetDropTarget(PyObject *self, PyObject *args);
static PyObject *GetExternal(PyObject *self, PyObject *args);
static PyObject *TranslateUrl(PyObject *self, PyObject *args);
static PyObject *FilterDataObject(PyObject *self, PyObject *args);
protected:
PyIDocHostUIHandler(IUnknown *pdisp);
~PyIDocHostUIHandler();
};
// ---------------------------------------------------
//
// Gateway Declaration
class PyGDocHostUIHandler : public PyGatewayBase, public IDocHostUIHandler
{
protected:
PyGDocHostUIHandler(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGDocHostUIHandler, IDocHostUIHandler, IID_IDocHostUIHandler, PyGatewayBase)
// IDocHostUIHandler
STDMETHOD(ShowContextMenu)(
DWORD dwID,
POINT * ppt,
IUnknown * pcmdtReserved,
IDispatch * pdispReserved);
STDMETHOD(GetHostInfo)(
DOCHOSTUIINFO * pInfo);
STDMETHOD(ShowUI)(
DWORD dwID,
IOleInPlaceActiveObject * pActiveObject,
IOleCommandTarget * pCommandTarget,
IOleInPlaceFrame * pFrame,
IOleInPlaceUIWindow * pDoc);
STDMETHOD(HideUI)(
void);
STDMETHOD(UpdateUI)(
void);
STDMETHOD(EnableModeless)(
BOOL fEnable);
STDMETHOD(OnDocWindowActivate)(
BOOL fActivate);
STDMETHOD(OnFrameWindowActivate)(
BOOL fActivate);
STDMETHOD(ResizeBorder)(
LPCRECT prcBorder,
IOleInPlaceUIWindow * pUIWindow,
BOOL fRameWindow);
STDMETHOD(TranslateAccelerator)(
LPMSG lpMsg,
const GUID * pguidCmdGroup,
DWORD nCmdID);
STDMETHOD(GetOptionKeyPath)(
LPOLESTR * pchKey,
DWORD dw);
STDMETHOD(GetDropTarget)(
IDropTarget * pDropTarget,
IDropTarget ** ppDropTarget);
STDMETHOD(GetExternal)(
IDispatch ** ppDispatch);
STDMETHOD(TranslateUrl)(
DWORD dwTranslate,
OLECHAR * pchURLIn,
OLECHAR ** ppchURLOut);
STDMETHOD(FilterDataObject)(
IDataObject * pDO,
IDataObject ** ppDORet);
};
--- NEW FILE: PyIHTMLOMWindowServices.h ---
// This file declares the IHTMLOMWindowServices Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Gateway Declaration
class PyGHTMLOMWindowServices : public PyGatewayBase, public IHTMLOMWindowServices
{
protected:
PyGHTMLOMWindowServices(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGHTMLOMWindowServices, IHTMLOMWindowServices, IID_IHTMLOMWindowServices, PyGatewayBase)
// IHTMLOMWindowServices
STDMETHOD(moveTo)(
LONG x,
LONG y);
STDMETHOD(moveBy)(
LONG x,
LONG y);
STDMETHOD(resizeTo)(
LONG x,
LONG y);
STDMETHOD(resizeBy)(
LONG x,
LONG y);
};
--- NEW FILE: PyIInternetSecurityManager.h ---
// This file declares the IInternetSecurityManager Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
#include "internet_pch.h"
class PyIInternetSecurityManager : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIInternetSecurityManager);
static IInternetSecurityManager *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *SetSecuritySite(PyObject *self, PyObject *args);
static PyObject *GetSecuritySite(PyObject *self, PyObject *args);
static PyObject *MapUrlToZone(PyObject *self, PyObject *args);
static PyObject *GetSecurityId(PyObject *self, PyObject *args);
static PyObject *ProcessUrlAction(PyObject *self, PyObject *args);
static PyObject *QueryCustomPolicy(PyObject *self, PyObject *args);
static PyObject *SetZoneMapping(PyObject *self, PyObject *args);
static PyObject *GetZoneMappings(PyObject *self, PyObject *args);
protected:
PyIInternetSecurityManager(IUnknown *pdisp);
~PyIInternetSecurityManager();
};
// ---------------------------------------------------
//
// Gateway Declaration
class PyGInternetSecurityManager : public PyGatewayBase, public IInternetSecurityManager
{
protected:
PyGInternetSecurityManager(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGInternetSecurityManager, IInternetSecurityManager, IID_IInternetSecurityManager, PyGatewayBase)
// IInternetSecurityManager
STDMETHOD(SetSecuritySite)(
IInternetSecurityMgrSite * pSite);
STDMETHOD(GetSecuritySite)(
IInternetSecurityMgrSite ** ppSite);
STDMETHOD(MapUrlToZone)(
LPCWSTR pwszUrl,
DWORD * pdwZone,
DWORD dwFlags);
STDMETHOD(GetSecurityId)(
LPCWSTR pwszUrl,
BYTE * pbSecurityId,
DWORD * pcbSecurityId,
DWORD_PTR dwReserved);
STDMETHOD(ProcessUrlAction)(
LPCWSTR pwszUrl,
DWORD dwAction,
BYTE * pPolicy,
DWORD cbPolicy,
BYTE * pContext,
DWORD cbContext,
DWORD dwFlags,
DWORD dwReserved);
STDMETHOD(QueryCustomPolicy)(
LPCWSTR pwszUrl,
REFGUID guidKey,
BYTE ** ppPolicy,
DWORD * pcbPolicy,
BYTE * pContext,
DWORD cbContext,
DWORD dwReserved);
STDMETHOD(SetZoneMapping)(
DWORD dwZone,
LPCWSTR lpszPattern,
DWORD dwFlags);
STDMETHOD(GetZoneMappings)(
DWORD dwZone,
IEnumString ** ppenumString,
DWORD dwFlags);
};
--- NEW FILE: PyIDocHostUIHandler.cpp ---
// This file implements the IDocHostUIHandler Interface and Gateway for Python.
// Generated by makegw.py
#include "internet_pch.h"
#include "MsHtmHst.h"
#include "PyIDocHostUIHandler.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIDocHostUIHandler::PyIDocHostUIHandler(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIDocHostUIHandler::~PyIDocHostUIHandler()
{
}
/* static */ IDocHostUIHandler *PyIDocHostUIHandler::GetI(PyObject *self)
{
return (IDocHostUIHandler *)PyIUnknown::GetI(self);
}
// @pymethod |PyIDocHostUIHandler|ShowContextMenu|Description of ShowContextMenu.
PyObject *PyIDocHostUIHandler::ShowContextMenu(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|dwID||Description for dwID
POINT pt;
// @pyparm (int, int)|pt||Description for ppt
// @pyparm <o PyIUnknown>|pcmdtReserved||Description for pcmdtReserved
// @pyparm <o PyIDispatch>|pdispReserved||Description for pdispReserved
PyObject *obpcmdtReserved;
PyObject *obpdispReserved;
DWORD dwID;
IUnknown * pcmdtReserved;
IDispatch * pdispReserved;
if ( !PyArg_ParseTuple(args, "l(ii)OO:ShowContextMenu", &dwID, &pt.x, &pt.y,
&obpcmdtReserved, &obpdispReserved) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpcmdtReserved, IID_IUnknown, (void **)&pcmdtReserved, TRUE /* bNoneOK */))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpdispReserved, IID_IDispatch, (void **)&pdispReserved, TRUE /* bNoneOK */)) {
if (pcmdtReserved) pcmdtReserved->Release();
return NULL;
}
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->ShowContextMenu( dwID, &pt, pcmdtReserved, pdispReserved );
if (pcmdtReserved) pcmdtReserved->Release();
if (pdispReserved) pdispReserved->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|GetHostInfo|Description of GetHostInfo.
PyObject *PyIDocHostUIHandler::GetHostInfo(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
DOCHOSTUIINFO info;
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
if ( !PyArg_ParseTuple(args, ":GetHostInfo"))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->GetHostInfo(&info);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler);
return Py_BuildValue("iiNN", info.dwFlags, info.dwDoubleClick,
MakeOLECHARToObj(info.pchHostCss),
MakeOLECHARToObj(info.pchHostNS));
}
// @pymethod |PyIDocHostUIHandler|ShowUI|Description of ShowUI.
PyObject *PyIDocHostUIHandler::ShowUI(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|dwID||Description for dwID
// @pyparm <o PyIOleInPlaceActiveObject>|pActiveObject||Description for pActiveObject
// @pyparm <o PyIOleCommandTarget>|pCommandTarget||Description for pCommandTarget
// @pyparm <o PyIOleInPlaceFrame>|pFrame||Description for pFrame
// @pyparm <o PyIOleInPlaceUIWindow>|pDoc||Description for pDoc
PyObject *obpActiveObject;
PyObject *obpCommandTarget;
PyObject *obpFrame;
PyObject *obpDoc;
DWORD dwID;
if ( !PyArg_ParseTuple(args, "lOOOO:ShowUI", &dwID, &obpActiveObject, &obpCommandTarget, &obpFrame, &obpDoc) )
return NULL;
IOleInPlaceActiveObject * pActiveObject;
IOleCommandTarget * pCommandTarget;
IOleInPlaceFrame * pFrame;
IOleInPlaceUIWindow * pDoc;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpActiveObject, IID_IOleInPlaceActiveObject, (void **)&pActiveObject, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpCommandTarget, IID_IOleCommandTarget, (void **)&pCommandTarget, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpFrame, IID_IOleInPlaceFrame, (void **)&pFrame, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDoc, IID_IOleInPlaceUIWindow, (void **)&pDoc, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->ShowUI( dwID, pActiveObject, pCommandTarget, pFrame, pDoc );
if (pActiveObject) pActiveObject->Release();
if (pCommandTarget) pCommandTarget->Release();
if (pFrame) pFrame->Release();
if (pDoc) pDoc->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|HideUI|Description of HideUI.
PyObject *PyIDocHostUIHandler::HideUI(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":HideUI") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->HideUI( );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|UpdateUI|Description of UpdateUI.
PyObject *PyIDocHostUIHandler::UpdateUI(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":UpdateUI") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->UpdateUI( );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|EnableModeless|Description of EnableModeless.
PyObject *PyIDocHostUIHandler::EnableModeless(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|fEnable||Description for fEnable
BOOL fEnable;
if ( !PyArg_ParseTuple(args, "i:EnableModeless", &fEnable) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->EnableModeless( fEnable );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|OnDocWindowActivate|Description of OnDocWindowActivate.
PyObject *PyIDocHostUIHandler::OnDocWindowActivate(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|fActivate||Description for fActivate
BOOL fActivate;
if ( !PyArg_ParseTuple(args, "i:OnDocWindowActivate", &fActivate) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->OnDocWindowActivate( fActivate );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|OnFrameWindowActivate|Description of OnFrameWindowActivate.
PyObject *PyIDocHostUIHandler::OnFrameWindowActivate(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|fActivate||Description for fActivate
BOOL fActivate;
if ( !PyArg_ParseTuple(args, "i:OnFrameWindowActivate", &fActivate) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->OnFrameWindowActivate( fActivate );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|ResizeBorder|Description of ResizeBorder.
PyObject *PyIDocHostUIHandler::ResizeBorder(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
RECT border;
// @pyparm (int, int, int, int)|prcBorder||Description for prcBorder
// @pyparm <o PyIOleInPlaceUIWindow>|pUIWindow||Description for pUIWindow
// @pyparm int|fRameWindow||Description for fRameWindow
PyObject *obpUIWindow;
IOleInPlaceUIWindow * pUIWindow;
BOOL fRameWindow;
if ( !PyArg_ParseTuple(args, "(iiii)Oi:ResizeBorder",
&border.left, &border.top, &border.right, &border.bottom,
&obpUIWindow, &fRameWindow) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpUIWindow, IID_IOleInPlaceUIWindow, (void **)&pUIWindow, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->ResizeBorder(&border, pUIWindow, fRameWindow );
if (pUIWindow) pUIWindow->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|TranslateAccelerator|Description of TranslateAccelerator.
PyObject *PyIDocHostUIHandler::TranslateAccelerator(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
MSG msg;
PyObject *oblpMsg;
// @pyparm <o PyLPMSG>|lpMsg||Description for lpMsg
// @pyparm <o PyIID>|pguidCmdGroup||Description for pguidCmdGroup
// @pyparm int|nCmdID||Description for nCmdID
PyObject *obpguidCmdGroup;
IID guidCmdGroup;
DWORD nCmdID;
if ( !PyArg_ParseTuple(args, "OOl:TranslateAccelerator", &oblpMsg, &obpguidCmdGroup, &nCmdID) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsMSG(oblpMsg, &msg)) bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obpguidCmdGroup, &guidCmdGroup)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->TranslateAccelerator(&msg, &guidCmdGroup, nCmdID );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyInt_FromLong(hr);
}
// @pymethod |PyIDocHostUIHandler|GetOptionKeyPath|Description of GetOptionKeyPath.
PyObject *PyIDocHostUIHandler::GetOptionKeyPath(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|dw||Description for dw
LPOLESTR pchKey;
DWORD dw;
if ( !PyArg_ParseTuple(args, "l:GetOptionKeyPath", &dw) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->GetOptionKeyPath( &pchKey, dw );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
PyObject *pyretval = MakeOLECHARToObj(pchKey);
CoTaskMemFree(pchKey);
return pyretval;
}
// @pymethod |PyIDocHostUIHandler|GetDropTarget|Description of GetDropTarget.
PyObject *PyIDocHostUIHandler::GetDropTarget(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm <o PyIDropTarget>|pDropTarget||Description for pDropTarget
PyObject *obpDropTarget;
IDropTarget * pDropTarget;
IDropTarget * ppDropTarget;
if ( !PyArg_ParseTuple(args, "O:GetDropTarget", &obpDropTarget) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpDropTarget, IID_IDropTarget, (void **)&pDropTarget, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->GetDropTarget( pDropTarget, &ppDropTarget );
if (pDropTarget) pDropTarget->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyCom_PyObjectFromIUnknown(ppDropTarget, IID_IDropTarget, FALSE);
}
// @pymethod |PyIDocHostUIHandler|GetExternal|Description of GetExternal.
PyObject *PyIDocHostUIHandler::GetExternal(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
IDispatch * ppDispatch;
if ( !PyArg_ParseTuple(args, ":GetExternal") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->GetExternal( &ppDispatch );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyCom_PyObjectFromIUnknown(ppDispatch, IID_IDispatch, FALSE);
}
// @pymethod |PyIDocHostUIHandler|TranslateUrl|Description of TranslateUrl.
PyObject *PyIDocHostUIHandler::TranslateUrl(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm int|dwTranslate||Description for dwTranslate
// @pyparm <o unicode>|pchURLIn||Description for pchURLIn
PyObject *obpchURLIn;
DWORD dwTranslate;
OLECHAR *pchURLIn;
OLECHAR *pchURLOut = 0;
if ( !PyArg_ParseTuple(args, "lO:TranslateUrl", &dwTranslate, &obpchURLIn) )
return NULL;
if (!PyWinObject_AsWCHAR(obpchURLIn, &pchURLIn))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->TranslateUrl( dwTranslate, pchURLIn, &pchURLOut);
PyWinObject_FreeWCHAR(pchURLIn);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
PyObject *pyretval = MakeOLECHARToObj(pchURLOut);
CoTaskMemFree(pchURLOut);
return pyretval;
}
// @pymethod |PyIDocHostUIHandler|FilterDataObject|Description of FilterDataObject.
PyObject *PyIDocHostUIHandler::FilterDataObject(PyObject *self, PyObject *args)
{
IDocHostUIHandler *pIDHUIH = GetI(self);
if ( pIDHUIH == NULL )
return NULL;
// @pyparm <o PyIDataObject>|pDO||Description for pDO
PyObject *obpDO;
IDataObject * pDO;
IDataObject * ppDORet;
if ( !PyArg_ParseTuple(args, "O:FilterDataObject", &obpDO) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpDO, IID_IDataObject, (void **)&pDO, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->FilterDataObject( pDO, &ppDORet );
if (pDO) pDO->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler );
return PyCom_PyObjectFromIUnknown(ppDORet, IID_IDataObject, FALSE);
}
// @object PyIDocHostUIHandler|Description of the interface
static struct PyMethodDef PyIDocHostUIHandler_methods[] =
{
{ "ShowContextMenu", PyIDocHostUIHandler::ShowContextMenu, 1 }, // @pymeth ShowContextMenu|Description of ShowContextMenu
{ "GetHostInfo", PyIDocHostUIHandler::GetHostInfo, 1 }, // @pymeth GetHostInfo|Description of GetHostInfo
{ "ShowUI", PyIDocHostUIHandler::ShowUI, 1 }, // @pymeth ShowUI|Description of ShowUI
{ "HideUI", PyIDocHostUIHandler::HideUI, 1 }, // @pymeth HideUI|Description of HideUI
{ "UpdateUI", PyIDocHostUIHandler::UpdateUI, 1 }, // @pymeth UpdateUI|Description of UpdateUI
{ "EnableModeless", PyIDocHostUIHandler::EnableModeless, 1 }, // @pymeth EnableModeless|Description of EnableModeless
{ "OnDocWindowActivate", PyIDocHostUIHandler::OnDocWindowActivate, 1 }, // @pymeth OnDocWindowActivate|Description of OnDocWindowActivate
{ "OnFrameWindowActivate", PyIDocHostUIHandler::OnFrameWindowActivate, 1 }, // @pymeth OnFrameWindowActivate|Description of OnFrameWindowActivate
{ "ResizeBorder", PyIDocHostUIHandler::ResizeBorder, 1 }, // @pymeth ResizeBorder|Description of ResizeBorder
{ "TranslateAccelerator", PyIDocHostUIHandler::TranslateAccelerator, 1 }, // @pymeth TranslateAccelerator|Description of TranslateAccelerator
{ "GetOptionKeyPath", PyIDocHostUIHandler::GetOptionKeyPath, 1 }, // @pymeth GetOptionKeyPath|Description of GetOptionKeyPath
{ "GetDropTarget", PyIDocHostUIHandler::GetDropTarget, 1 }, // @pymeth GetDropTarget|Description of GetDropTarget
{ "GetExternal", PyIDocHostUIHandler::GetExternal, 1 }, // @pymeth GetExternal|Description of GetExternal
{ "TranslateUrl", PyIDocHostUIHandler::TranslateUrl, 1 }, // @pymeth TranslateUrl|Description of TranslateUrl
{ "FilterDataObject", PyIDocHostUIHandler::FilterDataObject, 1 }, // @pymeth FilterDataObject|Description of FilterDataObject
{ NULL }
};
PyComTypeObject PyIDocHostUIHandler::type("PyIDocHostUIHandler",
&PyIUnknown::type,
sizeof(PyIDocHostUIHandler),
PyIDocHostUIHandler_methods,
GET_PYCOM_CTOR(PyIDocHostUIHandler));
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGDocHostUIHandler::ShowContextMenu(
/* [in] */ DWORD dwID,
/* [in] */ POINT * ppt,
/* [in] */ IUnknown * pcmdtReserved,
/* [in] */ IDispatch * pdispReserved)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("ShowContextMenu", NULL, "l(ii)NO",
dwID, ppt->x, ppt->y,
PyCom_PyObjectFromIUnknown(pcmdtReserved, IID_IUnknown, TRUE),
PyCom_PyObjectFromIUnknown(pdispReserved, IID_IDispatch, TRUE));
}
STDMETHODIMP PyGDocHostUIHandler::GetHostInfo(
/* [out][in] */ DOCHOSTUIINFO * pInfo)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetHostInfo", &result, "");
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obhostcss, *obhostns;
if (!PyArg_ParseTuple(result, "iiOO", &pInfo->dwFlags, &pInfo->dwDoubleClick, &obhostcss, &obhostns) ||
!PyWinObject_AsTaskAllocatedWCHAR(obhostcss, &pInfo->pchHostCss, TRUE, NULL) ||
!PyWinObject_AsTaskAllocatedWCHAR(obhostns, &pInfo->pchHostNS, TRUE, NULL))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetHostInfo");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::ShowUI(
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject * pActiveObject,
/* [in] */ IOleCommandTarget * pCommandTarget,
/* [in] */ IOleInPlaceFrame * pFrame,
/* [in] */ IOleInPlaceUIWindow * pDoc)
{
PY_GATEWAY_METHOD;
PyObject *obpActiveObject;
PyObject *obpCommandTarget;
PyObject *obpFrame;
PyObject *obpDoc;
obpActiveObject = PyCom_PyObjectFromIUnknown(pActiveObject, IID_IOleInPlaceActiveObject, TRUE);
obpCommandTarget = PyCom_PyObjectFromIUnknown(pCommandTarget, IID_IOleCommandTarget, TRUE);
obpFrame = PyCom_PyObjectFromIUnknown(pFrame, IID_IOleInPlaceFrame, TRUE);
obpDoc = PyCom_PyObjectFromIUnknown(pDoc, IID_IOleInPlaceUIWindow, TRUE);
HRESULT hr=InvokeViaPolicy("ShowUI", NULL, "lOOOO", dwID, obpActiveObject, obpCommandTarget, obpFrame, obpDoc);
Py_XDECREF(obpActiveObject);
Py_XDECREF(obpCommandTarget);
Py_XDECREF(obpFrame);
Py_XDECREF(obpDoc);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::HideUI(
void)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("HideUI", NULL);
}
STDMETHODIMP PyGDocHostUIHandler::UpdateUI(
void)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("UpdateUI", NULL);
}
STDMETHODIMP PyGDocHostUIHandler::EnableModeless(
/* [in] */ BOOL fEnable)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("EnableModeless", NULL, "i", fEnable);
}
STDMETHODIMP PyGDocHostUIHandler::OnDocWindowActivate(
/* [in] */ BOOL fActivate)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("OnDocWindowActivate", NULL, "i", fActivate);
}
STDMETHODIMP PyGDocHostUIHandler::OnFrameWindowActivate(
/* [in] */ BOOL fActivate)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("OnFrameWindowActivate", NULL, "i", fActivate);
}
STDMETHODIMP PyGDocHostUIHandler::ResizeBorder(
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow * pUIWindow,
/* [in] */ BOOL fRameWindow)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("ResizeBorder", NULL, "(iiii)Ni",
prcBorder->left, prcBorder->top, prcBorder->right, prcBorder->bottom,
PyCom_PyObjectFromIUnknown(pUIWindow, IID_IOleInPlaceUIWindow, TRUE),
fRameWindow);
}
STDMETHODIMP PyGDocHostUIHandler::TranslateAccelerator(
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID * pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("TranslateAccelerator", NULL, "NNl",
PyWinObject_FromMSG(lpMsg),
PyWinObject_FromIID(*pguidCmdGroup),
nCmdID);
}
STDMETHODIMP PyGDocHostUIHandler::GetOptionKeyPath(
/* [out] */ LPOLESTR * pchKey,
/* [in] */ DWORD dw)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetOptionKeyPath", &result, "l", dw);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyWinObject_AsTaskAllocatedWCHAR(result, pchKey, FALSE, NULL))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetOptionKeyPath");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::GetDropTarget(
/* [in] */ IDropTarget * pDropTarget,
/* [out] */ IDropTarget ** ppDropTarget)
{
PY_GATEWAY_METHOD;
if (ppDropTarget==NULL) return E_POINTER;
PyObject *obpDropTarget;
obpDropTarget = PyCom_PyObjectFromIUnknown(pDropTarget, IID_IDropTarget, TRUE);
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetDropTarget", &result, "O", obpDropTarget);
Py_XDECREF(obpDropTarget);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDropTarget, (void **)ppDropTarget, TRUE /* bNoneOK */))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetDropTarget");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::GetExternal(
/* [out] */ IDispatch ** ppDispatch)
{
PY_GATEWAY_METHOD;
if (ppDispatch==NULL) return E_POINTER;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetExternal", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDispatch, (void **)ppDispatch, TRUE /* bNoneOK */))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetExternal");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::TranslateUrl(
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR * pchURLIn,
/* [out] */ OLECHAR ** ppchURLOut)
{
PY_GATEWAY_METHOD;
if (ppchURLOut==NULL) return E_POINTER;
PyObject *obpchURLIn;
obpchURLIn = MakeOLECHARToObj(pchURLIn);
PyObject *result;
HRESULT hr=InvokeViaPolicy("TranslateUrl", &result, "lO", dwTranslate, obpchURLIn);
Py_XDECREF(obpchURLIn);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyWinObject_AsTaskAllocatedWCHAR(result, ppchURLOut, FALSE, NULL))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("TranslateUrl");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGDocHostUIHandler::FilterDataObject(
/* [in] */ IDataObject * pDO,
/* [out] */ IDataObject ** ppDORet)
{
PY_GATEWAY_METHOD;
if (ppDORet==NULL) return E_POINTER;
PyObject *obpDO;
obpDO = PyCom_PyObjectFromIUnknown(pDO, IID_IDataObject, TRUE);
PyObject *result;
HRESULT hr=InvokeViaPolicy("FilterDataObject", &result, "O", obpDO);
Py_XDECREF(obpDO);
if (FAILED(hr)) return hr;
if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IDataObject, (void **)ppDORet, TRUE /* bNoneOK */))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("FilterDataObject");
Py_DECREF(result);
return hr;
}
--- NEW FILE: PyIInternetSecurityManager.cpp ---
// This file implements the IInternetSecurityManager Interface and Gateway for Python.
// Generated by makegw.py
#include "internet_pch.h"
#include "PyIInternetSecurityManager.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIInternetSecurityManager::PyIInternetSecurityManager(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIInternetSecurityManager::~PyIInternetSecurityManager()
{
}
/* static */ IInternetSecurityManager *PyIInternetSecurityManager::GetI(PyObject *self)
{
return (IInternetSecurityManager *)PyIUnknown::GetI(self);
}
// @pymethod |PyIInternetSecurityManager|SetSecuritySite|Description of SetSecuritySite.
PyObject *PyIInternetSecurityManager::SetSecuritySite(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm <o PyIInternetSecurityMgrSite>|pSite||Description for pSite
PyObject *obpSite;
IInternetSecurityMgrSite * pSite;
if (!PyArg_ParseTuple(args, "O:SetSecuritySite", &obpSite))
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpSite, IID_IInternetSecurityMgrSite, (void **)&pSite, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->SetSecuritySite( pSite );
if (pSite) pSite->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIInternetSecurityManager|GetSecuritySite|Description of GetSecuritySite.
PyObject *PyIInternetSecurityManager::GetSecuritySite(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
IInternetSecurityMgrSite * ppSite;
if ( !PyArg_ParseTuple(args, ":GetSecuritySite") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->GetSecuritySite(&ppSite);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
return PyCom_PyObjectFromIUnknown(ppSite, IID_IInternetSecurityMgrSite, FALSE);
}
// @pymethod |PyIInternetSecurityManager|MapUrlToZone|Description of MapUrlToZone.
PyObject *PyIInternetSecurityManager::MapUrlToZone(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm <o unicode>|pwszUrl||Description for pwszUrl
// @pyparm int|dwFlags||Description for dwFlags
PyObject *obpwszUrl;
LPWSTR pwszUrl;
DWORD pdwZone;
DWORD dwFlags;
if (!PyArg_ParseTuple(args, "Ol:MapUrlToZone", &obpwszUrl, &dwFlags))
return NULL;
if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->MapUrlToZone( pwszUrl, &pdwZone, dwFlags );
SysFreeString(pwszUrl);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
return PyInt_FromLong(pdwZone);
}
// @pymethod |PyIInternetSecurityManager|GetSecurityId|Description of GetSecurityId.
PyObject *PyIInternetSecurityManager::GetSecurityId(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm <o unicode>|pwszUrl||Description for pwszUrl
// @pyparm int|pcbSecurityId||Description for pcbSecurityId
DWORD_PTR dwReserved = 0;
PyObject *obdwReserved = Py_None;
// ACK - 'reserved' docs appears to indicate its actually a string.
// so ignore it for now.
PyObject *obpwszUrl;
LPWSTR pwszUrl;
if ( !PyArg_ParseTuple(args, "O:GetSecurityId", &obpwszUrl) )
return NULL;
if (!PyWinObject_AsBstr(obpwszUrl, &pwszUrl))
return NULL;
BYTE buf[1024]; // big enough?
DWORD cbSecurityId = sizeof(buf);
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->GetSecurityId( pwszUrl, buf, &cbSecurityId, 0);
SysFreeString(pwszUrl);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
return PyString_FromStringAndSize((char *)buf, cbSecurityId);
}
// @pymethod |PyIInternetSecurityManager|ProcessUrlAction|Description of ProcessUrlAction.
PyObject *PyIInternetSecurityManager::ProcessUrlAction(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm <o unicode>|pwszUrl||Description for pwszUrl
// @pyparm int|dwAction||Description for dwAction
// @pyparm int|dwFlags||Description for dwFlags
PyObject *obpwszUrl;
LPWSTR pwszUrl;
DWORD dwAction;
PyObject *obContext;
DWORD dwFlags;
if ( !PyArg_ParseTuple(args, "OlOl:ProcessUrlAction", &obpwszUrl, &dwAction, &obContext, &dwFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
IID context;
if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyWinObject_AsIID(obContext, &context)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
DWORD dwPolicy = 0;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->ProcessUrlAction( pwszUrl, dwAction, (BYTE *)&dwPolicy, sizeof(dwPolicy), (BYTE *)&context, sizeof(context), dwFlags, 0);
SysFreeString(pwszUrl);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager);
return Py_BuildValue("ll", hr, dwPolicy);
}
/***
// @pymethod |PyIInternetSecurityManager|QueryCustomPolicy|Description of QueryCustomPolicy.
PyObject *PyIInternetSecurityManager::QueryCustomPolicy(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm <o unicode>|pwszUrl||Description for pwszUrl
// @pyparm <o PyIID>|guidKey||Description for guidKey
// @pyparm int|pContext||Description for pContext
// @pyparm int|cbContext||Description for cbContext
// @pyparm int|dwReserved||Description for dwReserved
PyObject *obpwszUrl;
PyObject *obguidKey;
LPWSTR pwszUrl;
IID guidKey;
BYTE ppPolicy;
DWORD pcbPolicy;
BYTE pContext;
DWORD cbContext;
DWORD dwReserved;
if ( !PyArg_ParseTuple(args, "OOill:QueryCustomPolicy", &obpwszUrl, &obguidKey, &pContext, &cbContext, &dwReserved) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszUrl, &pwszUrl)) bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obguidKey, &guidKey)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->QueryCustomPolicy( pwszUrl, guidKey, ?? (-2)ppPolicy, &pcbPolicy, &pContext, cbContext, dwReserved );
SysFreeString(pwszUrl);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
PyObject *pyretval = Py_BuildValue("il", ppPolicy, pcbPolicy);
return pyretval;
}
***/
// @pymethod |PyIInternetSecurityManager|SetZoneMapping|Description of SetZoneMapping.
PyObject *PyIInternetSecurityManager::SetZoneMapping(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm int|dwZone||Description for dwZone
// @pyparm <o unicode>|lpszPattern||Description for lpszPattern
// @pyparm int|dwFlags||Description for dwFlags
PyObject *oblpszPattern;
DWORD dwZone;
LPWSTR lpszPattern;
DWORD dwFlags;
if (!PyArg_ParseTuple(args, "lOl:SetZoneMapping", &dwZone, &oblpszPattern, &dwFlags))
return NULL;
if (!PyWinObject_AsBstr(oblpszPattern, &lpszPattern))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->SetZoneMapping( dwZone, lpszPattern, dwFlags );
SysFreeString(lpszPattern);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIInternetSecurityManager|GetZoneMappings|Description of GetZoneMappings.
PyObject *PyIInternetSecurityManager::GetZoneMappings(PyObject *self, PyObject *args)
{
IInternetSecurityManager *pIISM = GetI(self);
if ( pIISM == NULL )
return NULL;
// @pyparm int|dwZone||Description for dwZone
// @pyparm int|dwFlags||Description for dwFlags
DWORD dwZone;
IEnumString * ppenumString;
DWORD dwFlags;
if ( !PyArg_ParseTuple(args, "ll:GetZoneMappings", &dwZone, &dwFlags) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIISM->GetZoneMappings( dwZone, &ppenumString, dwFlags );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager );
return PyCom_PyObjectFromIUnknown(ppenumString, IID_IEnumString, FALSE);
}
// @object PyIInternetSecurityManager|Description of the interface
static struct PyMethodDef PyIInternetSecurityManager_methods[] =
{
{ "SetSecuritySite", PyIInternetSecurityManager::SetSecuritySite, 1 }, // @pymeth SetSecuritySite|Description of SetSecuritySite
{ "GetSecuritySite", PyIInternetSecurityManager::GetSecuritySite, 1 }, // @pymeth GetSecuritySite|Description of GetSecuritySite
{ "MapUrlToZone", PyIInternetSecurityManager::MapUrlToZone, 1 }, // @pymeth MapUrlToZone|Description of MapUrlToZone
{ "GetSecurityId", PyIInternetSecurityManager::GetSecurityId, 1 }, // @pymeth GetSecurityId|Description of GetSecurityId
{ "ProcessUrlAction", PyIInternetSecurityManager::ProcessUrlAction, 1 }, // @pymeth ProcessUrlAction|Description of ProcessUrlAction
// { "QueryCustomPolicy", PyIInternetSecurityManager::QueryCustomPolicy, 1 },
{ "SetZoneMapping", PyIInternetSecurityManager::SetZoneMapping, 1 }, // @pymeth SetZoneMapping|Description of SetZoneMapping
{ "GetZoneMappings", PyIInternetSecurityManager::GetZoneMappings, 1 }, // @pymeth GetZoneMappings|Description of GetZoneMappings
{ NULL }
};
PyComTypeObject PyIInternetSecurityManager::type("PyIInternetSecurityManager",
&PyIUnknown::type,
sizeof(PyIInternetSecurityManager),
PyIInternetSecurityManager_methods,
GET_PYCOM_CTOR(PyIInternetSecurityManager));
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGInternetSecurityManager::SetSecuritySite(
/* [unique][in] */ IInternetSecurityMgrSite * pSite)
{
PY_GATEWAY_METHOD;
PyObject *obpSite;
obpSite = PyCom_PyObjectFromIUnknown(pSite, IID_IInternetSecurityMgrSite, TRUE);
HRESULT hr=InvokeViaPolicy("SetSecuritySite", NULL, "O", obpSite);
Py_XDECREF(obpSite);
return hr;
}
STDMETHODIMP PyGInternetSecurityManager::GetSecuritySite(
/* [out] */ IInternetSecurityMgrSite ** ppSite)
{
PY_GATEWAY_METHOD;
if (ppSite==NULL) return E_POINTER;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetSecuritySite", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyCom_InterfaceFromPyInstanceOrObject(result, IID_IInternetSecurityMgrSite, (void **)ppSite, TRUE /* bNoneOK */))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecuritySite");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGInternetSecurityManager::MapUrlToZone(
/* [in] */ LPCWSTR pwszUrl,
/* [out] */ DWORD * pdwZone,
/* [in] */ DWORD dwFlags)
{
PY_GATEWAY_METHOD;
PyObject *obpwszUrl;
obpwszUrl = MakeOLECHARToObj(pwszUrl);
PyObject *result;
HRESULT hr=InvokeViaPolicy("MapUrlToZone", &result, "Ol", obpwszUrl, dwFlags);
Py_XDECREF(obpwszUrl);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyArg_Parse(result, "l" , pdwZone))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("MapUrlToZone");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGInternetSecurityManager::GetSecurityId(
/* [in] */ LPCWSTR pwszUrl,
/* [size_is][out] */ BYTE * pbSecurityId,
/* [out][in] */ DWORD * pcbSecurityId,
/* [in] */ DWORD_PTR dwReserved)
{
PY_GATEWAY_METHOD;
PyObject *obdwReserved = PyWinObject_FromDWORD_PTR(dwReserved);
if (obdwReserved==NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId");
PyObject *obpwszUrl;
obpwszUrl = MakeOLECHARToObj(pwszUrl);
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetSecurityId", &result, "OlO", obpwszUrl, *pcbSecurityId, obdwReserved);
Py_XDECREF(obpwszUrl);
Py_DECREF(obdwReserved);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
void *buf;
DWORD buf_len;
if (!PyWinObject_AsReadBuffer(result, &buf, &buf_len)) {
Py_DECREF(result);
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId");
}
*pcbSecurityId = min(buf_len, *pcbSecurityId);
memcpy(pbSecurityId, buf, *pcbSecurityId);
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGInternetSecurityManager::ProcessUrlAction(
/* [in] */ LPCWSTR pwszUrl,
/* [in] */ DWORD dwAction,
/* [size_is][out] */ BYTE * pPolicy,
/* [in] */ DWORD cbPolicy,
/* [in] */ BYTE * pContext,
/* [in] */ DWORD cbContext,
/* [in] */ DWORD dwFlags,
/* [in] */ DWORD dwReserved)
{
PY_GATEWAY_METHOD;
PyObject *obpwszUrl;
PyObject *obContext;
obpwszUrl = MakeOLECHARToObj(pwszUrl);
if (cbContext==0 || pContext==NULL) {
obContext = Py_None;
Py_INCREF(Py_None);
} else if (cbContext==sizeof(GUID))
obContext = PyWinObject_FromIID(*((IID *)*pContext));
else {
PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for context - what is that?", cbContext);
obContext = Py_None;
Py_INCREF(Py_None);
}
PyObject *result;
HRESULT hr=InvokeViaPolicy("ProcessUrlAction", &result, "OlOll", obpwszUrl, dwAction, obContext, dwFlags, dwReserved);
Py_XDECREF(obpwszUrl);
Py_XDECREF(obContext);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (cbPolicy==sizeof(DWORD)) {
*((DWORD *)pPolicy) = PyInt_AsLong(result);
if (*((DWORD *)pPolicy)==-1)
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("ProcessUrlAction");
} else {
PyCom_LoggerWarning(NULL, "PyGInternetSecurityManager::ProcessUrlAction has %d bytes for policy - what is that?", cbPolicy);
hr = E_UNEXPECTED;
}
return hr;
}
STDMETHODIMP PyGInternetSecurityManager::QueryCustomPolicy(
/* [in] */ LPCWSTR pwszUrl,
/* [in] */ REFGUID guidKey,
/* [size_is][size_is][out] */ BYTE ** ppPolicy,
/* [out] */ DWORD * pcbPolicy,
/* [in] */ BYTE * pContext,
/* [in] */ DWORD cbContext,
/* [in] */ DWORD dwReserved)
{
return INET_E_DEFAULT_ACTION;
/***
PY_GATEWAY_METHOD;
if (ppPolicy==NULL) return E_POINTER;
PyObject *obpwszUrl;
PyObject *obguidKey;
obpwszUrl = MakeOLECHARToObj(pwszUrl);
obguidKey = PyWinObject_FromIID(guidKey);
PyObject *result;
HRESULT hr=InvokeViaPolicy("QueryCustomPolicy", &result, "OOill", obpwszUrl, obguidKey, pContext, cbContext, dwReserved);
Py_XDECREF(obpwszUrl);
Py_XDECREF(obguidKey);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyArg_ParseTuple(result, "il" , *ppPolicy, pcbPolicy))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("QueryCustomPolicy");
Py_DECREF(result);
return hr;
***/
}
STDMETHODIMP PyGInternetSecurityManager::SetZoneMapping(
/* [in] */ DWORD dwZone,
/* [in] */ LPCWSTR lpszPattern,
/* [in] */ DWORD dwFlags)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("SetZoneMapping", NULL, "lNl",
dwZone,
MakeOLECHARToObj(lpszPattern),
dwFlags);
}
STDMETHODIMP PyGInternetSecurityManager::GetZoneMappings(
/* [in] */ DWORD dwZone,
/* [out] */ IEnumString ** ppenumString,
/* [in] */ DWORD dwFlags)
{
PY_GATEWAY_METHOD;
if (ppenumString==NULL) return E_POINTER;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetZoneMappings", &result, "ll", dwZone, dwFlags);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppenumString;
if (!PyArg_Parse(result, "O" , &obppenumString))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings");
if (!PyCom_InterfaceFromPyInstanceOrObject(obppenumString, IID_IEnumString, (void **)ppenumString, TRUE /* bNoneOK */))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetZoneMappings");
Py_DECREF(result);
return hr;
}
|