COM and IInternetSecurityManager - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

COM and IInternetSecurityManager

CorithCorith Posts: 1Member
I'm trying to write an interface for the IISecurityManager but I keep getting a compiler error when I uncomment the commented lines. Here is the code thus far with the three lines commented out. I think I've written the lines correctly, but I am stumbling my way through this application (I know C++, but not COM).

[code]
#pragma once
#include "urlmon.h"
#using
using namespace System;

interface ISecurityManager : IInternetSecurityManager
{
HRESULT SetSecuritySite([in] int *pSite);
HRESULT GetSecuritySite([out] int *pSite);
HRESULT MapUrlToZone([in] LPCWSTR pwszUrl, [out] UInt32 *pdwZone, [in] UInt32 dwFlags);
//HRESULT GetSecurityId([in] LPCWSTR pwszUrl, [out, size_is] BYTE *pbSecurityId, [out, in] DWORD *pcbSecurityId, [in] DWORD_PTR dwReserved);
HRESULT ProcessUrlAction([in] LPCWSTR pwszUrl, [in] UInt32 dwAction, [out] byte *Policy, [in] UInt32 cbPolicy, [in] byte pContext, [in] UInt32 cbContext, [in] UInt32 dwFlags, [in] UInt32 dwReserved);
//HRESULT QueryCustomPolicy([in] LPCWSTR pwszUrl, [in] REFGUID guidKey, [out] BYTE **ppPolicy, [out] DWORD *pcbPolicy, [in] BYTE *pContext, [in] DWORD cbContext, [in] DWORD dwReserved);
HRESULT SetZoneMapping([in] UInt32 dwZone, [in] LPCWSTR lpszPattern, [in] UInt32 dwFlags);
//HRESULT GetZoneMappings([in] DWORD dwZone, [out] IEnumString **ppenumString, [in] DWORD dwFlags);
};
[/code]

As soon as I uncomment the QueryCustomPolicy() and GetZoneMappings() methods, I get the file:

[code]
#pragma once
#include "urlmon.h"
#using
using namespace System;

interface ISecurityManager : IInternetSecurityManager
{
HRESULT SetSecuritySite([in] int *pSite);
HRESULT GetSecuritySite([out] int *pSite);
HRESULT MapUrlToZone([in] LPCWSTR pwszUrl, [out] UInt32 *pdwZone, [in] UInt32 dwFlags);
HRESULT GetSecurityId([in] LPCWSTR pwszUrl, [out, size_is] BYTE *pbSecurityId, [out, in] DWORD *pcbSecurityId, [in] DWORD_PTR dwReserved);
HRESULT ProcessUrlAction([in] LPCWSTR pwszUrl, [in] UInt32 dwAction, [out] byte *Policy, [in] UInt32 cbPolicy, [in] byte pContext, [in] UInt32 cbContext, [in] UInt32 dwFlags, [in] UInt32 dwReserved);
HRESULT QueryCustomPolicy([in] LPCWSTR pwszUrl, [in] REFGUID guidKey, [out] BYTE **ppPolicy, [out] DWORD *pcbPolicy, [in] BYTE *pContext, [in] DWORD cbContext, [in] DWORD dwReserved);
HRESULT SetZoneMapping([in] UInt32 dwZone, [in] LPCWSTR lpszPattern, [in] UInt32 dwFlags);
HRESULT GetZoneMappings([in] DWORD dwZone, [out] IEnumString **ppenumString, [in] DWORD dwFlags);
};
[/code]

Now I get the compiler errors:
[code]
error C2695: 'ISecurityManager::GetSecurityId': overriding virtual function differs from 'IInternetSecurityManager::GetSecurityId' only by calling convention
error C2695: 'ISecurityManager::GetSecurityId': overriding virtual function differs from 'IInternetSecurityManager::GetSecurityId' only by calling convention
error C2695: 'ISecurityManager::GetZoneMappings': overriding virtual function differs from 'IInternetSecurityManager::GetZoneMappings' only by calling convention
error C2695: 'ISecurityManager::GetZoneMappings': overriding virtual function differs from 'IInternetSecurityManager::GetZoneMappings' only by calling convention
error C2695: 'ISecurityManager::QueryCustomPolicy': overriding virtual function differs from 'IInternetSecurityManager::QueryCustomPolicy' only by calling convention
error C2695: 'ISecurityManager::QueryCustomPolicy': overriding virtual function differs from 'IInternetSecurityManager::QueryCustomPolicy' only by calling convention
[/code]

Any help on implimenting interfaces in COM would be great. Just for reference, the header file for urlmon.h (which is where the IInternetSecurityManager lives) looks like this:

[code]
MIDL_INTERFACE("79eac9ee-baf9-11ce-8c82-00aa004ba90b")
IInternetSecurityManager : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SetSecuritySite(
/* [unique][in] */ IInternetSecurityMgrSite *pSite) = 0;

virtual HRESULT STDMETHODCALLTYPE GetSecuritySite(
/* [out] */ IInternetSecurityMgrSite **ppSite) = 0;

virtual HRESULT STDMETHODCALLTYPE MapUrlToZone(
/* [in] */ LPCWSTR pwszUrl,
/* [out] */ DWORD *pdwZone,
/* [in] */ DWORD dwFlags) = 0;

virtual HRESULT STDMETHODCALLTYPE GetSecurityId(
/* [in] */ LPCWSTR pwszUrl,
/* [size_is][out] */ BYTE *pbSecurityId,
/* [out][in] */ DWORD *pcbSecurityId,
/* [in] */ DWORD_PTR dwReserved) = 0;

virtual HRESULT STDMETHODCALLTYPE 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) = 0;

virtual HRESULT STDMETHODCALLTYPE 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) = 0;

virtual HRESULT STDMETHODCALLTYPE SetZoneMapping(
/* [in] */ DWORD dwZone,
/* [in] */ LPCWSTR lpszPattern,
/* [in] */ DWORD dwFlags) = 0;

virtual HRESULT STDMETHODCALLTYPE GetZoneMappings(
/* [in] */ DWORD dwZone,
/* [out] */ IEnumString **ppenumString,
/* [in] */ DWORD dwFlags) = 0;

};
[/code]
Sign In or Register to comment.