Page 1 of 1

Having trouble mapping the COM1 interface of my VM to a port on the host

Posted: 12. Apr 2022, 19:39
by ZenHacker
I'm trying to map the COM1 interface in my MS-DOS VM to the printer interface on my host system (Windows 7) so that I can print files directly from MS-DOS. I've already managed to have it print to a file on the host filesystem and I've worked out that since the VM will send just the raw data (no interface-specific commands), I can easily map it to a USB printer without having to translate the signals, as it will simply send the data to be printed and the handshaking and other interface-specific signals will be handled transparently by the hardware. For example, if I'm writing documents in WordStar and configure the printer to "Generic PostScript", configure it to use the COM1 port for printing, and then map the COM1 port to a file, then it will simply send raw PostScript code to the file, which can then be printed. This will allow me to print files from WordStar (since PostScript is a universal standard and all printers recognize it), and also convert them to an interchangeable format such as PostScript or PDF that can be shared on the modern Internet. Essentially the "print to file" method allows me to print files from DOS in two steps: first printing to the host file through the COM1 interface, and then printing the host file using the normal procedure in Windows. I figured if I map the COM1 interface to whatever device or port interface the print spooler is using, I can merge these two steps into one, where the DOS program will send the PostScript code to my physical printer, using the VirtualBox port mapping as a proxy, allowing me to effectively print physical hard copies of documents directly from DOS.

Here's where I ran into some problems... I don't actually know the proper name or handle to use when mapping the COM1 interface. To get this information, I went into Devices and Printers and looked at the Printer Server Properties dialog box:

https://psychocod3r.files.wordpress.com ... -ports.png

According to this, I need to use the USB001 interface. Based on the tooltip shown by VirtualBox, I don't need a path for this port; I'm supposed to simply give it the name "USB001", like so:

https://psychocod3r.files.wordpress.com ... ttings.png

However, when I do this, I get a fatal error when I try to start up the MS-DOS VM, saying I used the wrong handle:

Code: Select all

Failed to open a session for the virtual machine MS-DOS 6.22.

Failed to open host device 'USB001' (VERR_INVALID_HANDLE).

Result Code: E_FAIL (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
I can only think of two possibilities: Either I used the wrong name, and it's supposed to be called something else, or I don't have permission to use that port. This is what I need help with, because I'm stumped as to what I need to do to make this work. I have attached the log file for my MS-DOS VM in case it's needed as a reference. Any help in understanding this problem would be greatly appreciated. Thanks.

Re: Having trouble mapping the COM1 interface of my VM to a port on the host

Posted: 13. Apr 2022, 01:04
by scottgus1
Please look through How to: Add a Serial Port in Windows XP and 7 Guest. Probably something there that can help.