From: Joel Holdsworth joel@airwebreathe.org.uk
Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk --- dlls/ntdll/tests/file.c | 233 +++++++++++++++++++++++----------------- 1 file changed, 136 insertions(+), 97 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index fdb69d5f65a..2344121f856 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2201,7 +2201,7 @@ static void test_file_rename_information(FILE_INFORMATION_CLASS class) delete_object( oldpath ); }
-static void test_file_link_information(void) +static void test_file_link_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}; @@ -2228,20 +2228,23 @@ static void test_file_link_information(void) pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); DeleteFileW( newpath ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + 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 exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class == FileLinkInformationEx ) + 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 ); @@ -2266,16 +2269,17 @@ static void test_file_link_information(void) ok( res != 0, "failed to create temp file\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->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 == FileLinkInformationEx ) + 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; @@ -2296,16 +2300,18 @@ static void test_file_link_information(void) ok( res != 0, "failed to create temp file\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + 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 exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2327,16 +2333,18 @@ static void test_file_link_information(void) wcsrchr( newpath, '\' )[1] = 'F'; pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + 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 exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2369,16 +2377,17 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->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 == FileLinkInformationEx ) + 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; @@ -2403,16 +2412,17 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->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 == FileLinkInformationEx ) + 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; @@ -2438,17 +2448,19 @@ static void test_file_link_information(void) pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); DeleteFileW( newpath ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY , - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY , + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2486,17 +2498,19 @@ static void test_file_link_information(void) pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); DeleteFileW( newpath ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2521,18 +2535,20 @@ static void test_file_link_information(void) ok( res != 0, "failed to create temp file\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, - "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, + "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2559,18 +2575,20 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, - "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, + "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2595,17 +2613,19 @@ static void test_file_link_information(void) ok( res != 0, "failed to create temp file\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2632,17 +2652,19 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2670,18 +2692,20 @@ static void test_file_link_information(void) ok( success != 0, "failed to create temp directory\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, - "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_OBJECT_NAME_COLLISION || res == STATUS_FILE_IS_A_DIRECTORY /* > Win XP */, + "res expected STATUS_OBJECT_NAME_COLLISION or STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2708,17 +2732,19 @@ static void test_file_link_information(void) ok( success != 0, "failed to create temp directory\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2748,17 +2774,19 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, - "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); - ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, got %lx\n", res ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == 0xdeadbeef || io.Status == STATUS_FILE_IS_A_DIRECTORY, + "io.Status expected 0xdeadbeef or STATUS_FILE_IS_A_DIRECTORY, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_FILE_IS_A_DIRECTORY, "res expected STATUS_FILE_IS_A_DIRECTORY, 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; @@ -2783,16 +2811,17 @@ static void test_file_link_information(void) ok( success != 0, "failed to create temp directory\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->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 == FileLinkInformationEx ) + 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; @@ -2816,16 +2845,17 @@ static void test_file_link_information(void) ok( success != 0, "failed to create temp directory\n" ); pRtlDosPathNameToNtPathName_U( newpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->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 == FileLinkInformationEx ) + 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; @@ -2851,19 +2881,21 @@ static void test_file_link_information(void) ok( handle2 != INVALID_HANDLE_VALUE, "CreateFileW failed\n" );
fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_LINK_INFORMATION) + lstrlenW(filename) * sizeof(WCHAR) ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = handle2; fli->FileNameLength = lstrlenW(filename) * sizeof(WCHAR); memcpy( fli->FileName, filename, fli->FileNameLength );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + 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 exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "file should exist\n" ); + todo_wine_if( class == FileLinkInformationEx ) 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 ); @@ -2887,22 +2919,25 @@ static void test_file_link_information(void)
pRtlDosPathNameToNtPathName_U( oldpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "got io status %#lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "got status %lx\n", res ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_OBJECT_NAME_COLLISION, "got status %lx\n", res );
- fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "got io status %#lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_SUCCESS, "got status %lx\n", res ); ok( GetFileAttributesW( oldpath ) != INVALID_FILE_ATTRIBUTES, "file should exist\n" );
CloseHandle( handle ); @@ -2918,22 +2953,25 @@ static void test_file_link_information(void) wcsrchr( oldpath, '\' )[1] = 'F'; pRtlDosPathNameToNtPathName_U( oldpath, &name_str, NULL, NULL ); fli = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length ); - fli->ReplaceIfExists = FALSE; + fli->Flags = 0; fli->RootDirectory = NULL; fli->FileNameLength = name_str.Length; memcpy( fli->FileName, name_str.Buffer, name_str.Length ); pRtlFreeUnicodeString( &name_str );
io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); + res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); todo_wine ok( io.Status == 0xdeadbeef, "got io status %#lx\n", io.Status ); - ok( res == STATUS_OBJECT_NAME_COLLISION, "got status %lx\n", res ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_OBJECT_NAME_COLLISION, "got status %lx\n", res );
- fli->ReplaceIfExists = TRUE; + fli->Flags = FILE_LINK_REPLACE_IF_EXISTS; io.Status = 0xdeadbeef; - res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformation ); - 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, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, class ); + todo_wine_if( class == FileLinkInformationEx ) + ok( io.Status == STATUS_SUCCESS, "got io status %#lx\n", io.Status ); + todo_wine_if( class == FileLinkInformationEx ) + ok( res == STATUS_SUCCESS, "got status %lx\n", res ); ok( GetFileAttributesW( oldpath ) != INVALID_FILE_ATTRIBUTES, "file should exist\n" );
CloseHandle( handle ); @@ -5712,7 +5750,8 @@ START_TEST(file) test_file_all_name_information(); test_file_rename_information(FileRenameInformation); test_file_rename_information(FileRenameInformationEx); - test_file_link_information(); + test_file_link_information(FileLinkInformation); + test_file_link_information(FileLinkInformationEx); test_file_disposition_information(); test_file_completion_information(); test_file_id_information();