From c141c7741bb29ca0bef9baedbd50aa3ed56df50b Mon Sep 17 00:00:00 2001 From: wj32 Date: Thu, 7 Feb 2013 03:38:40 +0000 Subject: [PATCH] added PhQueryFullAttributesFileWin32 git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5282 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 2.x/trunk/phlib/include/ph.h | 6 ++++++ 2.x/trunk/phlib/iosup.c | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/2.x/trunk/phlib/include/ph.h b/2.x/trunk/phlib/include/ph.h index 578bb7afa..bad78ba5b 100644 --- a/2.x/trunk/phlib/include/ph.h +++ b/2.x/trunk/phlib/include/ph.h @@ -1375,6 +1375,12 @@ NTSTATUS PhCreateFileWin32Ex( __out_opt PULONG CreateStatus ); +PHLIBAPI +NTSTATUS PhQueryFullAttributesFileWin32( + __in PWSTR FileName, + __out PFILE_NETWORK_OPEN_INFORMATION FileInformation + ); + PHLIBAPI NTSTATUS PhDeleteFileWin32( __in PWSTR FileName diff --git a/2.x/trunk/phlib/iosup.c b/2.x/trunk/phlib/iosup.c index 6da514a9f..05b88cc50 100644 --- a/2.x/trunk/phlib/iosup.c +++ b/2.x/trunk/phlib/iosup.c @@ -189,6 +189,43 @@ NTSTATUS PhCreateFileWin32Ex( return status; } +/** + * Queries file attributes. + * + * \param FileName The Win32 file name. + * \param FileInformation A variable that receives the file information. + */ +NTSTATUS PhQueryFullAttributesFileWin32( + __in PWSTR FileName, + __out PFILE_NETWORK_OPEN_INFORMATION FileInformation + ) +{ + NTSTATUS status; + UNICODE_STRING fileName; + OBJECT_ATTRIBUTES oa; + + if (!RtlDosPathNameToNtPathName_U( + FileName, + &fileName, + NULL, + NULL + )) + return STATUS_OBJECT_NAME_NOT_FOUND; + + InitializeObjectAttributes( + &oa, + &fileName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL + ); + + status = NtQueryFullAttributesFile(&oa, FileInformation); + RtlFreeHeap(RtlProcessHeap(), 0, fileName.Buffer); + + return status; +} + /** * Deletes a file. *