VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProvCredential.h@ 67772

Last change on this file since 67772 was 67772, checked in by vboxsync, 7 years ago

Additions/VBoxCredProv: Fixes for Windows 10 guests.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/* $Id: VBoxCredProvCredential.h 67772 2017-07-04 11:42:31Z vboxsync $ */
2/** @file
3 * VBoxCredProvCredential - Class for keeping and handling the passed credentials.
4 */
5
6/*
7 * Copyright (C) 2012-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VBOX_CREDPROV_CREDENTIAL_H___
19#define ___VBOX_CREDPROV_CREDENTIAL_H___
20
21
22/*******************************************************************************
23* Header Files *
24*******************************************************************************/
25#include <iprt/win/windows.h>
26#include <NTSecAPI.h>
27#define SECURITY_WIN32
28#include <Security.h>
29#include <ShlGuid.h>
30#include <strsafe.h>
31
32#include <iprt/win/shlwapi.h>
33
34#include <iprt/string.h>
35
36#include "VBoxCredentialProvider.h"
37
38
39
40class VBoxCredProvProvider;
41
42class VBoxCredProvCredential : public ICredentialProviderCredential
43{
44public:
45
46 VBoxCredProvCredential(void);
47
48 virtual ~VBoxCredProvCredential(void);
49
50 /** @name IUnknown methods
51 * @{ */
52 IFACEMETHODIMP_(ULONG) AddRef(void);
53 IFACEMETHODIMP_(ULONG) Release(void);
54 IFACEMETHODIMP QueryInterface(REFIID interfaceID, void **ppvInterface);
55 /** @} */
56
57 /** @name ICredentialProviderCredential methods.
58 * @{ */
59 IFACEMETHODIMP Advise(ICredentialProviderCredentialEvents* pcpce);
60 IFACEMETHODIMP UnAdvise(void);
61
62 IFACEMETHODIMP SetSelected(PBOOL pfAutoLogon);
63 IFACEMETHODIMP SetDeselected(void);
64
65 IFACEMETHODIMP GetFieldState(DWORD dwFieldID,
66 CREDENTIAL_PROVIDER_FIELD_STATE* pcpfs,
67 CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE* pcpfis);
68
69 IFACEMETHODIMP GetStringValue(DWORD dwFieldID, PWSTR *ppwsz);
70 IFACEMETHODIMP GetBitmapValue(DWORD dwFieldID, HBITMAP *phbmp);
71 IFACEMETHODIMP GetCheckboxValue(DWORD dwFieldID, PBOOL pfChecked, PWSTR *ppwszLabel);
72 IFACEMETHODIMP GetComboBoxValueCount(DWORD dwFieldID, DWORD* pcItems, DWORD *pdwSelectedItem);
73 IFACEMETHODIMP GetComboBoxValueAt(DWORD dwFieldID, DWORD dwItem, PWSTR *ppwszItem);
74 IFACEMETHODIMP GetSubmitButtonValue(DWORD dwFieldID, DWORD *pdwAdjacentTo);
75
76 IFACEMETHODIMP SetStringValue(DWORD dwFieldID, PCWSTR pwszValue);
77 IFACEMETHODIMP SetCheckboxValue(DWORD dwFieldID, BOOL fChecked);
78 IFACEMETHODIMP SetComboBoxSelectedValue(DWORD dwFieldID, DWORD dwSelectedItem);
79 IFACEMETHODIMP CommandLinkClicked(DWORD dwFieldID);
80
81 IFACEMETHODIMP GetSerialization(CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE *pcpGetSerializationResponse,
82 CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION *pcpCredentialSerialization,
83 PWSTR *ppwszOptionalStatusText, CREDENTIAL_PROVIDER_STATUS_ICON *pcpsiOptionalStatusIcon);
84 IFACEMETHODIMP ReportResult(NTSTATUS ntStatus, NTSTATUS ntSubStatus,
85 PWSTR *ppwszOptionalStatusText,
86 CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon);
87 /** @} */
88
89 HRESULT resetField(DWORD dwFieldID);
90 HRESULT Reset(void);
91 HRESULT Initialize(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus);
92 int RetrieveCredentials(void);
93 BOOL TranslateAccountName(PWSTR pwszDisplayName, PWSTR *ppwszAccoutName);
94 BOOL ExtractAccoutData(PWSTR pwszAccountData, PWSTR *ppwszAccoutName, PWSTR *ppwszDomain);
95
96protected:
97 HRESULT RTUTF16ToUnicode(PUNICODE_STRING pUnicodeDest, PRTUTF16 pwszSource, bool fCopy);
98 HRESULT RTUTF16ToUnicodeA(PUNICODE_STRING pUnicodeDest, PRTUTF16 pwszSource);
99 void UnicodeStringFree(PUNICODE_STRING pUnicode);
100
101 HRESULT kerberosLogonCreate(KERB_INTERACTIVE_LOGON *pLogon,
102 CREDENTIAL_PROVIDER_USAGE_SCENARIO enmUsage,
103 PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTUTF16 pwszDomain);
104 void kerberosLogonDestroy(KERB_INTERACTIVE_LOGON *pLogon);
105 HRESULT kerberosLogonSerialize(const KERB_INTERACTIVE_LOGON *pLogon, PBYTE *ppPackage, DWORD *pcbPackage);
106
107private:
108 /** Internal reference count. */
109 LONG m_cRefs;
110 /** The usage scenario for which we were enumerated. */
111 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_enmUsageScenario;
112 /** The actual credential provider fields.
113 * Must be allocated as long as the credential provider is in charge. */
114 PRTUTF16 m_apwszFields[VBOXCREDPROV_NUM_FIELDS];
115 /** Pointer to event handler. */
116 ICredentialProviderCredentialEvents *m_pEvents;
117 /** Flag indicating whether credentials already were retrieved. */
118 bool m_fHaveCreds;
119 /** Flag indicating wheter a profile (user tile) current is selected or not. */
120 bool m_fIsSelected;
121};
122#endif /* !___VBOX_CREDPROV_CREDENTIAL_H___ */
123
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette