From b1e5b0ed4642580e435642a61cd0e03c43511a53 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sat, 30 May 2015 16:05:10 +0000 Subject: [PATCH] [NTVDM] adjust VdmMenuPos in case the menu already exists CORE-9487 svn path=/trunk/; revision=67971 --- reactos/subsystems/mvdm/ntvdm/ntvdm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/ntvdm.c b/reactos/subsystems/mvdm/ntvdm/ntvdm.c index a6ac026e2eb..7a00543d760 100644 --- a/reactos/subsystems/mvdm/ntvdm/ntvdm.c +++ b/reactos/subsystems/mvdm/ntvdm/ntvdm.c @@ -126,7 +126,11 @@ VdmMenuExists(HMENU hConsoleMenu) for (i = 0; i <= MenuPos; i++) { if (GetMenuItemID(hConsoleMenu, i) == ID_SHOWHIDE_MOUSE) + { + /* set VdmMenuPos to the position of the existing menu */ + VdmMenuPos = i - 1; return TRUE; + } } return FALSE; } @@ -141,8 +145,6 @@ CreateVdmMenu(HANDLE ConOutHandle) /* Get the position where we are going to insert our menu items */ VdmMenuPos = GetMenuItemCount(hConsoleMenu); - // FIXME: What happens if the menu already exist? - // VdmMenuPos points *after* the already existing menu! /* Really add the menu if it doesn't already exist (in case eg. NTVDM crashed) */ if (!VdmMenuExists(hConsoleMenu))