Skip to content

Commit

Permalink
Merge pull request #994 from cracyc/help
Browse files Browse the repository at this point in the history
substitute winhlp32 for winhelp in dde additem and support winhelp ex…
  • Loading branch information
otya128 authored Jun 10, 2021
2 parents eeb29ba + 94b9136 commit e9320fb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
7 changes: 7 additions & 0 deletions user/dde.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
static const WCHAR delete_itemW[] = {'D','e','l','e','t','e','I','t','e','m',0};
static const WCHAR replace_itemW[] = {'R','e','p','l','a','c','e','I','t','e','m',0};
static const WCHAR exit_progmanW[] = {'E','x','i','t','P','r','o','g','m','a','n',0};
static const WCHAR winhelpW[] = {'w','i','n','h','e','l','p','.','e','x','e',0};
static const WCHAR winhlp32W[] = {'w','i','n','h','l','p','3','2','.','e','x','e',0};

static const WCHAR dotexeW[] = {'.','e','x','e',0};
static const WCHAR dotlnkW[] = {'.','l','n','k',0};
Expand Down Expand Up @@ -570,6 +572,11 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
defdirpath = TRUE;
len = SearchPathW(argv[6], prg_name, dotexeW, 0, NULL, NULL);
}
if (!wcsicmp(prg_name, winhelpW))
{
prg_name = winhlp32W;
len = SearchPathW(NULL, prg_name, dotexeW, 0, NULL, NULL);
}
if (len == 0)
{
LocalFree(cmd_argv);
Expand Down
29 changes: 25 additions & 4 deletions winhlp32/macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,18 @@ static void CALLBACK MACRO_EndMPrint(void)

static void CALLBACK MACRO_ExecFile(LPCSTR pgm, LPCSTR args, LONG cmd_show, LPCSTR topic)
{
HINSTANCE ret;
HINSTANCE ret = 0;
char buffer[256];
HWND hwnd = Globals.active_win ? Globals.active_win->hMainWnd : NULL;

WINE_TRACE("(%s, %s, %u, %s)\n",
debugstr_a(pgm), debugstr_a(args), cmd_show, debugstr_a(topic));

ret = ShellExecuteA(Globals.active_win ? Globals.active_win->hMainWnd : NULL, "open",
pgm, args, ".", cmd_show);
strcpy(buffer, "The help file is asking to run the program below. Say no if you don't recognize it.\n");
strncat(buffer, pgm, 256 - strlen(buffer));
int but = MessageBoxA(hwnd, buffer, "Notice", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2);
if (but == IDYES)
ret = ShellExecuteA(hwnd, "open", pgm, args, ".", cmd_show);
if ((DWORD_PTR)ret < 32)
{
WINE_WARN("Failed with %p\n", ret);
Expand All @@ -481,7 +486,23 @@ static void CALLBACK MACRO_ExecFile(LPCSTR pgm, LPCSTR args, LONG cmd_show, LPCS

static void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
{
WINE_FIXME("(%s, %u)\n", debugstr_a(str), u);
HWND hwnd = Globals.active_win ? Globals.active_win->hMainWnd : NULL;
char buffer[256];
WINE_TRACE("(%s, %u)\n", debugstr_a(str), u);
strcpy(buffer, "The help file is asking to run the program below. Say no if you don't recognize it.\n");
strncat(buffer, str, 256 - strlen(buffer));
int ret = MessageBoxA(hwnd, buffer, "Notice", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2);
if (ret == IDYES)
{
STARTUPINFOA si = {0};
PROCESS_INFORMATION pi;
si.cb = sizeof(STARTUPINFOA);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = u;
CreateProcessA(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
}

void CALLBACK MACRO_Exit(void)
Expand Down

0 comments on commit e9320fb

Please sign in to comment.