Subversion Repositories Aucun

Rev

Rev 138 | Rev 161 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
100 ixe013 1
/*
2
 Copyright (c) 2008, Guillaume Seguin ([email protected])
3
 All rights reserved.
2 ixe013 4
 
100 ixe013 5
 Redistribution and use in source and binary forms, with or without
6
 modification, are permitted provided that the following conditions
7
 are met:
2 ixe013 8
 
100 ixe013 9
 1. Redistributions of source code must retain the above copyright
10
    notice, this list of conditions and the following disclaimer.
2 ixe013 11
 
100 ixe013 12
 2. Redistributions in binary form must reproduce the above copyright
13
    notice, this list of conditions and the following disclaimer in the
14
    documentation and/or other materials provided with the distribution.
2 ixe013 15
 
100 ixe013 16
 THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
17
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
 ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
20
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
 SUCH DAMAGE.
27
*/
2 ixe013 28
 
29
#define _WIN32_WINNT 0x0501
30
 
31
#include <windows.h>
32
#include <winwlx.h>
33
 
34
#include "Ginahook.h"
35
#include "GinaDlg.h"
40 ixe013 36
#include "global.h"
91 ixe013 37
#include "trace.h"
40 ixe013 38
#include "debug.h"
138 ixe013 39
#include "randpasswd.h"
91 ixe013 40
#include "SecurityHelper.h"
118 ixe013 41
#include "Settings.h"
138 ixe013 42
#include "Serialize.h"
2 ixe013 43
 
122 ixe013 44
#include "loggedout_dlg.h"
127 ixe013 45
#include "resource.h"
122 ixe013 46
 
2 ixe013 47
//
48
// Location of the real MSGINA.
49
//
50
 
51
#define REALGINA_PATH      TEXT("MSGINA.DLL")
127 ixe013 52
#define GINASTUB_VERSION   (WLX_VERSION_1_4)
40 ixe013 53
 
54
//Hooked instance of MSGINA
129 ixe013 55
HINSTANCE hMsginaDll;
40 ixe013 56
 
2 ixe013 57
//
58
// Winlogon function dispatch table.
59
//
40 ixe013 60
PVOID g_pWinlogon = NULL;
2 ixe013 61
static DWORD g_dwVersion = WLX_VERSION_1_4;
62
 
40 ixe013 63
static MyGinaContext gAucunContext = {0};
64
MyGinaContext *pgAucunContext = &gAucunContext;
65
 
2 ixe013 66
//
67
// Pointers to the real MSGINA functions.
68
//
69
 
70
static PFWLXNEGOTIATE            pfWlxNegotiate;
71
static PFWLXINITIALIZE           pfWlxInitialize;
72
static PFWLXDISPLAYSASNOTICE     pfWlxDisplaySASNotice;
73
static PFWLXLOGGEDOUTSAS         pfWlxLoggedOutSAS;
74
static PFWLXACTIVATEUSERSHELL    pfWlxActivateUserShell;
75
static PFWLXLOGGEDONSAS          pfWlxLoggedOnSAS;
76
static PFWLXDISPLAYLOCKEDNOTICE  pfWlxDisplayLockedNotice;
77
static PFWLXWKSTALOCKEDSAS       pfWlxWkstaLockedSAS;
78
static PFWLXISLOCKOK             pfWlxIsLockOk;
79
static PFWLXISLOGOFFOK           pfWlxIsLogoffOk;
80
static PFWLXLOGOFF               pfWlxLogoff;
81
static PFWLXSHUTDOWN             pfWlxShutdown;
82
 
83
//
84
// New for version 1.1
85
//
86
static PFWLXSTARTAPPLICATION     pfWlxStartApplication  = NULL;
87
static PFWLXSCREENSAVERNOTIFY    pfWlxScreenSaverNotify = NULL;
88
 
89
//
90
// New for version 1.2 - No new GINA interface was added, except
91
//                       a new function in the dispatch table.
92
//
93
 
94
//
95
// New for version 1.3
96
//
97
static PFWLXNETWORKPROVIDERLOAD   pfWlxNetworkProviderLoad  = NULL;
98
static PFWLXDISPLAYSTATUSMESSAGE  pfWlxDisplayStatusMessage = NULL;
99
static PFWLXGETSTATUSMESSAGE      pfWlxGetStatusMessage     = NULL;
100
static PFWLXREMOVESTATUSMESSAGE   pfWlxRemoveStatusMessage  = NULL;
101
 
102
//
103
// New for version 1.4
104
//
105
static PWLXGETCONSOLESWITCHCREDENTIALS pfWlxGetConsoleSwitchCredentials = NULL;
106
static PWLXRECONNECTNOTIFY pfWlxReconnectNotify  = NULL;
107
static PWLXDISCONNECTNOTIFY pfWlxDisconnectNotify = NULL;
108
 
40 ixe013 109
PVOID GetHookedContext(PVOID pWlxContext)
110
{
134 ixe013 111
    return ((MyGinaContext*)pWlxContext)->mHookedContext;
40 ixe013 112
}
91 ixe013 113
 
2 ixe013 114
//
115
// Hook into the real MSGINA.
116
//
129 ixe013 117
BOOL MyInitialize(HINSTANCE hMsginaDll, DWORD dwWlxVersion)
2 ixe013 118
{
134 ixe013 119
    //
120
    // Get pointers to all of the WLX functions in the real MSGINA.
121
    //
122
    pfWlxInitialize = (PFWLXINITIALIZE) GetProcAddress(hMsginaDll, "WlxInitialize");
2 ixe013 123
 
134 ixe013 124
    if (!pfWlxInitialize)
125
    {
126
        return FALSE;
127
    }
2 ixe013 128
 
134 ixe013 129
    pfWlxDisplaySASNotice = (PFWLXDISPLAYSASNOTICE) GetProcAddress(hMsginaDll, "WlxDisplaySASNotice");
2 ixe013 130
 
134 ixe013 131
    if (!pfWlxDisplaySASNotice)
132
    {
133
        return FALSE;
134
    }
2 ixe013 135
 
134 ixe013 136
    pfWlxLoggedOutSAS = (PFWLXLOGGEDOUTSAS) GetProcAddress(hMsginaDll, "WlxLoggedOutSAS");
2 ixe013 137
 
134 ixe013 138
    if (!pfWlxLoggedOutSAS)
139
    {
140
        return FALSE;
141
    }
2 ixe013 142
 
134 ixe013 143
    pfWlxActivateUserShell = (PFWLXACTIVATEUSERSHELL) GetProcAddress(hMsginaDll, "WlxActivateUserShell");
2 ixe013 144
 
134 ixe013 145
    if (!pfWlxActivateUserShell)
146
    {
147
        return FALSE;
148
    }
2 ixe013 149
 
134 ixe013 150
    pfWlxLoggedOnSAS = (PFWLXLOGGEDONSAS) GetProcAddress(hMsginaDll, "WlxLoggedOnSAS");
2 ixe013 151
 
134 ixe013 152
    if (!pfWlxLoggedOnSAS)
153
    {
154
        return FALSE;
155
    }
2 ixe013 156
 
134 ixe013 157
    pfWlxDisplayLockedNotice = (PFWLXDISPLAYLOCKEDNOTICE) GetProcAddress(hMsginaDll, "WlxDisplayLockedNotice");
2 ixe013 158
 
134 ixe013 159
    if (!pfWlxDisplayLockedNotice)
160
    {
161
        return FALSE;
162
    }
2 ixe013 163
 
134 ixe013 164
    pfWlxIsLockOk = (PFWLXISLOCKOK) GetProcAddress(hMsginaDll, "WlxIsLockOk");
2 ixe013 165
 
134 ixe013 166
    if (!pfWlxIsLockOk)
167
    {
168
        return FALSE;
169
    }
2 ixe013 170
 
134 ixe013 171
    pfWlxWkstaLockedSAS = (PFWLXWKSTALOCKEDSAS) GetProcAddress(hMsginaDll, "WlxWkstaLockedSAS");
2 ixe013 172
 
134 ixe013 173
    if (!pfWlxWkstaLockedSAS)
174
    {
175
        return FALSE;
176
    }
2 ixe013 177
 
134 ixe013 178
    pfWlxIsLogoffOk = (PFWLXISLOGOFFOK) GetProcAddress(hMsginaDll, "WlxIsLogoffOk");
2 ixe013 179
 
134 ixe013 180
    if (!pfWlxIsLogoffOk)
181
    {
182
        return FALSE;
183
    }
2 ixe013 184
 
134 ixe013 185
    pfWlxLogoff = (PFWLXLOGOFF) GetProcAddress(hMsginaDll, "WlxLogoff");
2 ixe013 186
 
134 ixe013 187
    if (!pfWlxLogoff)
188
    {
189
        return FALSE;
190
    }
2 ixe013 191
 
134 ixe013 192
    pfWlxShutdown = (PFWLXSHUTDOWN) GetProcAddress(hMsginaDll, "WlxShutdown");
2 ixe013 193
 
134 ixe013 194
    if (!pfWlxShutdown)
195
    {
196
        return FALSE;
197
    }
2 ixe013 198
 
134 ixe013 199
    //
200
    // Load functions for version 1.1 as necessary.
201
    //
202
    if (dwWlxVersion > WLX_VERSION_1_0)
203
    {
204
        pfWlxStartApplication = (PFWLXSTARTAPPLICATION) GetProcAddress(hMsginaDll, "WlxStartApplication");
2 ixe013 205
 
134 ixe013 206
        if (!pfWlxStartApplication)
207
        {
208
            return FALSE;
209
        }
2 ixe013 210
 
134 ixe013 211
        pfWlxScreenSaverNotify = (PFWLXSCREENSAVERNOTIFY) GetProcAddress(hMsginaDll, "WlxScreenSaverNotify");
2 ixe013 212
 
134 ixe013 213
        if (!pfWlxScreenSaverNotify)
214
        {
215
            return FALSE;
216
        }
217
    }
2 ixe013 218
 
134 ixe013 219
    //
220
    // Load functions for version 1.3 as necessary.
221
    //
222
    if (dwWlxVersion > WLX_VERSION_1_2)
223
    {
224
        pfWlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hMsginaDll, "WlxNetworkProviderLoad");
2 ixe013 225
 
134 ixe013 226
        if (!pfWlxNetworkProviderLoad)
227
        {
228
            return FALSE;
229
        }
2 ixe013 230
 
134 ixe013 231
        pfWlxDisplayStatusMessage = (PFWLXDISPLAYSTATUSMESSAGE)GetProcAddress(hMsginaDll, "WlxDisplayStatusMessage");
2 ixe013 232
 
134 ixe013 233
        if (!pfWlxDisplayStatusMessage)
234
        {
235
            return FALSE;
236
        }
2 ixe013 237
 
134 ixe013 238
        pfWlxGetStatusMessage =(PFWLXGETSTATUSMESSAGE)GetProcAddress(hMsginaDll, "WlxGetStatusMessage");
239
        if (!pfWlxGetStatusMessage)
240
        {
241
            return FALSE;
242
        }
2 ixe013 243
 
134 ixe013 244
        pfWlxRemoveStatusMessage =
245
            (PFWLXREMOVESTATUSMESSAGE)
246
            GetProcAddress(hMsginaDll, "WlxRemoveStatusMessage");
247
        if (!pfWlxRemoveStatusMessage)
248
        {
249
            return FALSE;
250
        }
251
    }
23 ixe013 252
 
134 ixe013 253
    //
254
    // Load functions for version 1.3 as necessary.
255
    //
256
    if (dwWlxVersion > WLX_VERSION_1_3)
257
    {
258
        pfWlxGetConsoleSwitchCredentials = (PWLXGETCONSOLESWITCHCREDENTIALS) GetProcAddress(hMsginaDll, "WlxGetConsoleSwitchCredentials");
259
        if (!pfWlxGetConsoleSwitchCredentials) return FALSE;
23 ixe013 260
 
134 ixe013 261
        pfWlxReconnectNotify = (PWLXRECONNECTNOTIFY) GetProcAddress(hMsginaDll, "WlxReconnectNotify");
262
        if (!pfWlxReconnectNotify) return FALSE;
23 ixe013 263
 
134 ixe013 264
        pfWlxDisconnectNotify = (PWLXDISCONNECTNOTIFY) GetProcAddress(hMsginaDll, "WlxDisconnectNotify");
265
        if (!pfWlxDisconnectNotify) return FALSE;
23 ixe013 266
 
134 ixe013 267
    }
23 ixe013 268
 
134 ixe013 269
    //
270
    // Everything loaded OK.
271
    //
272
    return TRUE;
2 ixe013 273
}
274
 
275
 
23 ixe013 276
BOOL WINAPI WlxNegotiate(DWORD dwWinlogonVersion, DWORD *pdwDllVersion)
2 ixe013 277
{
134 ixe013 278
    DWORD dwWlxVersion = GINASTUB_VERSION;
9 ixe013 279
 
134 ixe013 280
    TRACE(eDEBUG, L"WlxNegotiate\n");
281
    //
282
    // Load MSGINA.DLL.
283
    //
284
    if (!(hMsginaDll = LoadLibrary(REALGINA_PATH)))
285
    {
286
        return FALSE;
287
    }
9 ixe013 288
 
134 ixe013 289
    //
290
    // Get pointers to WlxNegotiate function in the real MSGINA.
291
    //
292
    pfWlxNegotiate = (PFWLXNEGOTIATE) GetProcAddress(hMsginaDll, "WlxNegotiate");
293
    if (!pfWlxNegotiate)
294
    {
295
        return FALSE;
296
    }
9 ixe013 297
 
134 ixe013 298
    //
299
    // Handle older version of Winlogon.
300
    //
301
    if (dwWinlogonVersion < dwWlxVersion)
302
    {
303
        dwWlxVersion = dwWinlogonVersion;
304
    }
2 ixe013 305
 
134 ixe013 306
    //
307
    // Negotiate with MSGINA for version that we can support.
308
    //
309
    if (!pfWlxNegotiate(dwWlxVersion, &dwWlxVersion))
310
    {
311
        return FALSE;
312
    }
2 ixe013 313
 
134 ixe013 314
    //
315
    // Load the rest of the WLX functions from the real MSGINA.
316
    //
317
    if (!MyInitialize(hMsginaDll, dwWlxVersion))
318
    {
319
        return FALSE;
320
    }
2 ixe013 321
 
134 ixe013 322
    //
323
    // Inform Winlogon which version to use.
324
    //
325
    *pdwDllVersion = g_dwVersion = dwWlxVersion;
2 ixe013 326
 
134 ixe013 327
    return TRUE;
2 ixe013 328
}
329
 
330
 
23 ixe013 331
BOOL WINAPI WlxInitialize(LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID * pWlxContext)
2 ixe013 332
{
134 ixe013 333
    BOOL result;
2 ixe013 334
 
134 ixe013 335
    TRACE(eDEBUG, L"WlxInitialize\n");
336
    //
337
    // Save pointer to dispatch table.
338
    //
339
    // Note that g_pWinlogon will need to be properly casted to the
340
    // appropriate version when used to call function in the dispatch
341
    // table.
342
    //
343
    // For example, assuming we are at WLX_VERSION_1_3, we would call
344
    // WlxSasNotify() as follows:
345
    //
346
    // ((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxSasNotify(hWlx, MY_SAS);
347
    //
348
    g_pWinlogon = pWinlogonFunctions;
2 ixe013 349
 
134 ixe013 350
    //
351
    // Now hook the WlxDialogBoxParam() dispatch function.
352
    //
353
    HookWlxDialogBoxParam(g_pWinlogon, g_dwVersion);
40 ixe013 354
 
134 ixe013 355
    *pWlxContext = &gAucunContext;
356
    gAucunContext.Winlogon = hWlx;
357
    result = pfWlxInitialize(lpWinsta, hWlx, pvReserved, pWinlogonFunctions, &gAucunContext.mHookedContext);
91 ixe013 358
 
134 ixe013 359
    if (result == TRUE)
360
    {
361
        gAucunContext.mLSA = 0; //safety
362
        RegisterLogonProcess(LOGON_PROCESS_NAME, &gAucunContext.mLSA);
137 ixe013 363
 
138 ixe013 364
        //The first winlogon process will set the password for the other processes
365
        SerializeEnter();
366
 
154 ixe013 367
        if (!*gEncryptedRandomSelfservePassword)
368
            GenerateRandomUnicodePassword(gEncryptedRandomSelfservePassword, gEncryptedRandomSelfservePassword_len);
138 ixe013 369
 
370
        SerializeLeave();
371
 
372
        {
373
            wchar_t username[255];
374
            GetSelfServeSetting(L"Username", username, sizeof username / sizeof *username);
375
            SetSelfservePassword(username);
376
        }
134 ixe013 377
    }
122 ixe013 378
 
134 ixe013 379
    return result;
23 ixe013 380
}
2 ixe013 381
 
23 ixe013 382
VOID WINAPI WlxDisplaySASNotice(PVOID pWlxContext)
383
{
134 ixe013 384
    TRACE(eDEBUG, L"WlxDisplaySASNotice\n");
116 ixe013 385
 
137 ixe013 386
    //If we just finished a selfserve request (and pressed CTRL-ALT-DEL) we skip this notice.
387
    //If we did show the notice, the user would have to press CTRL-ALT-DEL a second time
388
    //It makes the mSelfServeLogon flag live a little longer than the actual self serve logon
389
    if (((MyGinaContext*)pWlxContext)->mSelfServeLogon)
390
    {
391
        ((MyGinaContext*)pWlxContext)->mSelfServeLogon = FALSE;
392
        //Inform Winlogon that CTRL-ALT_DELETE was pressed
393
        ((PWLX_DISPATCH_VERSION_1_0) g_pWinlogon)->WlxSasNotify(gAucunContext.Winlogon, WLX_SAS_TYPE_CTRL_ALT_DEL);
394
    }
395
    else
396
    {
397
        pfWlxDisplaySASNotice(GetHookedContext(pWlxContext));
398
    }
23 ixe013 399
}
2 ixe013 400
 
401
 
23 ixe013 402
int WINAPI WlxLoggedOutSAS(PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID * pProfile)
403
{
134 ixe013 404
    int result;
40 ixe013 405
 
134 ixe013 406
    TRACE(eDEBUG, L"WlxLoggedOutSAS\n");
40 ixe013 407
 
134 ixe013 408
    result =  pfWlxLoggedOutSAS(GetHookedContext(pWlxContext), dwSasType, pAuthenticationId, pLogonSid, pdwOptions, phToken, pMprNotifyInfo, pProfile);
91 ixe013 409
 
134 ixe013 410
    if (result == WLX_SAS_ACTION_LOGON)
411
    {
137 ixe013 412
        //A user might have gotten hold of the selfserve username's password.
413
        //Whatever the reason for logging in with the selfserve account, when
414
        //you do, you get the selfservice shell.
134 ixe013 415
        wchar_t username[255];
91 ixe013 416
 
134 ixe013 417
        if (GetSelfServeSetting(L"Username", username, sizeof username / sizeof *username) == S_OK)
418
        {
419
            PSID selfservesid = 0;
420
            if (GetSIDFromUsername(username, &selfservesid))
421
            {
137 ixe013 422
                PSID tokensid = 0;
423
                if (GetSIDFromToken(*phToken, &tokensid))
134 ixe013 424
                {
137 ixe013 425
                    //mSelfServeLogon will be true if user logging in with selfserve account
426
                    ((MyGinaContext*)pWlxContext)->mSelfServeLogon = EqualSid(selfservesid, tokensid);
134 ixe013 427
 
137 ixe013 428
                    HeapFree(GetProcessHeap(), 0, tokensid);
134 ixe013 429
                }
430
                HeapFree(GetProcessHeap(), 0, selfservesid);
431
            }
432
        }
137 ixe013 433
 
134 ixe013 434
        ((MyGinaContext*)pWlxContext)->mCurrentUser = *phToken;
435
    }
436
    else
437
    {
438
        TRACE(eERROR, L"Logon failed or cancelled.\n");
439
    }
440
 
441
    return result;
2 ixe013 442
}
443
 
444
 
445
BOOL WINAPI WlxActivateUserShell(PVOID pWlxContext, PWSTR pszDesktopName, PWSTR pszMprLogonScript, PVOID pEnvironment)
446
{
134 ixe013 447
    BOOL result = FALSE;
109 ixe013 448
 
134 ixe013 449
    TRACE(eDEBUG, L"WlxActivateUserShell\n");
450
    if (((MyGinaContext*)pWlxContext)->mSelfServeLogon)
451
    {
452
        wchar_t shell[MAX_PATH];
118 ixe013 453
 
134 ixe013 454
        if (GetSelfServeSetting(L"Shell", shell, sizeof shell / sizeof *shell) == S_OK)
455
        {
456
            TRACE(eERROR, L"Switching to selfservice account\n");
457
            //TODO : Deny Administrator group in token (not sure it will work)
458
            //TODO : Allow for command line parameters (could be in the registry, with placemarks ?)
459
            result = CreateProcessAsUserOnDesktop(((MyGinaContext*)pWlxContext)->mCurrentUser, shell, pszDesktopName, pEnvironment);
460
        }
137 ixe013 461
 
462
        if (*gUsername)
463
        {
464
            HKEY reg;
465
 
466
            if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, KEY_WRITE, &reg) == ERROR_SUCCESS)
467
            {
468
                RegSetValueEx(reg, L"DefaultUserName", 0, REG_SZ, (BYTE*)gUsername, sizeof(wchar_t)*(wcslen(gUsername)+1));
469
                RegCloseKey(reg);
470
                *gUsername = 0;
471
            }
472
        }
134 ixe013 473
    }
118 ixe013 474
 
134 ixe013 475
    if (!result)
476
        result = pfWlxActivateUserShell(GetHookedContext(pWlxContext), pszDesktopName, pszMprLogonScript, pEnvironment);
109 ixe013 477
 
134 ixe013 478
    return result;
2 ixe013 479
}
480
 
481
 
482
int WINAPI WlxLoggedOnSAS(PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
483
{
134 ixe013 484
    int result;
91 ixe013 485
 
134 ixe013 486
    TRACE(eDEBUG, L"WlxLoggedOnSAS, type %d\n", dwSasType);
91 ixe013 487
 
134 ixe013 488
    //If you press CTRL-ALT-DEL in the selfservice shell, the user is logged off
489
    if (((MyGinaContext*)pWlxContext)->mSelfServeLogon)
490
    {
491
        TRACEMORE(eDEBUG, L" received in a selfservice context\n");
127 ixe013 492
 
134 ixe013 493
        result = WLX_SAS_ACTION_LOGOFF;
494
    }
495
    else
496
    {
497
        TRACEMORE(eDEBUG, L"\n");
498
        result = pfWlxLoggedOnSAS(GetHookedContext(pWlxContext), dwSasType, pReserved);
499
    }
91 ixe013 500
 
134 ixe013 501
    return result;
2 ixe013 502
}
503
 
504
 
505
VOID WINAPI WlxDisplayLockedNotice(PVOID pWlxContext)
506
{
134 ixe013 507
    TRACE(eDEBUG, L"WlxDisplayLockedNotice\n");
508
    pfWlxDisplayLockedNotice(GetHookedContext(pWlxContext));
2 ixe013 509
}
510
 
511
 
512
BOOL WINAPI WlxIsLockOk(PVOID pWlxContext)
513
{
134 ixe013 514
    BOOL result = TRUE;
129 ixe013 515
 
134 ixe013 516
    TRACE(eDEBUG, L"WlxIsLockOk\n");
129 ixe013 517
 
134 ixe013 518
    //Lock is not OK in self serve mode. Else let MSGINA decide
519
    if (((MyGinaContext*)pWlxContext)->mSelfServeLogon)
520
    {
521
        //Lock is not allowed, we just log off
522
        result = FALSE;
523
        ((PWLX_DISPATCH_VERSION_1_0) g_pWinlogon)->WlxSasNotify(gAucunContext.Winlogon, WLX_SAS_TYPE_CTRL_ALT_DEL);
137 ixe013 524
        ((MyGinaContext*)pWlxContext)->mSelfServeLogon = FALSE;
134 ixe013 525
    }
526
    else
527
    {
528
        result = pfWlxIsLockOk(GetHookedContext(pWlxContext));
529
    }
530
    return result;
2 ixe013 531
}
532
 
533
 
534
int WINAPI WlxWkstaLockedSAS(PVOID pWlxContext, DWORD dwSasType)
535
{
134 ixe013 536
    int result;
40 ixe013 537
 
134 ixe013 538
    TRACE(eDEBUG, L"WlxWkstaLockedSAS\n");
40 ixe013 539
 
134 ixe013 540
    result = pfWlxWkstaLockedSAS(GetHookedContext(pWlxContext), dwSasType);
40 ixe013 541
 
134 ixe013 542
    if (result == WLX_SAS_ACTION_LOGOFF)
543
    {
544
        TRACE(eERROR, L"Proceding with a force logoff (comming from AUCUN).\n");
91 ixe013 545
 
134 ixe013 546
        result = WLX_SAS_ACTION_FORCE_LOGOFF;
547
    }
122 ixe013 548
 
134 ixe013 549
    return result;
2 ixe013 550
}
551
 
552
 
553
BOOL WINAPI WlxIsLogoffOk(PVOID pWlxContext)
554
{
134 ixe013 555
    TRACE(eDEBUG, L"WlxIsLogoffOk\n");
556
    return pfWlxIsLogoffOk(GetHookedContext(pWlxContext));
2 ixe013 557
}
558
 
559
 
560
VOID WINAPI WlxLogoff(PVOID pWlxContext)
561
{
134 ixe013 562
    TRACE(eDEBUG, L"WlxLogoff\n");
563
    pfWlxLogoff(GetHookedContext(pWlxContext));
40 ixe013 564
 
134 ixe013 565
    ((MyGinaContext*)pWlxContext)->mCurrentUser = 0;
2 ixe013 566
}
567
 
568
 
569
VOID WINAPI WlxShutdown(PVOID pWlxContext, DWORD ShutdownType)
570
{
134 ixe013 571
    TRACE(eDEBUG, L"WlxShutdown\n");
572
    pfWlxShutdown(GetHookedContext(pWlxContext), ShutdownType);
573
    LsaDeregisterLogonProcess(((MyGinaContext*)pWlxContext)->mLSA);
574
    FreeLibrary(hMsginaDll);
2 ixe013 575
}
576
 
577
 
578
//
579
// New for version 1.1
580
//
581
BOOL WINAPI WlxScreenSaverNotify(PVOID  pWlxContext, BOOL * pSecure)
582
{
134 ixe013 583
    TRACE(eDEBUG, L"WlxScreenSaverNotify\n");
584
    return pfWlxScreenSaverNotify(GetHookedContext(pWlxContext), pSecure);
2 ixe013 585
}
586
 
587
BOOL WINAPI WlxStartApplication(PVOID pWlxContext, PWSTR pszDesktopName, PVOID pEnvironment, PWSTR pszCmdLine)
588
{
134 ixe013 589
    TRACE(eDEBUG, L"WlxStartApplication\n");
590
    return pfWlxStartApplication(GetHookedContext(pWlxContext), pszDesktopName, pEnvironment, pszCmdLine);
2 ixe013 591
}
592
 
593
 
594
//
595
// New for version 1.3
596
//
597
 
598
BOOL WINAPI WlxNetworkProviderLoad(PVOID pWlxContext, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo)
599
{
134 ixe013 600
    TRACE(eDEBUG, L"WlxNetworkProviderLoad\n");
601
    return pfWlxNetworkProviderLoad(GetHookedContext(pWlxContext), pNprNotifyInfo);
2 ixe013 602
}
603
 
604
 
605
BOOL WINAPI WlxDisplayStatusMessage(PVOID pWlxContext, HDESK hDesktop, DWORD dwOptions, PWSTR pTitle, PWSTR pMessage)
606
{
134 ixe013 607
    TRACE(eDEBUG, L"WlxDisplayStatusMessage\n");
608
    return pfWlxDisplayStatusMessage(GetHookedContext(pWlxContext), hDesktop, dwOptions, pTitle, pMessage);
2 ixe013 609
}
610
 
611
 
612
BOOL WINAPI WlxGetStatusMessage(PVOID pWlxContext, DWORD * pdwOptions, PWSTR pMessage, DWORD dwBufferSize)
613
{
134 ixe013 614
    TRACE(eDEBUG, L"WlxGetStatusMessage\n");
615
    return pfWlxGetStatusMessage(GetHookedContext(pWlxContext), pdwOptions, pMessage, dwBufferSize);
2 ixe013 616
}
617
 
618
 
619
BOOL WINAPI WlxRemoveStatusMessage(PVOID pWlxContext)
620
{
134 ixe013 621
    TRACE(eDEBUG, L"WlxRemoveStatusMessage\n");
622
    return pfWlxRemoveStatusMessage(GetHookedContext(pWlxContext));
2 ixe013 623
}
624
 
625
 
626
//
627
// New for 1.4
628
//
23 ixe013 629
BOOL WINAPI WlxGetConsoleSwitchCredentials(PVOID pWlxContext, PVOID pCredInfo)
2 ixe013 630
{
134 ixe013 631
    TRACE(eDEBUG, L"WlxGetConsoleSwitchCredentials\n");
632
    return pfWlxGetConsoleSwitchCredentials(GetHookedContext(pWlxContext), pCredInfo);
2 ixe013 633
}
634
 
23 ixe013 635
VOID WINAPI WlxReconnectNotify(PVOID pWlxContext)
2 ixe013 636
{
134 ixe013 637
    TRACE(eDEBUG, L"WlxReconnectNotify\n");
638
    pfWlxReconnectNotify(GetHookedContext(pWlxContext));
2 ixe013 639
}
640
 
23 ixe013 641
VOID WINAPI WlxDisconnectNotify(PVOID pWlxContext)
2 ixe013 642
{
134 ixe013 643
    TRACE(eDEBUG, L"WlxDisconnectNotify\n");
644
    pfWlxDisconnectNotify(GetHookedContext(pWlxContext));
2 ixe013 645
}