VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp@ 96254

Last change on this file since 96254 was 95891, checked in by vboxsync, 3 years ago

Add/Nt/VBoxGINA: Made it build in VBOX_WITH_NOCRT_STATIC mode. [scm fixes] bugref:10261

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.3 KB
Line 
1/* $Id: VBoxGINA.cpp 95891 2022-07-28 01:50:07Z vboxsync $ */
2/** @file
3 * VBoxGINA -- Windows Logon DLL for VirtualBox
4 */
5
6/*
7 * Copyright (C) 2006-2022 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
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#include <iprt/win/windows.h>
23
24#include <iprt/buildconfig.h>
25#include <iprt/initterm.h>
26#include <iprt/ldr.h>
27#include <iprt/errcore.h>
28
29#include <VBox/VBoxGuestLib.h>
30
31#include "winwlx.h"
32#include "VBoxGINA.h"
33#include "Helper.h"
34#include "Dialog.h"
35
36
37/*********************************************************************************************************************************
38* Global Variables *
39*********************************************************************************************************************************/
40/** DLL instance handle. */
41HINSTANCE hDllInstance;
42
43/** Version of Winlogon. */
44DWORD wlxVersion;
45
46/** Handle to Winlogon service. */
47HANDLE hGinaWlx;
48/** Winlog function dispatch table. */
49PWLX_DISPATCH_VERSION_1_1 pWlxFuncs;
50
51/**
52 * Function pointers to MSGINA entry points.
53 */
54PGWLXNEGOTIATE GWlxNegotiate;
55PGWLXINITIALIZE GWlxInitialize;
56PGWLXDISPLAYSASNOTICE GWlxDisplaySASNotice;
57PGWLXLOGGEDOUTSAS GWlxLoggedOutSAS;
58PGWLXACTIVATEUSERSHELL GWlxActivateUserShell;
59PGWLXLOGGEDONSAS GWlxLoggedOnSAS;
60PGWLXDISPLAYLOCKEDNOTICE GWlxDisplayLockedNotice;
61PGWLXWKSTALOCKEDSAS GWlxWkstaLockedSAS;
62PGWLXISLOCKOK GWlxIsLockOk;
63PGWLXISLOGOFFOK GWlxIsLogoffOk;
64PGWLXLOGOFF GWlxLogoff;
65PGWLXSHUTDOWN GWlxShutdown;
66/* GINA 1.1. */
67PGWLXSTARTAPPLICATION GWlxStartApplication;
68PGWLXSCREENSAVERNOTIFY GWlxScreenSaverNotify;
69/* GINA 1.3. */
70PGWLXNETWORKPROVIDERLOAD GWlxNetworkProviderLoad;
71PGWLXDISPLAYSTATUSMESSAGE GWlxDisplayStatusMessage;
72PGWLXGETSTATUSMESSAGE GWlxGetStatusMessage;
73PGWLXREMOVESTATUSMESSAGE GWlxRemoveStatusMessage;
74/* GINA 1.4. */
75PGWLXGETCONSOLESWITCHCREDENTIALS GWlxGetConsoleSwitchCredentials;
76PGWLXRECONNECTNOTIFY GWlxReconnectNotify;
77PGWLXDISCONNECTNOTIFY GWlxDisconnectNotify;
78
79
80/**
81 * DLL entry point.
82 */
83BOOL WINAPI DllMain(HINSTANCE hInstance,
84 DWORD dwReason,
85 LPVOID pReserved)
86{
87 RT_NOREF(pReserved);
88 switch (dwReason)
89 {
90 case DLL_PROCESS_ATTACH:
91 {
92 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
93 VbglR3Init();
94
95 VBoxGINALoadConfiguration();
96
97 VBoxGINAVerbose(0, "VBoxGINA: v%s r%s (%s %s) loaded\n",
98 RTBldCfgVersion(), RTBldCfgRevisionStr(),
99 __DATE__, __TIME__);
100
101 DisableThreadLibraryCalls(hInstance);
102 hDllInstance = hInstance;
103 break;
104 }
105
106 case DLL_PROCESS_DETACH:
107 {
108 VBoxGINAVerbose(0, "VBoxGINA: Unloaded\n");
109 VbglR3Term();
110 /// @todo RTR3Term();
111 break;
112 }
113
114 default:
115 break;
116 }
117 return TRUE;
118}
119
120
121BOOL WINAPI WlxNegotiate(DWORD dwWinlogonVersion,
122 DWORD *pdwDllVersion)
123{
124 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: dwWinlogonVersion: %ld\n", dwWinlogonVersion);
125
126 /* Load the standard Microsoft GINA DLL. */
127 RTLDRMOD hLdrMod;
128 int rc = RTLdrLoadSystem("MSGINA.DLL", true /*fNoUnload*/, &hLdrMod);
129 if (RT_FAILURE(rc))
130 {
131 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed loading MSGINA! rc=%Rrc\n", rc);
132 return FALSE;
133 }
134
135 /*
136 * Now get the entry points of the MSGINA
137 */
138 GWlxNegotiate = (PGWLXNEGOTIATE)RTLdrGetFunction(hLdrMod, "WlxNegotiate");
139 if (!GWlxNegotiate)
140 {
141 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxNegotiate\n");
142 return FALSE;
143 }
144 GWlxInitialize = (PGWLXINITIALIZE)RTLdrGetFunction(hLdrMod, "WlxInitialize");
145 if (!GWlxInitialize)
146 {
147 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxInitialize\n");
148 return FALSE;
149 }
150 GWlxDisplaySASNotice =
151 (PGWLXDISPLAYSASNOTICE)RTLdrGetFunction(hLdrMod, "WlxDisplaySASNotice");
152 if (!GWlxDisplaySASNotice)
153 {
154 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxDisplaySASNotice\n");
155 return FALSE;
156 }
157 GWlxLoggedOutSAS =
158 (PGWLXLOGGEDOUTSAS)RTLdrGetFunction(hLdrMod, "WlxLoggedOutSAS");
159 if (!GWlxLoggedOutSAS)
160 {
161 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxLoggedOutSAS\n");
162 return FALSE;
163 }
164 GWlxActivateUserShell =
165 (PGWLXACTIVATEUSERSHELL)RTLdrGetFunction(hLdrMod, "WlxActivateUserShell");
166 if (!GWlxActivateUserShell)
167 {
168 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxActivateUserShell\n");
169 return FALSE;
170 }
171 GWlxLoggedOnSAS =
172 (PGWLXLOGGEDONSAS)RTLdrGetFunction(hLdrMod, "WlxLoggedOnSAS");
173 if (!GWlxLoggedOnSAS)
174 {
175 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxLoggedOnSAS\n");
176 return FALSE;
177 }
178 GWlxDisplayLockedNotice =
179 (PGWLXDISPLAYLOCKEDNOTICE)RTLdrGetFunction(hLdrMod, "WlxDisplayLockedNotice");
180 if (!GWlxDisplayLockedNotice)
181 {
182 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxDisplayLockedNotice\n");
183 return FALSE;
184 }
185 GWlxIsLockOk = (PGWLXISLOCKOK)RTLdrGetFunction(hLdrMod, "WlxIsLockOk");
186 if (!GWlxIsLockOk)
187 {
188 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxIsLockOk\n");
189 return FALSE;
190 }
191 GWlxWkstaLockedSAS =
192 (PGWLXWKSTALOCKEDSAS)RTLdrGetFunction(hLdrMod, "WlxWkstaLockedSAS");
193 if (!GWlxWkstaLockedSAS)
194 {
195 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxWkstaLockedSAS\n");
196 return FALSE;
197 }
198 GWlxIsLogoffOk = (PGWLXISLOGOFFOK)RTLdrGetFunction(hLdrMod, "WlxIsLogoffOk");
199 if (!GWlxIsLogoffOk)
200 {
201 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxIsLogoffOk\n");
202 return FALSE;
203 }
204 GWlxLogoff = (PGWLXLOGOFF)RTLdrGetFunction(hLdrMod, "WlxLogoff");
205 if (!GWlxLogoff)
206 {
207 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxLogoff\n");
208 return FALSE;
209 }
210 GWlxShutdown = (PGWLXSHUTDOWN)RTLdrGetFunction(hLdrMod, "WlxShutdown");
211 if (!GWlxShutdown)
212 {
213 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: failed resolving WlxShutdown\n");
214 return FALSE;
215 }
216 /* GINA 1.1, optional */
217 GWlxStartApplication = (PGWLXSTARTAPPLICATION)RTLdrGetFunction(hLdrMod, "WlxStartApplication");
218 GWlxScreenSaverNotify = (PGWLXSCREENSAVERNOTIFY)RTLdrGetFunction(hLdrMod, "WlxScreenSaverNotify");
219 /* GINA 1.3, optional */
220 GWlxNetworkProviderLoad = (PGWLXNETWORKPROVIDERLOAD)RTLdrGetFunction(hLdrMod, "WlxNetworkProviderLoad");
221 GWlxDisplayStatusMessage = (PGWLXDISPLAYSTATUSMESSAGE)RTLdrGetFunction(hLdrMod, "WlxDisplayStatusMessage");
222 GWlxGetStatusMessage = (PGWLXGETSTATUSMESSAGE)RTLdrGetFunction(hLdrMod, "WlxGetStatusMessage");
223 GWlxRemoveStatusMessage = (PGWLXREMOVESTATUSMESSAGE)RTLdrGetFunction(hLdrMod, "WlxRemoveStatusMessage");
224 /* GINA 1.4, optional */
225 GWlxGetConsoleSwitchCredentials =
226 (PGWLXGETCONSOLESWITCHCREDENTIALS)RTLdrGetFunction(hLdrMod, "WlxGetConsoleSwitchCredentials");
227 GWlxReconnectNotify = (PGWLXRECONNECTNOTIFY)RTLdrGetFunction(hLdrMod, "WlxReconnectNotify");
228 GWlxDisconnectNotify = (PGWLXDISCONNECTNOTIFY)RTLdrGetFunction(hLdrMod, "WlxDisconnectNotify");
229 VBoxGINAVerbose(0, "VBoxGINA::WlxNegotiate: optional function pointers:\n"
230 " WlxStartApplication: %p\n"
231 " WlxScreenSaverNotify: %p\n"
232 " WlxNetworkProviderLoad: %p\n"
233 " WlxDisplayStatusMessage: %p\n"
234 " WlxGetStatusMessage: %p\n"
235 " WlxRemoveStatusMessage: %p\n"
236 " WlxGetConsoleSwitchCredentials: %p\n"
237 " WlxReconnectNotify: %p\n"
238 " WlxDisconnectNotify: %p\n",
239 GWlxStartApplication, GWlxScreenSaverNotify, GWlxNetworkProviderLoad,
240 GWlxDisplayStatusMessage, GWlxGetStatusMessage, GWlxRemoveStatusMessage,
241 GWlxGetConsoleSwitchCredentials, GWlxReconnectNotify, GWlxDisconnectNotify);
242
243 wlxVersion = dwWinlogonVersion;
244
245 /* Acknowledge interface version. */
246 if (pdwDllVersion)
247 *pdwDllVersion = dwWinlogonVersion;
248
249 return TRUE; /* We're ready to rumble! */
250}
251
252
253BOOL WINAPI WlxInitialize(LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved,
254 PVOID pWinlogonFunctions, PVOID *pWlxContext)
255{
256 VBoxGINAVerbose(0, "VBoxGINA::WlxInitialize\n");
257
258 /* Store Winlogon function table */
259 pWlxFuncs = (PWLX_DISPATCH_VERSION_1_1)pWinlogonFunctions;
260
261 /* Store handle to Winlogon service*/
262 hGinaWlx = hWlx;
263
264 VBoxGINAReportStatus(VBoxGuestFacilityStatus_Init);
265
266 /* Hook the dialogs */
267 hookDialogBoxes(pWlxFuncs, wlxVersion);
268
269 /* Forward call */
270 if (GWlxInitialize)
271 return GWlxInitialize(lpWinsta, hWlx, pvReserved, pWinlogonFunctions, pWlxContext);
272 return TRUE;
273}
274
275
276VOID WINAPI WlxDisplaySASNotice(PVOID pWlxContext)
277{
278 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplaySASNotice\n");
279
280 /* Check if there are credentials for us, if so simulate C-A-D */
281 int rc = VbglR3CredentialsQueryAvailability();
282 if (RT_SUCCESS(rc))
283 {
284 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplaySASNotice: simulating C-A-D\n");
285 /* Wutomatic C-A-D */
286 pWlxFuncs->WlxSasNotify(hGinaWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
287 }
288 else
289 {
290 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplaySASNotice: starting credentials poller\n");
291 /* start the credentials poller thread */
292 VBoxGINACredentialsPollerCreate();
293 /* Forward call to MSGINA. */
294 if (GWlxDisplaySASNotice)
295 GWlxDisplaySASNotice(pWlxContext);
296 }
297}
298
299
300int WINAPI WlxLoggedOutSAS(PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId,
301 PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken,
302 PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID *pProfile)
303{
304 VBoxGINAVerbose(0, "VBoxGINA::WlxLoggedOutSAS\n");
305
306 /* When performing a direct logon without C-A-D, our poller might not be running */
307 int rc = VbglR3CredentialsQueryAvailability();
308 if (RT_FAILURE(rc))
309 VBoxGINACredentialsPollerCreate();
310
311 if (GWlxLoggedOutSAS)
312 {
313 int iRet;
314 iRet = GWlxLoggedOutSAS(pWlxContext, dwSasType, pAuthenticationId, pLogonSid,
315 pdwOptions, phToken, pMprNotifyInfo, pProfile);
316
317 if (iRet == WLX_SAS_ACTION_LOGON)
318 {
319 //
320 // Copy pMprNotifyInfo and pLogonSid for later use
321 //
322
323 // pMprNotifyInfo->pszUserName
324 // pMprNotifyInfo->pszDomain
325 // pMprNotifyInfo->pszPassword
326 // pMprNotifyInfo->pszOldPassword
327 }
328
329 return iRet;
330 }
331
332 return WLX_SAS_ACTION_NONE;
333}
334
335
336/**
337 * WinLogon calls this function following a successful logon to request that the GINA activate the user's shell program.
338 */
339BOOL WINAPI WlxActivateUserShell(PVOID pWlxContext, PWSTR pszDesktopName,
340 PWSTR pszMprLogonScript, PVOID pEnvironment)
341{
342 VBoxGINAVerbose(0, "VBoxGINA::WlxActivateUserShell\n");
343
344 /*
345 * Report status "terminated" to the host -- this means that a user
346 * got logged in (either manually or automatically using the provided credentials).
347 */
348 VBoxGINAReportStatus(VBoxGuestFacilityStatus_Terminated);
349
350 /* Forward call to MSGINA. */
351 if (GWlxActivateUserShell)
352 return GWlxActivateUserShell(pWlxContext, pszDesktopName, pszMprLogonScript, pEnvironment);
353 return TRUE; /* Activate the user shell. */
354}
355
356
357int WINAPI WlxLoggedOnSAS(PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
358{
359 VBoxGINAVerbose(0, "VBoxGINA::WlxLoggedOnSAS: dwSasType=%ld\n", dwSasType);
360
361 /*
362 * We don't want to do anything special here since the OS should behave
363 * as VBoxGINA wouldn't have been installed. So pass all calls down
364 * to the original MSGINA.
365 */
366
367 /* Forward call to MSGINA. */
368 VBoxGINAVerbose(0, "VBoxGINA::WlxLoggedOnSAS: Forwarding call to MSGINA ...\n");
369 if (GWlxLoggedOnSAS)
370 return GWlxLoggedOnSAS(pWlxContext, dwSasType, pReserved);
371 return WLX_SAS_ACTION_NONE;
372}
373
374VOID WINAPI WlxDisplayLockedNotice(PVOID pWlxContext)
375{
376 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplayLockedNotice\n");
377
378 /* Check if there are credentials for us, if so simulate C-A-D */
379 int rc = VbglR3CredentialsQueryAvailability();
380 if (RT_SUCCESS(rc))
381 {
382 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplayLockedNotice: simulating C-A-D\n");
383 /* Automatic C-A-D */
384 pWlxFuncs->WlxSasNotify(hGinaWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
385 }
386 else
387 {
388 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplayLockedNotice: starting credentials poller\n");
389 /* start the credentials poller thread */
390 VBoxGINACredentialsPollerCreate();
391 /* Forward call to MSGINA. */
392 if (GWlxDisplayLockedNotice)
393 GWlxDisplayLockedNotice(pWlxContext);
394 }
395}
396
397
398/*
399 * Winlogon calls this function before it attempts to lock the workstation.
400 */
401BOOL WINAPI WlxIsLockOk(PVOID pWlxContext)
402{
403 VBoxGINAVerbose(0, "VBoxGINA::WlxIsLockOk\n");
404
405 /* Forward call to MSGINA. */
406 if (GWlxIsLockOk)
407 return GWlxIsLockOk(pWlxContext);
408 return TRUE; /* Locking is OK. */
409}
410
411
412int WINAPI WlxWkstaLockedSAS(PVOID pWlxContext, DWORD dwSasType)
413{
414 VBoxGINAVerbose(0, "VBoxGINA::WlxWkstaLockedSAS, dwSasType=%ld\n", dwSasType);
415
416 /* When performing a direct logon without C-A-D, our poller might not be running */
417 int rc = VbglR3CredentialsQueryAvailability();
418 if (RT_FAILURE(rc))
419 VBoxGINACredentialsPollerCreate();
420
421 /* Forward call to MSGINA. */
422 if (GWlxWkstaLockedSAS)
423 return GWlxWkstaLockedSAS(pWlxContext, dwSasType);
424 return WLX_SAS_ACTION_NONE;
425}
426
427
428BOOL WINAPI WlxIsLogoffOk(PVOID pWlxContext)
429{
430 VBoxGINAVerbose(0, "VBoxGINA::WlxIsLogoffOk\n");
431
432 if (GWlxIsLogoffOk)
433 return GWlxIsLogoffOk(pWlxContext);
434 return TRUE; /* Log off is OK. */
435}
436
437
438/*
439 * Winlogon calls this function to notify the GINA of a logoff operation on this
440 * workstation. This allows the GINA to perform any logoff operations that may be required.
441 */
442VOID WINAPI WlxLogoff(PVOID pWlxContext)
443{
444 VBoxGINAVerbose(0, "VBoxGINA::WlxLogoff\n");
445
446 /* No need to report the "active" status to the host here -- this will be done
447 * when VBoxGINA gets the chance to hook the dialogs (again). */
448
449 /* Forward call to MSGINA. */
450 if (GWlxLogoff)
451 GWlxLogoff(pWlxContext);
452}
453
454
455/*
456 * Winlogon calls this function just before shutting down.
457 * This allows the GINA to perform any necessary shutdown tasks.
458 * Will be called *after* WlxLogoff!
459 */
460VOID WINAPI WlxShutdown(PVOID pWlxContext, DWORD ShutdownType)
461{
462 VBoxGINAVerbose(0, "VBoxGINA::WlxShutdown\n");
463
464 /*
465 * Report status "inactive" to the host -- this means the
466 * auto-logon feature won't be active anymore at this point
467 * (until it maybe gets loaded again after a reboot).
468 */
469 VBoxGINAReportStatus(VBoxGuestFacilityStatus_Inactive);
470
471 /* Forward call to MSGINA. */
472 if (GWlxShutdown)
473 GWlxShutdown(pWlxContext, ShutdownType);
474}
475
476
477/*
478 * GINA 1.1 entry points
479 */
480BOOL WINAPI WlxScreenSaverNotify(PVOID pWlxContext, BOOL *pSecure)
481{
482 RT_NOREF(pWlxContext);
483 VBoxGINAVerbose(0, "VBoxGINA::WlxScreenSaverNotify, pSecure=%d\n",
484 pSecure ? *pSecure : 0);
485
486 /* Report the status to "init" since the screensaver
487 * (Winlogon) does not give VBoxGINA yet the chance to hook into dialogs
488 * which only then in turn would set the status to "active" -- so
489 * at least set some status here. */
490 VBoxGINAReportStatus(VBoxGuestFacilityStatus_Init);
491
492 /* Note: Disabling the screensaver's grace period is necessary to get
493 * VBoxGINA loaded and set the status to "terminated" again properly
494 * after the logging-in handling was done. To do this:
495 * - on a non-domain machine, set:
496 * HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ScreenSaverGracePeriod (REG_SZ)
497 * to "0"
498 * - on a machine joined a domain:
499 * use the group policy preferences and/or the registry key above,
500 * depending on the domain's policies.
501 */
502
503 /* Indicate that the workstation should be locked. */
504 *pSecure = TRUE;
505
506 return TRUE; /* Screensaver should be activated. */
507}
508
509
510BOOL WINAPI WlxStartApplication(PVOID pWlxContext, PWSTR pszDesktopName,
511 PVOID pEnvironment, PWSTR pszCmdLine)
512{
513 VBoxGINAVerbose(0, "VBoxGINA::WlxStartApplication: pWlxCtx=%p, pszDesktopName=%ls, pEnvironment=%p, pszCmdLine=%ls\n",
514 pWlxContext, pszDesktopName, pEnvironment, pszCmdLine);
515
516 /* Forward to MSGINA if present. */
517 if (GWlxStartApplication)
518 return GWlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszCmdLine);
519 return FALSE;
520}
521
522
523/*
524 * GINA 1.3 entry points
525 */
526BOOL WINAPI WlxNetworkProviderLoad(PVOID pWlxContext, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo)
527{
528 VBoxGINAVerbose(0, "VBoxGINA::WlxNetworkProviderLoad\n");
529
530 /* Forward to MSGINA if present. */
531 if (GWlxNetworkProviderLoad)
532 return GWlxNetworkProviderLoad(pWlxContext, pNprNotifyInfo);
533 return FALSE;
534}
535
536
537BOOL WINAPI WlxDisplayStatusMessage(PVOID pWlxContext, HDESK hDesktop, DWORD dwOptions,
538 PWSTR pTitle, PWSTR pMessage)
539{
540 VBoxGINAVerbose(0, "VBoxGINA::WlxDisplayStatusMessage\n");
541
542 /* Forward to MSGINA if present. */
543 if (GWlxDisplayStatusMessage)
544 return GWlxDisplayStatusMessage(pWlxContext, hDesktop, dwOptions, pTitle, pMessage);
545 return FALSE;
546}
547
548
549BOOL WINAPI WlxGetStatusMessage(PVOID pWlxContext, DWORD *pdwOptions,
550 PWSTR pMessage, DWORD dwBufferSize)
551{
552 VBoxGINAVerbose(0, "VBoxGINA::WlxGetStatusMessage\n");
553
554 /* Forward to MSGINA if present. */
555 if (GWlxGetStatusMessage)
556 return GWlxGetStatusMessage(pWlxContext, pdwOptions, pMessage, dwBufferSize);
557 return FALSE;
558}
559
560
561BOOL WINAPI WlxRemoveStatusMessage(PVOID pWlxContext)
562{
563 VBoxGINAVerbose(0, "VBoxGINA::WlxRemoveStatusMessage\n");
564
565 /* Forward to MSGINA if present. */
566 if (GWlxRemoveStatusMessage)
567 return GWlxRemoveStatusMessage(pWlxContext);
568 return FALSE;
569}
570
571
572/*
573 * GINA 1.4 entry points
574 */
575BOOL WINAPI WlxGetConsoleSwitchCredentials(PVOID pWlxContext,PVOID pCredInfo)
576{
577 VBoxGINAVerbose(0, "VBoxGINA::WlxGetConsoleSwitchCredentials\n");
578
579 /* Forward call to MSGINA if present */
580 if (GWlxGetConsoleSwitchCredentials)
581 return GWlxGetConsoleSwitchCredentials(pWlxContext,pCredInfo);
582 return FALSE;
583}
584
585
586VOID WINAPI WlxReconnectNotify(PVOID pWlxContext)
587{
588 VBoxGINAVerbose(0, "VBoxGINA::WlxReconnectNotify\n");
589
590 /* Forward to MSGINA if present. */
591 if (GWlxReconnectNotify)
592 GWlxReconnectNotify(pWlxContext);
593}
594
595
596VOID WINAPI WlxDisconnectNotify(PVOID pWlxContext)
597{
598 VBoxGINAVerbose(0, "VBoxGINA::WlxDisconnectNotify\n");
599
600 /* Forward to MSGINA if present. */
601 if (GWlxDisconnectNotify)
602 GWlxDisconnectNotify(pWlxContext);
603}
604
605
606/*
607 * Windows Notification Package callbacks
608 */
609void WnpScreenSaverStop(PWLX_NOTIFICATION_INFO pInfo)
610{
611 RT_NOREF(pInfo);
612 VBoxGINAVerbose(0, "VBoxGINA::WnpScreenSaverStop\n");
613
614 /*
615 * Because we set the status to "init" in WlxScreenSaverNotify when
616 * the screensaver becomes active we also have to take into account
617 * that in case the screensaver terminates (either within the grace
618 * period or because the lock screen appears) we have to set the
619 * status accordingly.
620 */
621 VBoxGINAReportStatus(VBoxGuestFacilityStatus_Terminated);
622}
623
624
625DWORD WINAPI VBoxGINADebug(void)
626{
627#ifdef DEBUG
628 DWORD dwVersion;
629 BOOL fRes = WlxNegotiate(WLX_VERSION_1_4, &dwVersion);
630 if (!fRes)
631 return 1;
632
633 void* pWlxContext = NULL;
634 WLX_DISPATCH_VERSION_1_4 wlxDispatch;
635 ZeroMemory(&wlxDispatch, sizeof(WLX_DISPATCH_VERSION_1_4));
636
637 fRes = WlxInitialize(0, 0,
638 NULL /* Reserved */,
639 NULL /* Winlogon functions */,
640 &pWlxContext);
641 if (!fRes)
642 return 2;
643
644 WlxDisplaySASNotice(pWlxContext);
645
646 char szSID[MAX_PATH];
647 LUID luidAuth;
648 DWORD dwOpts;
649 WLX_MPR_NOTIFY_INFO wlxNotifyInfo;
650 void* pvProfile;
651 HANDLE hToken;
652 int iRes = WlxLoggedOutSAS(pWlxContext, WLX_SAS_TYPE_CTRL_ALT_DEL,
653 &luidAuth, szSID,
654 &dwOpts, &hToken, &wlxNotifyInfo, &pvProfile);
655 return iRes;
656#else
657 return 0;
658#endif
659}
660
Note: See TracBrowser for help on using the repository browser.

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