From 745ec84c8b8869d6dc99689ff9147209036379e7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 13 Nov 2000 04:54:45 +0000 Subject: [PATCH] Export the CallFrom16xxx functions from kernel32. Renamed them __wine_call_from_16 to follow the naming convention. --- dlls/kernel/kernel32.spec | 13 +++++++++++++ dlls/kernel/thunk.c | 8 ++++---- if1632/builtin.c | 4 ++-- if1632/relay.c | 15 ++++----------- if1632/snoop.c | 4 ++-- include/builtin16.h | 12 ++++++------ tools/winebuild/relay.c | 29 ++++++++++++++--------------- tools/winebuild/spec16.c | 8 ++++---- windows/winproc.c | 4 ++-- 9 files changed, 51 insertions(+), 46 deletions(-) diff --git a/dlls/kernel/kernel32.spec b/dlls/kernel/kernel32.spec index 0ea5407a2db..9f677ab605b 100644 --- a/dlls/kernel/kernel32.spec +++ b/dlls/kernel/kernel32.spec @@ -937,3 +937,16 @@ debug_channels (comm debugstr dll int resource stress thunk toolhelp win32) @ stdcall InitializeCriticalSectionAndSpinCount(ptr long) InitializeCriticalSectionAndSpinCount @ stdcall SetCriticalSectionSpinCount(ptr long) SetCriticalSectionSpinCount @ stdcall ProcessIdToSessionId(long ptr) ProcessIdToSessionId + +################## +# Wine extensions +# +# All functions must be prefixed with '__wine_' (for internal functions) +# or 'wine_' (for user-visible functions) to avoid namespace conflicts. + +# 16-bit relays +@ cdecl __wine_register_dll_16(ptr) __wine_register_dll_16 +@ varargs __wine_call_from_16_word() __wine_call_from_16_word +@ varargs __wine_call_from_16_long() __wine_call_from_16_word +@ varargs __wine_call_from_16_regs() __wine_call_from_16_word +@ varargs __wine_call_from_16_thunk() __wine_call_from_16_word diff --git a/dlls/kernel/thunk.c b/dlls/kernel/thunk.c index 8805a02e872..c61fbe3ac4b 100644 --- a/dlls/kernel/thunk.c +++ b/dlls/kernel/thunk.c @@ -1302,7 +1302,7 @@ void WINAPI C16ThkSL(CONTEXT86 *context) * push edx * push dx * push edx - * call __FLATCS:CallFrom16Thunk + * call __FLATCS:__wine_call_from_16_thunk */ *x++ = 0xB8; *((WORD *)x)++ = ds; @@ -1315,7 +1315,7 @@ void WINAPI C16ThkSL(CONTEXT86 *context) *x++ = 0x66; *x++ = 0x52; *x++ = 0x52; *x++ = 0x66; *x++ = 0x52; - *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)CallFrom16Thunk; + *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)__wine_call_from_16_thunk; *((WORD *)x)++ = cs; /* Jump to the stub code just created */ @@ -1361,7 +1361,7 @@ void WINAPI C16ThkSL01(CONTEXT86 *context) * push edx * push dx * push edx - * call __FLATCS:CallFrom16Thunk + * call __FLATCS:__wine_call_from_16_thunk */ *x++ = 0x66; *x++ = 0x33; *x++ = 0xC0; @@ -1372,7 +1372,7 @@ void WINAPI C16ThkSL01(CONTEXT86 *context) *x++ = 0x66; *x++ = 0x52; *x++ = 0x52; *x++ = 0x66; *x++ = 0x52; - *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)CallFrom16Thunk; + *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)__wine_call_from_16_thunk; *((WORD *)x)++ = cs; /* Jump to the stub code just created */ diff --git a/if1632/builtin.c b/if1632/builtin.c index 4d53a32498f..2a62061c966 100644 --- a/if1632/builtin.c +++ b/if1632/builtin.c @@ -209,11 +209,11 @@ LPCSTR BUILTIN_GetEntryPoint16( STACK16FRAME *frame, LPSTR name, WORD *pOrd ) /*********************************************************************** - * BUILTIN_RegisterDLL + * __wine_register_dll_16 * * Register a built-in DLL descriptor. */ -void BUILTIN_RegisterDLL( const BUILTIN16_DESCRIPTOR *descr ) +void __wine_register_dll_16( const BUILTIN16_DESCRIPTOR *descr ) { assert( nb_dlls < MAX_DLLS ); builtin_dlls[nb_dlls++] = descr; diff --git a/if1632/relay.c b/if1632/relay.c index 2892091ef4b..a314c4f6786 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -75,17 +75,10 @@ void CALLBACK CallTo16RegisterShort( CONTEXT86 *context, INT nArgs ) void CALLBACK CallTo16RegisterLong ( CONTEXT86 *context, INT nArgs ) { assert( FALSE ); } -WORD CallFrom16Word( void ) -{ assert( FALSE ); } - -LONG CallFrom16Long( void ) -{ assert( FALSE ); } - -void CallFrom16Register( void ) -{ assert( FALSE ); } - -void CallFrom16Thunk( void ) -{ assert( FALSE ); } +WORD __wine_call_from_16_word() { assert( FALSE ); } +LONG __wine_call_from_16_long() { assert( FALSE ); } +void __wine_call_from_16_regs() { assert( FALSE ); } +void __wine_call_from_16_thunk() { assert( FALSE ); } DWORD WINAPI CALL32_CBClient( FARPROC proc, LPWORD args, DWORD *esi ) { assert( FALSE ); } diff --git a/if1632/snoop.c b/if1632/snoop.c index 53120ddd19f..1f5b69a2b08 100644 --- a/if1632/snoop.c +++ b/if1632/snoop.c @@ -99,7 +99,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { snr[0].pushl = 0x68; snr[0].realfun = (DWORD)SNOOP16_Entry; snr[0].lcall = 0x9a; - snr[0].callfromregs = (DWORD)CallFrom16Register; + snr[0].callfromregs = (DWORD)__wine_call_from_16_regs; snr[0].seg = __get_cs(); snr[0].lret = 0xcb66; @@ -109,7 +109,7 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { snr[1].pushl = 0x68; snr[1].realfun = (DWORD)SNOOP16_Return; snr[1].lcall = 0x9a; - snr[1].callfromregs = (DWORD)CallFrom16Register; + snr[1].callfromregs = (DWORD)__wine_call_from_16_regs; snr[1].seg = __get_cs(); snr[1].lret = 0xcb66; } diff --git a/include/builtin16.h b/include/builtin16.h index e5626d294fc..4e0c02a02a3 100644 --- a/include/builtin16.h +++ b/include/builtin16.h @@ -14,11 +14,6 @@ struct _CONTEXT86; struct _STACK16FRAME; -extern WORD CallFrom16Word(); -extern LONG CallFrom16Long(); -extern void CallFrom16Register(); -extern void CallFrom16Thunk(); - extern WORD CALLBACK CallTo16Word( FARPROC16 target, INT nArgs ); extern LONG CALLBACK CallTo16Long( FARPROC16 target, INT nArgs ); extern void CALLBACK CallTo16RegisterShort( struct _CONTEXT86 *context, INT nArgs ); @@ -63,6 +58,11 @@ typedef struct extern HMODULE16 BUILTIN_LoadModule( LPCSTR name ); extern LPCSTR BUILTIN_GetEntryPoint16( struct _STACK16FRAME *frame, LPSTR name, WORD *pOrd ); -extern void BUILTIN_RegisterDLL( const BUILTIN16_DESCRIPTOR *descr ); + +extern void __wine_register_dll_16( const BUILTIN16_DESCRIPTOR *descr ); +extern WORD __wine_call_from_16_word(); +extern LONG __wine_call_from_16_long(); +extern void __wine_call_from_16_regs(); +extern void __wine_call_from_16_thunk(); #endif /* __WINE_BUILTIN16_H */ diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index aa2c550cab5..a58c0a793bf 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -87,17 +87,16 @@ */ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int short_ret ) { - char *name = thunk? "Thunk" : reg_func? "Register" : short_ret? "Word" : "Long"; + char *name = thunk? "thunk" : reg_func? "regs" : short_ret? "word" : "long"; /* Function header */ fprintf( outfile, "\n\t.align 4\n" ); #ifdef USE_STABS - fprintf( outfile, ".stabs \"CallFrom16%s:F1\",36,0,0," PREFIX "CallFrom16%s\n", - name, name); + fprintf( outfile, ".stabs \"__wine_call_from_16_%s:F1\",36,0,0," PREFIX "__wine_call_from_16_%s\n", name, name); #endif - fprintf( outfile, "\t.type " PREFIX "CallFrom16%s,@function\n", name ); - fprintf( outfile, "\t.globl " PREFIX "CallFrom16%s\n", name ); - fprintf( outfile, PREFIX "CallFrom16%s:\n", name ); + fprintf( outfile, "\t.type " PREFIX "__wine_call_from_16_%s,@function\n", name ); + fprintf( outfile, "\t.globl " PREFIX "__wine_call_from_16_%s\n", name ); + fprintf( outfile, PREFIX "__wine_call_from_16_%s:\n", name ); /* Create STACK16FRAME (except STACK32FRAME link) */ fprintf( outfile, "\tpushw %%gs\n" ); @@ -114,10 +113,10 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho if ( UsePIC ) { /* Get Global Offset Table into %ecx */ - fprintf( outfile, "\tcall .LCallFrom16%s.getgot1\n", name ); - fprintf( outfile, ".LCallFrom16%s.getgot1:\n", name ); + fprintf( outfile, "\tcall .L__wine_call_from_16_%s.getgot1\n", name ); + fprintf( outfile, ".L__wine_call_from_16_%s.getgot1:\n", name ); fprintf( outfile, "\tpopl %%ecx\n" ); - fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.LCallFrom16%s.getgot1], %%ecx\n", name ); + fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.L__wine_call_from_16_%s.getgot1], %%ecx\n", name ); } if (UsePIC) @@ -278,10 +277,10 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho fprintf( outfile, "\tpushl %%ebx\n" ); /* Get Global Offset Table into %ebx (for PLT call) */ - fprintf( outfile, "\tcall .LCallFrom16%s.getgot2\n", name ); - fprintf( outfile, ".LCallFrom16%s.getgot2:\n", name ); + fprintf( outfile, "\tcall .L__wine_call_from_16_%s.getgot2\n", name ); + fprintf( outfile, ".L__wine_call_from_16_%s.getgot2:\n", name ); fprintf( outfile, "\tpopl %%ebx\n" ); - fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.LCallFrom16%s.getgot2], %%ebx\n", name ); + fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.L__wine_call_from_16_%s.getgot2], %%ebx\n", name ); } fprintf( outfile, "\tpushl %%edx\n" ); @@ -317,10 +316,10 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho fprintf( outfile, "\tpushl %%ebx\n" ); /* Get Global Offset Table into %ebx (for PLT call) */ - fprintf( outfile, "\tcall .LCallFrom16%s.getgot3\n", name ); - fprintf( outfile, ".LCallFrom16%s.getgot3:\n", name ); + fprintf( outfile, "\tcall .L__wine_call_from_16_%s.getgot3\n", name ); + fprintf( outfile, ".L__wine_call_from_16_%s.getgot3:\n", name ); fprintf( outfile, "\tpopl %%ebx\n" ); - fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.LCallFrom16%s.getgot3], %%ebx\n", name ); + fprintf( outfile, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-.L__wine_call_from_16_%s.getgot3], %%ebx\n", name ); } fprintf( outfile, "\tpushl %%eax\n" ); diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index a113ecbc496..31edeeed13d 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -682,11 +682,11 @@ void BuildSpec16File( FILE *outfile ) if ( typelist[i]->type == TYPE_INTERRUPT ) argsize += 2; - fprintf( outfile, " { 0x68, %s_CallFrom16_%s, 0x9a, CallFrom16%s,\n", + fprintf( outfile, " { 0x68, %s_CallFrom16_%s, 0x9a, __wine_call_from_16_%s,\n", DLLName, profile, (typelist[i]->type == TYPE_REGISTER - || typelist[i]->type == TYPE_INTERRUPT)? "Register": - typelist[i]->type == TYPE_PASCAL_16? "Word" : "Long" ); + || typelist[i]->type == TYPE_INTERRUPT)? "regs": + typelist[i]->type == TYPE_PASCAL_16? "word" : "long" ); if (argsize) fprintf( outfile, " 0x%04x, 0x66, 0xca, %d, \"%s\" },\n", code_selector, argsize, profile ); @@ -787,7 +787,7 @@ void BuildSpec16File( FILE *outfile ) fprintf( outfile, " \"\\t.previous\\n\");\n" ); fprintf( outfile, "}\n" ); fprintf( outfile, "#endif /* defined(__GNUC__) */\n" ); - fprintf( outfile, "static void %s_init(void) { BUILTIN_RegisterDLL( &descriptor ); }\n", + fprintf( outfile, "static void %s_init(void) { __wine_register_dll_16( &descriptor ); }\n", DLLName ); } diff --git a/windows/winproc.c b/windows/winproc.c index 666cc189f9e..ddf89425017 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -42,7 +42,7 @@ typedef struct BYTE pushl_relay; /* pushl $relay */ void (*relay)(); /* WINPROC_Thunk16To32A/W() */ BYTE lcall; /* lcall cs:glue */ - void (*glue)(); /* CallFrom16Long */ + void (*glue)(); /* __wine_call_from_16_long */ WORD cs; /* __FLATCS */ WORD lret; /* lret $10 */ WORD nArgs; @@ -335,7 +335,7 @@ static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type, (void(*)())WINPROC_Thunk16To32A : (void(*)())WINPROC_Thunk16To32W; proc->thunk.t_from16.lcall = 0x9a; /* lcall cs:glue */ - proc->thunk.t_from16.glue = (void*)CallFrom16Long; + proc->thunk.t_from16.glue = (void*)__wine_call_from_16_long; proc->thunk.t_from16.cs = __get_cs(); proc->thunk.t_from16.lret = 0xca66; proc->thunk.t_from16.nArgs = 10;