- Implemented the driver loading by the sequence of tag entries in the GroupOrderList key.

svn path=/trunk/; revision=10941
This commit is contained in:
Hartmut Birr 2004-09-20 18:02:36 +00:00
parent b23fa198a6
commit 553993dcd2
3 changed files with 130 additions and 14 deletions

View file

@ -1,3 +1,8 @@
Changes in v1.8.24 (09/20/2004) (hbirr)
- Implemented the driver loading by the sequence of tag entries
in the GroupOrderList key.
Changes in v1.8.23 (30/08/2004) (ekohl) Changes in v1.8.23 (30/08/2004) (ekohl)
- Fixed some compiler warnings. - Fixed some compiler warnings.

View file

@ -22,7 +22,7 @@
/* just some stuff */ /* just some stuff */
#define VERSION "FreeLoader v1.8.23" #define VERSION "FreeLoader v1.8.24"
#define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>" #define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>"
#define AUTHOR_EMAIL "<brianp@sginet.com>" #define AUTHOR_EMAIL "<brianp@sginet.com>"
#define BY_AUTHOR "by Brian Palmer" #define BY_AUTHOR "by Brian Palmer"
@ -36,7 +36,7 @@
// //
#define FREELOADER_MAJOR_VERSION 1 #define FREELOADER_MAJOR_VERSION 1
#define FREELOADER_MINOR_VERSION 8 #define FREELOADER_MINOR_VERSION 8
#define FREELOADER_PATCH_VERSION 23 #define FREELOADER_PATCH_VERSION 24
#ifndef ASM #ifndef ASM

View file

@ -227,16 +227,19 @@ static VOID
LoadBootDrivers(PCHAR szSystemRoot, int nPos) LoadBootDrivers(PCHAR szSystemRoot, int nPos)
{ {
S32 rc = 0; S32 rc = 0;
HKEY hGroupKey, hServiceKey, hDriverKey; HKEY hGroupKey, hOrderKey, hServiceKey, hDriverKey;
char ValueBuffer[512]; char GroupNameBuffer[512];
char ServiceName[256]; char ServiceName[256];
U32 OrderList[128];
U32 BufferSize; U32 BufferSize;
U32 Index; U32 Index;
U32 TagIndex;
char *GroupName; char *GroupName;
U32 ValueSize; U32 ValueSize;
U32 ValueType; U32 ValueType;
U32 StartValue; U32 StartValue;
U32 TagValue;
UCHAR DriverGroup[256]; UCHAR DriverGroup[256];
U32 DriverGroupSize; U32 DriverGroupSize;
@ -249,7 +252,17 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
&hGroupKey); &hGroupKey);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
DbgPrint((DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder key (rc %d)\n", (int)rc)); DbgPrint((DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc));
return;
}
/* get 'group order list' key */
rc = RegOpenKey(NULL,
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\GroupOrderList",
&hOrderKey);
if (rc != ERROR_SUCCESS)
{
DbgPrint((DPRINT_REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc));
return; return;
} }
@ -263,26 +276,110 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
return; return;
} }
BufferSize = sizeof(ValueBuffer); BufferSize = sizeof(GroupNameBuffer);
rc = RegQueryValue(hGroupKey, "List", NULL, (PUCHAR)ValueBuffer, &BufferSize); rc = RegQueryValue(hGroupKey, "List", NULL, (PUCHAR)GroupNameBuffer, &BufferSize);
DbgPrint((DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc)); DbgPrint((DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc));
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
DbgPrint((DPRINT_REACTOS, "BufferSize: %d \n", (int)BufferSize)); DbgPrint((DPRINT_REACTOS, "BufferSize: %d \n", (int)BufferSize));
DbgPrint((DPRINT_REACTOS, "ValueBuffer: '%s' \n", ValueBuffer)); DbgPrint((DPRINT_REACTOS, "GroupNameBuffer: '%s' \n", GroupNameBuffer));
GroupName = ValueBuffer; GroupName = GroupNameBuffer;
while (*GroupName) while (*GroupName)
{ {
DbgPrint((DPRINT_REACTOS, "Driver group: '%s'\n", GroupName)); DbgPrint((DPRINT_REACTOS, "Driver group: '%s'\n", GroupName));
/* enumerate all drivers */ BufferSize = sizeof(OrderList);
rc = RegQueryValue(hOrderKey, GroupName, NULL, (PUCHAR)OrderList, &BufferSize);
if (rc != ERROR_SUCCESS)
{
OrderList[0] = 0;
}
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++)
{
/* enumerate all drivers */
Index = 0;
while (TRUE)
{
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
return;
DbgPrint((DPRINT_REACTOS, "Service %d: '%s'\n", (int)Index, ServiceName));
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
ValueSize = sizeof(U32);
rc = RegQueryValue(hDriverKey, "Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
ValueSize = sizeof(U32);
rc = RegQueryValue(hDriverKey, "Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
if (rc != ERROR_SUCCESS)
{
TagValue = (U32)-1;
}
DbgPrint((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
DriverGroupSize = 256;
rc = RegQueryValue(hDriverKey, "Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
DbgPrint((DPRINT_REACTOS, " Group: '%s' \n", DriverGroup));
if ((StartValue == 0) && (TagValue == OrderList[TagIndex]) &&(stricmp(DriverGroup, GroupName) == 0))
{
ValueSize = 256;
rc = RegQueryValue(hDriverKey,
"ImagePath",
NULL,
(PUCHAR)TempImagePath,
&ValueSize);
if (rc != ERROR_SUCCESS)
{
DbgPrint((DPRINT_REACTOS, " ImagePath: not found\n"));
strcpy(ImagePath, szSystemRoot);
strcat(ImagePath, "system32\\drivers\\");
strcat(ImagePath, ServiceName);
strcat(ImagePath, ".sys");
}
else if (TempImagePath[0] != '\\')
{
strcpy(ImagePath, szSystemRoot);
strcat(ImagePath, TempImagePath);
}
else
{
strcpy(ImagePath, TempImagePath);
DbgPrint((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
}
DbgPrint((DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath));
if (nPos < 100)
nPos += 5;
LoadDriver(ImagePath, nPos);
LoadSymbolFile(szSystemRoot, ImagePath, nPos);
}
else
{
DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current Tag %d, current group '%s')\n",
ServiceName, StartValue, TagValue, DriverGroup, OrderList[TagIndex], GroupName));
}
Index++;
}
}
Index = 0; Index = 0;
while (TRUE) while (TRUE)
{ {
ValueSize = sizeof(ValueBuffer); ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize); rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc)); DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
if (rc == ERROR_NO_MORE_ITEMS) if (rc == ERROR_NO_MORE_ITEMS)
@ -298,11 +395,25 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
rc = RegQueryValue(hDriverKey, "Start", &ValueType, (PUCHAR)&StartValue, &ValueSize); rc = RegQueryValue(hDriverKey, "Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue)); DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
ValueSize = sizeof(U32);
rc = RegQueryValue(hDriverKey, "Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
if (rc != ERROR_SUCCESS)
{
TagValue = (U32)-1;
}
DbgPrint((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
DriverGroupSize = 256; DriverGroupSize = 256;
rc = RegQueryValue(hDriverKey, "Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize); rc = RegQueryValue(hDriverKey, "Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
DbgPrint((DPRINT_REACTOS, " Group: '%s' \n", DriverGroup)); DbgPrint((DPRINT_REACTOS, " Group: '%s' \n", DriverGroup));
if ((StartValue == 0) && (stricmp(DriverGroup, GroupName) == 0)) for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++)
{
if (TagValue == OrderList[TagIndex])
break;
}
if ((StartValue == 0) && (TagIndex > OrderList[0]) && (stricmp(DriverGroup, GroupName) == 0))
{ {
ValueSize = 256; ValueSize = 256;
rc = RegQueryValue(hDriverKey, rc = RegQueryValue(hDriverKey,
@ -338,8 +449,8 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
} }
else else
{ {
DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d and Group '%s' (Current group '%s')\n", DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d, Tag %d and Group '%s' (Current group '%s')\n",
ImagePath, StartValue, DriverGroup, GroupName)); ServiceName, StartValue, TagValue, DriverGroup, GroupName));
} }
Index++; Index++;
} }