Author: mkupfer
Date: Sun Jan 10 14:38:46 2010
New Revision: 45025
URL:
http://svn.reactos.org/svn/reactos?rev=45025&view=rev
Log:
- Fixes a hidden pointer/reference problem with LoadGenentry function, which causes the
crash at this point
Modified:
trunk/reactos/base/setup/reactos/reactos.c
Modified: trunk/reactos/base/setup/reactos/reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos…
==============================================================================
--- trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] Sun Jan 10 14:38:46 2010
@@ -103,7 +103,7 @@
HINSTANCE hInstance;
BOOL isUnattend;
-LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY gen,PINFCONTEXT context);
+LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY *gen,PINFCONTEXT context);
/* FUNCTIONS ****************************************************************/
@@ -1084,15 +1084,15 @@
}
// get computers list
- SetupData.CompCount =
LoadGenentry(hTxtsetupSif,_T("Computer"),SetupData.pComputers,&InfContext);
+ SetupData.CompCount =
LoadGenentry(hTxtsetupSif,_T("Computer"),&SetupData.pComputers,&InfContext);
// get display list
- SetupData.DispCount =
LoadGenentry(hTxtsetupSif,_T("Display"),SetupData.pDisplays,&InfContext);
+ SetupData.DispCount =
LoadGenentry(hTxtsetupSif,_T("Display"),&SetupData.pDisplays,&InfContext);
// get keyboard list
- SetupData.KeybCount = LoadGenentry(hTxtsetupSif,
_T("Keyboard"),SetupData.pKeyboards,&InfContext);
-
- // get install directory
+ SetupData.KeybCount = LoadGenentry(hTxtsetupSif,
_T("Keyboard"),&SetupData.pKeyboards,&InfContext);
+
+ // get install directory
if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"),
_T("DefaultPath"), &InfContext))
{
SetupGetStringField(&InfContext,
@@ -1105,15 +1105,16 @@
}
}
-LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY gen,PINFCONTEXT context)
+LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY *gen,PINFCONTEXT context)
{
LONG TotalCount;
+ DWORD LineLength;
TotalCount = SetupGetLineCount(hinf, name);
if (TotalCount > 0)
{
- gen = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) *
TotalCount);
- if (gen != NULL)
+ *gen = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) *
TotalCount);
+ if (*gen != NULL)
{
if (SetupFindFirstLine(hinf, name, NULL, context))
{
@@ -1122,22 +1123,22 @@
{
SetupGetStringField(context,
0,
- gen[Count].Id,
- sizeof(gen[Count].Id) / sizeof(TCHAR),
- NULL);
+ (*gen)[Count].Id,
+ sizeof((*gen)[Count].Id) / sizeof(TCHAR),
+ &LineLength);
SetupGetStringField(context,
1,
- gen[Count].Value,
- sizeof(gen[Count].Value) / sizeof(TCHAR),
- NULL);
- Count++;
+ (*gen)[Count].Value,
+ sizeof((*gen)[Count].Value) / sizeof(TCHAR),
+ &LineLength);
+ ++Count;
}
while (SetupFindNextLine(context, context) && Count <
TotalCount);
}
}
- }
-
+ else return 0;
+ }
return TotalCount;
}