diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 5d5562e27c0..077c0058c83 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2006,7 +2006,6 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module ) peb->ImageSubSystem = main_image_info.SubSystemType; peb->ImageSubSystemMajorVersion = main_image_info.MajorSubsystemVersion; peb->ImageSubSystemMinorVersion = main_image_info.MinorSubsystemVersion; - peb->SessionId = 1; if (NtCurrentTeb()->WowTebOffset) { diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 5e3d7347a24..567f50d0ad7 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1513,6 +1513,7 @@ size_t server_init_process(void) ret = wine_server_call( req ); pid = reply->pid; tid = reply->tid; + peb->SessionId = reply->session_id; info_size = reply->info_size; server_start_time = reply->server_start; supported_machines_count = wine_server_reply_size( reply ) / sizeof(*supported_machines); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index d73f493edd3..32cbc928c76 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -933,9 +933,9 @@ struct init_first_thread_reply process_id_t pid; thread_id_t tid; timeout_t server_start; + unsigned int session_id; data_size_t info_size; /* VARARG(machines,ushorts); */ - char __pad_28[4]; }; @@ -6251,7 +6251,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 720 +#define SERVER_PROTOCOL_VERSION 721 /* ### protocol_version end ### */ diff --git a/server/directory.c b/server/directory.c index 30d69459984..ec8187b425a 100644 --- a/server/directory.c +++ b/server/directory.c @@ -462,7 +462,7 @@ void init_directories( struct fd *intl_fd ) /* sessions */ create_session( 0 ); - create_session( 1 ); + create_session( default_session_id ); /* object types */ diff --git a/server/process.c b/server/process.c index 9288bcc27d5..ad79a5ed640 100644 --- a/server/process.c +++ b/server/process.c @@ -686,6 +686,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla process->affinity = parent->affinity; } 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 * but Wine provides admin access to all applications right now so high diff --git a/server/process.h b/server/process.h index 0e1a83859d9..55e4d6dced6 100644 --- a/server/process.h +++ b/server/process.h @@ -51,6 +51,7 @@ struct process struct fd *msg_fd; /* fd for sendmsg/recvmsg */ process_id_t id; /* 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 */ unsigned short machine; /* client machine type */ int unix_pid; /* Unix pid for final SIGKILL */ @@ -142,4 +143,6 @@ static inline int is_process_init_done( struct process *process ) return process->startup_state == STARTUP_DONE; } +static const unsigned int default_session_id = 1; + #endif /* __WINE_SERVER_PROCESS_H */ diff --git a/server/protocol.def b/server/protocol.def index 59ed5632503..ae9a54197a1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -911,6 +911,7 @@ typedef struct process_id_t pid; /* process id of the new thread's process */ thread_id_t tid; /* thread id of the new thread */ timeout_t server_start; /* server start time */ + unsigned int session_id; /* process session id */ data_size_t info_size; /* total size of startup info */ VARARG(machines,ushorts); /* array of supported machines */ @END diff --git a/server/request.h b/server/request.h index 63b09358612..342f8d159f1 100644 --- a/server/request.h +++ b/server/request.h @@ -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, tid) == 12 ); 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( FIELD_OFFSET(struct init_thread_request, unix_tid) == 12 ); C_ASSERT( FIELD_OFFSET(struct init_thread_request, reply_fd) == 16 ); diff --git a/server/thread.c b/server/thread.c index f9535a7b25b..e0c520ee37c 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1431,6 +1431,7 @@ DECL_HANDLER(init_first_thread) reply->pid = get_process_id( process ); reply->tid = get_thread_id( current ); + reply->session_id = process->session_id; reply->info_size = get_process_startup_info_size( process ); reply->server_start = server_start_time; set_reply_data( supported_machines, diff --git a/server/trace.c b/server/trace.c index b3eea846453..d5d58c21588 100644 --- a/server/trace.c +++ b/server/trace.c @@ -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, ", tid=%04x", req->tid ); dump_timeout( ", server_start=", &req->server_start ); + fprintf( stderr, ", session_id=%08x", req->session_id ); fprintf( stderr, ", info_size=%u", req->info_size ); dump_varargs_ushorts( ", machines=", cur_size ); }