mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Fixed some unicode initialization bugs
svn path=/trunk/; revision=1020
This commit is contained in:
parent
c0ad0d9b02
commit
c37b4fd7f1
1 changed files with 63 additions and 74 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: loader.c,v 1.47 2000/02/25 00:32:04 ekohl Exp $
|
||||
/* $Id: loader.c,v 1.48 2000/02/27 18:01:44 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -109,8 +109,7 @@ VOID LdrInitModuleManagement(VOID)
|
|||
/* Create Modules object directory */
|
||||
wcscpy(NameBuffer, MODULE_ROOT_NAME);
|
||||
*(wcsrchr(NameBuffer, L'\\')) = 0;
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&ModuleName,
|
||||
0,
|
||||
|
@ -123,8 +122,7 @@ VOID LdrInitModuleManagement(VOID)
|
|||
/* Add module entry for NTOSKRNL */
|
||||
wcscpy(NameBuffer, MODULE_ROOT_NAME);
|
||||
wcscat(NameBuffer, L"ntoskrnl.exe");
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
DPRINT("Kernel's Module name is: %wZ\n", &ModuleName);
|
||||
|
||||
/* Initialize ObjectAttributes for ModuleObject */
|
||||
|
@ -142,13 +140,13 @@ VOID LdrInitModuleManagement(VOID)
|
|||
ObModuleType);
|
||||
assert(ModuleObject != NULL);
|
||||
|
||||
InitializeListHead(&ModuleListHead);
|
||||
InitializeListHead(&ModuleListHead);
|
||||
|
||||
/* Initialize ModuleObject data */
|
||||
/* Initialize ModuleObject data */
|
||||
ModuleObject->Base = (PVOID) KERNEL_BASE;
|
||||
ModuleObject->Flags = MODULE_FLAG_PE;
|
||||
InsertTailList(&ModuleListHead, &ModuleObject->ListEntry);
|
||||
ModuleObject->Name = wcsdup(L"ntoskrnl.exe");
|
||||
InsertTailList(&ModuleListHead, &ModuleObject->ListEntry);
|
||||
ModuleObject->Name = wcsdup(L"ntoskrnl.exe");
|
||||
DosHeader = (PIMAGE_DOS_HEADER) KERNEL_BASE;
|
||||
ModuleObject->Image.PE.FileHeader =
|
||||
(PIMAGE_FILE_HEADER) ((DWORD) ModuleObject->Base +
|
||||
|
@ -180,11 +178,7 @@ static VOID LdrLoadAutoConfigDriver (LPWSTR RelativeDriverName)
|
|||
LdrGetSystemDirectory(TmpFileName, (MAX_PATH * sizeof(WCHAR)));
|
||||
wcscat(TmpFileName, L"\\drivers\\");
|
||||
wcscat(TmpFileName, RelativeDriverName);
|
||||
|
||||
DriverName.Buffer = TmpFileName;
|
||||
DriverName.Length = wcslen(TmpFileName) * sizeof (WCHAR);
|
||||
DriverName.MaximumLength = DriverName.Length + sizeof(WCHAR);
|
||||
|
||||
RtlInitUnicodeString (&DriverName, TmpFileName);
|
||||
|
||||
Status = LdrLoadDriver(&DriverName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -351,9 +345,7 @@ LdrLoadModule(PUNICODE_STRING Filename)
|
|||
{
|
||||
wcscat(NameBuffer, Filename->Buffer);
|
||||
}
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
|
||||
ModuleObject = LdrProcessModule(ModuleLoadBase, &ModuleName);
|
||||
|
||||
|
@ -423,8 +415,7 @@ LdrOpenModule(PUNICODE_STRING Filename)
|
|||
{
|
||||
wcscat(NameBuffer, Filename->Buffer);
|
||||
}
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&ModuleName,
|
||||
0,
|
||||
|
@ -539,9 +530,8 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
|
|||
CHECKPOINT;
|
||||
|
||||
/* Determine the size of the module */
|
||||
|
||||
DriverSize = PEOptionalHeader->SizeOfImage;
|
||||
DPRINT("DriverSize %x\n",DriverSize);
|
||||
DriverSize = PEOptionalHeader->SizeOfImage;
|
||||
DPRINT("DriverSize %x\n",DriverSize);
|
||||
|
||||
/* Allocate a virtual section for the module */
|
||||
DriverBase = MmAllocateSection(DriverSize);
|
||||
|
@ -678,8 +668,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
|
|||
NameBuffer[Idx + Idx2] = (WCHAR) pName[Idx2];
|
||||
}
|
||||
NameBuffer[Idx + Idx2] = 0;
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
DPRINT("Import module: %wZ\n", &ModuleName);
|
||||
|
||||
LibraryModuleObject = LdrLoadModule(&ModuleName);
|
||||
|
@ -729,7 +718,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
|
|||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("Unresolved kernel symbol: %s\n", pName);
|
||||
DbgPrint("Unresolved kernel symbol: %s\n", pName);
|
||||
}
|
||||
ImportAddressList++;
|
||||
FunctionNameList++;
|
||||
|
@ -768,8 +757,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
|
|||
Idx2++;
|
||||
}
|
||||
}
|
||||
ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
|
||||
ModuleName.Buffer = NameBuffer;
|
||||
RtlInitUnicodeString (&ModuleName, NameBuffer);
|
||||
DbgPrint("Module name is: %wZ\n", &ModuleName);
|
||||
|
||||
/* Initialize ObjectAttributes for ModuleObject */
|
||||
|
@ -790,10 +778,10 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
|
|||
ModuleObject->Base = DriverBase;
|
||||
ModuleObject->Flags = MODULE_FLAG_PE;
|
||||
InsertTailList(&ModuleListHead, &ModuleObject->ListEntry);
|
||||
ModuleObject->Name = wcsdup(NameBuffer);
|
||||
ModuleObject->Name = wcsdup(NameBuffer);
|
||||
ModuleObject->EntryPoint = (PVOID) ((DWORD)DriverBase +
|
||||
PEOptionalHeader->AddressOfEntryPoint);
|
||||
ModuleObject->Length = DriverSize;
|
||||
ModuleObject->Length = DriverSize;
|
||||
DPRINT("entrypoint at %x\n", ModuleObject->EntryPoint);
|
||||
|
||||
ModuleObject->Image.PE.FileHeader =
|
||||
|
@ -877,10 +865,9 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
|
|||
if (ExportAddress == 0)
|
||||
{
|
||||
DbgPrint("Export not found for %d:%s\n", Hint, Name != NULL ? Name : "(Ordinal)");
|
||||
for(;;) ;
|
||||
for(;;) ;
|
||||
}
|
||||
|
||||
|
||||
return ExportAddress;
|
||||
}
|
||||
|
||||
|
@ -904,3 +891,5 @@ LdrPEGetEnclosingSectionHeader(DWORD RVA,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue