mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- close unattend inf in case of errors
- correctly convert provided LCID (with base 16) - verify provided LCID with installed languages - thanks to Colin_Fink svn path=/trunk/; revision=28654
This commit is contained in:
parent
dcae8a5dc5
commit
3e77d24896
3 changed files with 52 additions and 10 deletions
|
@ -173,6 +173,34 @@ void SetNewLocale(LCID lcid)
|
|||
RegCloseKey(langKey);
|
||||
|
||||
}
|
||||
DWORD
|
||||
VerifyUnattendLCID(HWND hwndDlg)
|
||||
{
|
||||
LRESULT lCount, lIndex, lResult;
|
||||
lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
|
||||
if (lCount == CB_ERR)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (lIndex = 0; lIndex < lCount; lIndex++)
|
||||
{
|
||||
lResult = SendMessage(hList, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0);
|
||||
if (lResult == CB_ERR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lResult == (LCID)UnattendLCID)
|
||||
{
|
||||
SendMessage(hList, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
|
@ -185,6 +213,15 @@ GeneralPageProc(HWND hwndDlg,
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
|
||||
if (IsUnattendedSetupEnabled)
|
||||
{
|
||||
if (VerifyUnattendLCID(hwndDlg))
|
||||
{
|
||||
SetNewLocale(UnattendLCID);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
|
|
|
@ -41,6 +41,9 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
|
|||
|
||||
HINSTANCE hApplet = 0;
|
||||
HINF hSetupInf = INVALID_HANDLE_VALUE;
|
||||
DWORD IsUnattendedSetupEnabled = 0;
|
||||
DWORD UnattendLCID = 0;
|
||||
|
||||
|
||||
/* Applets */
|
||||
APPLET Applets[NUM_APPLETS] =
|
||||
|
@ -97,10 +100,10 @@ OpenSetupInf()
|
|||
return (hSetupInf != INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
LONG ParseSetupInf()
|
||||
VOID
|
||||
ParseSetupInf()
|
||||
{
|
||||
INFCONTEXT InfContext;
|
||||
INT LocaleID;
|
||||
TCHAR szBuffer[30];
|
||||
|
||||
if (!SetupFindFirstLine(hSetupInf,
|
||||
|
@ -108,7 +111,8 @@ LONG ParseSetupInf()
|
|||
_T("LocaleID"),
|
||||
&InfContext))
|
||||
{
|
||||
return -1;
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SetupGetStringField(&InfContext,
|
||||
|
@ -117,13 +121,13 @@ LONG ParseSetupInf()
|
|||
sizeof(szBuffer) / sizeof(TCHAR),
|
||||
NULL))
|
||||
{
|
||||
return -1;
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
return;
|
||||
}
|
||||
LocaleID = _ttoi(szBuffer);
|
||||
SetNewLocale((LCID)LocaleID);
|
||||
|
||||
UnattendLCID = _tcstoul(szBuffer, NULL, 16);
|
||||
IsUnattendedSetupEnabled = 1;
|
||||
SetupCloseInfFile(hSetupInf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG APIENTRY
|
||||
|
@ -135,7 +139,7 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
|
||||
if (OpenSetupInf())
|
||||
{
|
||||
return ParseSetupInf();
|
||||
ParseSetupInf();
|
||||
}
|
||||
|
||||
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
|
|
|
@ -11,7 +11,8 @@ typedef struct _APPLET
|
|||
} APPLET, *PAPPLET;
|
||||
|
||||
extern HINSTANCE hApplet;
|
||||
|
||||
extern DWORD IsUnattendedSetupEnabled;
|
||||
extern DWORD UnattendLCID;
|
||||
|
||||
/* currency.c */
|
||||
INT_PTR CALLBACK
|
||||
|
|
Loading…
Reference in a new issue