[PATCH 1/6] include: Use public field names for FILE_RENAME_INFORMATION.
Zebediah Figura
z.figura12 at gmail.com
Thu Mar 5 19:03:20 CST 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
Perhaps it would also make sense to move this definition to ddk/ntifs.h?
dlls/ntdll/file.c | 4 +--
dlls/ntdll/tests/file.c | 68 ++++++++++++++++++++---------------------
include/winternl.h | 4 +--
3 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index fd83c724421..dc9a67fcffa 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2798,14 +2798,14 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
attr.Length = sizeof(attr);
attr.ObjectName = &name_str;
- attr.RootDirectory = info->RootDir;
+ attr.RootDirectory = info->RootDirectory;
attr.Attributes = OBJ_CASE_INSENSITIVE;
io->u.Status = nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF );
if (io->u.Status != STATUS_SUCCESS && io->u.Status != STATUS_NO_SUCH_FILE)
break;
- if (!info->Replace && io->u.Status == STATUS_SUCCESS)
+ if (!info->ReplaceIfExists && io->u.Status == STATUS_SUCCESS)
{
RtlFreeAnsiString( &unix_name );
io->u.Status = STATUS_OBJECT_NAME_COLLISION;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index dd188fd9132..561cf800433 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1502,8 +1502,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1540,8 +1540,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1570,8 +1570,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1603,8 +1603,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1637,8 +1637,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1672,8 +1672,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1719,8 +1719,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1759,8 +1759,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1795,8 +1795,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1829,8 +1829,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1865,8 +1865,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1902,8 +1902,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1938,8 +1938,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -1977,8 +1977,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2011,8 +2011,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = FALSE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2044,8 +2044,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
- fri->Replace = TRUE;
- fri->RootDir = NULL;
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str );
@@ -2079,8 +2079,8 @@ static void test_file_rename_information(void)
ok( handle2 != INVALID_HANDLE_VALUE, "CreateFileW failed\n" );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + lstrlenW(filename) * sizeof(WCHAR) );
- fri->Replace = FALSE;
- fri->RootDir = handle2;
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = handle2;
fri->FileNameLength = lstrlenW(filename) * sizeof(WCHAR);
memcpy( fri->FileName, filename, fri->FileNameLength );
diff --git a/include/winternl.h b/include/winternl.h
index 4c6e063338e..19e8965e99f 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -632,8 +632,8 @@ typedef struct _FILE_NAME_INFORMATION {
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
typedef struct _FILE_RENAME_INFORMATION {
- BOOLEAN Replace;
- HANDLE RootDir;
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
--
2.25.1
More information about the wine-devel
mailing list