[NTDLL:LDR]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 23 Jun 2014 20:30:54 +0000 (20:30 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 23 Jun 2014 20:30:54 +0000 (20:30 +0000)
- 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

reactos/dll/ntdll/include/ntdll.h
reactos/dll/ntdll/ldr/ldrapi.c
reactos/dll/ntdll/ldr/ldrutils.c

index a0e8f31..d4fe496 100644 (file)
 #include <winbase.h>
 #include <winreg.h>
 #include <winuser.h>
+#include <dpfilter.h>
 #define NTOS_MODE_USER
 #include <ndk/cmfuncs.h>
 #include <ndk/exfuncs.h>
 #include <ndk/iofuncs.h>
-#include <ndk/kdtypes.h>
 #include <ndk/kefuncs.h>
 #include <ndk/ldrfuncs.h>
 #include <ndk/mmfuncs.h>
index 3e09463..ec1ee9d 100644 (file)
@@ -322,10 +322,8 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
     PTEB Teb = NtCurrentTeb();
 
     /* Initialize the strings */
+    RtlInitEmptyUnicodeString(&DllString1, StringBuffer, sizeof(StringBuffer));
     RtlInitEmptyUnicodeString(&DllString2, NULL, 0);
-    DllString1.Buffer = StringBuffer;
-    DllString1.Length = 0;
-    DllString1.MaximumLength = sizeof(StringBuffer);
 
     /* Check if the SxS Assemblies specify another file */
     Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
@@ -410,8 +408,7 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
              (Status != STATUS_OBJECT_NAME_NOT_FOUND) &&
              (Status != STATUS_DLL_INIT_FAILED))
     {
-        // 85 == DPFLTR_LDR_ID;
-        DbgPrintEx(85,
+        DbgPrintEx(DPFLTR_LDR_ID,
                    DPFLTR_WARNING_LEVEL,
                    "LDR: %s - failing because LdrpLoadDll(%wZ) returned status %x\n",
                    __FUNCTION__,
@@ -503,8 +500,11 @@ LdrFindEntryForAddress(PVOID Address,
     }
 
     /* Nothing found */
-    // 85 == DPFLTR_LDR_ID;
-    DbgPrintEx(85, DPFLTR_WARNING_LEVEL, "LDR: %s() exiting 0x%08lx\n", __FUNCTION__, STATUS_NO_MORE_ENTRIES);
+    DbgPrintEx(DPFLTR_LDR_ID,
+               DPFLTR_WARNING_LEVEL,
+               "LDR: %s() exiting 0x%08lx\n",
+               __FUNCTION__,
+               STATUS_NO_MORE_ENTRIES);
     return STATUS_NO_MORE_ENTRIES;
 }
 
index 2efeafd..201a48d 100644 (file)
@@ -1072,8 +1072,8 @@ LdrpMapDll(IN PWSTR SearchPath OPTIONAL,
         if (!NT_SUCCESS(Status) && (Status != STATUS_DLL_NOT_FOUND))
         {
             /* Failure */
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s - call to LdrpCheckForKnownDll(\"%ws\", ...) failed with status %x\n",
                         __FUNCTION__,
                         DllName,
@@ -1660,8 +1660,8 @@ LdrpResolveFullName(IN PUNICODE_STRING OriginalName,
     /* Display debug output if snaps are on */
     if (ShowSnaps)
     {
-        DbgPrintEx(81, //DPFLTR_LDR_ID,
-                   0,
+        DbgPrintEx(DPFLTR_LDR_ID,
+                   DPFLTR_ERROR_LEVEL,
                    "LDR: %s - Expanding full name of %wZ\n",
                    __FUNCTION__,
                    OriginalName);
@@ -1737,16 +1737,16 @@ Quickie:
         /* Check which output to use -- failure or success */
         if (NT_SUCCESS(Status))
         {
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s - Expanded to %wZ\n",
                        __FUNCTION__,
                        *ExpandedName);
         }
         else
         {
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s - Failed to expand %wZ; 0x%08x\n",
                        __FUNCTION__,
                        OriginalName,
@@ -1784,8 +1784,8 @@ LdrpSearchPath(IN PWCHAR *SearchPath,
     /* Display debug output if snaps are on */
     if (ShowSnaps)
     {
-        DbgPrintEx(81, //DPFLTR_LDR_ID,
-                   0,
+        DbgPrintEx(DPFLTR_LDR_ID,
+                   DPFLTR_ERROR_LEVEL,
                    "LDR: %s - Looking for %ws in %ws\n",
                    __FUNCTION__,
                    DllName,
@@ -1852,8 +1852,8 @@ LdrpSearchPath(IN PWCHAR *SearchPath,
             /* Display debug output if snaps are on */
             if (ShowSnaps)
             {
-                DbgPrintEx(81, //DPFLTR_LDR_ID,
-                           0,
+                DbgPrintEx(DPFLTR_LDR_ID,
+                           DPFLTR_ERROR_LEVEL,
                            "LDR: %s - Looking for %ws\n",
                            __FUNCTION__,
                            Buffer);
@@ -1932,16 +1932,16 @@ Quickie:
         /* Check which output to use -- failure or success */
         if (NT_SUCCESS(Status))
         {
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s - Returning %wZ\n",
                        __FUNCTION__,
                        *ExpandedName);
         }
         else
         {
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s -  Unable to locate %ws in %ws: 0x%08x\n",
                        __FUNCTION__,
                        DllName,
@@ -2455,8 +2455,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
             sizeof(NameBuffer))
         {
             /* No space to add the extension */
-            DbgPrintEx(81, //DPFLTR_LDR_ID,
-                       0,
+            DbgPrintEx(DPFLTR_LDR_ID,
+                       DPFLTR_ERROR_LEVEL,
                        "LDR: %s - Dll name missing extension; with extension "
                        "added the name is too long\n"
                        "   DllName: (@ %p) \"%wZ\"\n"