1 | /* $Id: VBoxCredentialProvider.h 99828 2023-05-17 13:48:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxCredentialProvider - Main file of the VirtualBox Credential Provider.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredentialProvider_h
|
---|
29 | #define GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredentialProvider_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <iprt/win/windows.h>
|
---|
35 | #include <iprt/win/credentialprovider.h>
|
---|
36 | #include <Shlguid.h>
|
---|
37 |
|
---|
38 | #include "VBoxCredProvUtils.h"
|
---|
39 |
|
---|
40 | /** The VirtualBox credential provider class ID -- must not be changed. */
|
---|
41 | DEFINE_GUID(CLSID_VBoxCredProvider, 0x275d3bcc, 0x22bb, 0x4948, 0xa7, 0xf6, 0x3a, 0x30, 0x54, 0xeb, 0xa9, 0x2b);
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * The credential provider's UI field IDs, used for
|
---|
45 | * handling / identifying them.
|
---|
46 | */
|
---|
47 | enum VBOXCREDPROV_FIELDID
|
---|
48 | {
|
---|
49 | VBOXCREDPROV_FIELDID_TILEIMAGE = 0,
|
---|
50 | VBOXCREDPROV_FIELDID_USERNAME = 1,
|
---|
51 | VBOXCREDPROV_FIELDID_PASSWORD = 2,
|
---|
52 | VBOXCREDPROV_FIELDID_DOMAINNAME = 3,
|
---|
53 | VBOXCREDPROV_FIELDID_SUBMIT_BUTTON = 4,
|
---|
54 | VBOXCREDPROV_FIELDID_PROVIDER_LOGO = 5,
|
---|
55 | VBOXCREDPROV_FIELDID_PROVIDER_LABEL = 6
|
---|
56 | };
|
---|
57 |
|
---|
58 | /* Note: If new fields are added to VBOXCREDPROV_FIELDID and s_VBoxCredProvFields,
|
---|
59 | don't forget to increase this define! */
|
---|
60 | #define VBOXCREDPROV_NUM_FIELDS 7
|
---|
61 |
|
---|
62 | /** Maximum credential provider field length (in characters). */
|
---|
63 | #define VBOXCREDPROV_MAX_FIELD_LEN 255
|
---|
64 |
|
---|
65 | struct VBOXCREDPROV_FIELD
|
---|
66 | {
|
---|
67 | /** The actual description of this field: It's label,
|
---|
68 | * official field type ID, ... */
|
---|
69 | CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR desc;
|
---|
70 | /** The field's display state within the. */
|
---|
71 | CREDENTIAL_PROVIDER_FIELD_STATE state;
|
---|
72 | /** The interactive state: Used when this field gets shown to determine
|
---|
73 | * its state -- currently, only focussing is implemented. */
|
---|
74 | CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE stateInteractive;
|
---|
75 | };
|
---|
76 |
|
---|
77 | #ifndef PCREDENTIAL_PROVIDER_FIELD_DESCRIPTOR
|
---|
78 | # define PCREDENTIAL_PROVIDER_FIELD_DESCRIPTOR CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR*
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #if !defined(NTDDI_VERSION) || !defined(NTDDI_WIN8) || NTDDI_VERSION < NTDDI_WIN8 /* < Windows 8 */
|
---|
82 | /* 2d837775-f6cd-464e-a745-482fd0b47493, introduced in windows 8 */
|
---|
83 | DEFINE_GUID(CPFG_CREDENTIAL_PROVIDER_LOGO, 0x2d837775, 0xf6cd, 0x464e, 0xa7, 0x45, 0x48, 0x2f, 0xd0, 0xb4, 0x74, 0x93);
|
---|
84 | /* 286BBFF3-BAD4-438F-B007-79B7267C3D48, introduced in windows 8. */
|
---|
85 | DEFINE_GUID(CPFG_CREDENTIAL_PROVIDER_LABEL, 0x286BBFF3, 0xBAD4, 0x438F, 0xB0 ,0x07, 0x79, 0xB7, 0x26, 0x7C, 0x3D, 0x48);
|
---|
86 | #endif
|
---|
87 |
|
---|
88 |
|
---|
89 | /** The credential provider's default fields. */
|
---|
90 | static const VBOXCREDPROV_FIELD s_VBoxCredProvDefaultFields[] =
|
---|
91 | {
|
---|
92 | /** The user's profile image (tile). */
|
---|
93 | { { VBOXCREDPROV_FIELDID_TILEIMAGE, CPFT_TILE_IMAGE, (LPWSTR)L"Tile Image", {0} }, CPFS_DISPLAY_IN_BOTH, CPFIS_NONE },
|
---|
94 | { { VBOXCREDPROV_FIELDID_USERNAME, CPFT_LARGE_TEXT, (LPWSTR)L"Username", CPFG_LOGON_USERNAME }, CPFS_DISPLAY_IN_BOTH, CPFIS_NONE },
|
---|
95 | { { VBOXCREDPROV_FIELDID_PASSWORD, CPFT_PASSWORD_TEXT, (LPWSTR)L"Password", CPFG_LOGON_PASSWORD }, CPFS_DISPLAY_IN_SELECTED_TILE, CPFIS_FOCUSED },
|
---|
96 | { { VBOXCREDPROV_FIELDID_DOMAINNAME, CPFT_LARGE_TEXT, (LPWSTR)L"", {0} }, CPFS_DISPLAY_IN_SELECTED_TILE, CPFIS_FOCUSED },
|
---|
97 | { { VBOXCREDPROV_FIELDID_SUBMIT_BUTTON, CPFT_SUBMIT_BUTTON, (LPWSTR)L"Submit", {0} }, CPFS_DISPLAY_IN_SELECTED_TILE, CPFIS_FOCUSED },
|
---|
98 | /** New since Windows 8: The image used to represent a credential provider on the logon page. */
|
---|
99 | { { VBOXCREDPROV_FIELDID_PROVIDER_LOGO, CPFT_TILE_IMAGE, (LPWSTR)L"Provider Logo", CPFG_CREDENTIAL_PROVIDER_LOGO }, CPFS_HIDDEN /* Not used yet. */, CPFIS_NONE },
|
---|
100 | /** New since Windows 8: The label associated with a credential provider on the logon page. */
|
---|
101 | { { VBOXCREDPROV_FIELDID_PROVIDER_LABEL, CPFT_SMALL_TEXT, (LPWSTR)L"Provider Label", CPFG_CREDENTIAL_PROVIDER_LABEL }, CPFS_HIDDEN /* Not used yet. */, CPFIS_NONE }
|
---|
102 | };
|
---|
103 |
|
---|
104 | /** Prototypes. */
|
---|
105 | void VBoxCredentialProviderAcquire(void);
|
---|
106 | void VBoxCredentialProviderRelease(void);
|
---|
107 | LONG VBoxCredentialProviderRefCount(void);
|
---|
108 |
|
---|
109 | HRESULT VBoxCredentialProviderCreate(REFCLSID classID,
|
---|
110 | REFIID interfaceID, void **ppvInterface);
|
---|
111 |
|
---|
112 | #endif /* !GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredentialProvider_h */
|
---|
113 |
|
---|