From: Joel Holdsworth joel@airwebreathe.org.uk
Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk --- dlls/ntdll/tests/file.c | 167 ++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 83 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index e70bbc32be4..b3b7f79f51e 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1512,7 +1512,7 @@ static void delete_object( WCHAR *path ) } }
-static void test_file_rename_information(void) +static void test_file_rename_information(FILE_INFORMATION_CLASS class) { static const WCHAR foo_txtW[] = {'\','f','o','o','.','t','x','t',0}; static const WCHAR fooW[] = {'f','o','o',0}; @@ -1538,27 +1538,27 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( !fileDeleted, "file should exist\n" );
fni = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR) ); res = pNtQueryInformationFile( handle, &io, fni, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR), FileNameInformation ); ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fni->FileName[ fni->FileNameLength / sizeof(WCHAR) ] = 0; - ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", - wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); + todo_wine_if( class == FileRenameInformationEx ) ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", + wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); HeapFree( GetProcessHeap(), 0, fni );
CloseHandle( handle ); @@ -1576,16 +1576,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1606,18 +1606,18 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" );
@@ -1639,16 +1639,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1673,16 +1673,16 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1708,27 +1708,27 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( !fileDeleted, "file should exist\n" );
fni = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR) ); res = pNtQueryInformationFile( handle, &io, fni, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR), FileNameInformation ); ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fni->FileName[ fni->FileNameLength / sizeof(WCHAR) ] = 0; - ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", - wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); + todo_wine_if( class == FileRenameInformationEx ) ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", + wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); HeapFree( GetProcessHeap(), 0, fni );
CloseHandle( handle ); @@ -1755,20 +1755,20 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); todo_wine ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - todo_wine ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class != FileRenameInformationEx ) ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - todo_wine ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class != FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" );
CloseHandle( handle ); CloseHandle( handle2 ); @@ -1795,16 +1795,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1831,16 +1831,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1865,18 +1865,18 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" );
@@ -1901,16 +1901,16 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1938,16 +1938,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_OBJECT_NAME_COLLISION, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -1974,16 +1974,16 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2013,16 +2013,16 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); - ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == 0xdeadbeef || io.Status == STATUS_ACCESS_DENIED, "io.Status got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2047,16 +2047,16 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_OBJECT_NAME_COLLISION, "res expected STATUS_OBJECT_NAME_COLLISION, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2080,16 +2080,16 @@ 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->ReplaceIfExists = TRUE; + fri->Flags = FILE_RENAME_REPLACE_IF_EXISTS; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2115,26 +2115,26 @@ 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->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = handle2; fri->FileNameLength = lstrlenW(filename) * sizeof(WCHAR); memcpy( fri->FileName, filename, fri->FileNameLength );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( fileDeleted, "file should not exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class == FileRenameInformationEx ) ok( !fileDeleted, "file should exist\n" );
fni = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR) ); res = pNtQueryInformationFile( handle, &io, fni, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR), FileNameInformation ); ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fni->FileName[ fni->FileNameLength / sizeof(WCHAR) ] = 0; - ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", - wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); + todo_wine_if( class == FileRenameInformationEx ) ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n", + wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) ); HeapFree( GetProcessHeap(), 0, fni );
CloseHandle( handle ); @@ -2151,16 +2151,16 @@ static void test_file_rename_information(void)
pRtlDosPathNameToNtPathName_U( oldpath, &name_str, NULL, NULL ); fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); - fri->ReplaceIfExists = FALSE; + fri->Flags = 0; fri->RootDirectory = NULL; fri->FileNameLength = name_str.Length; memcpy( fri->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - ok( io.Status == STATUS_SUCCESS, "got io status %#lx\n", io.Status ); - ok( res == STATUS_SUCCESS, "got status %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, class ); + todo_wine_if( class == FileRenameInformationEx ) ok( io.Status == STATUS_SUCCESS, "got io status %#lx\n", io.Status ); + todo_wine_if( class == FileRenameInformationEx ) ok( res == STATUS_SUCCESS, "got status %lx\n", res ); ok( GetFileAttributesW( oldpath ) != INVALID_FILE_ATTRIBUTES, "file should exist\n" );
CloseHandle( handle ); @@ -5677,7 +5677,8 @@ START_TEST(file) test_file_name_information(); test_file_full_size_information(); test_file_all_name_information(); - test_file_rename_information(); + test_file_rename_information(FileRenameInformation); + test_file_rename_information(FileRenameInformationEx); test_file_link_information(); test_file_disposition_information(); test_file_completion_information();