server: Add a helper function to skip the object attributes structure.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-01-19 15:00:21 +09:00
parent d9e6a31c6e
commit c4843d4a45
4 changed files with 13 additions and 5 deletions

View File

@ -711,8 +711,7 @@ DECL_HANDLER(create_file)
if (!root_fd) return;
}
name = (const char *)get_req_data() + sizeof(*objattr) + objattr->sd_len;
name_len = get_req_data_size() - sizeof(*objattr) - objattr->sd_len;
name = get_req_data_after_objattr( objattr, &name_len );
reply->handle = 0;
if ((file = create_file( root_fd, name, name_len, req->access, req->sharing,

View File

@ -198,6 +198,15 @@ const struct object_attributes *get_req_object_attributes( const struct security
return attr;
}
/* return a pointer to the request data following an object attributes structure */
const void *get_req_data_after_objattr( const struct object_attributes *attr, data_size_t *len )
{
const void *ptr = (const WCHAR *)((const struct object_attributes *)get_req_data() + 1) +
attr->sd_len / sizeof(WCHAR) + attr->name_len / sizeof(WCHAR);
*len = get_req_data_size() - ((const char *)ptr - (const char *)get_req_data());
return ptr;
}
/* write the remaining part of the reply */
void write_reply( struct thread *thread )
{

View File

@ -48,6 +48,7 @@ extern const char *get_config_dir(void);
extern void *set_reply_data_size( data_size_t size );
extern const struct object_attributes *get_req_object_attributes( const struct security_descriptor **sd,
struct unicode_str *name );
extern const void *get_req_data_after_objattr( const struct object_attributes *attr, data_size_t *len );
extern int receive_fd( struct process *process );
extern int send_client_fd( struct process *process, int fd, obj_handle_t handle );
extern void read_request( struct thread *thread );

View File

@ -174,9 +174,8 @@ DECL_HANDLER(create_symlink)
if (!objattr) return;
target.str = (const WCHAR *)get_req_data() + sizeof(*objattr) / sizeof(WCHAR) +
objattr->sd_len / sizeof(WCHAR) + name.len / sizeof(WCHAR);
target.len = get_req_data_size() - ((const char *)target.str - (const char *)get_req_data());
target.str = get_req_data_after_objattr( objattr, &target.len );
target.len = (target.len / sizeof(WCHAR)) * sizeof(WCHAR);
if (objattr->rootdir && !(root = get_directory_obj( current->process, objattr->rootdir, 0 ))) return;