Implement the change password dialog.
 

svn path=/trunk/; revision=61864
This commit is contained in:
Eric Kohl 2014-01-28 19:32:53 +00:00
parent 29393f6441
commit e713cb8534
21 changed files with 261 additions and 21 deletions

View file

@ -17,6 +17,6 @@ list(APPEND SOURCE
add_library(msgina SHARED ${SOURCE})
set_module_type(msgina win32dll)
target_link_libraries(msgina wine)
add_importlibs(msgina advapi32 user32 gdi32 userenv msvcrt kernel32 ntdll)
add_importlibs(msgina advapi32 user32 gdi32 secur32 userenv msvcrt kernel32 ntdll)
add_pch(msgina msgina.h)
add_cd_file(TARGET msgina DESTINATION reactos/system32 FOR all)

View file

@ -221,10 +221,193 @@ GetTextboxText(
static
BOOL
DoChangePassword(HWND hwndDlg)
INT
ResourceMessageBox(
IN PGINA_CONTEXT pgContext,
IN HWND hwnd,
IN UINT uType,
IN UINT uCaption,
IN UINT uText)
{
return FALSE;
WCHAR szCaption[256];
WCHAR szText[256];
LoadStringW(pgContext->hDllInstance, uCaption, szCaption, 256);
LoadStringW(pgContext->hDllInstance, uText, szText, 256);
return pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx,
hwnd,
szText,
szCaption,
uType);
}
static
BOOL
DoChangePassword(
IN PGINA_CONTEXT pgContext,
IN HWND hwndDlg)
{
WCHAR UserName[256];
WCHAR DomainName[256];
WCHAR OldPassword[256];
WCHAR NewPassword1[256];
WCHAR NewPassword2[256];
PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer = NULL;
PMSV1_0_CHANGEPASSWORD_RESPONSE ResponseBuffer = NULL;
ULONG RequestBufferSize;
ULONG ResponseBufferSize = 0;
LPWSTR Ptr;
LSA_STRING PackageName;
HANDLE LsaHandle = NULL;
ULONG AuthenticationPackage = 0;
BOOL res = FALSE;
NTSTATUS ProtocolStatus;
NTSTATUS Status;
GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, UserName, 256);
GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_DOMAIN, DomainName, 256);
GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_OLDPWD, OldPassword, 256);
GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD1, NewPassword1, 256);
GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD2, NewPassword2, 256);
/* Compare the two passwords and fail if they do not match */
if (wcscmp(NewPassword1, NewPassword2) != 0)
{
ResourceMessageBox(pgContext,
hwndDlg,
MB_OK | MB_ICONEXCLAMATION,
IDS_CHANGEPWDTITLE,
IDS_NONMATCHINGPASSWORDS);
return FALSE;
}
/* Calculate the request buffer size */
RequestBufferSize = sizeof(MSV1_0_CHANGEPASSWORD_REQUEST) +
((wcslen(DomainName) + 1) * sizeof(WCHAR)) +
((wcslen(UserName) + 1) * sizeof(WCHAR)) +
((wcslen(OldPassword) + 1) * sizeof(WCHAR)) +
((wcslen(NewPassword1) + 1) * sizeof(WCHAR));
/* Allocate the request buffer */
RequestBuffer = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
RequestBufferSize);
if (RequestBuffer == NULL)
{
ERR("HeapAlloc failed\n");
return FALSE;
}
/* Initialize the request buffer */
RequestBuffer->MessageType = MsV1_0ChangePassword;
RequestBuffer->Impersonating = TRUE;
Ptr = (LPWSTR)((ULONG_PTR)RequestBuffer + sizeof(MSV1_0_CHANGEPASSWORD_REQUEST));
/* Pack the domain name */
RequestBuffer->DomainName.Length = wcslen(DomainName) * sizeof(WCHAR);
RequestBuffer->DomainName.MaximumLength = RequestBuffer->DomainName.Length + sizeof(WCHAR);
RequestBuffer->DomainName.Buffer = Ptr;
RtlCopyMemory(RequestBuffer->DomainName.Buffer,
DomainName,
RequestBuffer->DomainName.MaximumLength);
Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->DomainName.MaximumLength);
/* Pack the user name */
RequestBuffer->AccountName.Length = wcslen(UserName) * sizeof(WCHAR);
RequestBuffer->AccountName.MaximumLength = RequestBuffer->AccountName.Length + sizeof(WCHAR);
RequestBuffer->AccountName.Buffer = Ptr;
RtlCopyMemory(RequestBuffer->AccountName.Buffer,
UserName,
RequestBuffer->AccountName.MaximumLength);
Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->AccountName.MaximumLength);
/* Pack the old password */
RequestBuffer->OldPassword.Length = wcslen(OldPassword) * sizeof(WCHAR);
RequestBuffer->OldPassword.MaximumLength = RequestBuffer->OldPassword.Length + sizeof(WCHAR);
RequestBuffer->OldPassword.Buffer = Ptr;
RtlCopyMemory(RequestBuffer->OldPassword.Buffer,
OldPassword,
RequestBuffer->OldPassword.MaximumLength);
Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->OldPassword.MaximumLength);
/* Pack the new password */
RequestBuffer->NewPassword.Length = wcslen(NewPassword1) * sizeof(WCHAR);
RequestBuffer->NewPassword.MaximumLength = RequestBuffer->NewPassword.Length + sizeof(WCHAR);
RequestBuffer->NewPassword.Buffer = Ptr;
RtlCopyMemory(RequestBuffer->NewPassword.Buffer,
NewPassword1,
RequestBuffer->NewPassword.MaximumLength);
/* Connect to the LSA server */
Status = LsaConnectUntrusted(&LsaHandle);
if (!NT_SUCCESS(Status))
{
ERR("LsaConnectUntrusted failed (Status 0x%08lx)\n", Status);
goto done;
}
/* Get the authentication package */
RtlInitAnsiString((PANSI_STRING)&PackageName,
MSV1_0_PACKAGE_NAME);
Status = LsaLookupAuthenticationPackage(LsaHandle,
&PackageName,
&AuthenticationPackage);
if (!NT_SUCCESS(Status))
{
ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status);
goto done;
}
/* Call the authentication package */
Status = LsaCallAuthenticationPackage(LsaHandle,
AuthenticationPackage,
RequestBuffer,
RequestBufferSize,
(PVOID*)&ResponseBuffer,
&ResponseBufferSize,
&ProtocolStatus);
if (!NT_SUCCESS(Status))
{
ERR("LsaCallAuthenticationPackage failed (Status 0x%08lx)\n", Status);
goto done;
}
if (!NT_SUCCESS(ProtocolStatus))
{
TRACE("LsaCallAuthenticationPackage failed (ProtocolStatus 0x%08lx)\n", ProtocolStatus);
goto done;
}
res = TRUE;
ResourceMessageBox(pgContext,
hwndDlg,
MB_OK | MB_ICONINFORMATION,
IDS_CHANGEPWDTITLE,
IDS_PASSWORDCHANGED);
done:
if (RequestBuffer != NULL)
HeapFree(GetProcessHeap(), 0, RequestBuffer);
if (ResponseBuffer != NULL)
LsaFreeReturnBuffer(ResponseBuffer);
if (LsaHandle != NULL)
NtClose(LsaHandle);
return res;
}
@ -255,7 +438,7 @@ ChangePasswordDialogProc(
switch (LOWORD(wParam))
{
case IDOK:
if (DoChangePassword(hwndDlg))
if (DoChangePassword(pgContext, hwndDlg))
{
EndDialog(hwndDlg, TRUE);
}
@ -322,7 +505,7 @@ OnChangePassword(
{
INT res;
FIXME("OnChangePassword()\n");
TRACE("OnChangePassword()\n");
res = pgContext->pWlxFuncs->WlxDialogBoxParam(
pgContext->hWlx,
@ -332,7 +515,7 @@ OnChangePassword(
ChangePasswordDialogProc,
(LPARAM)pgContext);
FIXME("Result: %x\n", res);
TRACE("Result: %x\n", res);
return FALSE;
}

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -130,4 +130,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -46,7 +46,7 @@ BEGIN
PUSHBUTTON "Computer sperren", IDC_LOCK, 10, 135, 76, 14
PUSHBUTTON "Abmelden...", IDC_LOGOFF, 100, 135, 75, 14
PUSHBUTTON "Herunterfahren", IDC_SHUTDOWN, 189, 135, 76, 14
PUSHBUTTON "Password ändern", IDC_CHANGEPWD, 10, 154, 76, 14
PUSHBUTTON "Passwort ändern", IDC_CHANGEPWD, 10, 154, 76, 14
PUSHBUTTON "Task-Manager", IDC_TASKMGR, 100, 154, 75, 14
PUSHBUTTON "Abbrechen", IDCANCEL, 189, 154, 76, 14
END
@ -123,6 +123,9 @@ BEGIN
IDS_LOGONMSG "Sie sind angemeldet als %s."
IDS_LOGONDATE "Anmeldedatum: %s %s"
IDS_COMPUTERLOCKED "Computer ist gesperrt"
IDS_LOCKEDWRONGPASSWORD "Das Kennwort ist falsch. Bitte geben Sie das Kennwort erneut ein. Bei Buchstaben des Kennworts wird Groß- und Kleinschreibung unterschieden."
IDS_LOCKEDWRONGPASSWORD "Das Passwort ist falsch. Bitte geben Sie das Passwort erneut ein. Bei Buchstaben des Passworts wird Groß- und Kleinschreibung unterschieden."
IDS_LOCKEDWRONGUSER "Der Computer ist gesperrt. Nur %s\\%s oder ein Administrator kann den Computer entsperren."
IDS_CHANGEPWDTITLE "Passwort ändern"
IDS_NONMATCHINGPASSWORDS "Die eingegebenen Passworte stimmen nicht überein. Geben Sie das neue Passwort in beide Textfelder ein."
IDS_PASSWORDCHANGED "Ihr Passwort wurde geändert."
END

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -127,4 +127,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -124,4 +124,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -133,4 +133,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -125,4 +125,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -134,4 +134,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -127,4 +127,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -127,4 +127,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -130,4 +130,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -127,4 +127,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -133,4 +133,7 @@ BEGIN
IDS_COMPUTERLOCKED "Computer locked"
IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case."
IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer."
IDS_CHANGEPWDTITLE "Change Password"
IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes."
IDS_PASSWORDCHANGED "Your password has been changed."
END

View file

@ -15,8 +15,11 @@
#include <winuser.h>
#include <userenv.h>
#include <winwlx.h>
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
#include <ndk/sefuncs.h>
#include <ntlsa.h>
#include <ntsecapi.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(msgina);

View file

@ -34,15 +34,18 @@
#define IDI_LOCKICON 21
#define IDS_LOGGEDOUTSAS 40000
#define IDS_LOCKEDSAS 40001
#define IDS_PRESSCTRLALTDELETE 40002
#define IDS_ASKFORUSER 40003
#define IDS_ASKFORPASSWORD 40004
#define IDS_FORCELOGOFF 40005
#define IDS_LOCKMSG 40006
#define IDS_LOGONMSG 40007
#define IDS_LOGONDATE 40008
#define IDS_COMPUTERLOCKED 40009
#define IDS_LOCKEDWRONGPASSWORD 40010
#define IDS_LOCKEDWRONGUSER 40011
#define IDS_LOGGEDOUTSAS 40000
#define IDS_LOCKEDSAS 40001
#define IDS_PRESSCTRLALTDELETE 40002
#define IDS_ASKFORUSER 40003
#define IDS_ASKFORPASSWORD 40004
#define IDS_FORCELOGOFF 40005
#define IDS_LOCKMSG 40006
#define IDS_LOGONMSG 40007
#define IDS_LOGONDATE 40008
#define IDS_COMPUTERLOCKED 40009
#define IDS_LOCKEDWRONGPASSWORD 40010
#define IDS_LOCKEDWRONGUSER 40011
#define IDS_CHANGEPWDTITLE 40012
#define IDS_NONMATCHINGPASSWORDS 40013
#define IDS_PASSWORDCHANGED 40014