Commit 15751f20 authored by Alexandre Julliard's avatar Alexandre Julliard

winhlp32: Don't use FARPROC for functions that take variable number of arguments.

parent e2d22db7
......@@ -39,7 +39,7 @@ struct MacroDesc {
const char* alias;
BOOL isBool;
const char* arguments;
FARPROC fn;
void *fn;
};
static struct MacroDesc*MACRO_Loaded /* = NULL */;
......@@ -696,7 +696,7 @@ void CALLBACK MACRO_PrinterSetup(void)
static void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR args)
{
FARPROC fn = NULL;
void *fn = NULL;
int size;
WINHELP_DLL* dll;
......@@ -857,97 +857,97 @@ static void CALLBACK MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
*/
static struct MacroDesc MACRO_Builtins[] = {
{"About", NULL, 0, "", (FARPROC)MACRO_About},
{"AddAccelerator", "AA", 0, "UUS", (FARPROC)MACRO_AddAccelerator},
{"ALink", "AL", 0, "SUS", (FARPROC)MACRO_ALink},
{"Annotate", NULL, 0, "", (FARPROC)MACRO_Annotate},
{"AppendItem", NULL, 0, "SSSS", (FARPROC)MACRO_AppendItem},
{"Back", NULL, 0, "", (FARPROC)MACRO_Back},
{"BackFlush", "BF", 0, "", (FARPROC)MACRO_BackFlush},
{"BookmarkDefine", NULL, 0, "", (FARPROC)MACRO_BookmarkDefine},
{"BookmarkMore", NULL, 0, "", (FARPROC)MACRO_BookmarkMore},
{"BrowseButtons", NULL, 0, "", (FARPROC)MACRO_BrowseButtons},
{"ChangeButtonBinding", "CBB",0, "SS", (FARPROC)MACRO_ChangeButtonBinding},
{"ChangeEnable", "CE", 0, "SS", (FARPROC)MACRO_ChangeEnable},
{"ChangeItemBinding", "CIB",0, "SS", (FARPROC)MACRO_ChangeItemBinding},
{"CheckItem", "CI", 0, "S", (FARPROC)MACRO_CheckItem},
{"CloseSecondarys", "CS", 0, "", (FARPROC)MACRO_CloseSecondarys},
{"CloseWindow", "CW", 0, "S", (FARPROC)MACRO_CloseWindow},
{"Compare", NULL, 0, "S", (FARPROC)MACRO_Compare},
{"Contents", NULL, 0, "", (FARPROC)MACRO_Contents},
{"ControlPanel", NULL, 0, "SSU", (FARPROC)MACRO_ControlPanel},
{"CopyDialog", NULL, 0, "", (FARPROC)MACRO_CopyDialog},
{"CopyTopic", "CT", 0, "", (FARPROC)MACRO_CopyTopic},
{"CreateButton", "CB", 0, "SSS", (FARPROC)MACRO_CreateButton},
{"DeleteItem", NULL, 0, "S", (FARPROC)MACRO_DeleteItem},
{"DeleteMark", NULL, 0, "S", (FARPROC)MACRO_DeleteMark},
{"DestroyButton", NULL, 0, "S", (FARPROC)MACRO_DestroyButton},
{"DisableButton", "DB", 0, "S", (FARPROC)MACRO_DisableButton},
{"DisableItem", "DI", 0, "S", (FARPROC)MACRO_DisableItem},
{"EnableButton", "EB", 0, "S", (FARPROC)MACRO_EnableButton},
{"EnableItem", "EI", 0, "S", (FARPROC)MACRO_EnableItem},
{"EndMPrint", NULL, 0, "", (FARPROC)MACRO_EndMPrint},
{"ExecFile", "EF", 0, "SSUS", (FARPROC)MACRO_ExecFile},
{"ExecProgram", "EP", 0, "SU", (FARPROC)MACRO_ExecProgram},
{"Exit", NULL, 0, "", (FARPROC)MACRO_Exit},
{"ExtAbleItem", NULL, 0, "SU", (FARPROC)MACRO_ExtAbleItem},
{"ExtInsertItem", NULL, 0, "SSSSUU", (FARPROC)MACRO_ExtInsertItem},
{"ExtInsertMenu", NULL, 0, "SSSUU", (FARPROC)MACRO_ExtInsertMenu},
{"FileExist", "FE", 1, "S", (FARPROC)MACRO_FileExist},
{"FileOpen", "FO", 0, "", (FARPROC)MACRO_FileOpen},
{"Find", NULL, 0, "", (FARPROC)MACRO_Find},
{"Finder", "FD", 0, "", (FARPROC)MACRO_Finder},
{"FloatingMenu", NULL, 0, "", (FARPROC)MACRO_FloatingMenu},
{"Flush", "FH", 0, "", (FARPROC)MACRO_Flush},
{"FocusWindow", NULL, 0, "S", (FARPROC)MACRO_FocusWindow},
{"Generate", NULL, 0, "SUU", (FARPROC)MACRO_Generate},
{"GotoMark", NULL, 0, "S", (FARPROC)MACRO_GotoMark},
{"HelpOn", NULL, 0, "", (FARPROC)MACRO_HelpOn},
{"HelpOnTop", NULL, 0, "", (FARPROC)MACRO_HelpOnTop},
{"History", NULL, 0, "", (FARPROC)MACRO_History},
{"InitMPrint", NULL, 1, "", (FARPROC)MACRO_InitMPrint},
{"InsertItem", NULL, 0, "SSSSU", (FARPROC)MACRO_InsertItem},
{"InsertMenu", NULL, 0, "SSU", (FARPROC)MACRO_InsertMenu},
{"IfThen", "IF", 0, "BS", (FARPROC)MACRO_IfThen},
{"IfThenElse", "IE", 0, "BSS", (FARPROC)MACRO_IfThenElse},
{"IsBook", NULL, 1, "", (FARPROC)MACRO_IsBook},
{"IsMark", NULL, 1, "S", (FARPROC)MACRO_IsMark},
{"IsNotMark", "NM", 1, "S", (FARPROC)MACRO_IsNotMark},
{"JumpContents", NULL, 0, "SS", (FARPROC)MACRO_JumpContents},
{"JumpContext", "JC", 0, "SSU", (FARPROC)MACRO_JumpContext},
{"JumpHash", "JH", 0, "SSU", (FARPROC)MACRO_JumpHash},
{"JumpHelpOn", NULL, 0, "", (FARPROC)MACRO_JumpHelpOn},
{"JumpID", "JI", 0, "SS", (FARPROC)MACRO_JumpID},
{"JumpKeyword", "JK", 0, "SSS", (FARPROC)MACRO_JumpKeyword},
{"KLink", "KL", 0, "SUSS", (FARPROC)MACRO_KLink},
{"Menu", "MU", 0, "", (FARPROC)MACRO_Menu},
{"MPrintHash", NULL, 0, "U", (FARPROC)MACRO_MPrintHash},
{"MPrintID", NULL, 0, "S", (FARPROC)MACRO_MPrintID},
{"Next", NULL, 0, "", (FARPROC)MACRO_Next},
{"NoShow", "NS", 0, "", (FARPROC)MACRO_NoShow},
{"PopupContext", "PC", 0, "SU", (FARPROC)MACRO_PopupContext},
{"PopupHash", NULL, 0, "SU", (FARPROC)MACRO_PopupHash},
{"PopupId", "PI", 0, "SS", (FARPROC)MACRO_PopupId},
{"PositionWindow", "PW", 0, "IIUUUS", (FARPROC)MACRO_PositionWindow},
{"Prev", NULL, 0, "", (FARPROC)MACRO_Prev},
{"Print", NULL, 0, "", (FARPROC)MACRO_Print},
{"PrinterSetup", NULL, 0, "", (FARPROC)MACRO_PrinterSetup},
{"RegisterRoutine", "RR", 0, "SSS", (FARPROC)MACRO_RegisterRoutine},
{"RemoveAccelerator", "RA", 0, "UU", (FARPROC)MACRO_RemoveAccelerator},
{"ResetMenu", NULL, 0, "", (FARPROC)MACRO_ResetMenu},
{"SaveMark", NULL, 0, "S", (FARPROC)MACRO_SaveMark},
{"Search", NULL, 0, "", (FARPROC)MACRO_Search},
{"SetContents", NULL, 0, "SU", (FARPROC)MACRO_SetContents},
{"SetHelpOnFile", NULL, 0, "S", (FARPROC)MACRO_SetHelpOnFile},
{"SetPopupColor", "SPC",0, "UUU", (FARPROC)MACRO_SetPopupColor},
{"ShellExecute", "SE", 0, "SSUUSS", (FARPROC)MACRO_ShellExecute},
{"ShortCut", "SH", 0, "SSUUS", (FARPROC)MACRO_ShortCut},
{"TCard", NULL, 0, "U", (FARPROC)MACRO_TCard},
{"Test", NULL, 0, "U", (FARPROC)MACRO_Test},
{"TestALink", NULL, 1, "S", (FARPROC)MACRO_TestALink},
{"TestKLink", NULL, 1, "S", (FARPROC)MACRO_TestKLink},
{"UncheckItem", "UI", 0, "S", (FARPROC)MACRO_UncheckItem},
{"UpdateWindow", "UW", 0, "SS", (FARPROC)MACRO_UpdateWindow},
{"About", NULL, 0, "", MACRO_About},
{"AddAccelerator", "AA", 0, "UUS", MACRO_AddAccelerator},
{"ALink", "AL", 0, "SUS", MACRO_ALink},
{"Annotate", NULL, 0, "", MACRO_Annotate},
{"AppendItem", NULL, 0, "SSSS", MACRO_AppendItem},
{"Back", NULL, 0, "", MACRO_Back},
{"BackFlush", "BF", 0, "", MACRO_BackFlush},
{"BookmarkDefine", NULL, 0, "", MACRO_BookmarkDefine},
{"BookmarkMore", NULL, 0, "", MACRO_BookmarkMore},
{"BrowseButtons", NULL, 0, "", MACRO_BrowseButtons},
{"ChangeButtonBinding", "CBB",0, "SS", MACRO_ChangeButtonBinding},
{"ChangeEnable", "CE", 0, "SS", MACRO_ChangeEnable},
{"ChangeItemBinding", "CIB",0, "SS", MACRO_ChangeItemBinding},
{"CheckItem", "CI", 0, "S", MACRO_CheckItem},
{"CloseSecondarys", "CS", 0, "", MACRO_CloseSecondarys},
{"CloseWindow", "CW", 0, "S", MACRO_CloseWindow},
{"Compare", NULL, 0, "S", MACRO_Compare},
{"Contents", NULL, 0, "", MACRO_Contents},
{"ControlPanel", NULL, 0, "SSU", MACRO_ControlPanel},
{"CopyDialog", NULL, 0, "", MACRO_CopyDialog},
{"CopyTopic", "CT", 0, "", MACRO_CopyTopic},
{"CreateButton", "CB", 0, "SSS", MACRO_CreateButton},
{"DeleteItem", NULL, 0, "S", MACRO_DeleteItem},
{"DeleteMark", NULL, 0, "S", MACRO_DeleteMark},
{"DestroyButton", NULL, 0, "S", MACRO_DestroyButton},
{"DisableButton", "DB", 0, "S", MACRO_DisableButton},
{"DisableItem", "DI", 0, "S", MACRO_DisableItem},
{"EnableButton", "EB", 0, "S", MACRO_EnableButton},
{"EnableItem", "EI", 0, "S", MACRO_EnableItem},
{"EndMPrint", NULL, 0, "", MACRO_EndMPrint},
{"ExecFile", "EF", 0, "SSUS", MACRO_ExecFile},
{"ExecProgram", "EP", 0, "SU", MACRO_ExecProgram},
{"Exit", NULL, 0, "", MACRO_Exit},
{"ExtAbleItem", NULL, 0, "SU", MACRO_ExtAbleItem},
{"ExtInsertItem", NULL, 0, "SSSSUU", MACRO_ExtInsertItem},
{"ExtInsertMenu", NULL, 0, "SSSUU", MACRO_ExtInsertMenu},
{"FileExist", "FE", 1, "S", MACRO_FileExist},
{"FileOpen", "FO", 0, "", MACRO_FileOpen},
{"Find", NULL, 0, "", MACRO_Find},
{"Finder", "FD", 0, "", MACRO_Finder},
{"FloatingMenu", NULL, 0, "", MACRO_FloatingMenu},
{"Flush", "FH", 0, "", MACRO_Flush},
{"FocusWindow", NULL, 0, "S", MACRO_FocusWindow},
{"Generate", NULL, 0, "SUU", MACRO_Generate},
{"GotoMark", NULL, 0, "S", MACRO_GotoMark},
{"HelpOn", NULL, 0, "", MACRO_HelpOn},
{"HelpOnTop", NULL, 0, "", MACRO_HelpOnTop},
{"History", NULL, 0, "", MACRO_History},
{"InitMPrint", NULL, 1, "", MACRO_InitMPrint},
{"InsertItem", NULL, 0, "SSSSU", MACRO_InsertItem},
{"InsertMenu", NULL, 0, "SSU", MACRO_InsertMenu},
{"IfThen", "IF", 0, "BS", MACRO_IfThen},
{"IfThenElse", "IE", 0, "BSS", MACRO_IfThenElse},
{"IsBook", NULL, 1, "", MACRO_IsBook},
{"IsMark", NULL, 1, "S", MACRO_IsMark},
{"IsNotMark", "NM", 1, "S", MACRO_IsNotMark},
{"JumpContents", NULL, 0, "SS", MACRO_JumpContents},
{"JumpContext", "JC", 0, "SSU", MACRO_JumpContext},
{"JumpHash", "JH", 0, "SSU", MACRO_JumpHash},
{"JumpHelpOn", NULL, 0, "", MACRO_JumpHelpOn},
{"JumpID", "JI", 0, "SS", MACRO_JumpID},
{"JumpKeyword", "JK", 0, "SSS", MACRO_JumpKeyword},
{"KLink", "KL", 0, "SUSS", MACRO_KLink},
{"Menu", "MU", 0, "", MACRO_Menu},
{"MPrintHash", NULL, 0, "U", MACRO_MPrintHash},
{"MPrintID", NULL, 0, "S", MACRO_MPrintID},
{"Next", NULL, 0, "", MACRO_Next},
{"NoShow", "NS", 0, "", MACRO_NoShow},
{"PopupContext", "PC", 0, "SU", MACRO_PopupContext},
{"PopupHash", NULL, 0, "SU", MACRO_PopupHash},
{"PopupId", "PI", 0, "SS", MACRO_PopupId},
{"PositionWindow", "PW", 0, "IIUUUS", MACRO_PositionWindow},
{"Prev", NULL, 0, "", MACRO_Prev},
{"Print", NULL, 0, "", MACRO_Print},
{"PrinterSetup", NULL, 0, "", MACRO_PrinterSetup},
{"RegisterRoutine", "RR", 0, "SSS", MACRO_RegisterRoutine},
{"RemoveAccelerator", "RA", 0, "UU", MACRO_RemoveAccelerator},
{"ResetMenu", NULL, 0, "", MACRO_ResetMenu},
{"SaveMark", NULL, 0, "S", MACRO_SaveMark},
{"Search", NULL, 0, "", MACRO_Search},
{"SetContents", NULL, 0, "SU", MACRO_SetContents},
{"SetHelpOnFile", NULL, 0, "S", MACRO_SetHelpOnFile},
{"SetPopupColor", "SPC",0, "UUU", MACRO_SetPopupColor},
{"ShellExecute", "SE", 0, "SSUUSS", MACRO_ShellExecute},
{"ShortCut", "SH", 0, "SSUUS", MACRO_ShortCut},
{"TCard", NULL, 0, "U", MACRO_TCard},
{"Test", NULL, 0, "U", MACRO_Test},
{"TestALink", NULL, 1, "S", MACRO_TestALink},
{"TestKLink", NULL, 1, "S", MACRO_TestKLink},
{"UncheckItem", "UI", 0, "S", MACRO_UncheckItem},
{"UpdateWindow", "UW", 0, "SS", MACRO_UpdateWindow},
{NULL, NULL, 0, NULL, NULL}
};
......
......@@ -152,7 +152,7 @@ static const char* ts(int t)
}
}
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret);
static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret);
/******************************************************************
* MACRO_CheckArgs
......@@ -222,7 +222,7 @@ CheckArgs_end:
* Invokes boolean function fn, which arguments are defined by args
* stores bool result into ret
*/
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret)
{
void* pa[2];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
......@@ -234,8 +234,18 @@ static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
switch (strlen(args))
{
case 0: *ret = (void*)(fn)(); break;
case 1: *ret = (void*)(fn)(pa[0]); break;
case 0:
{
BOOL (WINAPI *func)(void) = fn;
*ret = (void *)(ULONG_PTR)func();
break;
}
case 1:
{
BOOL (WINAPI *func)(void *) = fn;
*ret = (void *)(ULONG_PTR)func( pa[0]);
break;
}
default: WINE_FIXME("NIY\n");
}
......@@ -247,7 +257,7 @@ static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
*
*
*/
static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
static int MACRO_CallVoidFunc(void *fn, const char* args)
{
void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
......@@ -259,13 +269,48 @@ static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
switch (strlen(args))
{
case 0: (fn)(); break;
case 1: (fn)(pa[0]); break;
case 2: (fn)(pa[0],pa[1]); break;
case 3: (fn)(pa[0],pa[1],pa[2]); break;
case 4: (fn)(pa[0],pa[1],pa[2],pa[3]); break;
case 5: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4]); break;
case 6: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); break;
case 0:
{
void (WINAPI *func)(void) = fn;
func();
break;
}
case 1:
{
void (WINAPI *func)(void*) = fn;
func( pa[0] );
break;
}
case 2:
{
void (WINAPI *func)(void*,void*) = fn;
func( pa[0], pa[1] );
break;
}
case 3:
{
void (WINAPI *func)(void*,void*,void*) = fn;
func( pa[0], pa[1], pa[2] );
break;
}
case 4:
{
void (WINAPI *func)(void*,void*,void*,void*) = fn;
func( pa[0], pa[1], pa[2], pa[3] );
break;
}
case 5:
{
void (WINAPI *func)(void*,void*,void*,void*,void*) = fn;
func( pa[0], pa[1], pa[2], pa[3], pa[4] );
break;
}
case 6:
{
void (WINAPI *func)(void*,void*,void*,void*,void*,void*) = fn;
func( pa[0], pa[1], pa[2], pa[3], pa[4], pa[5] );
break;
}
default: WINE_FIXME("NIY\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment