Commit ad93413c authored by Alexandre Julliard's avatar Alexandre Julliard

server: Store session id in the process and return it at process init time.

parent f5238be3
...@@ -2006,7 +2006,6 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module ) ...@@ -2006,7 +2006,6 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
peb->ImageSubSystem = main_image_info.SubSystemType; peb->ImageSubSystem = main_image_info.SubSystemType;
peb->ImageSubSystemMajorVersion = main_image_info.MajorSubsystemVersion; peb->ImageSubSystemMajorVersion = main_image_info.MajorSubsystemVersion;
peb->ImageSubSystemMinorVersion = main_image_info.MinorSubsystemVersion; peb->ImageSubSystemMinorVersion = main_image_info.MinorSubsystemVersion;
peb->SessionId = 1;
if (NtCurrentTeb()->WowTebOffset) if (NtCurrentTeb()->WowTebOffset)
{ {
......
...@@ -1513,6 +1513,7 @@ size_t server_init_process(void) ...@@ -1513,6 +1513,7 @@ size_t server_init_process(void)
ret = wine_server_call( req ); ret = wine_server_call( req );
pid = reply->pid; pid = reply->pid;
tid = reply->tid; tid = reply->tid;
peb->SessionId = reply->session_id;
info_size = reply->info_size; info_size = reply->info_size;
server_start_time = reply->server_start; server_start_time = reply->server_start;
supported_machines_count = wine_server_reply_size( reply ) / sizeof(*supported_machines); supported_machines_count = wine_server_reply_size( reply ) / sizeof(*supported_machines);
......
...@@ -933,9 +933,9 @@ struct init_first_thread_reply ...@@ -933,9 +933,9 @@ struct init_first_thread_reply
process_id_t pid; process_id_t pid;
thread_id_t tid; thread_id_t tid;
timeout_t server_start; timeout_t server_start;
unsigned int session_id;
data_size_t info_size; data_size_t info_size;
/* VARARG(machines,ushorts); */ /* VARARG(machines,ushorts); */
char __pad_28[4];
}; };
...@@ -6251,7 +6251,7 @@ union generic_reply ...@@ -6251,7 +6251,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 720 #define SERVER_PROTOCOL_VERSION 721
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -462,7 +462,7 @@ void init_directories( struct fd *intl_fd ) ...@@ -462,7 +462,7 @@ void init_directories( struct fd *intl_fd )
/* sessions */ /* sessions */
create_session( 0 ); create_session( 0 );
create_session( 1 ); create_session( default_session_id );
/* object types */ /* object types */
......
...@@ -686,6 +686,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla ...@@ -686,6 +686,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
process->affinity = parent->affinity; process->affinity = parent->affinity;
} }
if (!process->handles || !process->token) goto error; if (!process->handles || !process->token) goto error;
process->session_id = default_session_id;
/* Assign a high security label to the token. The default would be medium /* Assign a high security label to the token. The default would be medium
* but Wine provides admin access to all applications right now so high * but Wine provides admin access to all applications right now so high
......
...@@ -51,6 +51,7 @@ struct process ...@@ -51,6 +51,7 @@ struct process
struct fd *msg_fd; /* fd for sendmsg/recvmsg */ struct fd *msg_fd; /* fd for sendmsg/recvmsg */
process_id_t id; /* id of the process */ process_id_t id; /* id of the process */
process_id_t group_id; /* group id of the process */ process_id_t group_id; /* group id of the process */
unsigned int session_id; /* session id */
struct timeout_user *sigkill_timeout; /* timeout for final SIGKILL */ struct timeout_user *sigkill_timeout; /* timeout for final SIGKILL */
unsigned short machine; /* client machine type */ unsigned short machine; /* client machine type */
int unix_pid; /* Unix pid for final SIGKILL */ int unix_pid; /* Unix pid for final SIGKILL */
...@@ -142,4 +143,6 @@ static inline int is_process_init_done( struct process *process ) ...@@ -142,4 +143,6 @@ static inline int is_process_init_done( struct process *process )
return process->startup_state == STARTUP_DONE; return process->startup_state == STARTUP_DONE;
} }
static const unsigned int default_session_id = 1;
#endif /* __WINE_SERVER_PROCESS_H */ #endif /* __WINE_SERVER_PROCESS_H */
...@@ -911,6 +911,7 @@ typedef struct ...@@ -911,6 +911,7 @@ typedef struct
process_id_t pid; /* process id of the new thread's process */ process_id_t pid; /* process id of the new thread's process */
thread_id_t tid; /* thread id of the new thread */ thread_id_t tid; /* thread id of the new thread */
timeout_t server_start; /* server start time */ timeout_t server_start; /* server start time */
unsigned int session_id; /* process session id */
data_size_t info_size; /* total size of startup info */ data_size_t info_size; /* total size of startup info */
VARARG(machines,ushorts); /* array of supported machines */ VARARG(machines,ushorts); /* array of supported machines */
@END @END
......
...@@ -752,7 +752,8 @@ C_ASSERT( sizeof(struct init_first_thread_request) == 32 ); ...@@ -752,7 +752,8 @@ C_ASSERT( sizeof(struct init_first_thread_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, pid) == 8 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, pid) == 8 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, tid) == 12 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, tid) == 12 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, server_start) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, server_start) == 16 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, info_size) == 24 ); C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, session_id) == 24 );
C_ASSERT( FIELD_OFFSET(struct init_first_thread_reply, info_size) == 28 );
C_ASSERT( sizeof(struct init_first_thread_reply) == 32 ); C_ASSERT( sizeof(struct init_first_thread_reply) == 32 );
C_ASSERT( FIELD_OFFSET(struct init_thread_request, unix_tid) == 12 ); C_ASSERT( FIELD_OFFSET(struct init_thread_request, unix_tid) == 12 );
C_ASSERT( FIELD_OFFSET(struct init_thread_request, reply_fd) == 16 ); C_ASSERT( FIELD_OFFSET(struct init_thread_request, reply_fd) == 16 );
......
...@@ -1431,6 +1431,7 @@ DECL_HANDLER(init_first_thread) ...@@ -1431,6 +1431,7 @@ DECL_HANDLER(init_first_thread)
reply->pid = get_process_id( process ); reply->pid = get_process_id( process );
reply->tid = get_thread_id( current ); reply->tid = get_thread_id( current );
reply->session_id = process->session_id;
reply->info_size = get_process_startup_info_size( process ); reply->info_size = get_process_startup_info_size( process );
reply->server_start = server_start_time; reply->server_start = server_start_time;
set_reply_data( supported_machines, set_reply_data( supported_machines,
......
...@@ -1530,6 +1530,7 @@ static void dump_init_first_thread_reply( const struct init_first_thread_reply * ...@@ -1530,6 +1530,7 @@ static void dump_init_first_thread_reply( const struct init_first_thread_reply *
fprintf( stderr, " pid=%04x", req->pid ); fprintf( stderr, " pid=%04x", req->pid );
fprintf( stderr, ", tid=%04x", req->tid ); fprintf( stderr, ", tid=%04x", req->tid );
dump_timeout( ", server_start=", &req->server_start ); dump_timeout( ", server_start=", &req->server_start );
fprintf( stderr, ", session_id=%08x", req->session_id );
fprintf( stderr, ", info_size=%u", req->info_size ); fprintf( stderr, ", info_size=%u", req->info_size );
dump_varargs_ushorts( ", machines=", cur_size ); dump_varargs_ushorts( ", machines=", 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