mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 08:43:04 +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);
|
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 */
|
/* Property page dialog callback */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
@ -185,6 +213,15 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
|
CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
|
||||||
|
if (IsUnattendedSetupEnabled)
|
||||||
|
{
|
||||||
|
if (VerifyUnattendLCID(hwndDlg))
|
||||||
|
{
|
||||||
|
SetNewLocale(UnattendLCID);
|
||||||
|
PostQuitMessage(0);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
|
|
|
@ -41,6 +41,9 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
HINSTANCE hApplet = 0;
|
HINSTANCE hApplet = 0;
|
||||||
HINF hSetupInf = INVALID_HANDLE_VALUE;
|
HINF hSetupInf = INVALID_HANDLE_VALUE;
|
||||||
|
DWORD IsUnattendedSetupEnabled = 0;
|
||||||
|
DWORD UnattendLCID = 0;
|
||||||
|
|
||||||
|
|
||||||
/* Applets */
|
/* Applets */
|
||||||
APPLET Applets[NUM_APPLETS] =
|
APPLET Applets[NUM_APPLETS] =
|
||||||
|
@ -97,10 +100,10 @@ OpenSetupInf()
|
||||||
return (hSetupInf != INVALID_HANDLE_VALUE);
|
return (hSetupInf != INVALID_HANDLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG ParseSetupInf()
|
VOID
|
||||||
|
ParseSetupInf()
|
||||||
{
|
{
|
||||||
INFCONTEXT InfContext;
|
INFCONTEXT InfContext;
|
||||||
INT LocaleID;
|
|
||||||
TCHAR szBuffer[30];
|
TCHAR szBuffer[30];
|
||||||
|
|
||||||
if (!SetupFindFirstLine(hSetupInf,
|
if (!SetupFindFirstLine(hSetupInf,
|
||||||
|
@ -108,7 +111,8 @@ LONG ParseSetupInf()
|
||||||
_T("LocaleID"),
|
_T("LocaleID"),
|
||||||
&InfContext))
|
&InfContext))
|
||||||
{
|
{
|
||||||
return -1;
|
SetupCloseInfFile(hSetupInf);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupGetStringField(&InfContext,
|
if (!SetupGetStringField(&InfContext,
|
||||||
|
@ -117,13 +121,13 @@ LONG ParseSetupInf()
|
||||||
sizeof(szBuffer) / sizeof(TCHAR),
|
sizeof(szBuffer) / sizeof(TCHAR),
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
return -1;
|
SetupCloseInfFile(hSetupInf);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
LocaleID = _ttoi(szBuffer);
|
|
||||||
SetNewLocale((LCID)LocaleID);
|
UnattendLCID = _tcstoul(szBuffer, NULL, 16);
|
||||||
|
IsUnattendedSetupEnabled = 1;
|
||||||
SetupCloseInfFile(hSetupInf);
|
SetupCloseInfFile(hSetupInf);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LONG APIENTRY
|
static LONG APIENTRY
|
||||||
|
@ -135,7 +139,7 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (OpenSetupInf())
|
if (OpenSetupInf())
|
||||||
{
|
{
|
||||||
return ParseSetupInf();
|
ParseSetupInf();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||||
|
|
|
@ -11,7 +11,8 @@ typedef struct _APPLET
|
||||||
} APPLET, *PAPPLET;
|
} APPLET, *PAPPLET;
|
||||||
|
|
||||||
extern HINSTANCE hApplet;
|
extern HINSTANCE hApplet;
|
||||||
|
extern DWORD IsUnattendedSetupEnabled;
|
||||||
|
extern DWORD UnattendLCID;
|
||||||
|
|
||||||
/* currency.c */
|
/* currency.c */
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue