Author: dgorbachev
Date: Sun May 13 02:54:58 2007
New Revision: 26741
URL:
http://svn.reactos.org/svn/reactos?rev=26741&view=rev
Log:
Check result of ANSI -> Unicode conversion, which can fail in the case of
memory shortage.
Modified:
trunk/reactos/dll/ntdll/ldr/utils.c
Modified: trunk/reactos/dll/ntdll/ldr/utils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/utils.c?rev=…
==============================================================================
--- trunk/reactos/dll/ntdll/ldr/utils.c (original)
+++ trunk/reactos/dll/ntdll/ldr/utils.c Sun May 13 02:54:58 2007
@@ -1329,12 +1329,18 @@
PLDR_DATA_TABLE_ENTRY* Module,
BOOLEAN Load)
{
+ ANSI_STRING AnsiDllName;
UNICODE_STRING DllName;
NTSTATUS Status;
DPRINT("LdrpGetOrLoadModule() called for %s\n", Name);
- RtlCreateUnicodeStringFromAsciiz (&DllName, Name);
+ RtlInitAnsiString(&AnsiDllName, Name);
+ Status = RtlAnsiStringToUnicodeString(&DllName, &AnsiDllName, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
Status = LdrFindEntryForName (&DllName, Module, Load);
if (Load && !NT_SUCCESS(Status))