Commit 46187dd6 authored by Dan Kegel's avatar Dan Kegel Committed by Alexandre Julliard

ntdll: Fix NtQueryInformationFile test failures on Vista Home Basic.

parent fa12f039
...@@ -794,6 +794,7 @@ static void test_file_basic_information(void) ...@@ -794,6 +794,7 @@ static void test_file_basic_information(void)
FILE_BASIC_INFORMATION fbi; FILE_BASIC_INFORMATION fbi;
HANDLE h; HANDLE h;
int res; int res;
int attrib_mask = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NORMAL;
if (!(h = create_temp_file(0))) return; if (!(h = create_temp_file(0))) return;
...@@ -814,7 +815,7 @@ static void test_file_basic_information(void) ...@@ -814,7 +815,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n"); ok ( res == STATUS_SUCCESS, "can't get attributes\n");
todo_wine ok ( fbi.FileAttributes == FILE_ATTRIBUTE_SYSTEM, "attribute %x not FILE_ATTRIBUTE_SYSTEM\n", fbi.FileAttributes ); todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %x not FILE_ATTRIBUTE_SYSTEM\n", fbi.FileAttributes );
/* Then HIDDEN */ /* Then HIDDEN */
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
...@@ -825,7 +826,7 @@ static void test_file_basic_information(void) ...@@ -825,7 +826,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n"); ok ( res == STATUS_SUCCESS, "can't get attributes\n");
todo_wine ok ( fbi.FileAttributes == FILE_ATTRIBUTE_HIDDEN, "attribute %x not FILE_ATTRIBUTE_HIDDEN\n", fbi.FileAttributes ); todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %x not FILE_ATTRIBUTE_HIDDEN\n", fbi.FileAttributes );
/* Check NORMAL last of all (to make sure we can clear attributes) */ /* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
...@@ -836,7 +837,7 @@ static void test_file_basic_information(void) ...@@ -836,7 +837,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n"); ok ( res == STATUS_SUCCESS, "can't get attributes\n");
todo_wine ok ( fbi.FileAttributes == FILE_ATTRIBUTE_NORMAL, "attribute %x not FILE_ATTRIBUTE_NORMAL\n", fbi.FileAttributes ); todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_NORMAL, "attribute %x not 0\n", fbi.FileAttributes );
CloseHandle( h ); CloseHandle( h );
} }
...@@ -854,6 +855,7 @@ static void test_file_all_information(void) ...@@ -854,6 +855,7 @@ static void test_file_all_information(void)
} fai_buf; } fai_buf;
HANDLE h; HANDLE h;
int res; int res;
int attrib_mask = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NORMAL;
if (!(h = create_temp_file(0))) return; if (!(h = create_temp_file(0))) return;
...@@ -868,15 +870,14 @@ static void test_file_all_information(void) ...@@ -868,15 +870,14 @@ static void test_file_all_information(void)
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
fai_buf.fai.BasicInformation.FileAttributes = FILE_ATTRIBUTE_SYSTEM; fai_buf.fai.BasicInformation.FileAttributes = FILE_ATTRIBUTE_SYSTEM;
res = pNtSetInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); res = pNtSetInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
todo_wine ok ( res == STATUS_INVALID_INFO_CLASS || res == STATUS_NOT_IMPLEMENTED, "shouldn't be able to set FileAllInformation, res %x\n", res);
ok ( res == STATUS_INVALID_INFO_CLASS, "shouldn't be able to set FileAllInformation, res %x\n", res);
res = pNtSetInformationFile(h, &io, &fai_buf.fai.BasicInformation, sizeof fai_buf.fai.BasicInformation, FileBasicInformation); res = pNtSetInformationFile(h, &io, &fai_buf.fai.BasicInformation, sizeof fai_buf.fai.BasicInformation, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't set system attribute\n"); ok ( res == STATUS_SUCCESS, "can't set system attribute\n");
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res); ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res);
todo_wine ok ( fai_buf.fai.BasicInformation.FileAttributes == FILE_ATTRIBUTE_SYSTEM, "attribute %x not FILE_ATTRIBUTE_SYSTEM\n", fai_buf.fai.BasicInformation.FileAttributes ); todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %x not FILE_ATTRIBUTE_SYSTEM\n", fai_buf.fai.BasicInformation.FileAttributes );
/* Then HIDDEN */ /* Then HIDDEN */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
...@@ -887,7 +888,7 @@ static void test_file_all_information(void) ...@@ -887,7 +888,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n"); ok ( res == STATUS_SUCCESS, "can't get attributes\n");
todo_wine ok ( fai_buf.fai.BasicInformation.FileAttributes == FILE_ATTRIBUTE_HIDDEN, "attribute %x not FILE_ATTRIBUTE_HIDDEN\n", fai_buf.fai.BasicInformation.FileAttributes ); todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %x not FILE_ATTRIBUTE_HIDDEN\n", fai_buf.fai.BasicInformation.FileAttributes );
/* Check NORMAL last of all (to make sure we can clear attributes) */ /* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
...@@ -898,7 +899,7 @@ static void test_file_all_information(void) ...@@ -898,7 +899,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n"); ok ( res == STATUS_SUCCESS, "can't get attributes\n");
todo_wine ok ( fai_buf.fai.BasicInformation.FileAttributes == FILE_ATTRIBUTE_NORMAL, "attribute %x not FILE_ATTRIBUTE_NORMAL\n", fai_buf.fai.BasicInformation.FileAttributes ); todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_NORMAL, "attribute %x not FILE_ATTRIBUTE_NORMAL\n", fai_buf.fai.BasicInformation.FileAttributes );
CloseHandle( h ); CloseHandle( h );
} }
...@@ -914,8 +915,7 @@ static void test_file_both_information(void) ...@@ -914,8 +915,7 @@ static void test_file_both_information(void)
memset(&fbi, 0, sizeof(fbi)); memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBothDirectoryInformation); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBothDirectoryInformation);
todo_wine ok ( res == STATUS_INVALID_INFO_CLASS || res == STATUS_NOT_IMPLEMENTED, "shouldn't be able to query FileBothDirectoryInformation, res %x\n", res);
ok ( res == STATUS_INVALID_INFO_CLASS, "shouldn't be able to query FileBothDirectoryInformation, res %x\n", res);
CloseHandle( h ); CloseHandle( h );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment