Author: hbelusca
Date: Thu Aug 31 18:25:38 2017
New Revision: 75719
URL:
http://svn.reactos.org/svn/reactos?rev=75719&view=rev
Log:
[SETUPLIB]: Change some string pointer types & function prototypes so that the
usetup-specific "SelectedLanguageId" variable is not used in the library.
Modified:
branches/setup_improvements/base/setup/lib/mui.c
branches/setup_improvements/base/setup/lib/mui.h
Modified: branches/setup_improvements/base/setup/lib/mui.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/mui.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/mui.c [iso-8859-1] Thu Aug 31 18:25:38
2017
@@ -40,72 +40,78 @@
static
ULONG
-FindLanguageIndex(VOID)
+FindLanguageIndex(
+ IN PCWSTR LanguageId)
{
ULONG lngIndex = 0;
- if (SelectedLanguageId == NULL)
- {
- /* default to english */
- return 0;
- }
-
- do
- {
- if (_wcsicmp(LanguageList[lngIndex].LanguageID, SelectedLanguageId) == 0)
+ if (LanguageId == NULL)
+ {
+ /* Default to en-US */
+ // return 0; // FIXME!!
+ LanguageId = L"00000409";
+ }
+
+ while (LanguageList[lngIndex].LanguageID != NULL)
+ {
+ if (_wcsicmp(LanguageList[lngIndex].LanguageID, LanguageId) == 0)
{
return lngIndex;
}
lngIndex++;
- } while (LanguageList[lngIndex].LanguageID != NULL);
+ }
return 0;
}
BOOLEAN
IsLanguageAvailable(
- PWCHAR LanguageId)
+ IN PCWSTR LanguageId)
{
ULONG lngIndex = 0;
- do
+ while (LanguageList[lngIndex].LanguageID != NULL)
{
if (_wcsicmp(LanguageList[lngIndex].LanguageID, LanguageId) == 0)
return TRUE;
lngIndex++;
- } while (LanguageList[lngIndex].LanguageID != NULL);
+ }
return FALSE;
}
PCWSTR
-MUIDefaultKeyboardLayout(VOID)
-{
- ULONG lngIndex = max(FindLanguageIndex(), 0);
+MUIDefaultKeyboardLayout(
+ IN PCWSTR LanguageId)
+{
+ ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
return LanguageList[lngIndex].MuiLayouts[0].LayoutID;
}
-PWCHAR
-MUIGetOEMCodePage(VOID)
-{
- ULONG lngIndex = max(FindLanguageIndex(), 0);
+PCWSTR
+MUIGetOEMCodePage(
+ IN PCWSTR LanguageId)
+{
+ ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
return LanguageList[lngIndex].OEMCPage;
}
-PWCHAR
-MUIGetGeoID(VOID)
-{
- ULONG lngIndex = max(FindLanguageIndex(), 0);
+PCWSTR
+MUIGetGeoID(
+ IN PCWSTR LanguageId)
+{
+ ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
return LanguageList[lngIndex].GeoID;
}
-const MUI_LAYOUTS *
-MUIGetLayoutsList(VOID)
-{
- ULONG lngIndex = max(FindLanguageIndex(), 0);
+const MUI_LAYOUTS*
+MUIGetLayoutsList(
+ IN PCWSTR LanguageId)
+{
+ ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
return LanguageList[lngIndex].MuiLayouts;
}
@@ -139,8 +145,7 @@
NULL,
REG_OPTION_NON_VOLATILE,
&Disposition);
-
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
return FALSE;
@@ -230,14 +235,13 @@
NULL,
REG_OPTION_NON_VOLATILE,
&Disposition);
-
- if(NT_SUCCESS(Status))
- NtClose(KeyHandle);
- else
+ if (!NT_SUCCESS(Status))
{
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
return FALSE;
}
+
+ NtClose(KeyHandle);
KeyName.MaximumLength = sizeof(szKeyName);
Status = RtlAppendUnicodeToString(&KeyName, L"\\Preload");
@@ -262,7 +266,6 @@
NULL,
REG_OPTION_NON_VOLATILE,
&Disposition);
-
if (!NT_SUCCESS(Status))
{
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
@@ -283,8 +286,7 @@
NULL,
REG_OPTION_NON_VOLATILE,
&Disposition);
-
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
NtClose(SubKeyHandle);
@@ -292,7 +294,7 @@
return FALSE;
}
- do
+ while (MuiLayouts[uIndex].LangID != NULL)
{
if (uIndex > 19) break;
@@ -355,7 +357,6 @@
uIndex++;
}
- while (MuiLayouts[uIndex].LangID != NULL);
if (uIndex > 1)
AddHotkeySettings(L"2", L"2", L"1");
@@ -368,20 +369,20 @@
}
BOOLEAN
-AddKeyboardLayouts(VOID)
+AddKeyboardLayouts(
+ IN PCWSTR LanguageId)
{
ULONG lngIndex = 0;
- do
- {
- if (_wcsicmp(LanguageList[lngIndex].LanguageID, SelectedLanguageId) == 0)
+ while (LanguageList[lngIndex].LanguageID != NULL)
+ {
+ if (_wcsicmp(LanguageList[lngIndex].LanguageID, LanguageId) == 0)
{
return AddKbLayoutsToRegistry(LanguageList[lngIndex].MuiLayouts);
}
lngIndex++;
}
- while (LanguageList[lngIndex].LanguageID != NULL);
return FALSE;
}
@@ -494,7 +495,7 @@
return FALSE;
}
- do
+ while (MuiSubFonts[uIndex].FontName != NULL)
{
RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName);
Status = NtSetValueKey(KeyHandle,
@@ -512,7 +513,6 @@
uIndex++;
}
- while (MuiSubFonts[uIndex].FontName != NULL);
NtClose(KeyHandle);
@@ -520,12 +520,14 @@
}
BOOLEAN
-AddCodePage(VOID)
+AddCodePage(
+ IN PCWSTR LanguageId)
{
ULONG lngIndex = 0;
- do
- {
- if (_wcsicmp(LanguageList[lngIndex].LanguageID, SelectedLanguageId) == 0)
+
+ while (LanguageList[lngIndex].LanguageID != NULL)
+ {
+ if (_wcsicmp(LanguageList[lngIndex].LanguageID, LanguageId) == 0)
{
if (AddCodepageToRegistry(LanguageList[lngIndex].ACPage,
LanguageList[lngIndex].OEMCPage,
@@ -542,7 +544,6 @@
lngIndex++;
}
- while (LanguageList[lngIndex].LanguageID != NULL);
return FALSE;
}
Modified: branches/setup_improvements/base/setup/lib/mui.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/mui.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/mui.h [iso-8859-1] Thu Aug 31 18:25:38
2017
@@ -2,55 +2,57 @@
typedef struct
{
- PWCHAR FontName;
- PWCHAR SubFontName;
+ PCWSTR FontName;
+ PCWSTR SubFontName;
} MUI_SUBFONT;
typedef struct
{
- PWCHAR LangID; // Language ID (like "0409")
- PWCHAR LayoutID; // Layout ID (like "00000409")
+ PCWSTR LangID; // Language ID (like "0409")
+ PCWSTR LayoutID; // Layout ID (like "00000409")
} MUI_LAYOUTS;
typedef struct
{
- PWCHAR LanguageID;
- PWCHAR ACPage;
- PWCHAR OEMCPage;
- PWCHAR MACCPage;
- PWCHAR LanguageDescriptor;
- PWCHAR GeoID;
+ PCWSTR LanguageID;
+ PCWSTR ACPage;
+ PCWSTR OEMCPage;
+ PCWSTR MACCPage;
+ PCWSTR LanguageDescriptor;
+ PCWSTR GeoID;
const MUI_SUBFONT * MuiSubFonts;
const MUI_LAYOUTS * MuiLayouts;
} MUI_LANGUAGE;
-// HACK HACK HACK!!
-extern PWCHAR SelectedLanguageId;
-
-
BOOLEAN
IsLanguageAvailable(
- PWCHAR LanguageId);
+ IN PCWSTR LanguageId);
PCWSTR
-MUIDefaultKeyboardLayout(VOID);
+MUIDefaultKeyboardLayout(
+ IN PCWSTR LanguageId);
-PWCHAR
-MUIGetOEMCodePage(VOID);
+PCWSTR
+MUIGetOEMCodePage(
+ IN PCWSTR LanguageId);
-PWCHAR
-MUIGetGeoID(VOID);
+PCWSTR
+MUIGetGeoID(
+ IN PCWSTR LanguageId);
-const MUI_LAYOUTS *
-MUIGetLayoutsList(VOID);
+const MUI_LAYOUTS*
+MUIGetLayoutsList(
+ IN PCWSTR LanguageId);
BOOLEAN
AddKbLayoutsToRegistry(
IN const MUI_LAYOUTS *MuiLayouts);
BOOLEAN
-AddCodePage(VOID);
+AddKeyboardLayouts(
+ IN PCWSTR LanguageId);
BOOLEAN
-AddKeyboardLayouts(VOID);
+AddCodePage(
+ IN PCWSTR LanguageId);