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