mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
- Implemented the driver loading by the sequence of tag entries in the GroupOrderList key.
svn path=/trunk/; revision=10941
This commit is contained in:
parent
b23fa198a6
commit
553993dcd2
3 changed files with 130 additions and 14 deletions
|
@ -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)
|
||||
|
||||
- Fixed some compiler warnings.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
/* 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 AUTHOR_EMAIL "<brianp@sginet.com>"
|
||||
#define BY_AUTHOR "by Brian Palmer"
|
||||
|
@ -36,7 +36,7 @@
|
|||
//
|
||||
#define FREELOADER_MAJOR_VERSION 1
|
||||
#define FREELOADER_MINOR_VERSION 8
|
||||
#define FREELOADER_PATCH_VERSION 23
|
||||
#define FREELOADER_PATCH_VERSION 24
|
||||
|
||||
|
||||
#ifndef ASM
|
||||
|
|
|
@ -227,16 +227,19 @@ static VOID
|
|||
LoadBootDrivers(PCHAR szSystemRoot, int nPos)
|
||||
{
|
||||
S32 rc = 0;
|
||||
HKEY hGroupKey, hServiceKey, hDriverKey;
|
||||
char ValueBuffer[512];
|
||||
HKEY hGroupKey, hOrderKey, hServiceKey, hDriverKey;
|
||||
char GroupNameBuffer[512];
|
||||
char ServiceName[256];
|
||||
U32 OrderList[128];
|
||||
U32 BufferSize;
|
||||
U32 Index;
|
||||
U32 TagIndex;
|
||||
char *GroupName;
|
||||
|
||||
U32 ValueSize;
|
||||
U32 ValueType;
|
||||
U32 StartValue;
|
||||
U32 TagValue;
|
||||
UCHAR DriverGroup[256];
|
||||
U32 DriverGroupSize;
|
||||
|
||||
|
@ -249,7 +252,17 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
|
|||
&hGroupKey);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -263,26 +276,35 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
|
|||
return;
|
||||
}
|
||||
|
||||
BufferSize = sizeof(ValueBuffer);
|
||||
rc = RegQueryValue(hGroupKey, "List", NULL, (PUCHAR)ValueBuffer, &BufferSize);
|
||||
BufferSize = sizeof(GroupNameBuffer);
|
||||
rc = RegQueryValue(hGroupKey, "List", NULL, (PUCHAR)GroupNameBuffer, &BufferSize);
|
||||
DbgPrint((DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc));
|
||||
if (rc != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
DbgPrint((DPRINT_REACTOS, "Driver group: '%s'\n", GroupName));
|
||||
|
||||
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(ValueBuffer);
|
||||
ValueSize = sizeof(ServiceName);
|
||||
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
|
||||
DbgPrint((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
|
||||
if (rc == ERROR_NO_MORE_ITEMS)
|
||||
|
@ -298,11 +320,20 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
|
|||
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) && (stricmp(DriverGroup, GroupName) == 0))
|
||||
if ((StartValue == 0) && (TagValue == OrderList[TagIndex]) &&(stricmp(DriverGroup, GroupName) == 0))
|
||||
{
|
||||
ValueSize = 256;
|
||||
rc = RegQueryValue(hDriverKey,
|
||||
|
@ -338,8 +369,88 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
|
|||
}
|
||||
else
|
||||
{
|
||||
DbgPrint((DPRINT_REACTOS, " Skipping driver '%s' with Start %d and Group '%s' (Current group '%s')\n",
|
||||
ImagePath, StartValue, DriverGroup, GroupName));
|
||||
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;
|
||||
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));
|
||||
|
||||
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++)
|
||||
{
|
||||
if (TagValue == OrderList[TagIndex])
|
||||
break;
|
||||
}
|
||||
|
||||
if ((StartValue == 0) && (TagIndex > OrderList[0]) && (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 group '%s')\n",
|
||||
ServiceName, StartValue, TagValue, DriverGroup, GroupName));
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue