Commit 9e255ba4 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Pass the NT name in the set_fd_name_info request.

parent 76b32843
...@@ -4387,8 +4387,10 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, ...@@ -4387,8 +4387,10 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
{ {
req->handle = wine_server_obj_handle( handle ); req->handle = wine_server_obj_handle( handle );
req->rootdir = wine_server_obj_handle( attr.RootDirectory ); req->rootdir = wine_server_obj_handle( attr.RootDirectory );
req->namelen = nt_name.Length;
req->link = FALSE; req->link = FALSE;
req->replace = info->ReplaceIfExists; req->replace = info->ReplaceIfExists;
wine_server_add_data( req, nt_name.Buffer, nt_name.Length );
wine_server_add_data( req, unix_name, strlen(unix_name) ); wine_server_add_data( req, unix_name, strlen(unix_name) );
io->u.Status = wine_server_call( req ); io->u.Status = wine_server_call( req );
} }
...@@ -4425,8 +4427,10 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, ...@@ -4425,8 +4427,10 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
{ {
req->handle = wine_server_obj_handle( handle ); req->handle = wine_server_obj_handle( handle );
req->rootdir = wine_server_obj_handle( attr.RootDirectory ); req->rootdir = wine_server_obj_handle( attr.RootDirectory );
req->namelen = nt_name.Length;
req->link = TRUE; req->link = TRUE;
req->replace = info->ReplaceIfExists; req->replace = info->ReplaceIfExists;
wine_server_add_data( req, nt_name.Buffer, nt_name.Length );
wine_server_add_data( req, unix_name, strlen(unix_name) ); wine_server_add_data( req, unix_name, strlen(unix_name) );
io->u.Status = wine_server_call( req ); io->u.Status = wine_server_call( req );
} }
......
...@@ -5130,10 +5130,11 @@ struct set_fd_name_info_request ...@@ -5130,10 +5130,11 @@ struct set_fd_name_info_request
struct request_header __header; struct request_header __header;
obj_handle_t handle; obj_handle_t handle;
obj_handle_t rootdir; obj_handle_t rootdir;
data_size_t namelen;
int link; int link;
int replace; int replace;
/* VARARG(name,unicode_str,namelen); */
/* VARARG(filename,string); */ /* VARARG(filename,string); */
char __pad_28[4];
}; };
struct set_fd_name_info_reply struct set_fd_name_info_reply
{ {
...@@ -6279,7 +6280,7 @@ union generic_reply ...@@ -6279,7 +6280,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 670 #define SERVER_PROTOCOL_VERSION 671
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -2825,6 +2825,12 @@ DECL_HANDLER(set_fd_name_info) ...@@ -2825,6 +2825,12 @@ DECL_HANDLER(set_fd_name_info)
{ {
struct fd *fd, *root_fd = NULL; struct fd *fd, *root_fd = NULL;
if (req->namelen > get_req_data_size())
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
if (req->rootdir) if (req->rootdir)
{ {
struct dir *root; struct dir *root;
...@@ -2837,7 +2843,8 @@ DECL_HANDLER(set_fd_name_info) ...@@ -2837,7 +2843,8 @@ DECL_HANDLER(set_fd_name_info)
if ((fd = get_handle_fd_obj( current->process, req->handle, 0 ))) if ((fd = get_handle_fd_obj( current->process, req->handle, 0 )))
{ {
set_fd_name( fd, root_fd, get_req_data(), get_req_data_size(), req->link, req->replace ); set_fd_name( fd, root_fd, (const char *)get_req_data() + req->namelen,
get_req_data_size() - req->namelen, req->link, req->replace );
release_object( fd ); release_object( fd );
} }
if (root_fd) release_object( root_fd ); if (root_fd) release_object( root_fd );
......
...@@ -3542,8 +3542,10 @@ struct handle_info ...@@ -3542,8 +3542,10 @@ struct handle_info
@REQ(set_fd_name_info) @REQ(set_fd_name_info)
obj_handle_t handle; /* handle to a file or directory */ obj_handle_t handle; /* handle to a file or directory */
obj_handle_t rootdir; /* root directory */ obj_handle_t rootdir; /* root directory */
data_size_t namelen; /* length of NT name in bytes */
int link; /* link instead of renaming */ int link; /* link instead of renaming */
int replace; /* replace an existing file? */ int replace; /* replace an existing file? */
VARARG(name,unicode_str,namelen); /* NT name */
VARARG(filename,string); /* new file name */ VARARG(filename,string); /* new file name */
@END @END
......
...@@ -2173,8 +2173,9 @@ C_ASSERT( FIELD_OFFSET(struct set_fd_disp_info_request, unlink) == 16 ); ...@@ -2173,8 +2173,9 @@ C_ASSERT( FIELD_OFFSET(struct set_fd_disp_info_request, unlink) == 16 );
C_ASSERT( sizeof(struct set_fd_disp_info_request) == 24 ); 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, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_fd_name_info_request, rootdir) == 16 ); 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( FIELD_OFFSET(struct set_fd_name_info_request, namelen) == 20 );
C_ASSERT( FIELD_OFFSET(struct set_fd_name_info_request, replace) == 24 ); C_ASSERT( FIELD_OFFSET(struct set_fd_name_info_request, link) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_fd_name_info_request, replace) == 28 );
C_ASSERT( sizeof(struct set_fd_name_info_request) == 32 ); C_ASSERT( sizeof(struct set_fd_name_info_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct get_window_layered_info_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_window_layered_info_request, handle) == 12 );
C_ASSERT( sizeof(struct get_window_layered_info_request) == 16 ); C_ASSERT( sizeof(struct get_window_layered_info_request) == 16 );
......
...@@ -4292,8 +4292,10 @@ static void dump_set_fd_name_info_request( const struct set_fd_name_info_request ...@@ -4292,8 +4292,10 @@ static void dump_set_fd_name_info_request( const struct set_fd_name_info_request
{ {
fprintf( stderr, " handle=%04x", req->handle ); fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", rootdir=%04x", req->rootdir ); fprintf( stderr, ", rootdir=%04x", req->rootdir );
fprintf( stderr, ", namelen=%u", req->namelen );
fprintf( stderr, ", link=%d", req->link ); fprintf( stderr, ", link=%d", req->link );
fprintf( stderr, ", replace=%d", req->replace ); fprintf( stderr, ", replace=%d", req->replace );
dump_varargs_unicode_str( ", name=", min(cur_size,req->namelen) );
dump_varargs_string( ", filename=", cur_size ); dump_varargs_string( ", filename=", cur_size );
} }
......
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