VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxCredProv/dll.h@ 30601

Last change on this file since 30601 was 30252, checked in by vboxsync, 14 years ago

Windows Guest Additions Credential Provider:

  • Added reverse lookup for using "display names" as the user account name ("John Doe" -> "jdoe").
  • Fixed showing empty user tile on invalid user/credentials.
  • Fixed domain name handling.
  • Fixed "dot" caption when no domain name is used.
  • Wipe credentials after passing over to Kerberos.
  • Beautified code a bit.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1//
2// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
3// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
4// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
5// PARTICULAR PURPOSE.
6//
7// Copyright (c) 2006 Microsoft Corporation. All rights reserved.
8//
9// Modifications (c) 2009-2010 Oracle Corporation
10//
11
12#ifndef ___dll_h
13#define ___dll_h
14
15#include <iprt/assert.h>
16#include <iprt/initterm.h>
17#include <iprt/log.h>
18
19#include <VBox/Log.h>
20
21extern HINSTANCE g_hDllInst;
22
23LONG DllAddRef();
24LONG DllRelease();
25LONG DllGetRefCount();
26
27extern HRESULT VBoxCredProv_CreateInstance(REFIID riid, void** ppv);
28
29class CClassFactory : public IClassFactory
30{
31 public:
32 // IUnknown
33 STDMETHOD_(ULONG, AddRef)()
34 {
35 return _cRef++;
36 }
37
38 STDMETHOD_(ULONG, Release)()
39 {
40 LONG cRef = _cRef--;
41 if (!cRef)
42 {
43 delete this;
44 }
45 return cRef;
46 }
47
48 STDMETHOD (QueryInterface)(REFIID riid, void** ppv)
49 {
50 HRESULT hr;
51 if (ppv != NULL)
52 {
53 if (IID_IClassFactory == riid || IID_IUnknown == riid)
54 {
55 *ppv = static_cast<IUnknown*>(this);
56 reinterpret_cast<IUnknown*>(*ppv)->AddRef();
57 hr = S_OK;
58 }
59 else
60 {
61 *ppv = NULL;
62 hr = E_NOINTERFACE;
63 }
64 }
65 else
66 {
67 hr = E_INVALIDARG;
68 }
69 return hr;
70 }
71
72 // IClassFactory
73 STDMETHOD (CreateInstance)(IUnknown* pUnkOuter, REFIID riid, void** ppv)
74 {
75 HRESULT hr;
76 if (!pUnkOuter)
77 {
78 hr = VBoxCredProv_CreateInstance(riid, ppv);
79 }
80 else
81 {
82 hr = CLASS_E_NOAGGREGATION;
83 }
84 return hr;
85 }
86
87 STDMETHOD (LockServer)(BOOL bLock)
88 {
89 if (bLock)
90 {
91 DllAddRef();
92 }
93 else
94 {
95 DllRelease();
96 }
97 return S_OK;
98 }
99
100 private:
101
102 CClassFactory() : _cRef(1) {}
103 ~CClassFactory(){}
104
105 private:
106
107 LONG _cRef;
108 friend HRESULT CClassFactory_CreateInstance(REFCLSID rclsid, REFIID riid, void** ppv);
109};
110
111#endif /* ___dll_h */
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