Commit e368515e authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

server: Generalize server request make_temporary to set_object_permanence.

Required for implementing NtMakePermanentObject().
parent d282208a
......@@ -1281,9 +1281,10 @@ NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE handle )
TRACE("%p\n", handle);
SERVER_START_REQ( make_temporary )
SERVER_START_REQ( set_object_permanence )
{
req->handle = wine_server_obj_handle( handle );
req->permanent = 0;
ret = wine_server_call( req );
}
SERVER_END_REQ;
......
......@@ -1314,12 +1314,14 @@ struct compare_objects_reply
struct make_temporary_request
struct set_object_permanence_request
{
struct request_header __header;
obj_handle_t handle;
int permanent;
char __pad_20[4];
};
struct make_temporary_reply
struct set_object_permanence_reply
{
struct reply_header __header;
};
......@@ -5659,7 +5661,7 @@ enum request
REQ_set_handle_info,
REQ_dup_handle,
REQ_compare_objects,
REQ_make_temporary,
REQ_set_object_permanence,
REQ_open_process,
REQ_open_thread,
REQ_select,
......@@ -5951,7 +5953,7 @@ union generic_request
struct set_handle_info_request set_handle_info_request;
struct dup_handle_request dup_handle_request;
struct compare_objects_request compare_objects_request;
struct make_temporary_request make_temporary_request;
struct set_object_permanence_request set_object_permanence_request;
struct open_process_request open_process_request;
struct open_thread_request open_thread_request;
struct select_request select_request;
......@@ -6241,7 +6243,7 @@ union generic_reply
struct set_handle_info_reply set_handle_info_reply;
struct dup_handle_reply dup_handle_reply;
struct compare_objects_reply compare_objects_reply;
struct make_temporary_reply make_temporary_reply;
struct set_object_permanence_reply set_object_permanence_reply;
struct open_process_reply open_process_reply;
struct open_thread_reply open_thread_reply;
struct select_reply select_reply;
......@@ -6505,7 +6507,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 796
#define SERVER_PROTOCOL_VERSION 797
/* ### protocol_version end ### */
......
......@@ -885,13 +885,18 @@ DECL_HANDLER(get_system_handles)
}
}
DECL_HANDLER(make_temporary)
DECL_HANDLER(set_object_permanence)
{
struct object *obj;
if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
if (obj->is_permanent)
if (req->permanent && !obj->is_permanent)
{
grab_object( obj );
make_object_permanent( obj );
}
else if (!req->permanent && obj->is_permanent)
{
make_object_temporary( obj );
release_object( obj );
......
......@@ -1175,9 +1175,10 @@ typedef struct
@END
/* Make an object temporary */
@REQ(make_temporary)
/* Make an object permanent or temporary */
@REQ(set_object_permanence)
obj_handle_t handle; /* handle to the object */
int permanent; /* 1 to make permanent, 0 to make temporary */
@END
......
......@@ -144,7 +144,7 @@ DECL_HANDLER(close_handle);
DECL_HANDLER(set_handle_info);
DECL_HANDLER(dup_handle);
DECL_HANDLER(compare_objects);
DECL_HANDLER(make_temporary);
DECL_HANDLER(set_object_permanence);
DECL_HANDLER(open_process);
DECL_HANDLER(open_thread);
DECL_HANDLER(select);
......@@ -435,7 +435,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_set_handle_info,
(req_handler)req_dup_handle,
(req_handler)req_compare_objects,
(req_handler)req_make_temporary,
(req_handler)req_set_object_permanence,
(req_handler)req_open_process,
(req_handler)req_open_thread,
(req_handler)req_select,
......@@ -916,8 +916,9 @@ C_ASSERT( sizeof(struct dup_handle_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct compare_objects_request, first) == 12 );
C_ASSERT( FIELD_OFFSET(struct compare_objects_request, second) == 16 );
C_ASSERT( sizeof(struct compare_objects_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct make_temporary_request, handle) == 12 );
C_ASSERT( sizeof(struct make_temporary_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_object_permanence_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_object_permanence_request, permanent) == 16 );
C_ASSERT( sizeof(struct set_object_permanence_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct open_process_request, pid) == 12 );
C_ASSERT( FIELD_OFFSET(struct open_process_request, access) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_process_request, attributes) == 20 );
......
......@@ -1697,9 +1697,10 @@ static void dump_compare_objects_request( const struct compare_objects_request *
fprintf( stderr, ", second=%04x", req->second );
}
static void dump_make_temporary_request( const struct make_temporary_request *req )
static void dump_set_object_permanence_request( const struct set_object_permanence_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", permanent=%d", req->permanent );
}
static void dump_open_process_request( const struct open_process_request *req )
......@@ -4621,7 +4622,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_set_handle_info_request,
(dump_func)dump_dup_handle_request,
(dump_func)dump_compare_objects_request,
(dump_func)dump_make_temporary_request,
(dump_func)dump_set_object_permanence_request,
(dump_func)dump_open_process_request,
(dump_func)dump_open_thread_request,
(dump_func)dump_select_request,
......@@ -5197,7 +5198,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"set_handle_info",
"dup_handle",
"compare_objects",
"make_temporary",
"set_object_permanence",
"open_process",
"open_thread",
"select",
......
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