From 6677565f34d19a55c3f17f4eef764f0dbc5d9b98 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 2 Dec 2009 17:33:28 +0100 Subject: [PATCH] ntdll: Don't report a file id for directory entries that are on a different device. --- dlls/ntdll/directory.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index de8d57cc0cb..b01519ee5a2 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -166,6 +166,7 @@ static const int is_case_sensitive = FALSE; UNICODE_STRING windows_dir = { 0, 0, NULL }; /* windows directory */ UNICODE_STRING system_dir = { 0, 0, NULL }; /* system directory */ +static struct file_identity curdir; static struct file_identity windir; static RTL_CRITICAL_SECTION dir_section; @@ -1025,6 +1026,7 @@ static union file_directory_info *append_entry( void *info_ptr, IO_STATUS_BLOCK io->u.Status = STATUS_BUFFER_OVERFLOW; } info = (union file_directory_info *)((char *)info_ptr + io->Information); + if (st.st_dev != curdir.dev) st.st_ino = 0; /* ignore inode if on a different device */ /* all the structures start with a FileDirectoryInformation layout */ fill_stat_info( &st, info, class ); info->dir.NextEntryOffset = total_len; @@ -1713,6 +1715,10 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, cwd = open( ".", O_RDONLY ); if (fchdir( fd ) != -1) { + struct stat st; + fstat( fd, &st ); + curdir.dev = st.st_dev; + curdir.ino = st.st_ino; #ifdef VFAT_IOCTL_READDIR_BOTH if ((read_directory_vfat( fd, io, buffer, length, single_entry, mask, restart_scan, info_class )) != -1) goto done;