From 346ac55cfa3a3cdf710b532f341a7d32084e8436 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Mon, 25 Aug 2008 00:45:11 +0200 Subject: [PATCH] Add TRACEs to NtCreateFile returns. Similar to NtReadFile and NtWriteFile, NtCreateFile should trace return values on request. Providing the file handle allows to map read/write requests to the corresponding file name. Rob Shearman wrote regarding first try: > the status values are in include/ntstatus.h and are in > hexadecimal format and so the TRACE format should match this. Done. Used lowercase letters to match other TRACEs instead of uppercase to match ntstatus.h > the common format for dumping return values is, for example, > "trace:ntdll:NtReadFile -- 0xc0000005" or > "trace:ntdll:NtReadFile returning 0xc0000005" not > "trace:ntdll:NtReadFile = 0xc0000005". Done. --- dlls/ntdll/file.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index d7f5b93..21f028a 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -151,13 +151,18 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB attr->RootDirectory, attr->SecurityDescriptor, io, alloc_size, attributes, sharing, disposition, options, ea_buffer, ea_length ); - if (!attr || !attr->ObjectName) return STATUS_INVALID_PARAMETER; + if (!attr || !attr->ObjectName) + { + TRACE("returning STATUS_INVALID_PARAMETER\n"); + return STATUS_INVALID_PARAMETER; + } if (alloc_size) FIXME( "alloc_size not supported\n" ); if (attr->RootDirectory) { FIXME( "RootDirectory %p not supported\n", attr->RootDirectory ); + TRACE("returning STATUS_OBJECT_NAME_NOT_FOUND\n"); return STATUS_OBJECT_NAME_NOT_FOUND; } @@ -178,7 +183,13 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB *handle = reply->handle; } SERVER_END_REQ; - if (io->u.Status == STATUS_SUCCESS) io->Information = FILE_OPENED; + if (io->u.Status == STATUS_SUCCESS) + { + io->Information = FILE_OPENED; + TRACE("returning STATUS_SUCCESS, handle %p\n", *handle); + } + else + TRACE("returning 0x%08x\n", io->u.Status); return io->u.Status; } @@ -203,6 +214,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB if (io->u.Status != STATUS_SUCCESS) { RtlFreeAnsiString( &unix_name ); + TRACE("returning 0x%08x\n", io->u.Status); return io->u.Status; } } @@ -247,7 +259,10 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB io->Information = FILE_OVERWRITTEN; break; } + TRACE("returning STATUS_SUCCESS, handle %p\n", *handle); } + else + TRACE("returning 0x%08x\n", io->u.Status); return io->u.Status; } -- 1.5.6.3