mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 04:13:32 +00:00
- Fixed RtlFormatCurrentUserKeyPath and it's use.
- Fill correctly all members of the returned device object in IoCreateDevice. - Don't bug check in loader when export isn't found, only report it and don't load the module. - If we know a module path while loading, use it for searching for the import modules. - Modified LdrpBuildModuleBaseName to not strip the extension from file name, because the files 's3legacy.dll' and 's3legacy.sys' are otherwise treated as the same files and wrong module is loaded. svn path=/trunk/; revision=8562
This commit is contained in:
@@ -83,6 +83,7 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
||||
Status = RtlFormatCurrentUserKeyPath(&KeyName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return(Status);
|
||||
RtlAppendUnicodeToString(&KeyName, L"\\");
|
||||
break;
|
||||
|
||||
/* ReactOS specific */
|
||||
@@ -212,8 +213,8 @@ NTSTATUS STDCALL
|
||||
RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath)
|
||||
{
|
||||
/* FIXME: !!! */
|
||||
RtlCreateUnicodeString(KeyPath,
|
||||
L"\\Registry\\User\\.Default");
|
||||
KeyPath->Length = 0;
|
||||
RtlAppendUnicodeToString(KeyPath, L"\\Registry\\User\\.Default");
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: device.c,v 1.65 2003/12/15 17:50:23 ekohl Exp $
|
||||
/* $Id: device.c,v 1.66 2004/03/07 11:59:10 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -717,10 +717,15 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
||||
DeviceExtensionSize);
|
||||
}
|
||||
|
||||
CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + DeviceExtensionSize;
|
||||
CreatedDeviceObject->ReferenceCount = 1;
|
||||
CreatedDeviceObject->AttachedDevice = NULL;
|
||||
CreatedDeviceObject->DeviceType = DeviceType;
|
||||
CreatedDeviceObject->StackSize = 1;
|
||||
CreatedDeviceObject->AlignmentRequirement = 1;
|
||||
CreatedDeviceObject->Characteristics = DeviceCharacteristics;
|
||||
CreatedDeviceObject->Timer = NULL;
|
||||
CreatedDeviceObject->Vpb = NULL;
|
||||
KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
|
||||
|
||||
KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: loader.c,v 1.139 2004/01/05 14:28:21 weiden Exp $
|
||||
/* $Id: loader.c,v 1.140 2004/03/07 11:59:10 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -401,7 +401,7 @@ LdrLoadModule(PUNICODE_STRING Filename,
|
||||
&Module);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CPRINT("Could not process module");
|
||||
CPRINT("Could not process module\n");
|
||||
ExFreePool(ModuleLoadBase);
|
||||
return(Status);
|
||||
}
|
||||
@@ -672,9 +672,7 @@ static VOID
|
||||
LdrpBuildModuleBaseName(PUNICODE_STRING BaseName,
|
||||
PUNICODE_STRING FullName)
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
PWCHAR p;
|
||||
PWCHAR q;
|
||||
|
||||
DPRINT("LdrpBuildModuleBaseName()\n");
|
||||
DPRINT("FullName %wZ\n", FullName);
|
||||
@@ -691,18 +689,7 @@ LdrpBuildModuleBaseName(PUNICODE_STRING BaseName,
|
||||
|
||||
DPRINT("p %S\n", p);
|
||||
|
||||
RtlCreateUnicodeString(&Name, p);
|
||||
|
||||
q = wcschr(Name.Buffer, L'.');
|
||||
if (q != NULL)
|
||||
{
|
||||
*q = (WCHAR)0;
|
||||
}
|
||||
|
||||
DPRINT("p %S\n", p);
|
||||
|
||||
RtlCreateUnicodeString(BaseName, Name.Buffer);
|
||||
RtlFreeUnicodeString(&Name);
|
||||
RtlCreateUnicodeString(BaseName, p);
|
||||
}
|
||||
|
||||
|
||||
@@ -873,7 +860,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||
WORD Hint;
|
||||
UNICODE_STRING ModuleName;
|
||||
UNICODE_STRING NameString;
|
||||
WCHAR NameBuffer[60];
|
||||
WCHAR NameBuffer[PATH_MAX];
|
||||
MODULE_TEXT_SECTION* ModuleTextSection;
|
||||
NTSTATUS Status;
|
||||
KIRQL Irql;
|
||||
@@ -938,12 +925,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||
CPRINT("Failed to allocate a virtual section for driver\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
#if 0
|
||||
DbgPrint("DriverBase for %wZ: %x\n", FileName, DriverBase);
|
||||
#else
|
||||
DbgPrint("DriverBase for %wZ", FileName);
|
||||
DbgPrint(": %x\n", DriverBase);
|
||||
#endif
|
||||
CHECKPOINT;
|
||||
/* Copy headers over */
|
||||
memcpy(DriverBase, ModuleLoadBase, PEOptionalHeader->SizeOfHeaders);
|
||||
@@ -1076,11 +1058,34 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||
LibraryModuleObject = LdrGetModuleObject(&ModuleName);
|
||||
if (LibraryModuleObject == NULL)
|
||||
{
|
||||
DPRINT("Module '%wZ' not loaded yet\n", &ModuleName);
|
||||
wcscpy(NameBuffer, L"\\SystemRoot\\system32\\drivers\\");
|
||||
wcscat(NameBuffer, ModuleName.Buffer);
|
||||
RtlInitUnicodeString(&NameString, NameBuffer);
|
||||
Status = LdrLoadModule(&NameString, &LibraryModuleObject);
|
||||
PWCHAR PathEnd;
|
||||
ULONG PathLength;
|
||||
|
||||
PathEnd = wcsrchr(FileName->Buffer, L'\\');
|
||||
if (PathEnd != NULL)
|
||||
{
|
||||
PathLength = (PathEnd - FileName->Buffer + 1) * sizeof(WCHAR);
|
||||
RtlCopyMemory(
|
||||
NameBuffer,
|
||||
FileName->Buffer,
|
||||
PathLength);
|
||||
RtlCopyMemory(
|
||||
NameBuffer + (PathLength / sizeof(WCHAR)),
|
||||
ModuleName.Buffer,
|
||||
ModuleName.Length);
|
||||
NameString.Buffer = NameBuffer;
|
||||
NameString.MaximumLength =
|
||||
NameString.Length = PathLength + ModuleName.Length;
|
||||
Status = LdrLoadModule(&NameString, &LibraryModuleObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Module '%wZ' not loaded yet\n", &ModuleName);
|
||||
wcscpy(NameBuffer, L"\\SystemRoot\\system32\\drivers\\");
|
||||
wcscat(NameBuffer, ModuleName.Buffer);
|
||||
RtlInitUnicodeString(&NameString, NameBuffer);
|
||||
Status = LdrLoadModule(&NameString, &LibraryModuleObject);
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
wcscpy(NameBuffer, L"\\SystemRoot\\system32\\");
|
||||
@@ -1133,11 +1138,15 @@ LdrPEProcessModule(PVOID ModuleLoadBase,
|
||||
*ImportAddressList = LdrGetExportAddress(LibraryModuleObject,
|
||||
pName,
|
||||
Hint);
|
||||
if (*ImportAddressList == NULL)
|
||||
{
|
||||
return STATUS_PROCEDURE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CPRINT("Unresolved kernel symbol: %s\n", pName);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
return STATUS_PROCEDURE_NOT_FOUND;
|
||||
}
|
||||
ImportAddressList++;
|
||||
FunctionNameList++;
|
||||
@@ -1565,7 +1574,6 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
|
||||
DbgPrint("Export not found for %d:%s\n",
|
||||
Hint,
|
||||
Name != NULL ? Name : "(Ordinal)");
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
|
||||
return(ExportAddress);
|
||||
|
||||
Reference in New Issue
Block a user