Author: dgorbachev
Date: Mon Apr 20 07:16:12 2009
New Revision: 40601
URL:
http://svn.reactos.org/svn/reactos?rev=40601&view=rev
Log:
More error checks. Bug #4393.
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/settings.c
trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Mon Apr 20 07:16:12
2009
@@ -580,6 +580,11 @@
if (LayoutList == NULL)
{
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ if (LayoutList == NULL)
+ {
+ /* FIXME: Handle error! */
+ return;
+ }
}
ListEntry = GetFirstListEntry(LayoutList);
@@ -841,9 +846,9 @@
ListEntry = GetNextListEntry(ListEntry);
}
- SetConsoleCodePage();
-
- return INSTALL_INTRO_PAGE;
+ SetConsoleCodePage();
+
+ return INSTALL_INTRO_PAGE;
}
return LANGUAGE_PAGE;
Modified: trunk/reactos/base/setup/usetup/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/settings…
==============================================================================
--- trunk/reactos/base/setup/usetup/settings.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/settings.c [iso-8859-1] Mon Apr 20 07:16:12 2009
@@ -825,6 +825,7 @@
PWCHAR UserData;
const MUI_LAYOUTS * LayoutsList;
ULONG uIndex = 0;
+ BOOL KeyboardLayoutsFound = FALSE;
/* Get default layout id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLayout",
&Context))
@@ -856,7 +857,7 @@
/* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n");
DestroyGenericList(List, FALSE);
- break;
+ return NULL;
}
if (_wcsicmp(LayoutsList[uIndex].LayoutID, KeyName) == 0)
@@ -868,6 +869,9 @@
if (UserData == NULL)
{
/* FIXME: Handle error! */
+ DPRINT("RtlAllocateHeap() failed\n");
+ DestroyGenericList(List, FALSE);
+ return NULL;
}
wcscpy(UserData, KeyName);
@@ -877,13 +881,22 @@
Buffer,
UserData,
_wcsicmp(KeyName, DefaultKBLayout) ? FALSE :
TRUE);
+ KeyboardLayoutsFound = TRUE;
}
-
+
} while (SetupFindNextLine(&Context, &Context));
uIndex++;
} while (LayoutsList[uIndex].LangID != NULL);
+
+ /* FIXME: Handle this case */
+ if (!KeyboardLayoutsFound)
+ {
+ DPRINT1("No keyboard layouts have been found\n");
+ DestroyGenericList(List, FALSE);
+ return NULL;
+ }
return List;
}
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] Mon Apr 20 07:16:12
2009
@@ -330,7 +330,7 @@
rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize);
if (rc != ERROR_SUCCESS) {
- strcpy(szErrorOut, "Language Default setting exists, but isn't
readable");
+ sprintf(szErrorOut, "Language Default setting exists, but isn't readable
(%S)", szIdBuffer);
return(FALSE);
}