Added patch to implement DOS hidden/system file attributes.

This commit is contained in:
Erich E. Hoover
2014-08-20 19:22:07 -06:00
parent 2ae83d8d8e
commit fa92b283ed
28 changed files with 1388 additions and 226 deletions

View File

@@ -1,4 +1,4 @@
From 4d377524363a3e33e2df29c38fe16542b6cd0aa1 Mon Sep 17 00:00:00 2001
From 3ef7e99e837ddc153bc3f608c9e33b4ec4f47d5b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:56:49 -0700
Subject: ntdll: Add support for junction point creation.
@@ -11,7 +11,7 @@ Subject: ntdll: Add support for junction point creation.
create mode 100644 include/ntifs.h
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index d2efcc1..7164d1e 100644
index 91f96ee..f56facd 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -89,12 +89,14 @@
@@ -29,7 +29,7 @@ index d2efcc1..7164d1e 100644
#define SECSPERDAY 86400
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
@@ -1470,6 +1472,76 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
@@ -1576,6 +1578,76 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE handle, HANDLE event,
}
@@ -106,7 +106,7 @@ index d2efcc1..7164d1e 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1617,6 +1689,23 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1723,6 +1795,23 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
}
break;
}
@@ -131,7 +131,7 @@ index d2efcc1..7164d1e 100644
case FSCTL_PIPE_WAIT:
default:
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 695f034..127681a 100644
index 7a8e5d4..333ea44 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -37,6 +37,7 @@
@@ -142,7 +142,7 @@ index 695f034..127681a 100644
#ifndef IO_COMPLETION_ALL_ACCESS
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
@@ -2672,6 +2673,98 @@ todo_wine
@@ -2683,6 +2684,98 @@ todo_wine
CloseHandle(hfile);
}
@@ -241,7 +241,7 @@ index 695f034..127681a 100644
START_TEST(file)
{
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
@@ -2725,4 +2818,5 @@ START_TEST(file)
@@ -2736,4 +2829,5 @@ START_TEST(file)
test_file_disposition_information();
test_query_volume_information_file();
test_query_attribute_information_file();

View File

@@ -1,4 +1,4 @@
From c191da3e2cf2136800fbf0658ced3a3534280806 Mon Sep 17 00:00:00 2001
From 3870b0d2c6309e4aa93922d8af21ae32ddcf5652 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:57:57 -0700
Subject: ntdll: Add support for reading junction points.
@@ -9,10 +9,10 @@ Subject: ntdll: Add support for reading junction points.
2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 7164d1e..56e0ef6 100644
index f56facd..b02fe76 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1542,6 +1542,60 @@ cleanup:
@@ -1648,6 +1648,60 @@ cleanup:
}
@@ -73,7 +73,7 @@ index 7164d1e..56e0ef6 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1690,6 +1744,15 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1796,6 +1850,15 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
break;
}
@@ -90,10 +90,10 @@ index 7164d1e..56e0ef6 100644
{
REPARSE_DATA_BUFFER *buffer = (REPARSE_DATA_BUFFER *)in_buffer;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 127681a..595276a 100644
index 333ea44..a109376 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2702,9 +2702,10 @@ static void test_junction_points(void)
@@ -2713,9 +2713,10 @@ static void test_junction_points(void)
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
DWORD dwret, dwLen, dwFlags;
@@ -105,7 +105,7 @@ index 127681a..595276a 100644
BOOL bret;
/* Create a temporary folder for the junction point tests */
@@ -2752,6 +2753,17 @@ static void test_junction_points(void)
@@ -2763,6 +2764,17 @@ static void test_junction_points(void)
buffer_len = build_reparse_buffer(nameW.Buffer, &buffer);
bret = DeviceIoControl(hJunction, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
ok(bret, "Failed to create junction point! (0x%x)\n", GetLastError());

View File

@@ -1,4 +1,4 @@
From 9a592e9dd065355f785e997fb72ee5a586665dc0 Mon Sep 17 00:00:00 2001
From 87bd79756bb80f37751ea79a449e70bad0a08465 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:00:21 -0700
Subject: ntdll: Add support for deleting junction points.
@@ -10,10 +10,10 @@ Subject: ntdll: Add support for deleting junction points.
3 files changed, 85 insertions(+)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 56e0ef6..396bdf9 100644
index b02fe76..682e2e8 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1596,6 +1596,41 @@ cleanup:
@@ -1702,6 +1702,41 @@ cleanup:
}
@@ -55,7 +55,7 @@ index 56e0ef6..396bdf9 100644
/**************************************************************************
* NtFsControlFile [NTDLL.@]
* ZwFsControlFile [NTDLL.@]
@@ -1744,6 +1779,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
@@ -1850,6 +1885,22 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
break;
}
@@ -79,10 +79,10 @@ index 56e0ef6..396bdf9 100644
{
REPARSE_DATA_BUFFER *buffer = (REPARSE_DATA_BUFFER *)out_buffer;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 595276a..d3c6cf0 100644
index a109376..cc241c8 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2697,12 +2697,15 @@ static void test_junction_points(void)
@@ -2708,12 +2708,15 @@ static void test_junction_points(void)
static const WCHAR junctionW[] = {'\\','j','u','n','c','t','i','o','n',0};
WCHAR path[MAX_PATH], junction_path[MAX_PATH], target_path[MAX_PATH];
static const WCHAR targetW[] = {'\\','t','a','r','g','e','t',0};
@@ -98,7 +98,7 @@ index 595276a..d3c6cf0 100644
UNICODE_STRING nameW;
HANDLE hJunction;
WCHAR *dest;
@@ -2750,6 +2753,8 @@ static void test_junction_points(void)
@@ -2761,6 +2764,8 @@ static void test_junction_points(void)
win_skip("Failed to open junction point directory handle (0x%x).\n", GetLastError());
goto cleanup;
}
@@ -107,7 +107,7 @@ index 595276a..d3c6cf0 100644
buffer_len = build_reparse_buffer(nameW.Buffer, &buffer);
bret = DeviceIoControl(hJunction, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
ok(bret, "Failed to create junction point! (0x%x)\n", GetLastError());
@@ -2764,6 +2769,24 @@ static void test_junction_points(void)
@@ -2775,6 +2780,24 @@ static void test_junction_points(void)
ok(bret, "Failed to read junction point!\n");
ok((memcmp(dest, nameW.Buffer, string_len) == 0), "Junction point destination does not match ('%s' != '%s')!\n",
wine_dbgstr_w(dest), wine_dbgstr_w(nameW.Buffer));

View File

@@ -1,46 +1,51 @@
From f35e4dc0c96de3e9fbeb4ff1bdefc9db7c7d56d8 Mon Sep 17 00:00:00 2001
From 624df21e36009121bf5d7ecab86fb0ace8ca15d7 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:01:25 -0700
Subject: ntdll: Advertise that a file is a junction point.
---
dlls/ntdll/file.c | 7 ++++++-
dlls/ntdll/file.c | 7 +++++--
dlls/ntdll/tests/file.c | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 396bdf9..b4e06d1 100644
index 682e2e8..3230d95 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1988,10 +1988,11 @@ NTSTATUS fill_stat_info( const struct stat *st, void *ptr, FILE_INFORMATION_CLAS
@@ -182,8 +182,8 @@ int get_file_info( const char *path, struct stat *st, ULONG *xattr )
if (S_ISLNK( st->st_mode ))
{
ret = stat( path, st );
+ st->st_mode |= S_IFLNK;
if (ret == -1) return ret;
- if (S_ISDIR( st->st_mode )) *xattr |= FILE_ATTRIBUTE_REPARSE_POINT;
}
len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
if (len == -1) return ret;
@@ -2088,7 +2088,7 @@ static inline ULONG get_file_attributes( const ULONG xattr, const struct stat *s
{
ULONG attr;
get_file_times( st, &info->LastWriteTime, &info->ChangeTime,
&info->LastAccessTime, &info->CreationTime );
- if (S_ISDIR(st->st_mode)) info->FileAttributes = FILE_ATTRIBUTE_DIRECTORY;
+ if (st->st_mode & S_IFDIR) info->FileAttributes = FILE_ATTRIBUTE_DIRECTORY;
else info->FileAttributes = FILE_ATTRIBUTE_ARCHIVE;
if (!(st->st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+ if ((st->st_mode & S_IFLNK) == S_IFLNK) info->FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
}
break;
case FileStandardInformation:
@@ -2657,6 +2658,10 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC
status = STATUS_INVALID_INFO_CLASS;
else
{
+ struct stat lst;
- if (S_ISDIR(st->st_mode))
+ if (st->st_mode & S_IFDIR)
attr = FILE_ATTRIBUTE_DIRECTORY;
else
attr = FILE_ATTRIBUTE_ARCHIVE;
@@ -2098,6 +2098,9 @@ static inline ULONG get_file_attributes( const ULONG xattr, const struct stat *s
if (!(st->st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
attr |= FILE_ATTRIBUTE_READONLY;
+
+ if (lstat( unix_name.Buffer, &lst ) != -1)
+ st.st_mode |= (lst.st_mode & S_IFLNK);
status = fill_stat_info( &st, info, FileBasicInformation );
if (DIR_is_hidden_file( attr->ObjectName ))
info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
+ if (st->st_mode & S_IFLNK)
+ attr |= FILE_ATTRIBUTE_REPARSE_POINT;
return attr;
}
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index d3c6cf0..c75ba47 100644
index cc241c8..3f1973c 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2759,6 +2759,11 @@ static void test_junction_points(void)
@@ -2770,6 +2770,11 @@ static void test_junction_points(void)
bret = DeviceIoControl(hJunction, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
ok(bret, "Failed to create junction point! (0x%x)\n", GetLastError());

View File

@@ -1,4 +1,4 @@
From e6a876330230784a2b2be6588b94e5555de169da Mon Sep 17 00:00:00 2001
From e5c5d522bdf363ef1b07e7d18e73ddc2f7ff9305 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: kernel32,ntdll: Add support for deleting junction points with
@@ -47,10 +47,10 @@ index 09fb04b..c328cc0 100644
NtClose( handle );
return ret;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index c75ba47..f94a61c 100644
index 3f1973c..be6898b 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2703,7 +2703,7 @@ static void test_junction_points(void)
@@ -2714,7 +2714,7 @@ static void test_junction_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@@ -59,7 +59,7 @@ index c75ba47..f94a61c 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -2794,6 +2794,38 @@ static void test_junction_points(void)
@@ -2805,6 +2805,38 @@ static void test_junction_points(void)
new_attrib.LastAccessTime.QuadPart, old_attrib.LastAccessTime.QuadPart);
CloseHandle(hJunction);

View File

@@ -1,4 +1,4 @@
From 18631ce985f75851cd6f00eb8ff03aa7d3e852ec Mon Sep 17 00:00:00 2001
From 38d297f6be2c232433e9093ecbfcc45b2de715d2 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:03:47 -0700
Subject: kernel32: Advertise junction point support.
@@ -23,7 +23,7 @@ index d396764..0fb0aef 100644
}
ret = TRUE;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index acc9197..3112081 100644
index be6898b..57e7fc1 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2799,10 +2799,9 @@ static void test_junction_points(void)

View File

@@ -1,4 +1,4 @@
From f70c0d8ae00629148df5e16efb30960704b8bbf8 Mon Sep 17 00:00:00 2001
From 1a343f1a7d57ed717c07026091bca8efe47a8fd6 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:06:24 -0700
Subject: ntdll/tests: Add test for deleting junction point target.
@@ -8,10 +8,10 @@ Subject: ntdll/tests: Add test for deleting junction point target.
1 file changed, 11 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index f94a61c..ffb9ff2 100644
index 57e7fc1..0feda4a 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2826,6 +2826,17 @@ static void test_junction_points(void)
@@ -2836,6 +2836,17 @@ static void test_junction_points(void)
ok(dwret != (DWORD)~0, "Junction point doesn't exist (attributes: 0x%x)!\n", dwret);
ok(dwret & FILE_ATTRIBUTE_REPARSE_POINT, "File is not a junction point! (attributes: 0x%x)\n", dwret);