9 #include "debugtools.h"
10 #include "wine/winuser16.h"
11 #include "wine/winbase16.h"
12 #include "winversion.h"
17 DEFAULT_DEBUG_CHANNEL(win)
20 /**********************************************************************
21 * WinHelp16 (USER.171)
23 BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
27 /* We might call WinExec() */
28 SYSLEVEL_ReleaseWin16Lock();
29 ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) );
30 SYSLEVEL_RestoreWin16Lock();
35 /**********************************************************************
36 * WinHelp32A (USER32.579)
38 BOOL WINAPI WinHelpA( HWND hWnd, LPCSTR lpHelpFile, UINT wCommand,
41 static WORD WM_WINHELP = 0;
51 WM_WINHELP=RegisterWindowMessageA("WM_WINHELP");
56 hDest = FindWindowA( "MS_WINHELP", NULL );
58 if(wCommand == HELP_QUIT)
61 if ( VERSION_GetVersion() == WIN31 ) {
62 winhelp = WinExec ( "winhelp.exe -x", SW_SHOWNORMAL );
66 winhelp = WinExec ( "winhlp32.exe -x", SW_SHOWNORMAL );
68 if ( winhelp <= 32 ) return FALSE;
69 if ( ! ( hDest = FindWindowA ( "MS_WINHELP", NULL ) )) return FALSE;
76 case HELP_SETCONTENTS:
78 case HELP_CONTEXTPOPUP:
88 dsize = strlen( (LPSTR)dwData )+1;
91 dsize = ((LPMULTIKEYHELP)dwData)->mkSize;
94 dsize = ((LPHELPWININFO)dwData)->wStructSize;
97 WARN("Unknown help command %d\n",wCommand);
101 nlen = strlen(lpHelpFile)+1;
104 size = sizeof(WINHELP) + nlen + dsize;
105 hwh = GlobalAlloc16(0,size);
106 lpwh = GlobalLock16(hwh);
108 lpwh->command = wCommand;
111 strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile);
112 lpwh->ofsFilename = sizeof(WINHELP);
114 lpwh->ofsFilename = 0;
116 memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
117 lpwh->ofsData = sizeof(WINHELP)+nlen;
121 return SendMessage16(hDest,WM_WINHELP,hWnd,hwh);
125 /**********************************************************************
126 * WinHelp32W (USER32.580)
128 BOOL WINAPI WinHelpW( HWND hWnd, LPCWSTR helpFile, UINT command,
131 LPSTR file = HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile );
132 BOOL ret = WinHelpA( hWnd, file, command, dwData );
133 HeapFree( GetProcessHeap(), 0, file );