Fixed some unicode initialization bugs

svn path=/trunk/; revision=1020
This commit is contained in:
Eric Kohl 2000-02-27 18:01:44 +00:00
parent c0ad0d9b02
commit c37b4fd7f1

View file

@ -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 */
@ -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,7 +530,6 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
CHECKPOINT;
/* Determine the size of the module */
DriverSize = PEOptionalHeader->SizeOfImage;
DPRINT("DriverSize %x\n",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);
@ -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 */
@ -880,7 +868,6 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
for(;;) ;
}
return ExportAddress;
}
@ -904,3 +891,5 @@ LdrPEGetEnclosingSectionHeader(DWORD RVA,
return 0;
}
/* EOF */