Export the wine server functions from ntdll.

This commit is contained in:
Alexandre Julliard 2000-11-30 18:51:58 +00:00
parent a896531f38
commit 42a7320388
3 changed files with 28 additions and 39 deletions

View File

@ -1026,3 +1026,8 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
# Command-line
@ cdecl __wine_get_main_args(ptr) __wine_get_main_args
# Server interface
@ cdecl -norelay wine_server_call(long) wine_server_call
@ cdecl -norelay wine_server_alloc_req(long long) wine_server_alloc_req
@ cdecl -norelay __wine_server_exception_handler(ptr ptr ptr ptr) __wine_server_exception_handler

View File

@ -1616,12 +1616,16 @@ struct server_buffer_info
/* client communication functions */
extern unsigned int server_call_noerr( enum request req );
extern unsigned int wine_server_call( enum request req );
extern unsigned int server_call_fd( enum request req, int fd_out, int *fd_in );
extern void server_protocol_error( const char *err, ... ) WINE_NORETURN;
extern void *server_alloc_req( size_t fixed_size, size_t var_size );
extern void *wine_server_alloc_req( size_t fixed_size, size_t var_size );
extern const char *get_config_dir(void);
/* compatibility macros */
#define server_alloc_req(f,v) wine_server_alloc_req(f,v)
#define server_call_noerr(req) wine_server_call(req)
/* get a pointer to the request buffer */
static inline void WINE_UNUSED *get_req_buffer(void)
{
@ -1635,35 +1639,13 @@ static inline int WINE_UNUSED server_remaining( const void *ptr )
}
/* do a server call and set the last error code */
static inline int server_call( enum request req )
inline static unsigned int server_call( enum request req )
{
unsigned int res = server_call_noerr( req );
unsigned int res = wine_server_call( req );
if (res) SetLastError( RtlNtStatusToDosError(res) );
return res;
}
/* copy a Unicode string to the server buffer */
static inline void server_strcpyW( WCHAR *dst, const WCHAR *src )
{
if (src)
{
WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
while ((dst < end) && *src) *dst++ = *src++;
}
*dst = 0;
}
/* copy and convert an ASCII string to the server buffer */
static inline void server_strcpyAtoW( WCHAR *dst, const char *src )
{
if (src)
{
WCHAR *end = (WCHAR *)NtCurrentTeb()->buffer_info - 1;
while ((dst < end) && *src) *dst++ = (WCHAR)(unsigned char)*src++;
}
*dst = 0;
}
/* get a pointer to the variable part of the request */
inline static void *server_data_ptr( const void *req )
{
@ -1679,8 +1661,8 @@ inline static size_t server_data_size( const void *req )
/* exception support for server calls */
extern DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
extern DWORD __wine_server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
CONTEXT *context, EXCEPTION_FRAME **pdispatcher );
struct __server_exception_frame
{
@ -1691,7 +1673,7 @@ struct __server_exception_frame
#define SERVER_START_REQ \
do { \
struct __server_exception_frame __f; \
__f.frame.Handler = server_exception_handler; \
__f.frame.Handler = __wine_server_exception_handler; \
__f.info = *NtCurrentTeb()->buffer_info; \
__wine_push_frame( &__f.frame ); \
do {

View File

@ -46,6 +46,8 @@
#define SERVERDIR "/wineserver-" /* server socket directory (hostname appended) */
#define SOCKETNAME "socket" /* name of the socket file */
#undef server_alloc_req
/* data structure used to pass an fd with sendmsg/recvmsg */
struct cmsg_fd
{
@ -112,10 +114,10 @@ static void server_perror( const char *err )
/***********************************************************************
* server_exception_handler
* __wine_server_exception_handler
*/
DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
CONTEXT *context, EXCEPTION_FRAME **pdispatcher )
DWORD __wine_server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame,
CONTEXT *context, EXCEPTION_FRAME **pdispatcher )
{
struct __server_exception_frame *server_frame = (struct __server_exception_frame *)frame;
if ((record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)))
@ -125,9 +127,9 @@ DWORD server_exception_handler( PEXCEPTION_RECORD record, EXCEPTION_FRAME *frame
/***********************************************************************
* server_alloc_req
* wine_server_alloc_req
*/
void *server_alloc_req( size_t fixed_size, size_t var_size )
void *wine_server_alloc_req( size_t fixed_size, size_t var_size )
{
unsigned int pos = NtCurrentTeb()->buffer_info->cur_pos;
union generic_request *req = (union generic_request *)((char *)NtCurrentTeb()->buffer + pos);
@ -287,11 +289,11 @@ static void wait_reply_fd( int *fd )
/***********************************************************************
* server_call_noerr
* wine_server_call
*
* Perform a server call.
*/
unsigned int server_call_noerr( enum request req )
unsigned int wine_server_call( enum request req )
{
void *req_ptr = get_req_buffer();
send_request( req, req_ptr );
@ -586,11 +588,11 @@ int CLIENT_InitThread(void)
SERVER_START_REQ
{
struct init_thread_request *req = server_alloc_req( sizeof(*req), 0 );
struct init_thread_request *req = wine_server_alloc_req( sizeof(*req), 0 );
req->unix_pid = getpid();
req->teb = teb;
req->entry = teb->entry_point;
ret = server_call_noerr( REQ_INIT_THREAD );
ret = wine_server_call( REQ_INIT_THREAD );
}
SERVER_END_REQ;
return ret;
@ -606,7 +608,7 @@ int CLIENT_BootDone( int debug_level )
int ret;
SERVER_START_REQ
{
struct boot_done_request *req = server_alloc_req( sizeof(*req), 0 );
struct boot_done_request *req = wine_server_alloc_req( sizeof(*req), 0 );
req->debug_level = debug_level;
ret = server_call( REQ_BOOT_DONE );
}