Move the unlock code to a separate function and display error messages if user name or password do not match.
svn path=/trunk/; revision=61750
}
+static
+BOOL
+DoUnlock(
+ IN HWND hwndDlg,
+ IN PGINA_CONTEXT pgContext,
+ OUT LPINT Action)
+{
+ WCHAR Buffer1[256];
+ WCHAR Buffer2[256];
+ LPWSTR UserName = NULL;
+ LPWSTR Password = NULL;
+ BOOL res = FALSE;
+
+ if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
+ return FALSE;
+
+ if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password))
+ {
+ if (UserName != NULL && Password != NULL &&
+ wcscmp(UserName, pgContext->UserName) == 0 &&
+ wcscmp(Password, pgContext->Password) == 0)
+ {
+ *Action = WLX_SAS_ACTION_UNLOCK_WKSTA;
+ res = TRUE;
+ }
+ else if (wcscmp(UserName, pgContext->UserName) == 0 &&
+ wcscmp(Password, pgContext->Password) != 0)
+ {
+ /* Wrong Password */
+ LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGPASSWORD, Buffer2, 256);
+ LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, 256);
+ MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
+ }
+ else
+ {
+ /* Wrong user name */
+ LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGUSER, Buffer1, 256);
+ wsprintfW(Buffer2, Buffer1, pgContext->Domain, pgContext->UserName);
+ LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, 256);
+ MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
+ }
+ }
+
+ if (UserName != NULL)
+ HeapFree(GetProcessHeap(), 0, UserName);
+
+ if (Password != NULL)
+ HeapFree(GetProcessHeap(), 0, Password);
+
+ return res;
+}
+
+
static
INT_PTR
CALLBACK
IN LPARAM lParam)
{
PGINA_CONTEXT pgContext;
+ INT result = WLX_SAS_ACTION_NONE;
pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
switch (LOWORD(wParam))
{
case IDOK:
- {
- LPWSTR UserName = NULL, Password = NULL;
- INT result = WLX_SAS_ACTION_NONE;
-
- if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
- break;
- if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password))
- {
- if (UserName != NULL && Password != NULL &&
- wcscmp(UserName, pgContext->UserName) == 0 &&
- wcscmp(Password, pgContext->Password) == 0)
- {
- result = WLX_SAS_ACTION_UNLOCK_WKSTA;
- }
- }
- HeapFree(GetProcessHeap(), 0, UserName);
- HeapFree(GetProcessHeap(), 0, Password);
- EndDialog(hwndDlg, result);
+ if (DoUnlock(hwndDlg, pgContext, &result))
+ EndDialog(hwndDlg, result);
return TRUE;
- }
case IDCANCEL:
EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Pouze %s nebo Administrátor může odemknout tento počítač."
IDS_LOGONMSG "Jste přihlášeni jako %s."
IDS_LOGONDATE "Datum přihlášení: %s %s"
+ 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."
END
IDS_LOCKMSG "Nur %s oder ein Administrator kann den Computer entsperren."
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_LOCKEDWRONGUSER "Der Computer ist gesperrt. Nur %s\\%s oder ein Administrator kann den Computer entsperren."
END
PUSHBUTTON "Lock computer", IDC_LOCK, 10, 135, 76, 14
PUSHBUTTON "Log off...", IDC_LOGOFF, 100, 135, 75, 14
PUSHBUTTON "Shutdown", IDC_SHUTDOWN, 189, 135, 76, 14
- PUSHBUTTON "Change Password", IDC_CHANGEPWD, 10, 154, 76, 14, WS_DISABLED
+ PUSHBUTTON "Change Password", IDC_CHANGEPWD, 10, 154, 76, 14
PUSHBUTTON "Task manager", IDC_TASKMGR, 100, 154, 75, 14
PUSHBUTTON "Cancel", IDCANCEL, 189, 154, 76, 14
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Seulement %s ou bien un Administrateur peut déverrouiller cet ordinateur."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "רק %s או מנהל יכולים לשחרר את המחשב הזה."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "תאריך כניסה: %s %s"
+ 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."
END
IDS_FORCELOGOFF "Ini akan mengeluarkan pengguna saat ini dan kehilangan data yang belum disimpan. Lanjutkan?"
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Solo %s o un Amministratore possono sbloccare questo computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Dati di accesso: %s %s"
+ 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."
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Tylko %s lub Administrator może odblokować ten komputer."
IDS_LOGONMSG "Jesteś zalogowany jako %s."
IDS_LOGONDATE "Data logowania: %s %s"
+ 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."
END
IDS_LOCKMSG "Doar %s sau un Administrator poate debloca acest calculator."
IDS_LOGONMSG "Sunteți autentificat ca %s."
IDS_LOGONDATE "Data autentificării: %s %s"
+ 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."
END
IDS_LOCKMSG "Только %s или Администратор могут разблокировать этот компьютер."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Дата входа: %s %s"
+ 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."
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
IDS_LOCKMSG "Yalnızca %s ve bir yönetici bu bilgisayarı kilitleyebilir."
IDS_LOGONMSG "%s olarak oturum açtınız."
IDS_LOGONDATE "Oturum Açma Zamânı: %s %s"
+ 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."
END
IDS_LOCKMSG "Only %s or an Administrator can unlock this computer."
IDS_LOGONMSG "You are logged on as %s."
IDS_LOGONDATE "Logon date: %s %s"
+ 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."
END
#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_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