Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to create stack prologue for programs which hook entry poi… #914

Merged
merged 1 commit into from
Mar 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions convspec/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions convspec/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static const char * const FlagNames[] =
"register", /* FLAG_REGISTER */
"private", /* FLAG_PRIVATE */
"ordinal", /* FLAG_ORDINAL */
"stkprolog", /* FLAG_STKPROLOG */
NULL
};

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions convspec/spec16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
2 changes: 1 addition & 1 deletion krnl386/krnl386.exe16.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down