How to use the IUserConsentVerifierInterop interface in C++?

178 Views Asked by At

I'm trying to attach the Windows Hello dialog to an application. I found out that the IUserConsentVerifierInterop interface has an argument where I can attach the handle of the application, but I couldn't create an instance of the interface. I need help.

Check out this thread for more updates.

I still couldn't figure out why I can't call the IUserConsentVerifierInterop interface to use the RequestVerificationForWindowAsync() method.

I tried to create an instance of the IUserConsentVerifierInterop interface using CoCreateInstance()/ RoGetActivationFactory()/ winrt::get_activationFactory() methods, and get the similar errors :

object uninitialized

no information available in the symbol of userconsentverifier.dll

no such interface present

etc, and I couldn't initialize the instance of the interface.

code snippets:

c++

LPCOLESTR plpsz = L"{2D0F7985-9EE6-427C-AAAA-A9D72CBFA853}"; // userconsentverifier class clsid
LPCOLESTR clpsz = L"{39E050C3-4E74-441A-8DC0-B81104DF949C}"; // IUserConsentVerifierInterop interface clsid // check the registry for this value
LPCOLESTR dllname = L"Windows.Security.Credentials.UI.UserConsentVerifier";

CLSID pclsid{};
HRESULT RES3 = CLSIDFromString(plpsz, &pclsid);

CLSID cclsid{};
HRESULT res4 = CLSIDFromString(clpsz, &cclsid);

HSTRING hpclisd;
WindowsCreateString(dllname, wcslen(dllname), &hpclsid);
HRESULT RES1 = RoGetActivationFactory(hpclsid, cclsid, reinterpret_cast<void**>(&intop)); 

IUserConsentVerifierInterop* intop = nullptr;

HRESULT REX = CoCreateInstance(pclsid,nullptr,CLSCTX_INPROC_SERVER,cclsid,reinterpret_cast<void**>(&intop));  // the function to fetch instance of Iuserconsentverifierinterop

HRESULT hrt = GetActivationFactory(hpclsid, &intop); // to get the factory

winrt::com_ptr<IUserConsentVerifierInterop> interopFactory = winrt::get_activation_factory<Windows::Security::Credentials::UI::UserConsentVerifier,IUserConsentVerifierInterop>();

winrt::com_ptr<IDataTransferManagerInterop> dop = winrt::get_activation_factory<winrt::Windows::ApplicationModel::DataTransfer::DataTransferManager, IDataTransferManagerInterop>(); // this was just for verification this line should fetch the factory similar to the above method but both doesn't work
0

There are 0 best solutions below