在“其他用户”磁贴上显示V2凭据提供程序 [英] Displaying a V2 Credential Provider on 'Other user' tile

查看:104
本文介绍了在“其他用户”磁贴上显示V2凭据提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写自定义Windows凭据提供程序。我已经下载了 V2凭据提供程序示例并且我能够构建,注册并使用它。

I am trying to write a custom Windows credential provider. I have downloaded the V2 credential provider sample and I am able build, register and use it.

为了进行测试,我设置了一个Hyper-v Windows 8.1实例并加入了Windows
测试域。

For testing I have set up a hyper-v Windows 8.1 instance and joined a windows test domain.

但是,自定义凭据提供程序仅显示在用户图块上,而不显示在其他用户图块上。

However, the custom credential provider is only displayed on user tiles, not on the 'Other user' tile.

文档( Windows 8.docx中的凭据提供程序框架更改
提供了小片段:

The documentation (Credential Provider Framework Changes in Windows 8.docx) provides a small snippet:

// Gets the SID of the user corresponding to the credential. HRESULT CSampleCredential::GetUserSid(__deref_out PWSTR *ppszSid)
{
    *ppszSid = nullptr;
    HRESULT hr = E_UNEXPECTED;

    // _pszUserSid is a private member of CSampleCredential
    if (_pszUserSid != nullptr)
    {
        // ppszSid will be freed by Logon UI
        hr = SHStrDupW(_pszUserSid, ppszSid);
    }
    // Return S_FALSE with a null SID in ppszSid for the
    // credential to be associated with an anonymous user tile.
    else if (_fIsOtherUserTile)
    {
        hr = S_FALSE;
    }

    return hr;
}

我不确定 _fIsOtherUserTile来自何处。如果我忽略此
并仅将'hr'设置为S_FALSE,则凭据提供程序仍不会在
上显示其他用户图块。

I am not sure where '_fIsOtherUserTile' is coming from. If I am ignoring this and just set 'hr' to S_FALSE the credential provider is still not showing up on the 'Other user' tile.

我想念什么?我必须更改什么才能使用其他用户磁贴上的凭据提供程序?

What am I missing? What do I have to change so I am able to use the credential provider on the 'Other user' tile?

通常我会做Web项目,所以我对Windows SDK经验不足。

Usually I do web projects so I have little experience with the Windows SDK.

推荐答案

如果使用的是示例,它将始终在Initialize函数中初始化SID,因此此代码将始终将SID复制到函数的返回指针中,而不管您随后执行的操作(_pszUserSid!= nullptr是在示例中始终为true)。如果要具有此功能并将CP显示在其他用户下,则正文应该只不过是:

If you are using the example, it always initializes the SID in the Initialize function, so this code will always copy the SID into the return pointer of the function, regardless of what you do afterwards(_pszUserSid != nullptr is always true in the example). If you want to have this function and have your CP show under "Other user", then the body should be nothing more than:

    *ppszSid = nullptr;
    return S_FALSE;

如果您不希望将图块与用户绑定,则不必完全实现ICredentialProviderCredential2,因为它仅添加了此功能。如果未实现此界面,则CP将始终显示在其他用户下。为此,只需实现ICredentialProviderCredential。

If you don't want your tile to be tied to a user, you don't have to implement ICredentialProviderCredential2 at all, since it only adds this function. Without this interface implemented, your CP will always show under "Other user". Implementing ICredentialProviderCredential is enough for this.

这篇关于在“其他用户”磁贴上显示V2凭据提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆