ntdll: Don't trace potentially uninitialized structures if we are not going to use them.
Francois Gouget
fgouget at free.fr
Sun Sep 18 13:09:12 CDT 2011
---
In dlls/ntdll/tests/om.c we do:
OBJECT_ATTRIBUTES attr;
status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr);
This causes NtCreateDirectoryObject() to be called with an uninitialized
ObjectAttributes structure. However if tracing is turned on we will
dereference several pointers in that structure, although it would
normally not have been used at all. So I moved the tracing after we know
the structure will be used.
The drawback is that it means that if the directory handle is invalid
there will be no trace. I'm open to alternative solutions if that's an issue.
The same thing happens for NtOpenDirectoryObject().
dlls/ntdll/om.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index c103ddd..18da18d 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -404,10 +404,10 @@ NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Desir
POBJECT_ATTRIBUTES ObjectAttributes)
{
NTSTATUS ret;
- TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
+ TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
/* Have to test it here because server won't know difference between
* ObjectName == NULL and ObjectName == "" */
if (!ObjectAttributes->ObjectName)
@@ -452,9 +452,9 @@ NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Des
POBJECT_ATTRIBUTES ObjectAttributes)
{
NTSTATUS ret;
- TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
+ TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
SERVER_START_REQ(create_directory)
{
--
1.7.5.4
More information about the wine-patches
mailing list