mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 13:31:24 +00:00
Add 'const' when needed
Remove a string copy (an a possible buffer overflow) svn path=/trunk/; revision=31682
This commit is contained in:
parent
76b039af9f
commit
c21f0dc69a
3 changed files with 75 additions and 70 deletions
|
@ -199,8 +199,8 @@ DrawBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PopupError(PCHAR Text,
|
PopupError(PCCH Text,
|
||||||
PCHAR Status,
|
PCCH Status,
|
||||||
PINPUT_RECORD Ir,
|
PINPUT_RECORD Ir,
|
||||||
ULONG WaitEvent)
|
ULONG WaitEvent)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ PopupError(PCHAR Text,
|
||||||
ULONG MaxLength;
|
ULONG MaxLength;
|
||||||
ULONG Lines;
|
ULONG Lines;
|
||||||
PCHAR p;
|
PCHAR p;
|
||||||
PCHAR pnext;
|
PCCH pnext;
|
||||||
BOOLEAN LastLine;
|
BOOLEAN LastLine;
|
||||||
SHORT Width;
|
SHORT Width;
|
||||||
SHORT Height;
|
SHORT Height;
|
||||||
|
@ -560,14 +560,14 @@ CheckUnattendedSetup(VOID)
|
||||||
DPRINT("Running unattended setup\n");
|
DPRINT("Running unattended setup\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
VOID
|
||||||
UpdateKBLayout()
|
UpdateKBLayout(VOID)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PGENERIC_LIST_ENTRY ListEntry;
|
PGENERIC_LIST_ENTRY ListEntry;
|
||||||
WCHAR szNewLayout[20];
|
LPCWSTR pszNewLayout;
|
||||||
|
|
||||||
MUIDefaultKeyboardLayout(szNewLayout);
|
pszNewLayout = MUIDefaultKeyboardLayout();
|
||||||
|
|
||||||
if (LayoutList == NULL)
|
if (LayoutList == NULL)
|
||||||
{
|
{
|
||||||
|
@ -575,11 +575,15 @@ UpdateKBLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry = LayoutList->ListHead.Flink;
|
Entry = LayoutList->ListHead.Flink;
|
||||||
|
|
||||||
|
/* Search for default layout (if provided) */
|
||||||
|
if (pszNewLayout != NULL)
|
||||||
|
{
|
||||||
while (Entry != &LayoutList->ListHead)
|
while (Entry != &LayoutList->ListHead)
|
||||||
{
|
{
|
||||||
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
|
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
|
||||||
|
|
||||||
if (!wcscmp(szNewLayout, ListEntry->UserData))
|
if (!wcscmp(pszNewLayout, ListEntry->UserData))
|
||||||
{
|
{
|
||||||
LayoutList->CurrentEntry = ListEntry;
|
LayoutList->CurrentEntry = ListEntry;
|
||||||
break;
|
break;
|
||||||
|
@ -588,6 +592,7 @@ UpdateKBLayout()
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static PAGE_NUMBER
|
static PAGE_NUMBER
|
||||||
LanguagePage(PINPUT_RECORD Ir)
|
LanguagePage(PINPUT_RECORD Ir)
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include "lang/sv-SE.h"
|
#include "lang/sv-SE.h"
|
||||||
#include "lang/uk-UA.h"
|
#include "lang/uk-UA.h"
|
||||||
|
|
||||||
static MUI_LANGUAGE LanguageList[] =
|
static const MUI_LANGUAGE LanguageList[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
L"00000409", /* The Language ID */
|
L"00000409", /* The Language ID */
|
||||||
|
@ -155,18 +155,18 @@ static MUI_LANGUAGE LanguageList[] =
|
||||||
|
|
||||||
extern
|
extern
|
||||||
VOID
|
VOID
|
||||||
PopupError(PCHAR Text,
|
PopupError(IN PCCH Text,
|
||||||
PCHAR Status,
|
IN PCCH Status,
|
||||||
PINPUT_RECORD Ir,
|
IN PINPUT_RECORD Ir,
|
||||||
ULONG WaitEvent);
|
IN ULONG WaitEvent);
|
||||||
|
|
||||||
static
|
static
|
||||||
MUI_ENTRY *
|
const MUI_ENTRY *
|
||||||
FindMUIEntriesOfPage (ULONG PageNumber)
|
FindMUIEntriesOfPage(IN ULONG PageNumber)
|
||||||
{
|
{
|
||||||
ULONG muiIndex = 0;
|
ULONG muiIndex = 0;
|
||||||
ULONG lngIndex = 0;
|
ULONG lngIndex = 0;
|
||||||
MUI_PAGE * Pages = NULL;
|
const MUI_PAGE * Pages = NULL;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -195,8 +195,8 @@ FindMUIEntriesOfPage (ULONG PageNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
MUI_ERROR *
|
const MUI_ERROR *
|
||||||
FindMUIErrorEntries ()
|
FindMUIErrorEntries(VOID)
|
||||||
{
|
{
|
||||||
ULONG lngIndex = 0;
|
ULONG lngIndex = 0;
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ FindMUIErrorEntries ()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
LPCWSTR
|
||||||
MUIDefaultKeyboardLayout(WCHAR * KeyboardLayout)
|
MUIDefaultKeyboardLayout(VOID)
|
||||||
{
|
{
|
||||||
ULONG lngIndex = 0;
|
ULONG lngIndex = 0;
|
||||||
do
|
do
|
||||||
|
@ -225,22 +225,21 @@ MUIDefaultKeyboardLayout(WCHAR * KeyboardLayout)
|
||||||
/* First we search the language list till we find current selected language messages */
|
/* First we search the language list till we find current selected language messages */
|
||||||
if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
||||||
{
|
{
|
||||||
/* Get all available error messages for this language */
|
/* Return default keyboard layout */
|
||||||
wcscpy(KeyboardLayout, LanguageList[lngIndex].LanguageKeyboardLayoutID);
|
return LanguageList[lngIndex].LanguageKeyboardLayoutID;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lngIndex++;
|
lngIndex++;
|
||||||
}
|
}
|
||||||
while (LanguageList[lngIndex].MuiPages != NULL);
|
while (LanguageList[lngIndex].MuiPages != NULL);
|
||||||
|
|
||||||
KeyboardLayout[0] = L'\0';
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MUIDisplayPage(ULONG page)
|
MUIDisplayPage(IN ULONG page)
|
||||||
{
|
{
|
||||||
MUI_ENTRY * entry;
|
const MUI_ENTRY * entry;
|
||||||
int index;
|
int index;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
@ -281,13 +280,13 @@ MUIDisplayPage(ULONG page)
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent)
|
MUIDisplayError(IN ULONG ErrorNum, OUT PINPUT_RECORD Ir, IN ULONG WaitEvent)
|
||||||
{
|
{
|
||||||
MUI_ERROR * entry;
|
const MUI_ERROR * entry;
|
||||||
|
|
||||||
if (ErrorNum >= ERROR_LAST_ERROR_CODE)
|
if (ErrorNum >= ERROR_LAST_ERROR_CODE)
|
||||||
{
|
{
|
||||||
PopupError("Pnvalid error number provided",
|
PopupError("Invalid error number provided",
|
||||||
"Press ENTER to continue",
|
"Press ENTER to continue",
|
||||||
Ir,
|
Ir,
|
||||||
POPUP_WAIT_ENTER);
|
POPUP_WAIT_ENTER);
|
||||||
|
@ -312,7 +311,7 @@ MUIDisplayError(ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
AddCodepageToRegistry(PWCHAR ACPage, PWCHAR OEMCPage, PWCHAR MACCPage)
|
AddCodepageToRegistry(IN LPCWSTR ACPage, IN LPCWSTR OEMCPage, IN LPCWSTR MACCPage)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING KeyName;
|
UNICODE_STRING KeyName;
|
||||||
|
@ -329,7 +328,7 @@ AddCodepageToRegistry(PWCHAR ACPage, PWCHAR OEMCPage, PWCHAR MACCPage)
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtOpenKey(&KeyHandle,
|
Status = NtOpenKey(&KeyHandle,
|
||||||
KEY_ALL_ACCESS,
|
KEY_WRITE,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -344,7 +343,7 @@ AddCodepageToRegistry(PWCHAR ACPage, PWCHAR OEMCPage, PWCHAR MACCPage)
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(PVOID)ACPage,
|
(PVOID)ACPage,
|
||||||
4 * sizeof(PWCHAR));
|
wcslen(ACPage) * sizeof(PWCHAR));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
@ -359,7 +358,7 @@ AddCodepageToRegistry(PWCHAR ACPage, PWCHAR OEMCPage, PWCHAR MACCPage)
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(PVOID)OEMCPage,
|
(PVOID)OEMCPage,
|
||||||
3 * sizeof(PWCHAR));
|
wcslen(OEMCPage) * sizeof(PWCHAR));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
@ -374,7 +373,7 @@ AddCodepageToRegistry(PWCHAR ACPage, PWCHAR OEMCPage, PWCHAR MACCPage)
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(PVOID)MACCPage,
|
(PVOID)MACCPage,
|
||||||
5 * sizeof(PWCHAR));
|
wcslen(MACCPage) * sizeof(PWCHAR));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
@ -403,6 +402,7 @@ AddCodePage(VOID)
|
||||||
lngIndex++;
|
lngIndex++;
|
||||||
}
|
}
|
||||||
while (LanguageList[lngIndex].MuiPages != NULL);
|
while (LanguageList[lngIndex].MuiPages != NULL);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,19 @@ typedef struct
|
||||||
{
|
{
|
||||||
BYTE X;
|
BYTE X;
|
||||||
BYTE Y;
|
BYTE Y;
|
||||||
CHAR * Buffer;
|
LPCSTR Buffer;
|
||||||
BYTE Flags;
|
BYTE Flags;
|
||||||
}MUI_ENTRY, *PMUI_ENTRY;
|
}MUI_ENTRY, *PMUI_ENTRY;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
CHAR * ErrorText;
|
LPCSTR ErrorText;
|
||||||
CHAR * ErrorStatus;
|
LPCSTR ErrorStatus;
|
||||||
}MUI_ERROR;
|
}MUI_ERROR;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
long Number;
|
LONG Number;
|
||||||
MUI_ENTRY * MuiEntry;
|
MUI_ENTRY * MuiEntry;
|
||||||
}MUI_PAGE;
|
}MUI_PAGE;
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ typedef struct
|
||||||
PWCHAR OEMCPage;
|
PWCHAR OEMCPage;
|
||||||
PWCHAR MACCPage;
|
PWCHAR MACCPage;
|
||||||
PWCHAR LanguageDescriptor;
|
PWCHAR LanguageDescriptor;
|
||||||
MUI_PAGE * MuiPages;
|
const MUI_PAGE * MuiPages;
|
||||||
MUI_ERROR * MuiErrors;
|
const MUI_ERROR * MuiErrors;
|
||||||
}MUI_LANGUAGE;
|
}MUI_LANGUAGE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ MUIDisplayPage (ULONG PageNumber);
|
||||||
VOID
|
VOID
|
||||||
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
|
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
|
||||||
|
|
||||||
VOID
|
LPCWSTR
|
||||||
MUIDefaultKeyboardLayout(WCHAR * KeyboardLayout);
|
MUIDefaultKeyboardLayout(VOID);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
AddCodePage(VOID);
|
AddCodePage(VOID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue