[NTDLL:LDR]

- Actually use DPFLTR_LDR_ID in debug prints instead of a magic value and a comment
- Use RtlInitEmptyUnicodeString where appropriate

svn path=/trunk/; revision=63635
This commit is contained in:
Thomas Faber 2014-06-23 20:30:54 +00:00
parent 9e0c44c18d
commit 63861e09a4
3 changed files with 26 additions and 26 deletions

View file

@ -27,11 +27,11 @@
#include <winbase.h> #include <winbase.h>
#include <winreg.h> #include <winreg.h>
#include <winuser.h> #include <winuser.h>
#include <dpfilter.h>
#define NTOS_MODE_USER #define NTOS_MODE_USER
#include <ndk/cmfuncs.h> #include <ndk/cmfuncs.h>
#include <ndk/exfuncs.h> #include <ndk/exfuncs.h>
#include <ndk/iofuncs.h> #include <ndk/iofuncs.h>
#include <ndk/kdtypes.h>
#include <ndk/kefuncs.h> #include <ndk/kefuncs.h>
#include <ndk/ldrfuncs.h> #include <ndk/ldrfuncs.h>
#include <ndk/mmfuncs.h> #include <ndk/mmfuncs.h>

View file

@ -322,10 +322,8 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
PTEB Teb = NtCurrentTeb(); PTEB Teb = NtCurrentTeb();
/* Initialize the strings */ /* Initialize the strings */
RtlInitEmptyUnicodeString(&DllString1, StringBuffer, sizeof(StringBuffer));
RtlInitEmptyUnicodeString(&DllString2, NULL, 0); RtlInitEmptyUnicodeString(&DllString2, NULL, 0);
DllString1.Buffer = StringBuffer;
DllString1.Length = 0;
DllString1.MaximumLength = sizeof(StringBuffer);
/* Check if the SxS Assemblies specify another file */ /* Check if the SxS Assemblies specify another file */
Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE, Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
@ -410,8 +408,7 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
(Status != STATUS_OBJECT_NAME_NOT_FOUND) && (Status != STATUS_OBJECT_NAME_NOT_FOUND) &&
(Status != STATUS_DLL_INIT_FAILED)) (Status != STATUS_DLL_INIT_FAILED))
{ {
// 85 == DPFLTR_LDR_ID; DbgPrintEx(DPFLTR_LDR_ID,
DbgPrintEx(85,
DPFLTR_WARNING_LEVEL, DPFLTR_WARNING_LEVEL,
"LDR: %s - failing because LdrpLoadDll(%wZ) returned status %x\n", "LDR: %s - failing because LdrpLoadDll(%wZ) returned status %x\n",
__FUNCTION__, __FUNCTION__,
@ -503,8 +500,11 @@ LdrFindEntryForAddress(PVOID Address,
} }
/* Nothing found */ /* Nothing found */
// 85 == DPFLTR_LDR_ID; DbgPrintEx(DPFLTR_LDR_ID,
DbgPrintEx(85, DPFLTR_WARNING_LEVEL, "LDR: %s() exiting 0x%08lx\n", __FUNCTION__, STATUS_NO_MORE_ENTRIES); DPFLTR_WARNING_LEVEL,
"LDR: %s() exiting 0x%08lx\n",
__FUNCTION__,
STATUS_NO_MORE_ENTRIES);
return STATUS_NO_MORE_ENTRIES; return STATUS_NO_MORE_ENTRIES;
} }

View file

@ -1072,8 +1072,8 @@ LdrpMapDll(IN PWSTR SearchPath OPTIONAL,
if (!NT_SUCCESS(Status) && (Status != STATUS_DLL_NOT_FOUND)) if (!NT_SUCCESS(Status) && (Status != STATUS_DLL_NOT_FOUND))
{ {
/* Failure */ /* Failure */
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - call to LdrpCheckForKnownDll(\"%ws\", ...) failed with status %x\n", "LDR: %s - call to LdrpCheckForKnownDll(\"%ws\", ...) failed with status %x\n",
__FUNCTION__, __FUNCTION__,
DllName, DllName,
@ -1660,8 +1660,8 @@ LdrpResolveFullName(IN PUNICODE_STRING OriginalName,
/* Display debug output if snaps are on */ /* Display debug output if snaps are on */
if (ShowSnaps) if (ShowSnaps)
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Expanding full name of %wZ\n", "LDR: %s - Expanding full name of %wZ\n",
__FUNCTION__, __FUNCTION__,
OriginalName); OriginalName);
@ -1737,16 +1737,16 @@ Quickie:
/* Check which output to use -- failure or success */ /* Check which output to use -- failure or success */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Expanded to %wZ\n", "LDR: %s - Expanded to %wZ\n",
__FUNCTION__, __FUNCTION__,
*ExpandedName); *ExpandedName);
} }
else else
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Failed to expand %wZ; 0x%08x\n", "LDR: %s - Failed to expand %wZ; 0x%08x\n",
__FUNCTION__, __FUNCTION__,
OriginalName, OriginalName,
@ -1784,8 +1784,8 @@ LdrpSearchPath(IN PWCHAR *SearchPath,
/* Display debug output if snaps are on */ /* Display debug output if snaps are on */
if (ShowSnaps) if (ShowSnaps)
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Looking for %ws in %ws\n", "LDR: %s - Looking for %ws in %ws\n",
__FUNCTION__, __FUNCTION__,
DllName, DllName,
@ -1852,8 +1852,8 @@ LdrpSearchPath(IN PWCHAR *SearchPath,
/* Display debug output if snaps are on */ /* Display debug output if snaps are on */
if (ShowSnaps) if (ShowSnaps)
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Looking for %ws\n", "LDR: %s - Looking for %ws\n",
__FUNCTION__, __FUNCTION__,
Buffer); Buffer);
@ -1932,16 +1932,16 @@ Quickie:
/* Check which output to use -- failure or success */ /* Check which output to use -- failure or success */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Returning %wZ\n", "LDR: %s - Returning %wZ\n",
__FUNCTION__, __FUNCTION__,
*ExpandedName); *ExpandedName);
} }
else else
{ {
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Unable to locate %ws in %ws: 0x%08x\n", "LDR: %s - Unable to locate %ws in %ws: 0x%08x\n",
__FUNCTION__, __FUNCTION__,
DllName, DllName,
@ -2455,8 +2455,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
sizeof(NameBuffer)) sizeof(NameBuffer))
{ {
/* No space to add the extension */ /* No space to add the extension */
DbgPrintEx(81, //DPFLTR_LDR_ID, DbgPrintEx(DPFLTR_LDR_ID,
0, DPFLTR_ERROR_LEVEL,
"LDR: %s - Dll name missing extension; with extension " "LDR: %s - Dll name missing extension; with extension "
"added the name is too long\n" "added the name is too long\n"
" DllName: (@ %p) \"%wZ\"\n" " DllName: (@ %p) \"%wZ\"\n"