Alexandre Julliard : ntdll: Improve debugging helper for object attributes structure.

Alexandre Julliard julliard at winehq.org
Mon Feb 16 09:34:50 CST 2009


Module: wine
Branch: master
Commit: 912d98c2ae57708c2253a9b46e6659abf87d9728
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=912d98c2ae57708c2253a9b46e6659abf87d9728

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb 16 11:46:44 2009 +0100

ntdll: Improve debugging helper for object attributes structure.

---

 dlls/ntdll/misc.c       |   10 +++++-----
 dlls/ntdll/nt.c         |    7 +++----
 dlls/ntdll/ntdll_misc.h |    4 ++--
 dlls/ntdll/om.c         |   14 +++++---------
 dlls/ntdll/reg.c        |    7 +++----
 5 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 5272c87..f72ea50 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -37,12 +37,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 #define POP_FPU(x) DO_FPU("fstpl",x)
 #endif
 
-void dump_ObjectAttributes (const OBJECT_ATTRIBUTES *oa)
+LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa)
 {
-	if (oa)
-	  TRACE("%p:(name=%s, attr=0x%08x, hRoot=%p, sd=%p)\n",
-	    oa, debugstr_us(oa->ObjectName),
-	    oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
+    if (!oa) return "<null>";
+    return wine_dbg_sprintf( "{name=%s, attr=0x%08x, hRoot=%p, sd=%p}\n",
+                             debugstr_us(oa->ObjectName), oa->Attributes,
+                             oa->RootDirectory, oa->SecurityDescriptor );
 }
 
 LPCSTR debugstr_us( const UNICODE_STRING *us )
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 7d24731..7654f69 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -63,10 +63,9 @@ NTSTATUS WINAPI NtDuplicateToken(
 {
     NTSTATUS status;
 
-    TRACE("(%p,0x%08x,%p,0x%08x,0x%08x,%p)\n",
-        ExistingToken, DesiredAccess, ObjectAttributes,
-        ImpersonationLevel, TokenType, NewToken);
-        dump_ObjectAttributes(ObjectAttributes);
+    TRACE("(%p,0x%08x,%s,0x%08x,0x%08x,%p)\n",
+          ExistingToken, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes),
+          ImpersonationLevel, TokenType, NewToken);
 
     if (ObjectAttributes && ObjectAttributes->SecurityQualityOfService)
     {
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 1d56da8..444a211 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -43,9 +43,9 @@ extern void wait_suspend( CONTEXT *context );
 extern void WINAPI __regs_RtlRaiseException( PEXCEPTION_RECORD, PCONTEXT );
 extern void set_cpu_context( const CONTEXT *context );
 
-/* debug helper */
+/* debug helpers */
 extern LPCSTR debugstr_us( const UNICODE_STRING *str );
-extern void dump_ObjectAttributes (const OBJECT_ATTRIBUTES *ObjectAttributes);
+extern LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa);
 
 extern NTSTATUS NTDLL_queue_process_apc( HANDLE process, const apc_call_t *call, apc_result_t *result );
 extern NTSTATUS NTDLL_wait_for_multiple_objects( UINT count, const HANDLE *handles, UINT flags,
diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index fb6d675..588d810 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -332,8 +332,7 @@ NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Desir
                                       POBJECT_ATTRIBUTES ObjectAttributes)
 {
     NTSTATUS ret;
-    TRACE("(%p,0x%08x)\n", DirectoryHandle, DesiredAccess);
-    dump_ObjectAttributes(ObjectAttributes);
+    TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
 
     if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
     if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
@@ -381,8 +380,7 @@ NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Des
                                         POBJECT_ATTRIBUTES ObjectAttributes)
 {
     NTSTATUS ret;
-    TRACE("(%p,0x%08x)\n", DirectoryHandle, DesiredAccess);
-    dump_ObjectAttributes(ObjectAttributes);
+    TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
 
     if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
 
@@ -489,8 +487,7 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK
                                          IN POBJECT_ATTRIBUTES ObjectAttributes)
 {
     NTSTATUS ret;
-    TRACE("(%p,0x%08x,%p)\n",LinkHandle, DesiredAccess, ObjectAttributes);
-    dump_ObjectAttributes(ObjectAttributes);
+    TRACE("(%p,0x%08x,%s)\n",LinkHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
 
     if (!LinkHandle) return STATUS_ACCESS_VIOLATION;
     if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
@@ -544,9 +541,8 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACC
     if (!SymbolicLinkHandle || !TargetName) return STATUS_ACCESS_VIOLATION;
     if (!TargetName->Buffer) return STATUS_INVALID_PARAMETER;
 
-    TRACE("(%p,0x%08x,%p, -> %s)\n", SymbolicLinkHandle, DesiredAccess, ObjectAttributes,
-                                      debugstr_us(TargetName));
-    dump_ObjectAttributes(ObjectAttributes);
+    TRACE("(%p,0x%08x,%s -> %s)\n", SymbolicLinkHandle, DesiredAccess,
+          debugstr_ObjectAttributes(ObjectAttributes), debugstr_us(TargetName));
 
     SERVER_START_REQ(create_symlink)
     {
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 0d6a137..6521c70 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -693,10 +693,9 @@ NTSTATUS WINAPI NtReplaceKey(
 	IN HANDLE Key,
 	IN POBJECT_ATTRIBUTES ReplacedObjectAttributes)
 {
-	FIXME("(%p),stub!\n", Key);
-	dump_ObjectAttributes(ObjectAttributes);
-	dump_ObjectAttributes(ReplacedObjectAttributes);
-	return STATUS_SUCCESS;
+    FIXME("(%s,%p,%s),stub!\n", debugstr_ObjectAttributes(ObjectAttributes), Key,
+          debugstr_ObjectAttributes(ReplacedObjectAttributes) );
+    return STATUS_SUCCESS;
 }
 /******************************************************************************
  * NtRestoreKey [NTDLL.@]




More information about the wine-cvs mailing list