9 #include "debugtools.h"
12 #include "wine/winuser16.h"
13 #include "wine/winbase16.h"
18 DEFAULT_DEBUG_CHANNEL(win);
21 /* WinHelp internal structure */
32 /**********************************************************************
33 * WinHelp16 (USER.171)
35 BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
39 /* We might call WinExec() */
40 SYSLEVEL_ReleaseWin16Lock();
42 if (!(ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) )))
44 /* try to start the 16-bit winhelp */
45 if (WinExec( "winhelp.exe -x", SW_SHOWNORMAL ) >= 32)
48 ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) );
52 SYSLEVEL_RestoreWin16Lock();
57 /**********************************************************************
58 * WinHelpA (USER32.579)
60 BOOL WINAPI WinHelpA( HWND hWnd, LPCSTR lpHelpFile, UINT wCommand,
63 static WORD WM_WINHELP = 0;
72 WM_WINHELP=RegisterWindowMessageA("WM_WINHELP");
77 hDest = FindWindowA( "MS_WINHELP", NULL );
79 if(wCommand == HELP_QUIT) return TRUE;
80 if (WinExec ( "winhlp32.exe -x", SW_SHOWNORMAL ) < 32) return FALSE;
81 if ( ! ( hDest = FindWindowA ( "MS_WINHELP", NULL ) )) return FALSE;
88 case HELP_SETCONTENTS:
90 case HELP_CONTEXTPOPUP:
100 dsize = dwData ? strlen( (LPSTR)dwData )+1: 0;
103 dsize = ((LPMULTIKEYHELPA)dwData)->mkSize;
106 dsize = ((LPHELPWININFOA)dwData)->wStructSize;
109 WARN("Unknown help command %d\n",wCommand);
113 nlen = strlen(lpHelpFile)+1;
116 size = sizeof(WINHELP) + nlen + dsize;
117 hwh = GlobalAlloc16(0,size);
118 lpwh = GlobalLock16(hwh);
120 lpwh->command = wCommand;
123 strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile);
124 lpwh->ofsFilename = sizeof(WINHELP);
126 lpwh->ofsFilename = 0;
128 memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
129 lpwh->ofsData = sizeof(WINHELP)+nlen;
133 return SendMessage16(hDest,WM_WINHELP,hWnd,hwh);
137 /**********************************************************************
138 * WinHelpW (USER32.580)
140 BOOL WINAPI WinHelpW( HWND hWnd, LPCWSTR helpFile, UINT command,
143 LPSTR file = HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile );
144 BOOL ret = WinHelpA( hWnd, file, command, dwData );
145 HeapFree( GetProcessHeap(), 0, file );