gpt4 book ai didi

c++ - 在 'Other user' 磁贴上显示 V2 凭据提供程序

转载 作者:可可西里 更新时间:2023-11-01 13:27:04 26 4
gpt4 key购买 nike

我正在尝试编写自定义 Windows 凭据提供程序。我已经下载了 V2 credential provider sample我能够构建、注册和使用它。

为了测试,我设置了一个 hyper-v Windows 8.1 实例并加入了一个 windows测试域名。

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

文档 ( Credential Provider Framework Changes in Windows 8.docx )提供了一个小片段:

// 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 凭据提供程序仍未显示“其他用户”磁贴。

我错过了什么?我必须更改什么才能在“其他用户”磁贴上使用凭据提供程序?

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

最佳答案

如果你正在使用这个例子,它总是在 Initialize 函数中初始化 SID,所以这段代码总是将 SID 复制到函数的返回指针中,不管你之后做什么(_pszUserSid != nullptr 总是 true在示例中)。如果你想拥有这个功能,让你的CP显示在“其他用户”下,那么body应该无非就是:

    *ppszSid = nullptr;
return S_FALSE;

如果您不希望您的磁贴与用户绑定(bind),则根本不必实现 ICredentialProviderCredential2,因为它只添加了此功能。如果不实现此接口(interface),您的 CP 将始终显示在“其他用户”下。实现 ICredentialProviderCredential 就足够了。

关于c++ - 在 'Other user' 磁贴上显示 V2 凭据提供程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29603940/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com