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