Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
1f2a443c
Commit
1f2a443c
authored
Aug 21, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Aug 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Implement support for FileLinkInformation class in NtSetInformationFile.
parent
57d44382
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
28 deletions
+96
-28
file.c
dlls/ntdll/file.c
+44
-0
file.c
dlls/ntdll/tests/file.c
+22
-22
server_protocol.h
include/wine/server_protocol.h
+2
-2
fd.c
server/fd.c
+25
-4
protocol.def
server/protocol.def
+1
-0
request.h
server/request.h
+1
-0
trace.c
server/trace.c
+1
-0
No files found.
dlls/ntdll/file.c
View file @
1f2a443c
...
...
@@ -2813,6 +2813,50 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
rootdir
=
wine_server_obj_handle
(
attr
.
RootDirectory
);
req
->
link
=
FALSE
;
wine_server_add_data
(
req
,
unix_name
.
Buffer
,
unix_name
.
Length
);
io
->
u
.
Status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
RtlFreeAnsiString
(
&
unix_name
);
}
else
io
->
u
.
Status
=
STATUS_INVALID_PARAMETER_3
;
break
;
case
FileLinkInformation
:
if
(
len
>=
sizeof
(
FILE_LINK_INFORMATION
))
{
FILE_LINK_INFORMATION
*
info
=
ptr
;
UNICODE_STRING
name_str
;
OBJECT_ATTRIBUTES
attr
;
ANSI_STRING
unix_name
;
name_str
.
Buffer
=
info
->
FileName
;
name_str
.
Length
=
info
->
FileNameLength
;
name_str
.
MaximumLength
=
info
->
FileNameLength
+
sizeof
(
WCHAR
);
attr
.
Length
=
sizeof
(
attr
);
attr
.
ObjectName
=
&
name_str
;
attr
.
RootDirectory
=
info
->
RootDirectory
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
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
)
break
;
if
(
!
info
->
ReplaceIfExists
&&
io
->
u
.
Status
==
STATUS_SUCCESS
)
{
RtlFreeAnsiString
(
&
unix_name
);
io
->
u
.
Status
=
STATUS_OBJECT_NAME_COLLISION
;
break
;
}
SERVER_START_REQ
(
set_fd_name_info
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
rootdir
=
wine_server_obj_handle
(
attr
.
RootDirectory
);
req
->
link
=
TRUE
;
wine_server_add_data
(
req
,
unix_name
.
Buffer
,
unix_name
.
Length
);
io
->
u
.
Status
=
wine_server_call
(
req
);
}
...
...
dlls/ntdll/tests/file.c
View file @
1f2a443c
...
...
@@ -2113,12 +2113,12 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\n
"
,
res
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\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
;
todo_wine
ok
(
!
fileDeleted
,
"file should exist
\n
"
);
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
);
...
...
@@ -2152,7 +2152,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\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
;
...
...
@@ -2181,8 +2181,8 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\n
"
,
res
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\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
;
...
...
@@ -2215,7 +2215,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\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
;
...
...
@@ -2249,7 +2249,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_ACCESS_DENIED
,
"res expected STATUS_ACCESS_DENIED, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_ACCESS_DENIED
,
"res expected STATUS_ACCESS_DENIED, got %x
\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
;
...
...
@@ -2284,7 +2284,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2331,7 +2331,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2365,7 +2365,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
||
res
==
STATUS_FILE_IS_A_DIRECTORY
/* > Win XP */
,
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 %x
\n
"
,
res
);
fileDeleted
=
GetFileAttributesW
(
oldpath
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
;
ok
(
!
fileDeleted
,
"file should exist
\n
"
);
...
...
@@ -2402,7 +2402,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
||
res
==
STATUS_FILE_IS_A_DIRECTORY
/* > Win XP */
,
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 %x
\n
"
,
res
);
fileDeleted
=
GetFileAttributesW
(
oldpath
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
;
ok
(
!
fileDeleted
,
"file should exist
\n
"
);
...
...
@@ -2437,7 +2437,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2473,7 +2473,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2510,7 +2510,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
||
res
==
STATUS_FILE_IS_A_DIRECTORY
/* > Win XP */
,
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 %x
\n
"
,
res
);
fileDeleted
=
GetFileAttributesW
(
oldpath
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
;
ok
(
!
fileDeleted
,
"file should exist
\n
"
);
...
...
@@ -2547,7 +2547,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2586,7 +2586,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_FILE_IS_A_DIRECTORY
,
"res expected STATUS_FILE_IS_A_DIRECTORY, got %x
\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
;
...
...
@@ -2620,7 +2620,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_OBJECT_NAME_COLLISION
,
"res expected STATUS_OBJECT_NAME_COLLISION, got %x
\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
;
...
...
@@ -2653,7 +2653,7 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
0xdeadbeef
,
"io.Status expected 0xdeadbeef, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_ACCESS_DENIED
,
"res expected STATUS_ACCESS_DENIED, got %x
\n
"
,
res
);
ok
(
res
==
STATUS_ACCESS_DENIED
,
"res expected STATUS_ACCESS_DENIED, got %x
\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
;
...
...
@@ -2686,12 +2686,12 @@ static void test_file_link_information(void)
U
(
io
).
Status
=
0xdeadbeef
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
fli
,
sizeof
(
FILE_LINK_INFORMATION
)
+
fli
->
FileNameLength
,
FileLinkInformation
);
todo_wine
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
todo_wine
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\n
"
,
res
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"io.Status expected STATUS_SUCCESS, got %x
\n
"
,
U
(
io
).
Status
);
ok
(
res
==
STATUS_SUCCESS
,
"res expected STATUS_SUCCESS, got %x
\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
;
todo_wine
ok
(
!
fileDeleted
,
"file should exist
\n
"
);
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
);
...
...
include/wine/server_protocol.h
View file @
1f2a443c
...
...
@@ -5099,8 +5099,8 @@ struct set_fd_name_info_request
struct
request_header
__header
;
obj_handle_t
handle
;
obj_handle_t
rootdir
;
int
link
;
/* VARARG(filename,string); */
char
__pad_20
[
4
];
};
struct
set_fd_name_info_reply
{
...
...
@@ -6149,6 +6149,6 @@ union generic_reply
struct
terminate_job_reply
terminate_job_reply
;
};
#define SERVER_PROTOCOL_VERSION 48
6
#define SERVER_PROTOCOL_VERSION 48
7
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/fd.c
View file @
1f2a443c
...
...
@@ -2255,7 +2255,8 @@ static void set_fd_disposition( struct fd *fd, int unlink )
}
/* set new name for the fd */
static
void
set_fd_name
(
struct
fd
*
fd
,
struct
fd
*
root
,
const
char
*
nameptr
,
data_size_t
len
)
static
void
set_fd_name
(
struct
fd
*
fd
,
struct
fd
*
root
,
const
char
*
nameptr
,
data_size_t
len
,
int
create_link
)
{
struct
inode
*
inode
;
struct
stat
st
;
...
...
@@ -2287,6 +2288,14 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
name
=
combined_name
;
}
/* when creating a hard link, source cannot be a dir */
if
(
create_link
&&
fd
->
unix_fd
!=
-
1
&&
!
fstat
(
fd
->
unix_fd
,
&
st
)
&&
S_ISDIR
(
st
.
st_mode
))
{
set_error
(
STATUS_FILE_IS_A_DIRECTORY
);
goto
failed
;
}
if
(
!
stat
(
name
,
&
st
))
{
/* can't replace directories or special files */
...
...
@@ -2308,14 +2317,26 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
}
}
/* link() expects that the target doesn't exist */
/* rename() cannot replace files with directories */
if
(
fd
->
unix_fd
!=
-
1
&&
!
fstat
(
fd
->
unix_fd
,
&
st
)
&&
S_ISDIR
(
st
.
st_mode
)
&&
unlink
(
name
))
if
(
create_link
||
(
fd
->
unix_fd
!=
-
1
&&
!
fstat
(
fd
->
unix_fd
,
&
st
)
&&
S_ISDIR
(
st
.
st_mode
)))
{
if
(
unlink
(
name
))
{
file_set_error
();
goto
failed
;
}
}
}
if
(
create_link
)
{
if
(
link
(
fd
->
unix_name
,
name
))
file_set_error
();
free
(
name
);
return
;
}
if
(
rename
(
fd
->
unix_name
,
name
))
{
...
...
@@ -2556,7 +2577,7 @@ DECL_HANDLER(set_fd_name_info)
if
((
fd
=
get_handle_fd_obj
(
current
->
process
,
req
->
handle
,
0
)))
{
set_fd_name
(
fd
,
root_fd
,
get_req_data
(),
get_req_data_size
()
);
set_fd_name
(
fd
,
root_fd
,
get_req_data
(),
get_req_data_size
()
,
req
->
link
);
release_object
(
fd
);
}
if
(
root_fd
)
release_object
(
root_fd
);
...
...
server/protocol.def
View file @
1f2a443c
...
...
@@ -3536,6 +3536,7 @@ enum coords_relative
@REQ(set_fd_name_info)
obj_handle_t handle; /* handle to a file or directory */
obj_handle_t rootdir; /* root directory */
int link; /* link instead of renaming */
VARARG(filename,string); /* new file name */
@END
...
...
server/request.h
View file @
1f2a443c
...
...
@@ -2230,6 +2230,7 @@ C_ASSERT( FIELD_OFFSET(struct set_fd_disp_info_request, unlink) == 16 );
C_ASSERT
(
sizeof
(
struct
set_fd_disp_info_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_fd_name_info_request
,
handle
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_fd_name_info_request
,
rootdir
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_fd_name_info_request
,
link
)
==
20
);
C_ASSERT
(
sizeof
(
struct
set_fd_name_info_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_window_layered_info_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_window_layered_info_request
)
==
16
);
...
...
server/trace.c
View file @
1f2a443c
...
...
@@ -4146,6 +4146,7 @@ static void dump_set_fd_name_info_request( const struct set_fd_name_info_request
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
fprintf
(
stderr
,
", rootdir=%04x"
,
req
->
rootdir
);
fprintf
(
stderr
,
", link=%d"
,
req
->
link
);
dump_varargs_string
(
", filename="
,
cur_size
);
}
...
...
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