[PATCH] [WinHelp]: implemented ExecFile macro (fix for #23054)
Eric Pouech
eric.pouech at orange.fr
Tue Jun 8 14:44:20 CDT 2010
A+
---
programs/winhlp32/macro.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/programs/winhlp32/macro.c b/programs/winhlp32/macro.c
index 0e48ca8..c40ba06 100644
--- a/programs/winhlp32/macro.c
+++ b/programs/winhlp32/macro.c
@@ -64,6 +64,9 @@ static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR na
return b;
}
+/******* some forward declarations *******/
+static void CALLBACK MACRO_JumpID(LPCSTR lpszPathWindow, LPCSTR topic_id);
+
/******* real macro implementation *******/
void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
@@ -352,9 +355,30 @@ static void CALLBACK MACRO_EndMPrint(void)
WINE_FIXME("()\n");
}
-static void CALLBACK MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
+static void CALLBACK MACRO_ExecFile(LPCSTR pgm, LPCSTR args, LONG cmd_show, LPCSTR topic)
{
- WINE_FIXME("(\"%s\", \"%s\", %u, \"%s\")\n", str1, str2, u, str3);
+ static HINSTANCE (WINAPI *shell_exec)(HWND, LPCSTR, LPCSTR, LPCSTR, LPCSTR, INT);
+ HINSTANCE ret = 0;
+
+ WINE_TRACE("(\"%s\", \"%s\", %u, \"%s\")\n", pgm, args, cmd_show, topic);
+ if (!shell_exec)
+ {
+ HANDLE h;
+
+ if ((!(h = GetModuleHandle("shell32.dll")) && !(h = LoadLibraryA("shell32.dll"))) ||
+ !(shell_exec = (void*)GetProcAddress(h, "ShellExecuteA")))
+ {
+ WINE_ERR("Couldn't load shell32.ShellExecute\n");
+ }
+ }
+ if (shell_exec)
+ ret = (shell_exec)(Globals.active_win ? Globals.active_win->hMainWnd : NULL, "open",
+ pgm, args, ".", cmd_show);
+ if ((DWORD_PTR)ret < 32)
+ {
+ WINE_WARN("Failed with %p\n", ret);
+ if (topic) MACRO_JumpID(NULL, topic);
+ }
}
static void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
More information about the wine-patches
mailing list