9 #include "debugtools.h"
12 #include "wine/winuser16.h"
13 #include "wine/winbase16.h"
14 #include "winversion.h"
19 DEFAULT_DEBUG_CHANNEL(win
)
22 /**********************************************************************
23 * WinHelp16 (USER.171)
25 BOOL16 WINAPI
WinHelp16( HWND16 hWnd
, LPCSTR lpHelpFile
, UINT16 wCommand
,
29 /* We might call WinExec() */
30 SYSLEVEL_ReleaseWin16Lock();
31 ret
= WinHelpA( hWnd
, lpHelpFile
, wCommand
, (DWORD
)PTR_SEG_TO_LIN(dwData
) );
32 SYSLEVEL_RestoreWin16Lock();
37 /**********************************************************************
38 * WinHelp32A (USER32.579)
40 BOOL WINAPI
WinHelpA( HWND hWnd
, LPCSTR lpHelpFile
, UINT wCommand
,
43 static WORD WM_WINHELP
= 0;
53 WM_WINHELP
=RegisterWindowMessageA("WM_WINHELP");
58 hDest
= FindWindowA( "MS_WINHELP", NULL
);
60 if(wCommand
== HELP_QUIT
)
63 if ( VERSION_GetVersion() == WIN31
) {
64 winhelp
= WinExec ( "winhelp.exe -x", SW_SHOWNORMAL
);
68 winhelp
= WinExec ( "winhlp32.exe -x", SW_SHOWNORMAL
);
70 if ( winhelp
<= 32 ) return FALSE
;
71 if ( ! ( hDest
= FindWindowA ( "MS_WINHELP", NULL
) )) return FALSE
;
78 case HELP_SETCONTENTS
:
80 case HELP_CONTEXTPOPUP
:
90 dsize
= strlen( (LPSTR
)dwData
)+1;
93 dsize
= ((LPMULTIKEYHELP
)dwData
)->mkSize
;
96 dsize
= ((LPHELPWININFO
)dwData
)->wStructSize
;
99 WARN("Unknown help command %d\n",wCommand
);
103 nlen
= strlen(lpHelpFile
)+1;
106 size
= sizeof(WINHELP
) + nlen
+ dsize
;
107 hwh
= GlobalAlloc16(0,size
);
108 lpwh
= GlobalLock16(hwh
);
110 lpwh
->command
= wCommand
;
113 strcpy(((char*)lpwh
) + sizeof(WINHELP
),lpHelpFile
);
114 lpwh
->ofsFilename
= sizeof(WINHELP
);
116 lpwh
->ofsFilename
= 0;
118 memcpy(((char*)lpwh
)+sizeof(WINHELP
)+nlen
,(LPSTR
)dwData
,dsize
);
119 lpwh
->ofsData
= sizeof(WINHELP
)+nlen
;
123 return SendMessage16(hDest
,WM_WINHELP
,hWnd
,hwh
);
127 /**********************************************************************
128 * WinHelp32W (USER32.580)
130 BOOL WINAPI
WinHelpW( HWND hWnd
, LPCWSTR helpFile
, UINT command
,
133 LPSTR file
= HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile
);
134 BOOL ret
= WinHelpA( hWnd
, file
, command
, dwData
);
135 HeapFree( GetProcessHeap(), 0, file
);