ReactOS 0.4.15-dev-7889-g76290a6
winhelp.c File Reference
#include <user32.h>
Include dependency graph for winhelp.c:

Go to the source code of this file.

Classes

struct  WINHELP
 

Typedefs

typedef struct WINHELPLPWINHELP
 

Functions

BOOL WINAPI WinHelpA (HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
 
BOOL WINAPI WinHelpW (HWND hWnd, LPCWSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
 

Typedef Documentation

◆ LPWINHELP

Function Documentation

◆ WinHelpA()

BOOL WINAPI WinHelpA ( HWND  hWnd,
LPCSTR  lpszHelp,
UINT  uCommand,
DWORD_PTR  dwData 
)

Definition at line 49 of file winhelp.c.

50{
51 static WORD WM_WINHELP = 0;
52 HWND hDest;
53 LPWINHELP lpwh;
54 HGLOBAL hwh;
55 int size,dsize,nlen;
56
57 if (!WM_WINHELP) {
58 WM_WINHELP = RegisterWindowMessageA("WM_WINHELP");
59 if (!WM_WINHELP)
60 return FALSE;
61 }
62
63 hDest = FindWindowA("MS_WINHELP", NULL);
64 if (!hDest) {
65 if (uCommand == HELP_QUIT) return TRUE;
66 if (WinExec("winhlp32.exe -x", SW_SHOWNORMAL) < 32) {
67 //ERR("can't start winhlp32.exe -x ?\n");
68 return FALSE;
69 }
70 if (!(hDest = FindWindowA("MS_WINHELP", NULL))) {
71 //FIXME("did not find MS_WINHELP (FindWindow() failed, maybe global window handling still unimplemented)\n");
72 return FALSE;
73 }
74 }
75 switch (uCommand) {
76 case HELP_CONTEXT:
78 case HELP_CONTENTS:
80 case HELP_FORCEFILE:
81 case HELP_HELPONHELP:
82 case HELP_FINDER:
83 case HELP_QUIT:
84 dsize=0;
85 break;
86 case HELP_KEY:
87 case HELP_PARTIALKEY:
88 case HELP_COMMAND:
89 dsize = dwData ? strlen( (LPSTR)dwData )+1: 0;
90 break;
91 case HELP_MULTIKEY:
92 dsize = ((LPMULTIKEYHELPA)dwData)->mkSize;
93 break;
94 case HELP_SETWINPOS:
95 dsize = ((LPHELPWININFOA)dwData)->wStructSize;
96 break;
97 default:
98 //FIXME("Unknown help command %d\n",uCommand);
99 return FALSE;
100 }
101 if (lpszHelp)
102 nlen = strlen(lpszHelp)+1;
103 else
104 nlen = 0;
105 size = sizeof(WINHELP) + nlen + dsize;
106 hwh = GlobalAlloc(0,size);
107 if (hwh == NULL)
108 return FALSE;
109 lpwh = GlobalLock(hwh);
110 lpwh->size = size;
111 lpwh->command = uCommand;
112 lpwh->data = dwData;
113 if (nlen) {
114 strcpy(((char*)lpwh) + sizeof(WINHELP), lpszHelp);
115 lpwh->ofsFilename = sizeof(WINHELP);
116 } else {
117 lpwh->ofsFilename = 0;
118 }
119 if (dsize) {
120 memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
121 lpwh->ofsData = sizeof(WINHELP)+nlen;
122 } else {
123 lpwh->ofsData = 0;
124 }
125 GlobalUnlock(hwh);
126 return SendMessageA(hDest, WM_WINHELP, (WPARAM)hWnd, (LPARAM)hwh);
127}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Definition: proc.c:4773
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizeiptr size
Definition: glext.h:5919
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HANDLE ULONG_PTR dwData
Definition: file.c:35
WORD size
Definition: winhelp.c:336
WORD command
Definition: winhelp.c:337
WORD ofsFilename
Definition: winhelp.c:340
LONG data
Definition: winhelp.c:338
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define HELP_PARTIALKEY
Definition: winuser.h:2413
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
#define HELP_CONTEXTPOPUP
Definition: winuser.h:2407
struct tagHELPWININFOA * LPHELPWININFOA
#define HELP_QUIT
Definition: winuser.h:2414
#define HELP_SETCONTENTS
Definition: winuser.h:2415
#define HELP_HELPONHELP
Definition: winuser.h:2409
#define HELP_CONTENTS
Definition: winuser.h:2405
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HELP_COMMAND
Definition: winuser.h:2404
#define HELP_MULTIKEY
Definition: winuser.h:2412
struct tagMULTIKEYHELPA * LPMULTIKEYHELPA
#define HELP_CONTEXT
Definition: winuser.h:2406
#define HELP_FINDER
Definition: winuser.h:2419
#define HELP_FORCEFILE
Definition: winuser.h:2408
#define HELP_SETWINPOS
Definition: winuser.h:2417
#define HELP_KEY
Definition: winuser.h:2411
HWND WINAPI FindWindowA(_In_opt_ LPCSTR, _In_opt_ LPCSTR)
char * LPSTR
Definition: xmlstorage.h:182

Referenced by WinHelpW().

◆ WinHelpW()

BOOL WINAPI WinHelpW ( HWND  hWnd,
LPCWSTR  lpszHelp,
UINT  uCommand,
DWORD_PTR  dwData 
)

Definition at line 135 of file winhelp.c.

136{
137 INT len;
138 LPSTR file;
139 BOOL ret = FALSE;
140
141 if (!lpszHelp) return WinHelpA(hWnd, NULL, uCommand, dwData);
142
143 len = WideCharToMultiByte(CP_ACP, 0, lpszHelp, -1, NULL, 0, NULL, NULL);
144 if ((file = HeapAlloc(GetProcessHeap(), 0, len))) {
145 WideCharToMultiByte(CP_ACP, 0, lpszHelp, -1, file, len, NULL, NULL);
146 ret = WinHelpA(hWnd, file, uCommand, dwData);
148 }
149 return ret;
150}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
Definition: fci.c:127
int32_t INT
Definition: typedefs.h:58
int ret
BOOL WINAPI WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
Definition: winhelp.c:49