VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxCredProv/dll.cpp@ 37801

最後變更 在這個檔案從37801是 30252,由 vboxsync 提交於 14 年 前

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.
  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.7 KB
 
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// Standard dll required functions and class factory implementation.
10//
11// Modifications (c) 2009-2010 Oracle Corporation
12//
13
14/*******************************************************************************
15* Header Files *
16*******************************************************************************/
17#include <windows.h>
18
19#include <VBox/VBoxGuestLib.h>
20
21#include "dll.h"
22#include "guid.h"
23
24
25/*******************************************************************************
26* Global Variables *
27*******************************************************************************/
28static LONG g_cRef = 0; /* Global DLL reference count. */
29HINSTANCE g_hDllInst = NULL; /* Global DLL hinstance. */
30
31
32HRESULT CClassFactory_CreateInstance(REFCLSID rclsid, REFIID riid, void** ppv)
33{
34 HRESULT hr;
35 if (CLSID_VBoxCredProvider == rclsid)
36 {
37 CClassFactory* pClassFactory = new CClassFactory;
38 if (pClassFactory)
39 {
40 hr = pClassFactory->QueryInterface(riid, ppv);
41 pClassFactory->Release();
42 }
43 else
44 {
45 hr = E_OUTOFMEMORY;
46 }
47 }
48 else
49 {
50 hr = CLASS_E_CLASSNOTAVAILABLE;
51 }
52 return hr;
53}
54
55
56BOOL WINAPI DllMain(HINSTANCE hinstDll,
57 DWORD dwReason,
58 LPVOID pReserved)
59{
60 UNREFERENCED_PARAMETER(pReserved);
61
62 switch (dwReason)
63 {
64 case DLL_PROCESS_ATTACH:
65
66 DisableThreadLibraryCalls(hinstDll);
67 break;
68
69 case DLL_PROCESS_DETACH:
70 break;
71
72 case DLL_THREAD_ATTACH:
73 case DLL_THREAD_DETACH:
74 break;
75 }
76
77 g_hDllInst = hinstDll;
78 return TRUE;
79}
80
81
82LONG DllAddRef()
83{
84 return InterlockedIncrement(&g_cRef);
85}
86
87
88LONG DllRelease()
89{
90 return InterlockedDecrement(&g_cRef);
91}
92
93
94LONG DllGetRefCount()
95{
96 return g_cRef;
97}
98
99
100/* DLL entry point. */
101STDAPI DllCanUnloadNow()
102{
103 HRESULT hr;
104
105 if (g_cRef > 0)
106 {
107 hr = S_FALSE; /* Cocreated objects still exist, don't unload */
108 }
109 else
110 {
111 hr = S_OK; /* Refcount is zero, ok to unload */
112 }
113
114 /* Never terminate the runtime! */
115 return hr;
116}
117
118
119STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
120{
121 return CClassFactory_CreateInstance(rclsid, riid, ppv);
122}
123
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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