- Add DPRINTs to the DumpMemory function.
- Use a VgaSetActiveScreenBuffer function to change active screen buffers: it calls the SetConsoleActiveScreenBuffer API but also recreates the VDM console menus, because on windows custom console menus are per-screen-buffer, and not per-console, so that if you set menus when one screen buffer is activated, and if you change it, then your menus become unuseful because for this new active screenbuffer, they are not set. It's completely ridiculous but we need to live with that (on ReactOS we still don't have this behaviour).

svn path=/trunk/; revision=64137
This commit is contained in:
Hermès Bélusca-Maïto 2014-09-14 00:43:43 +00:00
parent 75c869d7b5
commit fe68098da9
4 changed files with 26 additions and 7 deletions

View file

@ -355,6 +355,8 @@ VOID DumpMemory(VOID)
_snwprintf(FileName, MAX_PATH, L"memdump%lu.txt", DumpNumber);
++DumpNumber;
DPRINT1("Creating memory dump file '%S'...\n", FileName);
/* Always create the dump file */
hFile = CreateFileW(FileName,
GENERIC_WRITE,
@ -415,6 +417,8 @@ VOID DumpMemory(VOID)
/* Close the file */
CloseHandle(hFile);
DPRINT1("Memory dump done\n");
}
DWORD WINAPI PumpConsoleInput(LPVOID Parameter);

View file

@ -942,6 +942,16 @@ Cleanup:
return Result;
}
static VOID VgaSetActiveScreenBuffer(HANDLE ScreenBuffer)
{
/* Set the active buffer */
SetConsoleActiveScreenBuffer(ScreenBuffer);
/* Reinitialize the VDM menu */
DestroyVdmMenu();
CreateVdmMenu(ScreenBuffer);
}
static BOOL VgaEnterGraphicsMode(PCOORD Resolution)
{
DWORD i;
@ -999,7 +1009,7 @@ static BOOL VgaEnterGraphicsMode(PCOORD Resolution)
ZeroMemory(ConsoleFramebuffer, BitmapInfo->bmiHeader.biSizeImage);
/* Set the active buffer */
SetConsoleActiveScreenBuffer(GraphicsConsoleBuffer);
VgaSetActiveScreenBuffer(GraphicsConsoleBuffer);
/* Set the graphics mode palette */
SetConsolePalette(GraphicsConsoleBuffer,
@ -1018,7 +1028,7 @@ static VOID VgaLeaveGraphicsMode(VOID)
ReleaseMutex(ConsoleMutex);
/* Switch back to the default console text buffer */
// SetConsoleActiveScreenBuffer(TextConsoleBuffer);
// VgaSetActiveScreenBuffer(TextConsoleBuffer);
/* Cleanup the video data */
CloseHandle(ConsoleMutex);
@ -1034,7 +1044,7 @@ static BOOL VgaEnterTextMode(PCOORD Resolution)
DPRINT1("VgaEnterTextMode\n");
/* Switch to the text buffer */
SetConsoleActiveScreenBuffer(TextConsoleBuffer);
VgaSetActiveScreenBuffer(TextConsoleBuffer);
/* Adjust the text framebuffer if we changed the resolution */
if (TextResolution.X != Resolution->X ||
@ -1950,7 +1960,7 @@ VOID VgaDetachFromConsole(BOOL ChangingMode)
SMALL_RECT ConRect;
/* Restore the old screen buffer */
SetConsoleActiveScreenBuffer(TextConsoleBuffer);
VgaSetActiveScreenBuffer(TextConsoleBuffer);
/* Restore the original console size */
ConRect.Left = 0;
@ -1988,7 +1998,7 @@ BOOLEAN VgaInitialize(HANDLE TextHandle)
/***/ VgaResetPalette(); /***/
/* Switch to the text buffer */
SetConsoleActiveScreenBuffer(TextConsoleBuffer);
VgaSetActiveScreenBuffer(TextConsoleBuffer);
/* Clear the VGA memory */
VgaClearMemory();

View file

@ -119,7 +119,7 @@ AppendMenuItems(HMENU hMenu,
} while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL && Items[i].wCmdID == 0));
}
static VOID
/*static*/ VOID
CreateVdmMenu(HANDLE ConOutHandle)
{
hConsoleMenu = ConsoleMenuControl(ConOutHandle,
@ -132,7 +132,7 @@ CreateVdmMenu(HANDLE ConOutHandle)
DrawMenuBar(GetConsoleWindow());
}
static VOID
/*static*/ VOID
DestroyVdmMenu(VOID)
{
UINT i = 0;

View file

@ -48,6 +48,11 @@ extern HANDLE VdmTaskEvent;
VOID DisplayMessage(LPCWSTR Format, ...);
/*static*/ VOID
CreateVdmMenu(HANDLE ConOutHandle);
/*static*/ VOID
DestroyVdmMenu(VOID);
#endif // _NTVDM_H_
/* EOF */