ReactOS 0.4.15-dev-8100-g1887773
password.c
Go to the documentation of this file.
1//
2// password.c
3//
4// Password support for Win9x
5//
6#include <windows.h>
7#include <tchar.h>
8
10typedef VOID (WINAPI *PWDCHANGEPASSWORD)(LPCTSTR lpcRegkeyname, HWND hwnd,UINT uiReserved1,UINT uiReserved2);
11
13{
14 // Under NT, we return TRUE immediately. This lets the saver quit,
15 // and the system manages passwords. Under '95, we call VerifyScreenSavePwd.
16 // This checks the appropriate registry key and, if necessary,
17 // pops up a verify dialog
18
19 HINSTANCE hpwdcpl;
20 VERIFYSCREENSAVEPWD VerifyScreenSavePwd;
21 BOOL fResult;
22
23 if(GetVersion() < 0x80000000)
24 return TRUE;
25
26 hpwdcpl = LoadLibrary(_T("PASSWORD.CPL"));
27
28 if(hpwdcpl == NULL)
29 {
30 return FALSE;
31 }
32
33
34 VerifyScreenSavePwd = (VERIFYSCREENSAVEPWD)GetProcAddress(hpwdcpl, "VerifyScreenSavePwd");
35
36 if(VerifyScreenSavePwd == NULL)
37 {
38 FreeLibrary(hpwdcpl);
39 return FALSE;
40 }
41
42 fResult = VerifyScreenSavePwd(hwnd);
43 FreeLibrary(hpwdcpl);
44
45 return fResult;
46}
47
49{
50 // This only ever gets called under '95, when started with the /a option.
51 HINSTANCE hmpr = LoadLibrary(_T("MPR.DLL"));
52 PWDCHANGEPASSWORD PwdChangePassword;
53
54 if(hmpr == NULL)
55 return FALSE;
56
57 PwdChangePassword = (PWDCHANGEPASSWORD)GetProcAddress(hmpr, "PwdChangePasswordA");
58
59 if(PwdChangePassword == NULL)
60 {
61 FreeLibrary(hmpr);
62 return FALSE;
63 }
64
65 PwdChangePassword(_T("SCRSAVE"), hwnd, 0, 0);
66 FreeLibrary(hmpr);
67
68 return TRUE;
69}
#define VOID
Definition: acefi.h:82
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
BOOL VerifyPassword(HWND hwnd)
Definition: password.c:12
BOOL(WINAPI * VERIFYSCREENSAVEPWD)(HWND hwnd)
Definition: password.c:9
VOID(WINAPI * PWDCHANGEPASSWORD)(LPCTSTR lpcRegkeyname, HWND hwnd, UINT uiReserved1, UINT uiReserved2)
Definition: password.c:10
BOOL ChangePassword(HWND hwnd)
Definition: password.c:48
DWORD WINAPI GetVersion()
Definition: redirtest.c:5
#define _T(x)
Definition: vfdio.h:22
#define LoadLibrary
Definition: winbase.h:3862
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
const CHAR * LPCTSTR
Definition: xmlstorage.h:193