VBoxCredProv.cpp revision dee9dd86962066a952b5343dc01f59328f532138
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd// PARTICULAR PURPOSE.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end// Copyright (c) 2006 Microsoft Corporation. All rights reserved.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end// Modifications (c) 2009-2010 Oracle Corporation
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end LogRel(("VBoxCredProv: Could not init runtime! rc = %Rrc\n", rc));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end LogRel(("VBoxCredProv: Could not init guest library! rc = %Rrc\n", rc));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end if (lRefCount == 1) /* First (=last) instance unloaded? */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end Log(("VBoxCredProv: DLL refcount (unload) = %ld\n", lRefCount));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * SetUsageScenario is the provider's cue that it's going to be asked for tiles
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * in a subsequent call. This call happens after the user pressed CTRL+ALT+DEL
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * and we need to handle the CPUS_LOGON event.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1endHRESULT VBoxCredProv::SetUsageScenario(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpUsageScenario,
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /* Decide which scenarios to support here. Returning E_NOTIMPL simply tells the caller
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * that we're not designed for that scenario. */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end Log(("VBoxCredProv::SetUsageScenario: Could not initialize credentials poller thread!\n"));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /* All stuff allocated? */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end Log(("VBoxCredProv::SetUsageScenario: Out of memory!\n"));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /* All set up already! */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end /* If we did fail -> cleanup */
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end Log(("VBoxCredProv::SetUsageScenario returned 0x%08x (cpUS: %d, Flags: %ld)\n", hr, cpUsageScenario, dwFlags));
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * SetSerialization takes the kind of buffer that you would normally return to LogonUI for
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * an authentication attempt. It's the opposite of ICredentialProviderCredential::GetSerialization.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * GetSerialization is implement by a credential and serializes that credential. Instead,
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * SetSerialization takes the serialization and uses it to create a credential.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * SetSerialization is called for two main scenarios. The first scenario is in the credUI case
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * where it is prepopulating a tile with credentials that the user chose to store in the OS.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * The second situation is in a remote logon case where the remote client may wish to
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * prepopulate a tile with a username, or in some cases, completely populate the tile and
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * use it to logon without showing any UI.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1endSTDMETHODIMP VBoxCredProv::SetSerialization(const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION *pcpCredentialSerialization)
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * Called by LogonUI to give you a callback. Providers often use the callback if they
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * some event would cause them to need to change the set of tiles (visible UI elements)
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end * that they enumerated.
053bfa8a288528fafab2b7a032c15116bb5de711ndHRESULT VBoxCredProv::Advise(ICredentialProviderEvents *pcpEvents,
0d0ba3a410038e179b695446bb149cce6264e0abnd * Save advice context for later use when binding to
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh * certain ICredentialProviderEvents events.
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh/* Called by LogonUI when the ICredentialProviderEvents callback is no longer valid. */
return S_OK;
return S_OK;
return hr;
bool fGotCredentials = false;
if ( m_pPoller
&& m_pCred)
if (fGotCredentials)
*pbAutoLogonWithDefault = TRUE; /* We always at least try to auto-login (if password is correct). */
*pdwCount = 0;
Log(("VBoxCredProv::GetCredentialCount: *pdwCount=%ld, *pdwDefault=%ld, *pbAutoLogonWithDefault=%s\n",
return S_OK;
* Returns the credential at the index specified by dwIndex. This function is called by logonUI to enumerate
Log(("VBoxCredProv::GetCredentialAt: Index=%ld, ppCredProvCredential=%p\n", dwIndex, ppCredProvCredential));
return E_INVALIDARG;
if( dwIndex == 0
reinterpret_cast<void**>(ppCredProvCredential));
return hr;
if (pProvider)
return hr;