Author: hbelusca
Date: Sun Sep 27 15:24:26 2015
New Revision: 69375
URL:
http://svn.reactos.org/svn/reactos?rev=69375&view=rev
Log:
[NTVDM]
- Start implementing a user menu for mounting/unmounting floppy disks at runtime. Menu
state refresh & proper localization remain to be done.
- Add a temporary "Sleep(INFINITE)" where the VdmShutdown function is
susceptible to trigger again a VDM cleanup in case it was called again in parallel. For
diagnosing CORE-10182, see also r69366.
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/CMakeLists.txt
trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c
trunk/reactos/subsystems/mvdm/ntvdm/emulator.c
trunk/reactos/subsystems/mvdm/ntvdm/emulator.h
trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.c
trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.h
trunk/reactos/subsystems/mvdm/ntvdm/lang/cs-CZ.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/de-DE.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/en-US.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/es-ES.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/fr-FR.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/it-IT.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/pl-PL.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/ro-RO.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/ru-RU.rc
trunk/reactos/subsystems/mvdm/ntvdm/lang/tr-TR.rc
trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.c
trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.h
trunk/reactos/subsystems/mvdm/ntvdm/resource.h
Modified: trunk/reactos/subsystems/mvdm/ntvdm/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/CMak…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/CMakeLists.txt [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -73,5 +73,5 @@
add_executable(ntvdm ${SOURCE})
set_module_type(ntvdm win32cui UNICODE IMAGEBASE 0x0F000000)
target_link_libraries(ntvdm fast486 ${PSEH_LIB})
-add_importlibs(ntvdm user32 gdi32 advapi32 msvcrt kernel32 ntdll)
+add_importlibs(ntvdm user32 gdi32 advapi32 comdlg32 msvcrt kernel32 ntdll)
add_cd_file(TARGET ntvdm DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/bios…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c [iso-8859-1] Sun Sep 27
15:24:26 2015
@@ -686,9 +686,9 @@
/* Detect and initialize the supported disks */
// TODO: the "Detect" part is missing.
- FloppyDrive[0] = &XDCFloppyDrive[0];
- FloppyDrive[1] = &XDCFloppyDrive[1];
- HardDrive[0] = &XDCHardDrive[0];
+ FloppyDrive[0] = RetrieveDisk(FLOPPY_DISK, 0);
+ FloppyDrive[1] = RetrieveDisk(FLOPPY_DISK, 1);
+ HardDrive[0] = RetrieveDisk(HARD_DISK, 0);
return TRUE;
}
Modified: trunk/reactos/subsystems/mvdm/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/emul…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/emulator.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/emulator.c [iso-8859-1] Sun Sep 27 15:24:26 2015
@@ -405,6 +405,51 @@
DPRINT1("Memory dump done\n");
}
+VOID MountFloppy(IN ULONG DiskNumber)
+{
+// FIXME: This should be present in PSDK commdlg.h
+//
+// FlagsEx Values
+#if (_WIN32_WINNT >= 0x0500)
+#define OFN_EX_NOPLACESBAR 0x00000001
+#endif // (_WIN32_WINNT >= 0x0500)
+
+ OPENFILENAMEA ofn;
+ CHAR szFile[MAX_PATH] = "";
+
+ RtlZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = hConsoleWnd;
+ ofn.lpstrTitle = "Select a virtual floppy image";
+ ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_LONGNAMES |
OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
+// ofn.FlagsEx = OFN_EX_NOPLACESBAR;
+ ofn.lpstrFilter = "Virtual floppy images (*.vfd;*.img;*.ima;*.dsk)\0*.vfd\0All
files (*.*)\0*.*\0";
+ ofn.lpstrDefExt = "vfd";
+ ofn.nFilterIndex = 0;
+ ofn.lpstrFile = szFile;
+ ofn.nMaxFile = ARRAYSIZE(szFile);
+
+ if (!GetOpenFileNameA(&ofn))
+ {
+ DPRINT1("CommDlgExtendedError = %d\n", CommDlgExtendedError());
+ return;
+ }
+
+ // TODO: Refresh the menu state
+
+ if (!MountDisk(FLOPPY_DISK, DiskNumber, szFile, !!(ofn.Flags & OFN_READONLY)))
+ DisplayMessage(L"An error happened when mounting disk %d",
DiskNumber);
+}
+
+VOID EjectFloppy(IN ULONG DiskNumber)
+{
+ // TODO: Refresh the menu state
+
+ if (!UnmountDisk(FLOPPY_DISK, DiskNumber))
+ DisplayMessage(L"An error happened when ejecting disk %d",
DiskNumber);
+}
+
+
VOID EmulatorPause(VOID)
{
/* Pause the VDM */
@@ -506,6 +551,18 @@
return FALSE;
}
+#if 0
+ // The following commands are examples of MountDisk usage.
+ // NOTE: Those values are hardcoded paths on my local test machines!!
+
+ // MountDisk(FLOPPY_DISK, 0, "H:\\trunk\\ntvdm_studies\\diskette_high.vfd",
TRUE);
+ // MountDisk(FLOPPY_DISK, 0, "H:\\DOS_tests\\Dos5.0.img", TRUE);
+ // MountDisk(FLOPPY_DISK, 0,
"H:\\trunk\\ntvdm_studies\\hdd_10Mo_fixed.vhd", TRUE);
+ // MountDisk(FLOPPY_DISK, 0, "H:\\DOS_tests\\diskette_test.vfd", FALSE);
+
+ MountDisk(HARD_DISK, 0, "H:\\DOS_tests\\MS-DOS 6_fixed_size.vhd", FALSE);
+#endif
+
/* Initialize the software callback system and register the emulator BOPs */
InitializeInt32();
RegisterBop(BOP_DEBUGGER , EmulatorDebugBreakBop);
Modified: trunk/reactos/subsystems/mvdm/ntvdm/emulator.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/emul…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/emulator.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/emulator.h [iso-8859-1] Sun Sep 27 15:24:26 2015
@@ -98,6 +98,9 @@
VOID DumpMemory(BOOLEAN TextFormat);
+VOID MountFloppy(IN ULONG DiskNumber);
+VOID EjectFloppy(IN ULONG DiskNumber);
+
UCHAR FASTCALL EmulatorIntAcknowledge
(
PFAST486_STATE State
Modified: trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/hard…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.c [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -156,8 +156,7 @@
/*************************** FLOPPY DISK CONTROLLER ***************************/
// A Floppy Controller can support up to 4 floppy drives.
-/*static*/
-DISK_IMAGE XDCFloppyDrive[4];
+static DISK_IMAGE XDCFloppyDrive[4];
// Taken from DOSBox
typedef struct _DISK_GEO
@@ -239,8 +238,7 @@
// An IDE Hard Disk Controller can support up to 4 drives:
// Primary Master Drive, Primary Slave Drive,
// Secondary Master Drive, Secondary Slave Drive.
-/*static*/
-DISK_IMAGE XDCHardDrive[4];
+static DISK_IMAGE XDCHardDrive[4];
BOOLEAN
MountHDD(IN PDISK_IMAGE DiskImage,
@@ -468,21 +466,59 @@
typedef BOOLEAN (*MOUNT_DISK_HANDLER)(IN PDISK_IMAGE DiskImage, IN HANDLE hFile);
+typedef struct _DISK_MOUNT_INFO
+{
+ PDISK_IMAGE DiskArray;
+ ULONG NumDisks;
+ MOUNT_DISK_HANDLER MountDiskHelper;
+} DISK_MOUNT_INFO, *PDISK_MOUNT_INFO;
+
+static DISK_MOUNT_INFO DiskMountInfo[MAX_DISK_TYPE] =
+{
+ {XDCFloppyDrive, ARRAYSIZE(XDCFloppyDrive), MountFDI},
+ {XDCHardDrive , ARRAYSIZE(XDCHardDrive) , MountHDD},
+};
+
+PDISK_IMAGE
+RetrieveDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber)
+{
+ ASSERT(DiskType < MAX_DISK_TYPE);
+
+ if (DiskNumber >= DiskMountInfo[DiskType].NumDisks)
+ {
+ DisplayMessage(L"RetrieveDisk: Disk number %d:%d invalid.", DiskType,
DiskNumber);
+ return NULL;
+ }
+
+ return &DiskMountInfo[DiskType].DiskArray[DiskNumber];
+}
+
BOOLEAN
-MountDisk(IN PDISK_IMAGE DiskImage,
- MOUNT_DISK_HANDLER MountDiskHelper,
+MountDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber,
IN PCSTR FileName,
IN BOOLEAN ReadOnly)
{
BOOLEAN Success = FALSE;
+ PDISK_IMAGE DiskImage;
HANDLE hFile;
BY_HANDLE_FILE_INFORMATION FileInformation;
+ ASSERT(DiskType < MAX_DISK_TYPE);
+
+ if (DiskNumber >= DiskMountInfo[DiskType].NumDisks)
+ {
+ DisplayMessage(L"MountDisk: Disk number %d:%d invalid.", DiskType,
DiskNumber);
+ return FALSE;
+ }
+
+ DiskImage = &DiskMountInfo[DiskType].DiskArray[DiskNumber];
if (IsDiskPresent(DiskImage))
{
- DisplayMessage(L"MountDisk: Disk 0x%p already in use.", DiskImage);
- return FALSE;
+ DPRINT1("MountDisk: Disk %d:%d:0x%p already in use, recycling...\n",
DiskType, DiskNumber, DiskImage);
+ UnmountDisk(DiskType, DiskNumber);
}
/* Try to open the file */
@@ -540,7 +576,7 @@
}
/* Success, mount the image */
- if (!MountDiskHelper(DiskImage, hFile))
+ if (!DiskMountInfo[DiskType].MountDiskHelper(DiskImage, hFile))
{
DisplayMessage(L"MountDisk: Failed to mount disk file '%S' in
0x%p.", FileName, DiskImage);
goto Quit;
@@ -553,11 +589,23 @@
}
BOOLEAN
-UnmountDisk(IN PDISK_IMAGE DiskImage)
-{
+UnmountDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber)
+{
+ PDISK_IMAGE DiskImage;
+
+ ASSERT(DiskType < MAX_DISK_TYPE);
+
+ if (DiskNumber >= DiskMountInfo[DiskType].NumDisks)
+ {
+ DisplayMessage(L"UnmountDisk: Disk number %d:%d invalid.", DiskType,
DiskNumber);
+ return FALSE;
+ }
+
+ DiskImage = &DiskMountInfo[DiskType].DiskArray[DiskNumber];
if (!IsDiskPresent(DiskImage))
{
- DisplayMessage(L"UnmountDisk: Disk 0x%p is already unmounted.",
DiskImage);
+ DPRINT1("UnmountDisk: Disk %d:%d:0x%p is already unmounted\n",
DiskType, DiskNumber, DiskImage);
return FALSE;
}
@@ -573,28 +621,20 @@
BOOLEAN DiskCtrlInitialize(VOID)
{
-#if 0
- // The following commands are examples of MountDisk usage.
- // NOTE: Those values are hardcoded paths on my local test machines!!
-
- // MountDisk(&XDCFloppyDrive[0], MountFDI,
"H:\\trunk\\ntvdm_studies\\diskette_high.vfd", TRUE);
- // MountDisk(&XDCFloppyDrive[0], MountFDI, "H:\\DOS_tests\\Dos5.0.img",
TRUE);
- // MountDisk(&XDCHardDrive[0] , MountHDD,
"H:\\trunk\\ntvdm_studies\\hdd_10Mo_fixed.vhd", TRUE);
-
- MountDisk(&XDCFloppyDrive[0], MountFDI,
"H:\\DOS_tests\\diskette_test.vfd", FALSE);
- MountDisk(&XDCHardDrive[0] , MountHDD, "H:\\DOS_tests\\MS-DOS
6_fixed_size.vhd", FALSE);
-#endif
-
return TRUE;
}
VOID DiskCtrlCleanup(VOID)
{
-#if 0
- // The following commands are examples of UnmountDisk usage.
- UnmountDisk(&XDCHardDrive[0]);
- UnmountDisk(&XDCFloppyDrive[0]);
-#endif
+ ULONG DiskNumber;
+
+ /* Unmount all the floppy disk drives */
+ for (DiskNumber = 0; DiskNumber < DiskMountInfo[FLOPPY_DISK].NumDisks;
++DiskNumber)
+ UnmountDisk(FLOPPY_DISK, DiskNumber);
+
+ /* Unmount all the hard disk drives */
+ for (DiskNumber = 0; DiskNumber < DiskMountInfo[HARD_DISK].NumDisks;
++DiskNumber)
+ UnmountDisk(HARD_DISK, DiskNumber);
}
/* EOF */
Modified: trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/hard…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/hardware/disk.h [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -39,9 +39,12 @@
} DISK_IMAGE, *PDISK_IMAGE;
-// HACKHACK! For dskbios32.c
-extern DISK_IMAGE XDCFloppyDrive[];
-extern DISK_IMAGE XDCHardDrive[];
+typedef enum _DISK_TYPE
+{
+ FLOPPY_DISK,
+ HARD_DISK,
+ MAX_DISK_TYPE
+} DISK_TYPE;
/* FUNCTIONS ******************************************************************/
@@ -68,6 +71,20 @@
IN BYTE Sector,
IN BYTE NumSectors);
+PDISK_IMAGE
+RetrieveDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber);
+
+BOOLEAN
+MountDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber,
+ IN PCSTR FileName,
+ IN BOOLEAN ReadOnly);
+
+BOOLEAN
+UnmountDisk(IN DISK_TYPE DiskType,
+ IN ULONG DiskNumber);
+
BOOLEAN DiskCtrlInitialize(VOID);
VOID DiskCtrlCleanup(VOID);
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/cs-CZ.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/cs-CZ.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/cs-CZ.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -15,7 +15,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Dump Memory (&Text)"
- IDS_VDM_DUMPMEM_BIN, "Dump Memory (&Binary)"
- IDS_VDM_QUIT , "&UkonÄit ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Dump Memory (&Text)"
+ IDS_VDM_DUMPMEM_BIN , "Dump Memory (&Binary)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&UkonÄit ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/de-DE.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Dump Memory (&Text)"
- IDS_VDM_DUMPMEM_BIN, "Dump Memory (&Binary)"
- IDS_VDM_QUIT , "ReactOS VDM b&eenden"
+ IDS_VDM_DUMPMEM_TXT , "Dump Memory (&Text)"
+ IDS_VDM_DUMPMEM_BIN , "Dump Memory (&Binary)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "ReactOS VDM b&eenden"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/en-US.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Dump Memory (&Text)"
- IDS_VDM_DUMPMEM_BIN, "Dump Memory (&Binary)"
- IDS_VDM_QUIT , "&Quit the ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Dump Memory (&Text)"
+ IDS_VDM_DUMPMEM_BIN , "Dump Memory (&Binary)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&Quit the ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/es-ES.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Dump Memory (&Text)"
- IDS_VDM_DUMPMEM_BIN, "Dump Memory (&Binary)"
- IDS_VDM_QUIT , "&Salir de ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Dump Memory (&Text)"
+ IDS_VDM_DUMPMEM_BIN , "Dump Memory (&Binary)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&Salir de ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/fr-FR.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Vidage Mémoire (&Texte)"
- IDS_VDM_DUMPMEM_BIN, "Vidage Mémoire (&Binaire)"
- IDS_VDM_QUIT , "&Quitter la ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Vidage Mémoire (&Texte)"
+ IDS_VDM_DUMPMEM_BIN , "Vidage Mémoire (&Binaire)"
+ IDS_VDM_MOUNT_FLOPPY, "Insérer une disquette dans le lecteur %d
<%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Ãjecter la disquette du lecteur %d"
+ IDS_VDM_QUIT , "&Quitter la ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/it-IT.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Dump Memory (&Text)"
- IDS_VDM_DUMPMEM_BIN, "Dump Memory (&Binary)"
- IDS_VDM_QUIT , "&Esci da ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Dump Memory (&Text)"
+ IDS_VDM_DUMPMEM_BIN , "Dump Memory (&Binary)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&Esci da ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/pl-PL.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -11,7 +11,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Zrzut pamiÄci (&Tekst)"
- IDS_VDM_DUMPMEM_BIN, "Zrzut pamiÄci (&Binarny)"
- IDS_VDM_QUIT , "&Wyjdź z ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Zrzut pamiÄci (&Tekst)"
+ IDS_VDM_DUMPMEM_BIN , "Zrzut pamiÄci (&Binarny)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&Wyjdź z ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/ro-RO.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "CapturÄ memorie (te&xt)"
- IDS_VDM_DUMPMEM_BIN, "CapturÄ memorie (&binarÄ)"
- IDS_VDM_QUIT , "I&eÈire din ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "CapturÄ memorie (te&xt)"
+ IDS_VDM_DUMPMEM_BIN , "CapturÄ memorie (&binarÄ)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "I&eÈire din ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/ru-RU.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -9,7 +9,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "Ðамп памÑÑи (&ТекÑÑовÑй)"
- IDS_VDM_DUMPMEM_BIN, "Ðамп памÑÑи (&ÐинаÑнÑй)"
- IDS_VDM_QUIT , "&ÐÑйÑи из ReactOS VDM"
+ IDS_VDM_DUMPMEM_TXT , "Ðамп памÑÑи (&ТекÑÑовÑй)"
+ IDS_VDM_DUMPMEM_BIN , "Ðамп памÑÑи (&ÐинаÑнÑй)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&ÐÑйÑи из ReactOS VDM"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/lang…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/lang/tr-TR.rc [iso-8859-1] Sun Sep 27 15:24:26
2015
@@ -11,7 +11,14 @@
STRINGTABLE
BEGIN
- IDS_VDM_DUMPMEM_TXT, "&Bellek Dökümünü Al (Metin)"
- IDS_VDM_DUMPMEM_BIN, "B&ellek Dökümünü Al (İkili)"
- IDS_VDM_QUIT , "&ReactOS VDM'den Ãık"
+ IDS_VDM_DUMPMEM_TXT , "&Bellek Dökümünü Al (Metin)"
+ IDS_VDM_DUMPMEM_BIN , "B&ellek Dökümünü Al (İkili)"
+ IDS_VDM_MOUNT_FLOPPY, "Insert a floppy in drive %d <%s>..."
+ IDS_VDM_EJECT_FLOPPY, "Eject floppy from drive %d"
+ IDS_VDM_QUIT , "&ReactOS VDM'den Ãık"
END
+
+STRINGTABLE
+BEGIN
+ IDS_NO_MEDIA, "No media"
+END
Modified: trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/ntvd…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.c [iso-8859-1] Sun Sep 27 15:24:26 2015
@@ -30,7 +30,7 @@
INT NtVdmArgc;
WCHAR** NtVdmArgv;
-
+HWND hConsoleWnd = NULL;
static HMENU hConsoleMenu = NULL;
static INT VdmMenuPos = -1;
static BOOLEAN ShowPointer = FALSE;
@@ -42,13 +42,17 @@
{
UINT uID;
const struct _VDM_MENUITEM *SubMenu;
- WORD wCmdID;
+ UINT_PTR uCmdID;
} VDM_MENUITEM, *PVDM_MENUITEM;
static const VDM_MENUITEM VdmMenuItems[] =
{
{ IDS_VDM_DUMPMEM_TXT, NULL, ID_VDM_DUMPMEM_TXT },
{ IDS_VDM_DUMPMEM_BIN, NULL, ID_VDM_DUMPMEM_BIN },
+ { -1, NULL, 0 }, /* Separator */
+ // { IDS_VDM_MOUNT_FLOPPY, NULL, ID_VDM_DRIVES },
+ // { IDS_VDM_EJECT_FLOPPY, NULL, ID_VDM_DRIVES },
+ { -1, NULL, 0 }, /* Separator */
{ IDS_VDM_QUIT , NULL, ID_VDM_QUIT },
{ 0, NULL, 0 } /* End of list */
@@ -57,7 +61,7 @@
static const VDM_MENUITEM VdmMainMenuItems[] =
{
{ -1, NULL, 0 }, /* Separator */
- { IDS_HIDE_MOUSE, NULL, ID_SHOWHIDE_MOUSE }, /* Hide mouse; can be renamed to Show
mouse */
+ { IDS_HIDE_MOUSE, NULL, ID_SHOWHIDE_MOUSE }, /* "Hide mouse"; can be
renamed to "Show mouse" */
{ IDS_VDM_MENU , VdmMenuItems, 0 }, /* ReactOS VDM Menu */
{ 0, NULL, 0 } /* End of list */
@@ -68,7 +72,7 @@
const VDM_MENUITEM *Items)
{
UINT i = 0;
- WCHAR szMenuString[255];
+ WCHAR szMenuString[256];
HMENU hSubMenu;
do
@@ -100,7 +104,7 @@
{
AppendMenuW(hMenu,
MF_STRING,
- Items[i].wCmdID,
+ Items[i].uCmdID,
szMenuString);
}
}
@@ -113,7 +117,7 @@
NULL);
}
i++;
- } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL &&
Items[i].wCmdID == 0));
+ } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL &&
Items[i].uCmdID == 0));
}
BOOL
@@ -138,9 +142,15 @@
/*static*/ VOID
CreateVdmMenu(HANDLE ConOutHandle)
{
+ HMENU hVdmSubMenu;
+ UINT_PTR ItemID = ID_VDM_DRIVES;
+ UINT Pos;
+ WCHAR szNoMedia[100];
+ WCHAR szMenuString1[256], szMenuString2[256];
+
hConsoleMenu = ConsoleMenuControl(ConOutHandle,
ID_SHOWHIDE_MOUSE,
- ID_VDM_QUIT);
+ ID_VDM_DRIVES + 4);
if (hConsoleMenu == NULL) return;
/* Get the position where we are going to insert our menu items */
@@ -149,8 +159,52 @@
/* Really add the menu if it doesn't already exist (in case eg. NTVDM crashed)
*/
if (!VdmMenuExists(hConsoleMenu))
{
+ /* Add all the menu entries */
AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
- DrawMenuBar(GetConsoleWindow());
+
+ /* Add the removable drives menu entries */
+ hVdmSubMenu = GetSubMenu(hConsoleMenu, VdmMenuPos + 2); // VdmMenuItems
+ Pos = 3; // After the 2 items and the separator in VdmMenuItems
+
+ LoadStringW(GetModuleHandle(NULL),
+ IDS_NO_MEDIA,
+ szNoMedia,
+ ARRAYSIZE(szNoMedia));
+
+ LoadStringW(GetModuleHandle(NULL),
+ IDS_VDM_MOUNT_FLOPPY,
+ szMenuString1,
+ ARRAYSIZE(szMenuString1));
+
+ /* Drive 0 -- Mount */
+ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, 0,
szNoMedia);
+ szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
+ InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 0,
szMenuString2);
+
+ /* Drive 1 -- Mount */
+ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, 1,
szNoMedia);
+ szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
+ InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 2,
szMenuString2);
+
+ LoadStringW(GetModuleHandle(NULL),
+ IDS_VDM_EJECT_FLOPPY,
+ szMenuString1,
+ ARRAYSIZE(szMenuString1));
+
+ /* Drive 0 -- Eject */
+ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, 0);
+ szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
+ InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 1,
szMenuString2);
+
+ /* Drive 1 -- Eject */
+ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, 1);
+ szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL;
+ InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 3,
szMenuString2);
+
+ // TODO: Refresh the menu state
+
+ /* Refresh the menu */
+ DrawMenuBar(hConsoleWnd);
}
}
@@ -164,14 +218,14 @@
{
DeleteMenu(hConsoleMenu, VdmMenuPos, MF_BYPOSITION);
i++;
- } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL &&
Items[i].wCmdID == 0));
-
- DrawMenuBar(GetConsoleWindow());
+ } while (!(Items[i].uID == 0 && Items[i].SubMenu == NULL &&
Items[i].uCmdID == 0));
+
+ DrawMenuBar(hConsoleWnd);
}
static VOID ShowHideMousePointer(HANDLE ConOutHandle, BOOLEAN ShowPtr)
{
- WCHAR szMenuString[255] = L"";
+ WCHAR szMenuString[256];
if (ShowPtr)
{
@@ -267,7 +321,7 @@
/* Display the message */
DPRINT1("\n\nNTVDM Subsystem\n%S\n\n", Buffer);
- MessageBoxW(NULL, Buffer, L"NTVDM Subsystem", MB_OK);
+ MessageBoxW(hConsoleWnd, Buffer, L"NTVDM Subsystem", MB_OK);
#ifndef WIN2K_COMPLIANT
/* Free the buffer if needed */
@@ -291,6 +345,7 @@
if (MustShutdown)
{
DPRINT1("Shutdown is ongoing...\n");
+ Sleep(INFINITE);
return;
}
@@ -343,6 +398,7 @@
static VOID
ConsoleInitUI(VOID)
{
+ hConsoleWnd = GetConsoleWindow();
CreateVdmMenu(ConsoleOutput);
}
@@ -468,6 +524,26 @@
case ID_VDM_DUMPMEM_BIN:
DumpMemory(FALSE);
break;
+
+ /* Drive 0 -- Mount */
+ /* Drive 1 -- Mount */
+ case ID_VDM_DRIVES + 0:
+ case ID_VDM_DRIVES + 2:
+ {
+ ULONG DiskNumber = (MenuEvent->dwCommandId - ID_VDM_DRIVES) / 2;
+ MountFloppy(DiskNumber);
+ break;
+ }
+
+ /* Drive 0 -- Eject */
+ /* Drive 1 -- Eject */
+ case ID_VDM_DRIVES + 1:
+ case ID_VDM_DRIVES + 3:
+ {
+ ULONG DiskNumber = (MenuEvent->dwCommandId - ID_VDM_DRIVES - 1) / 2;
+ EjectFloppy(DiskNumber);
+ break;
+ }
case ID_VDM_QUIT:
/* Stop the VDM */
Modified: trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/ntvd…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/ntvdm.h [iso-8859-1] Sun Sep 27 15:24:26 2015
@@ -24,6 +24,8 @@
#include <winnls.h>
#include <winreg.h>
#include <winuser.h>
+#include <commdlg.h>
+
#include <subsys/win/vdm.h>
// Do not include stuff that is only defined
@@ -73,6 +75,8 @@
extern INT NtVdmArgc;
extern WCHAR** NtVdmArgv;
+extern HWND hConsoleWnd;
+
/*
* Interface functions
Modified: trunk/reactos/subsystems/mvdm/ntvdm/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/reso…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/resource.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/resource.h [iso-8859-1] Sun Sep 27 15:24:26 2015
@@ -6,14 +6,21 @@
#define ID_VDM_DUMPMEM_BIN 1002
#define ID_VDM_QUIT 1003
+/* Menu IDs for removable media */
+#define ID_VDM_DRIVES 1010
+
/* String IDs */
#define IDS_HIDE_MOUSE 100
#define IDS_SHOW_MOUSE 101
#define IDS_VDM_MENU 102
-#define IDS_VDM_DUMPMEM_TXT 200
-#define IDS_VDM_DUMPMEM_BIN 201
-#define IDS_VDM_QUIT 202
+#define IDS_VDM_DUMPMEM_TXT 200
+#define IDS_VDM_DUMPMEM_BIN 201
+#define IDS_VDM_MOUNT_FLOPPY 202
+#define IDS_VDM_EJECT_FLOPPY 203
+#define IDS_VDM_QUIT 204
+
+#define IDS_NO_MEDIA 300
/* Icon */
#define IDI_APPICON 1