[2/3] ntdll: Implement FileIdInformation class support in NtQueryInformationFile.

Jon Doron arilou at gmail.com
Sat Dec 31 08:10:17 CST 2016


I was referring to ntifs.h because this has to do with ntdll, do you
still want me to move it to winbase? this will probably cause
compilation errors
in the NTDLL part that implements the functionality

On Sat, Dec 31, 2016 at 4:04 PM, Nikolay Sivov <nsivov at codeweavers.com> wrote:
> On 31.12.2016 16:50, Jonathan Doron wrote:
>> Signed-off-by: Jonathan Doron <jond at wizery.com>
>> ---
>>  dlls/ntdll/file.c  | 19 ++++++++++++++++++-
>>  include/winternl.h |  9 +++++++++
>>  2 files changed, 27 insertions(+), 1 deletion(-)
>>
>> diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
>> index 6eddd19..fbadfbd 100644
>> --- a/dlls/ntdll/file.c
>> +++ b/dlls/ntdll/file.c
>> @@ -2379,7 +2379,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
>>          0,                                             /* FileRenameInformationBypassAccessCheck */
>>          0,                                             /* FileLinkInformationBypassAccessCheck */
>>          0,                                             /* FileVolumeNameInformation */
>> -        0,                                             /* FileIdInformation */
>> +        sizeof(FILE_ID_INFORMATION),                   /* FileIdInformation */
>>          0,                                             /* FileIdExtdDirectoryInformation */
>>          0,                                             /* FileReplaceCompletionInformation */
>>          0,                                             /* FileHardLinkFullIdInformation */
>> @@ -2621,6 +2621,23 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
>>              }
>>          }
>>          break;
>> +    case FileIdInformation:
>> +        {
>> +            struct statfs volstats;
>> +            FILE_ID_INFORMATION *info = ptr;
>> +            if ((fstat(fd, &st) == -1) || (fstatfs(fd, &volstats) == -1))
>> +            {
>> +                io->u.Status = FILE_GetNtStatus();
>> +            }
>> +            else
>> +            {
>> +                memset(info, 0, sizeof(*info));
>> +                ((PLARGE_INTEGER)&info->VolumeSerialNumber)->LowPart = (ULONG)volstats.f_fsid.__val[0];
>> +                ((PLARGE_INTEGER)&info->VolumeSerialNumber)->HighPart = (ULONG)volstats.f_fsid.__val[1];
>> +                ((PLARGE_INTEGER)&info->FileId)->QuadPart = st.st_ino;
>> +            }
>> +        }
>> +        break;
>>      default:
>>          FIXME("Unsupported class (%d)\n", class);
>>          io->u.Status = STATUS_NOT_IMPLEMENTED;
>> diff --git a/include/winternl.h b/include/winternl.h
>> index 891b6a7..2f2ea86 100644
>> --- a/include/winternl.h
>> +++ b/include/winternl.h
>> @@ -571,6 +571,15 @@ typedef struct _FILE_INTERNAL_INFORMATION {
>>      LARGE_INTEGER IndexNumber;
>>  } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
>>
>> +typedef struct _FILE_ID_128 {
>> +    UCHAR Identifier[16];
>> +} FILE_ID_128, *PFILE_ID_128;
> Windows SDK has it in winnt.h, using BYTE instead of UCHAR.
>
>> +
>> +typedef struct _FILE_ID_INFORMATION {
>> +    ULONGLONG VolumeSerialNumber;
>> +    FILE_ID_128 FileId;
>> +} FILE_ID_INFORMATION, *PFILE_ID_INFORMATION;
>> +
> This one should go to winbase.h, as FILE_ID_INFO.
>>  typedef struct _FILE_EA_INFORMATION {
>>      ULONG EaSize;
>>  } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
>
>



More information about the wine-devel mailing list