diff --git a/convspec/build.h b/convspec/build.h index 7e69edeac26..31edd8496db 100644 --- a/convspec/build.h +++ b/convspec/build.h @@ -173,6 +173,7 @@ struct strarray #define FLAG_REGISTER 0x10 /* use register calling convention */ #define FLAG_PRIVATE 0x20 /* function is private (cannot be imported) */ #define FLAG_ORDINAL 0x40 /* function should be imported by ordinal */ +#define FLAG_STKPROLOG 0x80 /* add stack adjust prolog for programs that hook exports */ #define FLAG_FORWARD 0x100 /* function is a forwarded name */ #define FLAG_EXT_LINK 0x200 /* function links to an external symbol */ diff --git a/convspec/parser.c b/convspec/parser.c index ad996547a5b..d0358461a70 100644 --- a/convspec/parser.c +++ b/convspec/parser.c @@ -69,6 +69,7 @@ static const char * const FlagNames[] = "register", /* FLAG_REGISTER */ "private", /* FLAG_PRIVATE */ "ordinal", /* FLAG_ORDINAL */ + "stkprolog", /* FLAG_STKPROLOG */ NULL }; @@ -502,6 +503,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp ) { case FLAG_RET16: case FLAG_REGISTER: + case FLAG_STKPROLOG: if (spec->type == SPEC_WIN32) error( "Flag '%s' is not supported in Win32\n", FlagNames[i] ); break; diff --git a/convspec/spec16.c b/convspec/spec16.c index f27fe425bbb..ce030433b7d 100644 --- a/convspec/spec16.c +++ b/convspec/spec16.c @@ -768,6 +768,14 @@ static void output_module16( DLLSPEC *spec ) if (!odp || !is_function( odp )) continue; output( ".L__wine_%s_%u:\n", spec->c_name, i ); output( "\tpushw %%bp\n" ); + if (odp->flags & FLAG_STKPROLOG) + { + output( "\tmovw %%sp, %%bp\n" ); + output( "\tpushw $0x1234\n" ); + output( "\tpopw %%bp\n" ); + output( "\tpopw %%bp\n" ); + output( "\tpushw %%bp\n" ); + } output( "\tpushl $%s\n", odp->type == TYPE_PASCAL ? asm_name_stdcall16(odp->link_name, odp) : (odp->type == TYPE_STUB ? get_stub_name(odp, spec) : asm_name( odp->link_name ))); output( "\tcallw .L__wine_spec_callfrom16_%s\n", get_callfrom16_name( odp ) ); diff --git a/krnl386/krnl386.exe16.spec b/krnl386/krnl386.exe16.spec index 480b965f636..48259dfb733 100644 --- a/krnl386/krnl386.exe16.spec +++ b/krnl386/krnl386.exe16.spec @@ -96,7 +96,7 @@ 92 pascal GetTempDrive(word) GetTempDrive 93 pascal GetCodeHandle(segptr) GetCodeHandle16 94 pascal -ret16 DefineHandleTable(word) DefineHandleTable16 -95 pascal -ret16 LoadLibrary(str) LoadLibrary16 +95 pascal -ret16 -stkprolog LoadLibrary(str) LoadLibrary16 96 pascal FreeLibrary(word) WIN16_FreeLibrary16 97 pascal -ret16 GetTempFileName(word str word ptr) GetTempFileName16 98 pascal -ret16 GetLastDiskChange() KERNEL_nop