NtQueryAttributesFile

Hi all,

I’m trying to use the undocumented NtQueryAttributesFile() function in
NTDLL.DLL. I got the following prototype from this list:

NTSTATUS NTAPI NtQueryAttributesFile(
POBJECT_ATTRIBUTES ObjectAttributes,
PFILE_BASIC_INFORMATION Attributes
);

And in my code, I’m using it like this

OBJECT_ATTRIBUTES FileObject;
FILE_BASIC_INFORMATION fbi = {0, 0, 0, 0, 0};
//
// Initialize object attributes
//
ntStatus = NtQueryAttributesFile(&FileObject, &fbi);

If the file exists, it always returns STATUS_SUCCESS, but on most
systems, fails to retrieve any of the file times when the file is on a
NTFS volume. It always returns the correct file times when the file is
on FAT. More specifically, I have exactly one W2K (SP2) system where it
also works on files on NTFS volumes. But I have another W2K SP2 system
and a NT4 system where all the file times remain zero when the file is
on a NTFS volume.

So, is NtQueryAttributesFile, as the name implies, supposed to retrieve
a files attributes only, or “should” it also retrieve the file times?

Thanks!

Ralf.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com