ReactOS 0.4.15-dev-8146-gdc0ed6d
console.c
Go to the documentation of this file.
1
2/* INCLUDES *******************************************************************/
3
4// #include "ntvdm.h"
5
6// #define NDEBUG
7// #include <debug.h>
8
9// #include "emulator.h"
10#include "resource.h"
11
12/* VARIABLES ******************************************************************/
13
15
19
22static INT VdmMenuPos = -1;
24
25/*
26 * Those menu helpers were taken from the GUI frontend in winsrv.dll
27 */
28typedef struct _VDM_MENUITEM
29{
31 const struct _VDM_MENUITEM *SubMenu;
34
35static const VDM_MENUITEM VdmMenuItems[] =
36{
39 { -1, NULL, 0 }, /* Separator */
40 // { IDS_VDM_MOUNT_FLOPPY, NULL, ID_VDM_DRIVES },
41 // { IDS_VDM_EJECT_FLOPPY, NULL, ID_VDM_DRIVES },
42 { -1, NULL, 0 }, /* Separator */
44
45 { 0, NULL, 0 } /* End of list */
46};
47
49{
50 { -1, NULL, 0 }, /* Separator */
51 { IDS_CAPTURE_MOUSE, NULL, ID_CAPTURE_MOUSE }, /* "Capture mouse"; can be renamed to "Release mouse" */
52 { IDS_VDM_MENU , VdmMenuItems, 0 }, /* ReactOS VDM Menu */
53
54 { 0, NULL, 0 } /* End of list */
55};
56
57static VOID
59 const VDM_MENUITEM *Items)
60{
61 UINT i = 0;
62 WCHAR szMenuString[256];
63 HMENU hSubMenu;
64
65 do
66 {
67 if (Items[i].uID != (UINT)-1)
68 {
70 Items[i].uID,
71 szMenuString,
72 ARRAYSIZE(szMenuString)) > 0)
73 {
74 if (Items[i].SubMenu != NULL)
75 {
76 hSubMenu = CreatePopupMenu();
77 if (hSubMenu != NULL)
78 {
79 AppendMenuItems(hSubMenu, Items[i].SubMenu);
80
81 if (!AppendMenuW(hMenu,
83 (UINT_PTR)hSubMenu,
84 szMenuString))
85 {
86 DestroyMenu(hSubMenu);
87 }
88 }
89 }
90 else
91 {
92 AppendMenuW(hMenu,
94 Items[i].uCmdID,
95 szMenuString);
96 }
97 }
98 }
99 else
100 {
101 AppendMenuW(hMenu,
103 0,
104 NULL);
105 }
106 i++;
107 } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL && Items[i].uCmdID == 0));
108}
109
110static BOOL
112{
113 INT MenuPos, i;
115
116 /* Check for the presence of one of the VDM menu items */
117 for (i = 0; i <= MenuPos; i++)
118 {
120 {
121 /* Set VdmMenuPos to the position of the existing menu */
122 VdmMenuPos = i - 1;
123 return TRUE;
124 }
125 }
126 return FALSE;
127}
128
129static VOID
131{
132 WCHAR szMenuString[256];
133
134 /* Update "Capture/Release mouse" menu item */
137 szMenuString,
138 ARRAYSIZE(szMenuString)) > 0)
139 {
141 MF_BYCOMMAND, ID_CAPTURE_MOUSE, szMenuString);
142 }
143}
144
145/*static*/ VOID
147{
148 UINT_PTR ItemID;
149 USHORT i;
150
151 WCHAR szNoMedia[100];
152 WCHAR szMenuString1[256], szMenuString2[256];
153
154 /* Update the disks menu items */
155
158 szNoMedia,
159 ARRAYSIZE(szNoMedia));
160
163 szMenuString1,
164 ARRAYSIZE(szMenuString1));
165
166 for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
167 {
168 ItemID = ID_VDM_DRIVES + (2 * i);
169
173 {
174 /* Update item text */
175 _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i, GlobalSettings.FloppyDisks[i].Buffer);
176 szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
177 ModifyMenuW(hConsoleMenu, ItemID, MF_BYCOMMAND | MF_STRING, ItemID, szMenuString2);
178
179 /* Enable the eject item */
181 }
182 else
183 {
184 /* Update item text */
185 _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i, szNoMedia);
186 szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
187 ModifyMenuW(hConsoleMenu, ItemID, MF_BYCOMMAND | MF_STRING, ItemID, szMenuString2);
188
189 /* Disable the eject item */
191 }
192 }
193}
194
195static VOID
197{
200}
201
202static VOID
204{
205 HMENU hVdmSubMenu;
206 UINT_PTR ItemID;
207 UINT Pos;
208 USHORT i;
209 WCHAR szNoMedia[100];
210 WCHAR szMenuString1[256], szMenuString2[256];
211
212 hConsoleMenu = ConsoleMenuControl(ConOutHandle,
215 if (hConsoleMenu == NULL) return;
216
217 /* Get the position where we are going to insert our menu items */
219
220 /* Really add the menu if it doesn't already exist (in case eg. NTVDM crashed) */
222 {
223 /* Add all the menu entries */
225
226 /* Add the removable drives menu entries */
227 hVdmSubMenu = GetSubMenu(hConsoleMenu, VdmMenuPos + 2); // VdmMenuItems
228 Pos = 3; // After the 2 items and the separator in VdmMenuItems
229
232 szNoMedia,
233 ARRAYSIZE(szNoMedia));
234
237 szMenuString1,
238 ARRAYSIZE(szMenuString1));
239
240 /* Drive 'x' -- Mount */
241 for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
242 {
243 ItemID = ID_VDM_DRIVES + (2 * i);
244
245 /* Add the item */
246 _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i, szNoMedia);
247 szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
248 InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID, szMenuString2);
249 }
250
253 szMenuString1,
254 ARRAYSIZE(szMenuString1));
255
256 /* Drive 'x' -- Eject */
257 for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
258 {
259 ItemID = ID_VDM_DRIVES + (2 * i);
260
261 /* Add the item */
262 _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i);
263 szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
264 InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 1, szMenuString2);
265 }
266
267 /* Refresh the menu state */
270 }
271}
272
273static VOID
275{
276 UINT i = 0;
277 const VDM_MENUITEM *Items = VdmMainMenuItems;
278
279 do
280 {
282 i++;
283 } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL && Items[i].uCmdID == 0));
284
286}
287
289{
290 static BOOL IsClipped = FALSE; // For debugging purposes
291 UNREFERENCED_PARAMETER(IsClipped);
292
293 if (Capture)
294 {
295 RECT rcClip;
296
297 // if (IsClipped) return;
298
299 /* Be sure the cursor will be hidden */
300 while (ShowConsoleCursor(ConOutHandle, FALSE) >= 0) ;
301
302 GetClientRect(hConsoleWnd, &rcClip);
303 MapWindowPoints(hConsoleWnd, HWND_DESKTOP /*NULL*/, (LPPOINT)&rcClip, 2 /* Magic value when the LPPOINT parameter is a RECT */);
304 IsClipped = ClipCursor(&rcClip);
305 }
306 else
307 {
308 // if (!IsClipped) return;
309
311 IsClipped = FALSE;
312
313 /* Be sure the cursor will be shown */
314 while (ShowConsoleCursor(ConOutHandle, TRUE) < 0) ;
315 }
316}
317
319{
320 DWORD ConInMode;
321
322 if (GetConsoleMode(ConsoleInput, &ConInMode))
323 {
324#if 0
325 // GetNumberOfConsoleMouseButtons();
326 // GetSystemMetrics(SM_CMOUSEBUTTONS);
327 // GetSystemMetrics(SM_MOUSEPRESENT);
328 if (MousePresent)
329 {
330#endif
331 /* Support mouse input events if there is a mouse on the system */
332 ConInMode |= ENABLE_MOUSE_INPUT;
333#if 0
334 }
335 else
336 {
337 /* Do not support mouse input events if there is no mouse on the system */
338 ConInMode &= ~ENABLE_MOUSE_INPUT;
339 }
340#endif
341
342 SetConsoleMode(ConsoleInput, ConInMode);
343 }
344}
345
346
347
348
349
350
351
352/* PUBLIC FUNCTIONS ***********************************************************/
353
354/*static*/ VOID
355VdmShutdown(BOOLEAN Immediate);
356
357static BOOL
358WINAPI
360{
361 switch (ControlType)
362 {
364 {
365 /* Delayed shutdown */
366 DPRINT1("NTVDM delayed killing in the CTRL_LAST_CLOSE_EVENT CtrlHandler!\n");
368 break;
369 }
370
371 default:
372 {
373 /* Stop the VDM if the user logs out or closes the console */
374 DPRINT1("Killing NTVDM in the 'default' CtrlHandler!\n");
376 }
377 }
378 return TRUE;
379}
380
381static VOID
383{
386}
387
388static VOID
390{
391 /* Display again properly the mouse pointer */
393
395}
396
397BOOL
399{
400 /* Save the original input and output console modes */
403 {
406 wprintf(L"FATAL: Cannot save console in/out modes\n");
407 return FALSE;
408 }
409
410 /* Set the console input mode */
413
414 /* Set the console output mode */
415 // SetConsoleMode(ConsoleOutput, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
416
417 /* Initialize the UI */
419
420 return TRUE;
421}
422
423VOID
425{
426 /* Cleanup the UI */
428
429 /* Restore the original input and output console modes */
432}
433
434VOID
436{
438 CurrentConsoleOutput = ConOutHandle;
439 CreateVdmMenu(ConOutHandle);
440
441 /* Synchronize mouse cursor display with console screenbuffer switches */
443}
444
445static BOOL
447{
448 /* Set the handler routine */
450
451 /* Enable the CTRL_LAST_CLOSE_EVENT */
453
454 /*
455 * NOTE: The CONIN$ and CONOUT$ "virtual" files
456 * always point to non-redirected console handles.
457 */
458
459 /* Get the input handle to the real console, and check for success */
460 ConsoleInput = CreateFileW(L"CONIN$",
463 NULL,
465 0,
466 NULL);
468 {
469 wprintf(L"FATAL: Cannot retrieve a handle to the console input\n");
470 return FALSE;
471 }
472
473 /* Get the output handle to the real console, and check for success */
474 ConsoleOutput = CreateFileW(L"CONOUT$",
477 NULL,
479 0,
480 NULL);
482 {
484 wprintf(L"FATAL: Cannot retrieve a handle to the console output\n");
485 return FALSE;
486 }
487
488 /* Effectively attach to the console */
489 return ConsoleAttach();
490}
491
492static VOID
494{
495 /* Detach from the console */
497
498 /* Close the console handles */
501}
502
504{
505 DWORD dwMode;
506
507 /* Check whether the handle may be that of a console... */
508 if ((GetFileType(hHandle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR)
509 return FALSE;
510
511 /*
512 * It may be. Perform another test... The idea comes from the
513 * MSDN description of the WriteConsole API:
514 *
515 * "WriteConsole fails if it is used with a standard handle
516 * that is redirected to a file. If an application processes
517 * multilingual output that can be redirected, determine whether
518 * the output handle is a console handle (one method is to call
519 * the GetConsoleMode function and check whether it succeeds).
520 * If the handle is a console handle, call WriteConsole. If the
521 * handle is not a console handle, the output is redirected and
522 * you should call WriteFile to perform the I/O."
523 */
524 return GetConsoleMode(hHandle, &dwMode);
525}
526
528{
529 switch (MenuEvent->dwCommandId)
530 {
531 /*
532 * System-defined menu commands
533 */
534
535 case WM_INITMENU:
536 case WM_MENUSELECT:
537 {
538 /*
539 * If the mouse is captured, release it or recapture it
540 * when the menu opens or closes, respectively.
541 */
542 if (!CaptureMouse) break;
544 break;
545 }
546
547
548 /*
549 * User-defined menu commands
550 */
551
552 case ID_CAPTURE_MOUSE:
556 break;
557
560 break;
561
564 break;
565
566 /* Drive 0 -- Mount */
567 /* Drive 1 -- Mount */
568 case ID_VDM_DRIVES + 0:
569 case ID_VDM_DRIVES + 2:
570 {
571 ULONG DiskNumber = (MenuEvent->dwCommandId - ID_VDM_DRIVES) / 2;
572 MountFloppy(DiskNumber);
573 break;
574 }
575
576 /* Drive 0 -- Eject */
577 /* Drive 1 -- Eject */
578 case ID_VDM_DRIVES + 1:
579 case ID_VDM_DRIVES + 3:
580 {
581 ULONG DiskNumber = (MenuEvent->dwCommandId - ID_VDM_DRIVES - 1) / 2;
582 EjectFloppy(DiskNumber);
583 break;
584 }
585
586 case ID_VDM_QUIT:
587 /* Stop the VDM */
588 // EmulatorTerminate();
589
590 /* Nothing runs, so exit immediately */
591 DPRINT1("Killing NTVDM via console menu!\n");
593 break;
594
595 default:
596 break;
597 }
598}
599
601{
602 /*
603 * If the mouse is captured, release it or recapture it
604 * when we lose or regain focus, respectively.
605 */
606 if (!CaptureMouse) return;
608}
unsigned char BOOLEAN
#define DPRINT1
Definition: precomp.h:8
struct _Capture Capture
Definition: capture.h:24
ush Pos
Definition: deflate.h:92
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
HMENU WINAPI DECLSPEC_HOTPATCH ConsoleMenuControl(HANDLE hConsoleOutput, DWORD dwCmdIdLow, DWORD dwCmdIdHigh)
Definition: console.c:396
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
Definition: console.c:1569
INT WINAPI DECLSPEC_HOTPATCH ShowConsoleCursor(HANDLE hConsoleOutput, BOOL bShow)
Definition: console.c:1073
DWORD WINAPI SetLastConsoleEventActive(VOID)
Definition: console.c:3279
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1606
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2109
HWND WINAPI DECLSPEC_HOTPATCH GetConsoleWindow(VOID)
Definition: console.c:2729
DWORD WINAPI GetFileType(HANDLE hFile)
Definition: fileinfo.c:269
VOID DumpMemory(BOOLEAN TextFormat)
Definition: emulator.c:369
VOID EjectFloppy(IN ULONG DiskNumber)
Definition: emulator.c:467
VOID MountFloppy(IN ULONG DiskNumber)
Definition: emulator.c:413
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
NTVDM_SETTINGS GlobalSettings
Definition: ntvdm.c:28
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define IsConsoleHandle(h)
Definition: console.h:14
UNICODE_STRING FloppyDisks[2]
Definition: ntvdm.h:88
const struct _VDM_MENUITEM * SubMenu
Definition: console.c:31
UINT_PTR uCmdID
Definition: console.c:32
UINT uID
Definition: console.c:30
static VOID AppendMenuItems(HMENU hMenu, const VDM_MENUITEM *Items)
Definition: console.c:58
VOID UpdateVdmMenuDisks(VOID)
Definition: console.c:146
struct _VDM_MENUITEM * PVDM_MENUITEM
BOOL ConsoleAttach(VOID)
Definition: console.c:398
struct _VDM_MENUITEM VDM_MENUITEM
VOID VdmShutdown(BOOLEAN Immediate)
Definition: ntvdm.c:317
static BOOL VdmMenuExists(HMENU hConsoleMenu)
Definition: console.c:111
static VOID UpdateVdmMenuMouse(VOID)
Definition: console.c:130
static DWORD OrgConsoleOutputMode
Definition: console.c:18
static VOID DestroyVdmMenu(VOID)
Definition: console.c:274
static VOID ConsoleCleanup(VOID)
Definition: console.c:493
static BOOL CaptureMouse
Definition: console.c:23
static HANDLE CurrentConsoleOutput
Definition: console.c:14
static VOID CreateVdmMenu(HANDLE ConOutHandle)
Definition: console.c:203
HWND hConsoleWnd
Definition: console.c:20
VOID MenuEventHandler(PMENU_EVENT_RECORD MenuEvent)
Definition: console.c:527
VOID FocusEventHandler(PFOCUS_EVENT_RECORD FocusEvent)
Definition: console.c:600
static HMENU hConsoleMenu
Definition: console.c:21
static VOID ConsoleInitUI(VOID)
Definition: console.c:382
VOID ConsoleDetach(VOID)
Definition: console.c:424
static VOID EnableExtraHardware(HANDLE ConsoleInput)
Definition: console.c:318
static BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType)
Definition: console.c:359
static HANDLE ConsoleOutput
Definition: console.c:17
static BOOL ConsoleInit(VOID)
Definition: console.c:446
static const VDM_MENUITEM VdmMainMenuItems[]
Definition: console.c:48
static VOID CaptureMousePointer(HANDLE ConOutHandle, BOOLEAN Capture)
Definition: console.c:288
VOID ConsoleReattach(HANDLE ConOutHandle)
Definition: console.c:435
static DWORD OrgConsoleInputMode
Definition: console.c:18
static INT VdmMenuPos
Definition: console.c:22
static VOID UpdateVdmMenu(VOID)
Definition: console.c:196
static const VDM_MENUITEM VdmMenuItems[]
Definition: console.c:35
static VOID ConsoleCleanupUI(VOID)
Definition: console.c:389
#define IDS_RELEASE_MOUSE
Definition: resource.h:14
#define IDS_NO_MEDIA
Definition: resource.h:23
#define IDS_VDM_MENU
Definition: resource.h:15
#define IDS_VDM_EJECT_FLOPPY
Definition: resource.h:20
#define ID_VDM_DUMPMEM_BIN
Definition: resource.h:6
#define ID_VDM_DRIVES
Definition: resource.h:10
#define IDS_CAPTURE_MOUSE
Definition: resource.h:13
#define IDS_VDM_QUIT
Definition: resource.h:21
#define ID_CAPTURE_MOUSE
Definition: resource.h:4
#define IDS_VDM_DUMPMEM_TXT
Definition: resource.h:17
#define IDS_VDM_MOUNT_FLOPPY
Definition: resource.h:19
#define ID_VDM_QUIT
Definition: resource.h:7
#define IDS_VDM_DUMPMEM_BIN
Definition: resource.h:18
#define ID_VDM_DUMPMEM_TXT
Definition: resource.h:5
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define wprintf(...)
Definition: whoami.c:18
#define GetModuleHandle
Definition: winbase.h:3827
#define FILE_TYPE_CHAR
Definition: winbase.h:260
#define FILE_TYPE_REMOTE
Definition: winbase.h:262
#define ENABLE_MOUSE_INPUT
Definition: wincon.h:82
#define CTRL_LAST_CLOSE_EVENT
Definition: wincon.h:71
#define ENABLE_WINDOW_INPUT
Definition: wincon.h:81
#define WINAPI
Definition: msvc.h:6
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MF_BYCOMMAND
Definition: winuser.h:202
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
BOOL WINAPI ClipCursor(_In_opt_ LPCRECT)
#define MF_STRING
Definition: winuser.h:138
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_INITMENU
Definition: winuser.h:1745
UINT WINAPI GetMenuItemID(_In_ HMENU, _In_ int)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define MF_POPUP
Definition: winuser.h:136
#define HWND_DESKTOP
Definition: winuser.h:1209
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MF_ENABLED
Definition: winuser.h:128
#define MF_SEPARATOR
Definition: winuser.h:137
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI ModifyMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define WM_MENUSELECT
Definition: winuser.h:1747
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define MF_GRAYED
Definition: winuser.h:129
__wchar_t WCHAR
Definition: xmlstorage.h:180