以下情况:
我有一个实现IConnectableCredentialProviderCredential
接口的工作 V1 CP。这种依赖关系是访问IQueryContinueWithStatus
我需要的接口所必需的。
class CCredential : public IConnectableCredentialProviderCredential
{
[...]
IConnectableCredentialProviderCredential
实现ICredentialProviderCredential
。
COMIUknown
查询方法是使用以下代码段完成的:
IFACEMETHODIMP QueryInterface(__in REFIID riid, __deref_out void** ppv)
{
static const QITAB qitOnlyCredUI[] =
{
QITABENT(CCredential, ICredentialProviderCredential),
{ 0 },
};
static const QITAB qitFull[] =
{
QITABENT(CCredential, ICredentialProviderCredential), // IID_ICredentialProviderCredential
QITABENT(CCredential, IConnectableCredentialProviderCredential), // IID_IConnectableCredentialProviderCredential
{ 0 },
};
[...]
现在我想将提供程序迁移为 V2 CP 并实现ICredentialProviderCredential2
接口,但保持与IQueryContinueWithStatus
接口兼容。此外,QITABENT(CCredential, ICredentialProviderCredential)
退出不是选项,因为qitOnlyCredUI
在请求不支持的 CredUI 时是必需的IQueryContinueWithStatus
。
class CCredential : public IConnectableCredentialProviderCredential,
public ICredentialProviderCredential2,
public ICredentialProviderCredentialWithFieldOptions
{
[...]
ICredentialProviderCredential2
实现ICredentialProviderCredential
。
实现 COMQueryInterface
方法,如:
IFACEMETHODIMP QueryInterface(__in REFIID riid, __deref_out void** ppv)
{
static const QITAB qitOnlyCredUI[] =
{
QITABENT(CCredential, ICredentialProviderCredential),
{ 0 },
};
static const QITAB qitFull[] =
{
QITABENT(CCredential, ICredentialProviderCredential), // IID_ICredentialProviderCredential
QITABENT(CCredential, ICredentialProviderCredential2), // IID_ICredentialProviderCredential2
QITABENT(CCredential, IConnectableCredentialProviderCredential), // IID_IConnectableCredentialProviderCredential
QITABENT(CCredential, ICredentialProviderCredentialWithFieldOptions), //IID_ICredentialProviderCredentialWithFieldOptions
{ 0 },
};
这就是钻石问题开始的地方,因为ICredentialProviderCredential2
两者IConnectableCredentialProviderCredential
都实施ICredentialProviderCredential
。
尝试编译肯定会导致编译器抱怨ICredentialProviderCredential
基类的定义不明确。
任何想法如何实现?