Moved the wine server client-side support to dlls/ntdll. Removed a

couple of unnecessary functions.
This commit is contained in:
Alexandre Julliard 2003-09-18 23:27:19 +00:00
parent ba71316172
commit 52f692fb9b
7 changed files with 30 additions and 50 deletions

View File

@ -306,7 +306,7 @@ static BOOL process_init( char *argv[] )
InitializeListHead(&process_ldr.InInitializationOrderModuleList);
/* Setup the server connection */
CLIENT_InitServer();
wine_server_init_thread();
/* Retrieve startup info from the server */
SERVER_START_REQ( init_process )
@ -386,7 +386,13 @@ static BOOL process_init( char *argv[] )
SHELL_LoadRegistry();
/* global boot finished, the rest is process-local */
CLIENT_BootDone( TRACE_ON(server) );
SERVER_START_REQ( boot_done )
{
req->debug_level = TRACE_ON(server);
wine_server_call( req );
}
SERVER_END_REQ;
if (TRACE_ON(relay) || TRACE_ON(snoop)) RELAY_InitDebugLists();
return TRUE;

View File

@ -189,7 +189,7 @@ static void THREAD_Start( TEB *teb )
SYSDEPS_SetCurThread( teb );
SIGNAL_Init();
CLIENT_InitThread();
wine_server_init_thread();
if (TRACE_ON(relay))
DPRINTF("%04lx:Starting thread (entryproc=%p)\n", GetCurrentThreadId(), func );

View File

@ -31,7 +31,6 @@ C_SRCS = \
$(TOPOBJDIR)/relay32/builtin32.c \
$(TOPOBJDIR)/relay32/relay386.c \
$(TOPOBJDIR)/relay32/snoop.c \
$(TOPOBJDIR)/scheduler/client.c \
$(TOPOBJDIR)/scheduler/handle.c \
$(TOPOBJDIR)/scheduler/process.c \
$(TOPOBJDIR)/scheduler/pthread.c \
@ -58,6 +57,7 @@ C_SRCS = \
rtlbitmap.c \
rtlstr.c \
sec.c \
server.c \
signal_i386.c \
signal_powerpc.c \
signal_sparc.c \

View File

@ -1062,6 +1062,7 @@
# Server interface
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_init_thread()
@ cdecl wine_server_fd_to_handle(long long long ptr)
@ cdecl wine_server_handle_to_fd(long long ptr ptr ptr)

View File

@ -1,5 +1,5 @@
/*
* Client part of the client/server communication
* Wine server communication
*
* Copyright (C) 1998 Alexandre Julliard
*
@ -76,9 +76,8 @@ struct cmsg_fd
};
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
static HANDLE boot_thread_id;
static sigset_t block_set; /* signals to block during server calls */
static int fd_socket; /* socket to exchange file descriptors with the server */
static int fd_socket = -1; /* socket to exchange file descriptors with the server */
#ifdef __GNUC__
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
@ -602,11 +601,11 @@ static int server_connect( const char *oldcwd, const char *serverdir )
/***********************************************************************
* CLIENT_InitServer
* server_init
*
* Start the server and create the initial socket pair.
*/
void CLIENT_InitServer(void)
static void server_init(void)
{
int size;
char *oldcwd;
@ -658,23 +657,23 @@ void CLIENT_InitServer(void)
/* receive the first thread request fd on the main socket */
NtCurrentTeb()->request_fd = receive_fd( &dummy_handle );
CLIENT_InitThread();
}
/***********************************************************************
* CLIENT_InitThread
* wine_server_init_thread
*
* Send an init thread request. Return 0 if OK.
*/
void CLIENT_InitThread(void)
void wine_server_init_thread(void)
{
TEB *teb = NtCurrentTeb();
int version, ret;
int reply_pipe[2];
struct sigaction sig_act;
if (fd_socket == -1) server_init();
sig_act.sa_handler = SIG_IGN;
sig_act.sa_flags = 0;
sigemptyset( &sig_act.sa_mask );
@ -712,8 +711,6 @@ void CLIENT_InitThread(void)
teb->ClientId.UniqueProcess = (HANDLE)reply->pid;
teb->ClientId.UniqueThread = (HANDLE)reply->tid;
version = reply->version;
if (reply->boot) boot_thread_id = teb->ClientId.UniqueThread;
else if (boot_thread_id == teb->ClientId.UniqueThread) boot_thread_id = 0;
}
SERVER_END_REQ;
@ -726,30 +723,3 @@ void CLIENT_InitThread(void)
version, SERVER_PROTOCOL_VERSION,
(version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
}
/***********************************************************************
* CLIENT_BootDone
*
* Signal that we have finished booting, and set debug level.
*/
void CLIENT_BootDone( int debug_level )
{
SERVER_START_REQ( boot_done )
{
req->debug_level = debug_level;
wine_server_call( req );
}
SERVER_END_REQ;
}
/***********************************************************************
* CLIENT_IsBootThread
*
* Return TRUE if current thread is the boot thread.
*/
int CLIENT_IsBootThread(void)
{
return (GetCurrentThreadId() == (DWORD)boot_thread_id);
}

View File

@ -56,6 +56,7 @@ extern void wine_server_send_fd( int fd );
extern int wine_server_fd_to_handle( int fd, unsigned int access, int inherit, obj_handle_t *handle );
extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd,
enum fd_type *type, int *flags );
extern void wine_server_init_thread(void);
/* do a server call and set the last error code */
inline static unsigned int wine_server_call_err( void *req_ptr )
@ -113,9 +114,5 @@ inline static void wine_server_set_reply( void *req_ptr, void *ptr, unsigned int
/* non-exported functions */
extern void DECLSPEC_NORETURN server_protocol_error( const char *err, ... );
extern void DECLSPEC_NORETURN server_protocol_perror( const char *err );
extern void CLIENT_InitServer(void);
extern void CLIENT_InitThread(void);
extern void CLIENT_BootDone( int debug_level );
extern int CLIENT_IsBootThread(void);
#endif /* __WINE_WINE_SERVER_H */

View File

@ -1654,6 +1654,7 @@ void SHELL_LoadRegistry( void )
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
DWORD count;
ULONG dispos;
BOOL res;
int all, period;
char tmp[1024];
@ -1677,8 +1678,6 @@ void SHELL_LoadRegistry( void )
TRACE("(void)\n");
if (!CLIENT_IsBootThread()) return; /* already loaded */
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &nameW;
@ -1686,10 +1685,17 @@ void SHELL_LoadRegistry( void )
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, UserW );
NtCreateKey( &hkey_users, KEY_ALL_ACCESS, &attr, 0, NULL, 0, &dispos );
if (dispos == REG_OPENED_EXISTING_KEY)
{
/* someone else already loaded the registry */
NtClose( hkey_users );
return;
}
RtlInitUnicodeString( &nameW, MachineW );
NtCreateKey( &hkey_local_machine, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL );
RtlInitUnicodeString( &nameW, UserW );
NtCreateKey( &hkey_users, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL );
attr.RootDirectory = hkey_users;
RtlInitUnicodeString( &nameW, DefaultW );