include: Use public field names for FILE_RENAME_INFORMATION.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-05 20:47:12 -06:00 committed by Alexandre Julliard
parent d6305e1bdb
commit b2b4d1b0ec
3 changed files with 38 additions and 38 deletions

View File

@ -2771,14 +2771,14 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.ObjectName = &name_str; attr.ObjectName = &name_str;
attr.RootDirectory = info->RootDir; attr.RootDirectory = info->RootDirectory;
attr.Attributes = OBJ_CASE_INSENSITIVE; attr.Attributes = OBJ_CASE_INSENSITIVE;
io->u.Status = nt_to_unix_file_name_attr( &attr, &unix_name, FILE_OPEN_IF ); 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) if (io->u.Status != STATUS_SUCCESS && io->u.Status != STATUS_NO_SUCH_FILE)
break; break;
if (!info->Replace && io->u.Status == STATUS_SUCCESS) if (!info->ReplaceIfExists && io->u.Status == STATUS_SUCCESS)
{ {
RtlFreeAnsiString( &unix_name ); RtlFreeAnsiString( &unix_name );
io->u.Status = STATUS_OBJECT_NAME_COLLISION; io->u.Status = STATUS_OBJECT_NAME_COLLISION;

View File

@ -1502,8 +1502,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath ); DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1540,8 +1540,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" ); ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1570,8 +1570,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" ); ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1603,8 +1603,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1637,8 +1637,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1672,8 +1672,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath ); DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1719,8 +1719,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
DeleteFileW( newpath ); DeleteFileW( newpath );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1759,8 +1759,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" ); ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1795,8 +1795,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1829,8 +1829,8 @@ static void test_file_rename_information(void)
ok( res != 0, "failed to create temp file\n" ); ok( res != 0, "failed to create temp file\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1865,8 +1865,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1902,8 +1902,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" ); ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1938,8 +1938,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" ); ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -1977,8 +1977,8 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -2011,8 +2011,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" ); ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -2044,8 +2044,8 @@ static void test_file_rename_information(void)
ok( success != 0, "failed to create temp directory\n" ); ok( success != 0, "failed to create temp directory\n" );
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
fri->Replace = TRUE; fri->ReplaceIfExists = TRUE;
fri->RootDir = NULL; fri->RootDirectory = NULL;
fri->FileNameLength = name_str.Length; fri->FileNameLength = name_str.Length;
memcpy( fri->FileName, name_str.Buffer, name_str.Length ); memcpy( fri->FileName, name_str.Buffer, name_str.Length );
pRtlFreeUnicodeString( &name_str ); pRtlFreeUnicodeString( &name_str );
@ -2079,8 +2079,8 @@ static void test_file_rename_information(void)
ok( handle2 != INVALID_HANDLE_VALUE, "CreateFileW failed\n" ); ok( handle2 != INVALID_HANDLE_VALUE, "CreateFileW failed\n" );
fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + lstrlenW(filename) * sizeof(WCHAR) ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + lstrlenW(filename) * sizeof(WCHAR) );
fri->Replace = FALSE; fri->ReplaceIfExists = FALSE;
fri->RootDir = handle2; fri->RootDirectory = handle2;
fri->FileNameLength = lstrlenW(filename) * sizeof(WCHAR); fri->FileNameLength = lstrlenW(filename) * sizeof(WCHAR);
memcpy( fri->FileName, filename, fri->FileNameLength ); memcpy( fri->FileName, filename, fri->FileNameLength );

View File

@ -632,8 +632,8 @@ typedef struct _FILE_NAME_INFORMATION {
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
typedef struct _FILE_RENAME_INFORMATION { typedef struct _FILE_RENAME_INFORMATION {
BOOLEAN Replace; BOOLEAN ReplaceIfExists;
HANDLE RootDir; HANDLE RootDirectory;
ULONG FileNameLength; ULONG FileNameLength;
WCHAR FileName[1]; WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION; } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;