Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4ad75758
Commit
4ad75758
authored
Apr 12, 2023
by
Torge Matthies
Committed by
Alexandre Julliard
May 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add test for file attributes of files with names beginning with a dot.
parent
2b7ba087
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
file.c
dlls/ntdll/tests/file.c
+92
-0
No files found.
dlls/ntdll/tests/file.c
View file @
4ad75758
...
...
@@ -4051,6 +4051,97 @@ static void test_file_attribute_tag_information(void)
CloseHandle
(
h
);
}
static
void
rename_file
(
HANDLE
h
,
const
WCHAR
*
filename
)
{
FILE_RENAME_INFORMATION
*
fri
;
UNICODE_STRING
ntpath
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
BOOLEAN
ret
;
ULONG
size
;
ret
=
pRtlDosPathNameToNtPathName_U
(
filename
,
&
ntpath
,
NULL
,
NULL
);
ok
(
ret
,
"RtlDosPathNameToNtPathName_U failed
\n
"
);
size
=
offsetof
(
FILE_RENAME_INFORMATION
,
FileName
)
+
ntpath
.
Length
;
fri
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ok
(
fri
!=
NULL
,
"HeapAlloc failed
\n
"
);
fri
->
ReplaceIfExists
=
TRUE
;
fri
->
RootDirectory
=
NULL
;
fri
->
FileNameLength
=
ntpath
.
Length
;
memcpy
(
fri
->
FileName
,
ntpath
.
Buffer
,
ntpath
.
Length
);
pRtlFreeUnicodeString
(
&
ntpath
);
status
=
pNtSetInformationFile
(
h
,
&
io
,
fri
,
size
,
FileRenameInformation
);
HeapFree
(
GetProcessHeap
(),
0
,
fri
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
}
static
void
test_dotfile_file_attributes
(
void
)
{
char
temppath
[
MAX_PATH
],
filename
[
MAX_PATH
];
WCHAR
temppathW
[
MAX_PATH
],
filenameW
[
MAX_PATH
];
FILE_BASIC_INFORMATION
info
=
{};
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
DWORD
attrs
;
HANDLE
h
;
GetTempPathA
(
MAX_PATH
,
temppath
);
GetTempFileNameA
(
temppath
,
".foo"
,
0
,
filename
);
h
=
CreateFileA
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
h
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
status
=
nt_get_file_attrs
(
filename
,
&
attrs
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
todo_wine
ok
(
!
(
attrs
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
attrs
);
status
=
pNtQueryInformationFile
(
h
,
&
io
,
&
info
,
sizeof
(
info
),
FileBasicInformation
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
!
(
info
.
FileAttributes
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
info
.
FileAttributes
);
info
.
FileAttributes
=
FILE_ATTRIBUTE_SYSTEM
;
status
=
pNtSetInformationFile
(
h
,
&
io
,
&
info
,
sizeof
(
info
),
FileBasicInformation
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
status
=
nt_get_file_attrs
(
filename
,
&
attrs
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
attrs
&
FILE_ATTRIBUTE_SYSTEM
,
"got attributes %#lx
\n
"
,
attrs
);
todo_wine
ok
(
!
(
attrs
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
attrs
);
status
=
pNtQueryInformationFile
(
h
,
&
io
,
&
info
,
sizeof
(
info
),
FileBasicInformation
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
info
.
FileAttributes
&
FILE_ATTRIBUTE_SYSTEM
,
"got attributes %#lx
\n
"
,
info
.
FileAttributes
);
ok
(
!
(
info
.
FileAttributes
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
info
.
FileAttributes
);
CloseHandle
(
h
);
GetTempPathW
(
MAX_PATH
,
temppathW
);
GetTempFileNameW
(
temppathW
,
L"foo"
,
0
,
filenameW
);
h
=
CreateFileW
(
filenameW
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
h
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
GetTempFileNameW
(
temppathW
,
L".foo"
,
0
,
filenameW
);
winetest_push_context
(
"foo -> .foo"
);
rename_file
(
h
,
filenameW
);
winetest_pop_context
();
status
=
pNtQueryInformationFile
(
h
,
&
io
,
&
info
,
sizeof
(
info
),
FileBasicInformation
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
!
(
info
.
FileAttributes
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
info
.
FileAttributes
);
GetTempFileNameW
(
temppathW
,
L"foo"
,
0
,
filenameW
);
winetest_push_context
(
".foo -> foo"
);
rename_file
(
h
,
filenameW
);
winetest_pop_context
();
status
=
pNtQueryInformationFile
(
h
,
&
io
,
&
info
,
sizeof
(
info
),
FileBasicInformation
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
!
(
info
.
FileAttributes
&
FILE_ATTRIBUTE_HIDDEN
),
"got attributes %#lx
\n
"
,
info
.
FileAttributes
);
CloseHandle
(
h
);
}
static
void
test_file_mode
(
void
)
{
UNICODE_STRING
file_name
,
pipe_dev_name
,
mountmgr_dev_name
,
mailslot_dev_name
;
...
...
@@ -5499,6 +5590,7 @@ START_TEST(file)
test_file_id_information
();
test_file_access_information
();
test_file_attribute_tag_information
();
test_dotfile_file_attributes
();
test_file_mode
();
test_file_readonly_access
();
test_query_volume_information_file
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment