ReactOS  0.4.15-dev-994-ga9f6032
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:
77  case HELP_SETCONTENTS:
78  case HELP_CONTENTS:
79  case HELP_CONTEXTPOPUP:
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 }
#define HELP_PARTIALKEY
Definition: winuser.h:2388
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define HELP_CONTENTS
Definition: winuser.h:2380
#define HELP_CONTEXTPOPUP
Definition: winuser.h:2382
LONG data
Definition: winhelp.c:334
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
WORD size
Definition: winhelp.c:332
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HELP_QUIT
Definition: winuser.h:2389
#define HELP_HELPONHELP
Definition: winuser.h:2384
HWND hWnd
Definition: settings.c:17
static HANDLE ULONG_PTR dwData
Definition: file.c:35
UINT_PTR WPARAM
Definition: windef.h:207
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Definition: proc.c:4776
char * LPSTR
Definition: xmlstorage.h:182
#define HELP_FINDER
Definition: winuser.h:2394
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define HELP_FORCEFILE
Definition: winuser.h:2383
WORD ofsFilename
Definition: winhelp.c:336
GLsizeiptr size
Definition: glext.h:5919
#define HELP_CONTEXT
Definition: winuser.h:2381
#define HELP_SETWINPOS
Definition: winuser.h:2392
unsigned short WORD
Definition: ntddk_ex.h:93
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define HELP_MULTIKEY
Definition: winuser.h:2387
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HWND WINAPI FindWindowA(_In_opt_ LPCSTR, _In_opt_ LPCSTR)
struct tagMULTIKEYHELPA * LPMULTIKEYHELPA
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define HELP_COMMAND
Definition: winuser.h:2379
struct tagHELPWININFOA * LPHELPWININFOA
#define HELP_SETCONTENTS
Definition: winuser.h:2390
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
WORD command
Definition: winhelp.c:333
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)
#define HELP_KEY
Definition: winuser.h:2386

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 WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
HWND hWnd
Definition: settings.c:17
static HANDLE ULONG_PTR dwData
Definition: file.c:35
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
Definition: winhelp.c:49
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const char file[]
Definition: icontest.c:11
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define HeapFree(x, y, z)
Definition: compat.h:483
Definition: fci.c:126