diff --git a/dll/win32/userenv/internal.h b/dll/win32/userenv/internal.h index 2c1cfeb79b4..c20d65205ba 100644 --- a/dll/win32/userenv/internal.h +++ b/dll/win32/userenv/internal.h @@ -80,6 +80,47 @@ AppendBackslash(LPWSTR String); PSECURITY_DESCRIPTOR CreateDefaultSecurityDescriptor(VOID); + +typedef struct _POLICY_VALUES +{ + PCWSTR ValueName; + DWORD Type; + PVOID Data; + DWORD Length; +} POLICY_VALUES, *PPOLICY_VALUES; + +LONG +GetPolicyValues( + _In_ HKEY hRootKey, + _Inout_ PPOLICY_VALUES QueryTable); + +LONG +GetPolicyValue( + _In_ HKEY hRootKey, + _In_ PCWSTR ValueName, + _In_ DWORD Type, + _Out_opt_ PVOID pData, + _Inout_opt_ PDWORD pcbData); + + +VOID +ReportErrorWorker( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr); + +VOID +ReportErrorV( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr, + _In_ va_list args); + +VOID +__cdecl +ReportError( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr, + ...); + /* profile.c */ BOOL AppendSystemPostfix(LPWSTR lpName, diff --git a/dll/win32/userenv/lang/bg-BG.rc b/dll/win32/userenv/lang/bg-BG.rc index 21da1b64683..07d8f220c48 100644 --- a/dll/win32/userenv/lang/bg-BG.rc +++ b/dll/win32/userenv/lang/bg-BG.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/cs-CZ.rc b/dll/win32/userenv/lang/cs-CZ.rc index 49bee685d17..7a9b34a0a80 100644 --- a/dll/win32/userenv/lang/cs-CZ.rc +++ b/dll/win32/userenv/lang/cs-CZ.rc @@ -5,6 +5,18 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/da-DK.rc b/dll/win32/userenv/lang/da-DK.rc index 9324cf3deeb..213758057d2 100644 --- a/dll/win32/userenv/lang/da-DK.rc +++ b/dll/win32/userenv/lang/da-DK.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/de-DE.rc b/dll/win32/userenv/lang/de-DE.rc index 6bb12707924..8e735411a80 100644 --- a/dll/win32/userenv/lang/de-DE.rc +++ b/dll/win32/userenv/lang/de-DE.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/el-GR.rc b/dll/win32/userenv/lang/el-GR.rc index 657e1c601cc..6cbb58f526f 100644 --- a/dll/win32/userenv/lang/el-GR.rc +++ b/dll/win32/userenv/lang/el-GR.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_GREEK, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/en-US.rc b/dll/win32/userenv/lang/en-US.rc index 448a99170cc..72a2dcfe0ae 100644 --- a/dll/win32/userenv/lang/en-US.rc +++ b/dll/win32/userenv/lang/en-US.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" // "User Environment" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/es-ES.rc b/dll/win32/userenv/lang/es-ES.rc index c5b361df779..3a67a11f3cd 100644 --- a/dll/win32/userenv/lang/es-ES.rc +++ b/dll/win32/userenv/lang/es-ES.rc @@ -9,6 +9,18 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/eu-ES.rc b/dll/win32/userenv/lang/eu-ES.rc index d5320123cb5..d8eea051e6d 100644 --- a/dll/win32/userenv/lang/eu-ES.rc +++ b/dll/win32/userenv/lang/eu-ES.rc @@ -7,6 +7,18 @@ LANGUAGE LANG_BASQUE, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/fi-FI.rc b/dll/win32/userenv/lang/fi-FI.rc index fc5e90c4d1f..86f177d5511 100644 --- a/dll/win32/userenv/lang/fi-FI.rc +++ b/dll/win32/userenv/lang/fi-FI.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/fr-FR.rc b/dll/win32/userenv/lang/fr-FR.rc index 0c2dd616c41..4c693c731ed 100644 --- a/dll/win32/userenv/lang/fr-FR.rc +++ b/dll/win32/userenv/lang/fr-FR.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Profil utilisateur" // "Environnement utilisateur" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Temps restant :", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/he-IL.rc b/dll/win32/userenv/lang/he-IL.rc index 5d2ffedeef5..999fd063704 100644 --- a/dll/win32/userenv/lang/he-IL.rc +++ b/dll/win32/userenv/lang/he-IL.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/hu-HU.rc b/dll/win32/userenv/lang/hu-HU.rc index 9b47e11134e..3d631bda706 100644 --- a/dll/win32/userenv/lang/hu-HU.rc +++ b/dll/win32/userenv/lang/hu-HU.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/id-ID.rc b/dll/win32/userenv/lang/id-ID.rc index 6715e746e99..4bd2e619206 100644 --- a/dll/win32/userenv/lang/id-ID.rc +++ b/dll/win32/userenv/lang/id-ID.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/it-IT.rc b/dll/win32/userenv/lang/it-IT.rc index 704946d78ef..94dbbaba995 100644 --- a/dll/win32/userenv/lang/it-IT.rc +++ b/dll/win32/userenv/lang/it-IT.rc @@ -11,6 +11,18 @@ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/ja-JP.rc b/dll/win32/userenv/lang/ja-JP.rc index b9aef4b977f..4a0ba5d7b39 100644 --- a/dll/win32/userenv/lang/ja-JP.rc +++ b/dll/win32/userenv/lang/ja-JP.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/lt-LT.rc b/dll/win32/userenv/lang/lt-LT.rc index 3a9fda5b1b9..b205adc8415 100644 --- a/dll/win32/userenv/lang/lt-LT.rc +++ b/dll/win32/userenv/lang/lt-LT.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_LITHUANIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/nl-NL.rc b/dll/win32/userenv/lang/nl-NL.rc index bd648f3b8bf..b4a45624009 100644 --- a/dll/win32/userenv/lang/nl-NL.rc +++ b/dll/win32/userenv/lang/nl-NL.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/no-NO.rc b/dll/win32/userenv/lang/no-NO.rc index 5a1aeaf5481..11e5fb061d1 100644 --- a/dll/win32/userenv/lang/no-NO.rc +++ b/dll/win32/userenv/lang/no-NO.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/pl-PL.rc b/dll/win32/userenv/lang/pl-PL.rc index 46308e7002f..8a52ab2be9b 100644 --- a/dll/win32/userenv/lang/pl-PL.rc +++ b/dll/win32/userenv/lang/pl-PL.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/pt-BR.rc b/dll/win32/userenv/lang/pt-BR.rc index ecbee96f31b..9c0d6a780b6 100644 --- a/dll/win32/userenv/lang/pt-BR.rc +++ b/dll/win32/userenv/lang/pt-BR.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/pt-PT.rc b/dll/win32/userenv/lang/pt-PT.rc index 7f667b4726e..52797c47413 100644 --- a/dll/win32/userenv/lang/pt-PT.rc +++ b/dll/win32/userenv/lang/pt-PT.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/ro-RO.rc b/dll/win32/userenv/lang/ro-RO.rc index bd3a3f2778e..27c7e41e277 100644 --- a/dll/win32/userenv/lang/ro-RO.rc +++ b/dll/win32/userenv/lang/ro-RO.rc @@ -8,6 +8,18 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/ru-RU.rc b/dll/win32/userenv/lang/ru-RU.rc index 0705a7c4bde..8919d50b563 100644 --- a/dll/win32/userenv/lang/ru-RU.rc +++ b/dll/win32/userenv/lang/ru-RU.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/sk-SK.rc b/dll/win32/userenv/lang/sk-SK.rc index 5b476dd5068..7fcb4be0091 100644 --- a/dll/win32/userenv/lang/sk-SK.rc +++ b/dll/win32/userenv/lang/sk-SK.rc @@ -5,6 +5,18 @@ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/sq-AL.rc b/dll/win32/userenv/lang/sq-AL.rc index 5aab4ba11f0..42024239253 100644 --- a/dll/win32/userenv/lang/sq-AL.rc +++ b/dll/win32/userenv/lang/sq-AL.rc @@ -1,10 +1,21 @@ /* TRANSLATOR : Ardit Dani (Ard1t) (ardit.dani@gmail.com) * DATE OF TRANSLATION: 06-02-2014 -*/ - + */ LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/sv-SE.rc b/dll/win32/userenv/lang/sv-SE.rc index eb7c1ed3e2e..a6186c103b1 100644 --- a/dll/win32/userenv/lang/sv-SE.rc +++ b/dll/win32/userenv/lang/sv-SE.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/th-TH.rc b/dll/win32/userenv/lang/th-TH.rc index e85d0e8b802..3a2f8b75bc4 100644 --- a/dll/win32/userenv/lang/th-TH.rc +++ b/dll/win32/userenv/lang/th-TH.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_THAI, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/tr-TR.rc b/dll/win32/userenv/lang/tr-TR.rc index c0ce85e9aef..8359d30feb6 100644 --- a/dll/win32/userenv/lang/tr-TR.rc +++ b/dll/win32/userenv/lang/tr-TR.rc @@ -2,6 +2,18 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/uk-UA.rc b/dll/win32/userenv/lang/uk-UA.rc index a43432f02af..f4ee8628506 100644 --- a/dll/win32/userenv/lang/uk-UA.rc +++ b/dll/win32/userenv/lang/uk-UA.rc @@ -1,5 +1,17 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/zh-CN.rc b/dll/win32/userenv/lang/zh-CN.rc index d5bb8e2f521..0ae16667cf7 100644 --- a/dll/win32/userenv/lang/zh-CN.rc +++ b/dll/win32/userenv/lang/zh-CN.rc @@ -6,6 +6,18 @@ English folder names into Chinese, or it may cause problems in the system. */ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/zh-HK.rc b/dll/win32/userenv/lang/zh-HK.rc index 76fe017dd39..59252d773ea 100644 --- a/dll/win32/userenv/lang/zh-HK.rc +++ b/dll/win32/userenv/lang/zh-HK.rc @@ -12,6 +12,18 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_HONGKONG +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/lang/zh-TW.rc b/dll/win32/userenv/lang/zh-TW.rc index 019c3f1d122..c5b985f1605 100644 --- a/dll/win32/userenv/lang/zh-TW.rc +++ b/dll/win32/userenv/lang/zh-TW.rc @@ -5,6 +5,18 @@ English folder names into Chinese, or it may cause problems in the system. */ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL +IDD_ERRORDLG DIALOGEX 0, 0, 250, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "User Profile" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_USERENV, IDC_STATIC, 6, 10, 18, 20 + DEFPUSHBUTTON "OK", IDOK, 190, 10, 50, 14, BS_NOTIFY | WS_TABSTOP + EDITTEXT IDC_ERRORDESC, 37, 10, 145, 66, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_BORDER | WS_TABSTOP + RTEXT "Time remaining:", IDC_TIMEOUTSTATIC, 172, 80, 54, 8 + LTEXT "", IDC_TIMEOUT, 230, 80, 12, 8 +END + /* See also: dll/win32/shell32/lang */ STRINGTABLE BEGIN diff --git a/dll/win32/userenv/misc.c b/dll/win32/userenv/misc.c index 214d8f1f448..cbf9000ab38 100644 --- a/dll/win32/userenv/misc.c +++ b/dll/win32/userenv/misc.c @@ -25,9 +25,10 @@ */ #include "precomp.h" - #include +#include "resources.h" + #define NDEBUG #include @@ -52,7 +53,6 @@ AppendBackslash(LPWSTR String) return &String[Length]; } - PSECURITY_DESCRIPTOR CreateDefaultSecurityDescriptor(VOID) { @@ -198,6 +198,299 @@ Cleanup: return pSD; } +/* Policy values helpers *****************************************************/ + +LONG +GetPolicyValues( + _In_ HKEY hRootKey, + _Inout_ PPOLICY_VALUES QueryTable) +{ + static PCWSTR PolicyKeys[] = + { + L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", + L"Software\\Policies\\Microsoft\\Windows\\System" + }; + + /* Retrieve the sought policy values in each of the policy keys */ + DWORD i; + for (i = 0; i < _countof(PolicyKeys); ++i) + { + HKEY hKey; + PPOLICY_VALUES Value; + DWORD dwType, cbData; + + if (RegOpenKeyExW(hRootKey, PolicyKeys[i], 0, + KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) + { + continue; + } + + for (Value = QueryTable; Value->ValueName || Value->Data; ++Value) + { + /* Retrieve the type and data length for validation checks */ + if (RegQueryValueExW(hKey, Value->ValueName, NULL, + &dwType, NULL, &cbData) != ERROR_SUCCESS) + { + continue; + } + + /* Verify for compatible types */ + if ( ((Value->Type == REG_SZ || Value->Type == REG_EXPAND_SZ) && + (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) || + (Value->Type == REG_DWORD && dwType == REG_DWORD) || + (Value->Type == REG_QWORD && dwType == REG_QWORD) || + (Value->Type == REG_MULTI_SZ && dwType == REG_MULTI_SZ) || + (Value->Type == REG_NONE || Value->Type == REG_BINARY) ) + { + /* Verify whether the given buffer can hold the data; + * if so, retrieve the actual data */ + if (Value->Length >= cbData) + { + RegQueryValueExW(hKey, Value->ValueName, NULL, + &dwType, Value->Data, &cbData); + } + } + } + RegCloseKey(hKey); + } + + return ERROR_SUCCESS; +} + +LONG +GetPolicyValue( + _In_ HKEY hRootKey, + _In_ PCWSTR ValueName, + _In_ DWORD Type, + _Out_opt_ PVOID pData, + _Inout_opt_ PDWORD pcbData) +{ + POLICY_VALUES QueryTable[] = + { + {ValueName, Type, pData, pcbData ? *pcbData : 0}, + {NULL, 0, NULL, 0} + }; + LONG ret = GetPolicyValues(hRootKey, QueryTable); + if ((ret == ERROR_SUCCESS) && pcbData) + *pcbData = QueryTable[0].Length; + + return ret; +} + +/* Timed dialog helpers ******************************************************/ + +#define IDT_DLGTIMER 1 + +typedef struct _TIMERDLG_BUTTON +{ + UINT uID; + INT_PTR nResult; +} TIMERDLG_BUTTON, *PTIMERDLG_BUTTON; + +typedef struct _TIMERDLG_INFO +{ + ULONG ulTimeout; ///< Dialog timeout. + WORD wDefBtnOnTimeout; ///< Index in button map for the default action on timeout. + WORD wDefBtnOnCancel; ///< Index in button map for the default action on dialog cancel. + TIMERDLG_BUTTON ButtonMap[2]; ///< Button/result map for the 1st and 2nd buttons. +} TIMERDLG_INFO, *PTIMERDLG_INFO; + +static INT_PTR +CALLBACK +TimerDlgProc( + _Inout_ PTIMERDLG_INFO Info, + _In_ HWND hDlg, + _In_ UINT uMsg, + _In_ WPARAM wParam, + _In_ LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + /* Setup the timeout */ + if (Info->ulTimeout) + { + /* Display the countdown */ + WCHAR szTimeout[10]; + StringCchPrintfW(szTimeout, _countof(szTimeout), L"%d", Info->ulTimeout); + SetDlgItemTextW(hDlg, IDC_TIMEOUT, szTimeout); + + /* Set a 1-second timer */ + SetTimer(hDlg, IDT_DLGTIMER, 1000, NULL); + } + break; + } + + case WM_COMMAND: + { + PTIMERDLG_BUTTON ButtonMap = Info->ButtonMap; + WORD wDefBtnOnTimeout = min(Info->wDefBtnOnTimeout, _countof(Info->ButtonMap)-1); + WORD i; + + if (LOWORD(wParam) == IDCANCEL) + { + /* ESC or CANCEL button pressed: stop the timeout, + * close the dialog and return the default result */ + WORD wDefBtnOnCancel = min(Info->wDefBtnOnCancel, _countof(Info->ButtonMap)-1); + KillTimer(hDlg, IDT_DLGTIMER); + EndDialog(hDlg, ButtonMap[wDefBtnOnCancel].nResult); + break; + } + + for (i = 0; i < _countof(Info->ButtonMap); ++i) + { + if (LOWORD(wParam) == ButtonMap[i].uID) + { + if (HIWORD(wParam) == BN_CLICKED) + { + /* Button pressed: stop the timeout, close the + * dialog and return the corresponding result */ + KillTimer(hDlg, IDT_DLGTIMER); + EndDialog(hDlg, ButtonMap[i].nResult); + } + else if (HIWORD(wParam) == BN_KILLFOCUS) + { + /* Button lost the focus: stop the timeout + * only if this isn't the default action */ + if (i != wDefBtnOnTimeout) + break; + KillTimer(hDlg, IDT_DLGTIMER); + ShowWindow(GetDlgItem(hDlg, IDC_TIMEOUT), SW_HIDE); + ShowWindow(GetDlgItem(hDlg, IDC_TIMEOUTSTATIC), SW_HIDE); + } + break; + } + } + break; + } + + case WM_TIMER: + { + if (Info->ulTimeout < 1) + { + /* Timeout ended, close the dialog */ + WORD wDefBtnOnTimeout = min(Info->wDefBtnOnTimeout, _countof(Info->ButtonMap)-1); + PostMessageW(hDlg, WM_COMMAND, + MAKEWPARAM(Info->ButtonMap[wDefBtnOnTimeout].uID, BN_CLICKED), + 0); + } + else + { + /* Decrement and display the countdown */ + WCHAR szTimeout[10]; + StringCchPrintfW(szTimeout, _countof(szTimeout), L"%d", --(Info->ulTimeout)); + SetDlgItemTextW(hDlg, IDC_TIMEOUT, szTimeout); + } + break; + } + } + + return FALSE; +} + +/* Error reporting helpers ***************************************************/ + +typedef struct _ERRORDLG_PARAMS +{ + ULONG ulTimeout; + PCWSTR pszString; +} ERRORDLG_PARAMS, *PERRORDLG_PARAMS; + +static TIMERDLG_INFO ErrorDlg = +{ + 0, ///< Global error-dialog timeout, used for all displayed error dialogs. + 0, 1, + {{IDOK, TRUE}, {IDCANCEL, FALSE}} +}; + +static INT_PTR +CALLBACK +ErrorDlgProc( + _In_ HWND hDlg, + _In_ UINT uMsg, + _In_ WPARAM wParam, + _In_ LPARAM lParam) +{ + if (uMsg == WM_INITDIALOG) + { + PERRORDLG_PARAMS Params = (PERRORDLG_PARAMS)lParam; + + /* Position and focus the dialog */ + // CenterWindow(hDlg); // Already done with the DS_CENTER style. + SetForegroundWindow(hDlg); + + /* Display the message */ + SetDlgItemTextW(hDlg, IDC_ERRORDESC, Params->pszString); + + /* Setup the timeout and display the countdown */ + ErrorDlg.ulTimeout = Params->ulTimeout; + // SetWindowLongPtrW(hDlg, DWLP_USER, &ErrorDlg); + TimerDlgProc(&ErrorDlg, hDlg, WM_INITDIALOG, wParam, lParam); + return TRUE; + } + return TimerDlgProc(&ErrorDlg, hDlg, uMsg, wParam, lParam); +} + +VOID +ErrorDialogEx( + _In_ ULONG ulTimeout, + _In_ PCWSTR pszString) +{ + ERRORDLG_PARAMS Params = {ulTimeout, pszString}; + DialogBoxParamW(hInstance, MAKEINTRESOURCEW(IDD_ERRORDLG), + NULL, ErrorDlgProc, (LPARAM)&Params); +} + +VOID +ReportErrorWorker( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr) +{ + // TODO: Report event to Application log, "Userenv" source. + DPRINT1("%S", pszStr); + + if (!(dwFlags & PI_NOUI)) + { + /* Retrieve the "Profile Dialog Time Out" policy value, + * defaulting to 30 seconds timeout */ + ULONG ulTimeout = 30; + DWORD cbData = sizeof(ulTimeout); + GetPolicyValue(HKEY_LOCAL_MACHINE, + L"ProfileDlgTimeOut", + REG_DWORD, + &ulTimeout, + &cbData); + ErrorDialogEx(ulTimeout, pszStr); + } +} + +VOID +ReportErrorV( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr, + _In_ va_list args) +{ + WCHAR Buffer[4096]; + _vsnwprintf(Buffer, _countof(Buffer), pszStr, args); + ReportErrorWorker(dwFlags, Buffer); +} + +VOID +__cdecl +ReportError( + _In_ DWORD dwFlags, + _In_ PCWSTR pszStr, + ...) +{ + va_list args; + + va_start(args, pszStr); + ReportErrorV(dwFlags, pszStr, args); + va_end(args); +} + + /* Dynamic DLL loading interface **********************************************/ /* OLE32.DLL import table */ @@ -212,7 +505,6 @@ DYN_MODULE DynOle32 = } }; - /* * Use this function to load functions from other modules. We cannot statically * link to e.g. ole32.dll because those dlls would get loaded on startup with @@ -254,7 +546,6 @@ LoadDynamicImports(PDYN_MODULE Module, return TRUE; } - VOID UnloadDynamicImports(PDYN_FUNCS DynFuncs) { diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c index 0e7a9295242..d23a8d118c1 100644 --- a/dll/win32/userenv/profile.c +++ b/dll/win32/userenv/profile.c @@ -2007,12 +2007,12 @@ LoadUserProfileW( _Inout_ LPPROFILEINFOW lpProfileInfo) { WCHAR szUserHivePath[MAX_PATH]; + DWORD dwLength = _countof(szUserHivePath); PTOKEN_USER UserSid = NULL; UNICODE_STRING SidString = { 0, 0, NULL }; HANDLE hProfileMutex = NULL; - LONG Error; + DWORD dwError = MAXDWORD; BOOL ret = FALSE; - DWORD dwLength = sizeof(szUserHivePath) / sizeof(szUserHivePath[0]); DPRINT("LoadUserProfileW(%p %p)\n", hToken, lpProfileInfo); @@ -2083,15 +2083,15 @@ LoadUserProfileW( if (GetTokenInformation(hToken, TokenUser, NULL, 0, &dwLength) || GetLastError() != ERROR_INSUFFICIENT_BUFFER) { - DPRINT1 ("GetTokenInformation() failed\n"); + DPRINT1("GetTokenInformation() failed\n"); goto cleanup; } UserSid = (PTOKEN_USER)HeapAlloc(GetProcessHeap(), 0, dwLength); if (!UserSid) { + dwError = ERROR_NOT_ENOUGH_MEMORY; DPRINT1("HeapAlloc() failed\n"); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto cleanup; } @@ -2108,6 +2108,7 @@ LoadUserProfileW( DPRINT1("CreateUserProfileW() failed\n"); goto cleanup; } + ret = FALSE; } /* Acquire restore privilege */ @@ -2117,20 +2118,19 @@ LoadUserProfileW( goto cleanup; } - /* Load user registry hive */ - Error = RegLoadKeyW(HKEY_USERS, - SidString.Buffer, - szUserHivePath); + /* Load the user registry hive */ + dwError = RegLoadKeyW(HKEY_USERS, + SidString.Buffer, + szUserHivePath); AcquireRemoveRestorePrivilege(FALSE); /* HACK: Do not fail if the profile has already been loaded! */ - if (Error == ERROR_SHARING_VIOLATION) - Error = ERROR_SUCCESS; + if (dwError == ERROR_SHARING_VIOLATION) + dwError = ERROR_SUCCESS; - if (Error != ERROR_SUCCESS) + if (dwError != ERROR_SUCCESS) { - DPRINT1("RegLoadKeyW() failed (Error %ld)\n", Error); - SetLastError((DWORD)Error); + DPRINT1("RegLoadKeyW() failed (Error %ld)\n", dwError); goto cleanup; } @@ -2140,29 +2140,30 @@ LoadUserProfileW( } /* Open future HKEY_CURRENT_USER */ - Error = RegOpenKeyExW(HKEY_USERS, - SidString.Buffer, - 0, - MAXIMUM_ALLOWED, - (PHKEY)&lpProfileInfo->hProfile); - if (Error != ERROR_SUCCESS) + dwError = RegOpenKeyExW(HKEY_USERS, + SidString.Buffer, + 0, + MAXIMUM_ALLOWED, + (PHKEY)&lpProfileInfo->hProfile); + if (dwError != ERROR_SUCCESS) { - DPRINT1("RegOpenKeyExW() failed (Error %ld)\n", Error); - SetLastError((DWORD)Error); + DPRINT1("RegOpenKeyExW() failed (Error %ld)\n", dwError); goto cleanup; } - Error = IncrementRefCount(SidString.Buffer, NULL); - if (Error != ERROR_SUCCESS) + dwError = IncrementRefCount(SidString.Buffer, NULL); + if (dwError != ERROR_SUCCESS) { - DPRINT1("IncrementRefCount() failed (Error %ld)\n", Error); - SetLastError((DWORD)Error); + DPRINT1("IncrementRefCount() failed (Error %ld)\n", dwError); goto cleanup; } ret = TRUE; cleanup: + if (dwError == MAXDWORD) + dwError = GetLastError(); + if (UserSid != NULL) HeapFree(GetProcessHeap(), 0, UserSid); @@ -2174,7 +2175,19 @@ cleanup: RtlFreeUnicodeString(&SidString); + /* Report any error occurred */ + if (!ret) + { + // TODO: Use a localized *.mc resource message* error. + ReportError(lpProfileInfo->dwFlags, + L"ReactOS could not load the locally stored user profile. " + L"Possible causes of this error include insufficient security rights or a corrupt local profile.\n" + L"\nError: %lu\n", + dwError); + } + DPRINT("LoadUserProfileW() done\n"); + SetLastError(dwError); return ret; } diff --git a/dll/win32/userenv/res/userenv.ico b/dll/win32/userenv/res/userenv.ico new file mode 100644 index 00000000000..cf1e2e4d809 Binary files /dev/null and b/dll/win32/userenv/res/userenv.ico differ diff --git a/dll/win32/userenv/resources.h b/dll/win32/userenv/resources.h index 43202a0394b..5ba934705c1 100644 --- a/dll/win32/userenv/resources.h +++ b/dll/win32/userenv/resources.h @@ -8,6 +8,18 @@ #pragma once +#define IDC_STATIC (-1) + +/* Icons */ +#define IDI_USERENV 1 + +/* Dialogs */ +#define IDD_ERRORDLG 3000 +#define IDC_ERRORDESC 3001 +#define IDC_TIMEOUTSTATIC 1005 +#define IDC_TIMEOUT 1004 + +/* Strings */ #define IDS_PROFILEPATH 1 #define IDS_APPDATA 2 #define IDS_DESKTOP 3 diff --git a/dll/win32/userenv/userenv.rc b/dll/win32/userenv/userenv.rc index f3bb49cb55f..b36f85cee92 100644 --- a/dll/win32/userenv/userenv.rc +++ b/dll/win32/userenv/userenv.rc @@ -1,4 +1,5 @@ -/* Copyright (C) 2004 Eric Kohl +/* + * Copyright (C) 2004 Eric Kohl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +17,7 @@ */ #include +#include #include "resources.h" @@ -30,6 +32,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_USERENV ICON "res/userenv.ico" + /* * Everything specific to any language goes in one of the specific * files. Note that you can and may override resources which also have