joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.81k stars 383 forks source link

WordStar macros that access the file system fail under DOSBox-X but not vDosPlus or TameDOS #3012

Closed RobertJSawyer closed 3 years ago

RobertJSawyer commented 3 years ago

Code of Conduct & Contributing Guidelines

Have you checked that no other similar bug report(s) already exists?

What operating system(s) this bug have occurred on?

Windows 7 32-bit SP1

What version(s) of DOSBox-X have this bug?

0.83.18 both SDL1 and SDL2 32-bit

Describe the bug

DOSBox-X has trouble with WordStar for DOS 7.0 macros that access the file system to overwrite or delete existing files.

The attached macro SAMPLE.WSM copies DOSBox-X's README.TXT from DOSBox-X's drive Z: to a file named TESTFILE.TXT in the current folder, and then copies TESTFILE.TXT five times to files named COPY1.WS, COPY2.WS, COPY3.WS, COPY4.WS, and COPY5.WS.

I've provided error handling in the macro to deal with prompts to confirm overwriting or for files not found, so that it should run successfully regardless of whether TESTFILE.TXT or COPY?.WS already exist.

Furthermore, the macro sets WordStar to help level 0 while it is running, which turns off all confirmations, so the error handling is actually redundant. The macro should simply run to completion with no prompting for confirmations by the user, no matter how many times the macro is invoked.

If you run the attached macro SAMPLE.WSM from WordStar's OPENING MENU (by selecting MP, for Macro Play), it succeeds the FIRST time, when none of the files it tries to overwrite already exist.

But if you run it a SECOND (or subsequent time), it will crap out, first by asking the user for confirmations that should not be required, and, second, by dropping parts of commands.

The macro runs flawlessly under vDosPlus by @Wengier as well as TameDOS, but fails under DOSBox-X.

Expected behavior

WordStar should be able to overwrite or delete existing files using its own file-copy or file-delete commands from within a macro.

Steps to reproduce the behaviour

  1. Unzip the attached WordStar for DOS 7.0 macro named SAMPLE.WSM to the folder that contains your WordStar macros (commonly either C:\WS or C:\WS\MACROS).
  2. Run WordStar for DOS 7.0
  3. From WordStar's opening menu, run the macro SAMPLE by selecting M then P (for Macro Play) or Alt-U,M,P if using the pulldown menus)
  4. Macro will run flawlessly the first time, as none of the files it tries to overwrite yet exist.
  5. Macro will fail badly on second and subsequent invocations since the files it is trying to overwrite do exist. SAMPLE.zip

Used configuration

h mouse callback,
#                                                     but does not properly preserve CPU registers. Diagnostic function only (default off).
#                                   keyboardlayout: Language code of the keyboard layout (or none).
#                                   customcodepage: Set a custom code page for CHCP command and specify a SBCS code page file.
#                                             dbcs: Enable DBCS table and Chinese, Japanese, Korean support for the TrueType font (TTF) output.
#                                                     CAUTION: Some software will crash without the DBCS table, including the Open Watcom installer.
#                                     filenamechar: Enable filename char table
#                          collating and uppercase: Enable collating and uppercase table
#  con device use int 16h to detect keyboard input: If set, use INT 16h to detect keyboard input (MS-DOS 6.22 behavior). If clear, detect keyboard input by
#                                                     peeking into the BIOS keyboard buffer (Mainline DOSBox behavior). You will need to set this
#                                                     option for programs that hook INT 16h to handle keyboard input ahead of the DOS console.
#                                                     Microsoft Scandisk needs this option to respond to keyboard input correctly.
#         zero memory on int 21h memory allocation: If set, memory returned by the INT 21h allocation call is zeroed first. This is NOT what
#                                                     DOS actually does, but if set, can help certain DOS games and demos cope with problems
#                                                     related to uninitialized variables in the data or stack segment. If you intend to run a
#                                                     game or demo known to have this problem (Second Unreal, for example), set to true, else
#                                                     set to false. When enabled this option may incur a slight to moderate performance penalty.
#                      dos clipboard device enable: If enabled, a DOS device will be added for bidirectional communications with the shared clipboard.
#                                                     Setting to "read" will only allow read access, and setting to "write" will only allow write access.
#                                                     Setting to "full" or "true" enables both; setting to "false" or "disabled" disables the access or device.
#                                                     The default device name is CLIP$, but can be changed with the "dos clipboard device name" setting below.
#                        dos clipboard device name: Set DOS device name (up to 8 characters) for bidirectional communications with the shared clipboard.
#                                                     If unset or invalid, the default name CLIP$ will be used (e.g. "TYPE CLIP$" shows the clipboard contents).
#                                                     It has no effect if "dos clipboard device enable" is disabled, and it is deactivated if the secure mode is enabled.
#                                dos clipboard api: If set, DOS APIs for communications with the Windows clipboard will be enabled for shared clipboard communications.
xms                                              = true
xms handles                                      = 0
shell configuration as commands                  = false
hma                                              = true
hma allow reservation                            = true
hard drive data rate limit                       = -1
drive z is remote                                = auto
drive z expand path                              = true
drive z hide files                               = /A20GATE.COM /BIOSTEST.COM /DSXMENU.EXE /HEXMEM16.EXE /HEXMEM32.EXE /INT2FDBG.COM /LOADROM.COM /NMITEST.COM /VESAMOED.COM /VFRCRATE.COM
hidenonrepresentable                             = true
hma minimum allocation                           = 0
ansi.sys                                         = true
log console                                      = false
dos sda size                                     = 0
hma free space                                   = 34816
cpm compatibility mode                           = auto
share                                            = true
file access tries                                = 3
network redirector                               = true
minimum dos initial private segment              = 0
minimum mcb segment                              = 0
minimum mcb free                                 = 0
enable dummy device mcb                          = false
maximum environment block size on exec           = -1
additional environment block size on exec        = -1
enable a20 on windows init                       = false
zero memory on xms memory allocation             = false
ems                                              = true
vcpi                                             = true
unmask timer on disk io                          = false
zero int 67h if no ems                           = true
zero unused int 68h                              = false
emm386 startup active                            = false
zero memory on ems memory allocation             = false
ems system handle memory size                    = 384
ems system handle on even megabyte               = false
umb                                              = true
umb start                                        = 0
umb end                                          = 0
kernel allocation in umb                         = false
keep umb on boot                                 = false
keep private area on boot                        = auto
private area in umb                              = true
quick reboot                                     = false
ver                                              = 7.1
shellhigh                                        = auto
lfn                                              = auto
automount                                        = true
automountall                                     = false
mountwarning                                     = true
autoa20fix                                       = true
autoloadfix                                      = true
autofixwarning                                   = true
startcmd                                         = true
starttranspath                                   = false
startwait                                        = true
startquiet                                       = false
startincon                                       = assoc attrib chcp copy dir echo for ftype help if set type ver vol xcopy
int33                                            = true
int33 hide host cursor if interrupt subroutine   = true
int33 hide host cursor when polling              = false
int33 disable cell granularity                   = false
int 13 extensions                                = true
biosps2                                          = true
int15 wait force unmask irq                      = true
int15 mouse callback does not preserve registers = false
keyboardlayout                                   = auto
customcodepage                                   = 
dbcs                                             = true
filenamechar                                     = true
collating and uppercase                          = true
con device use int 16h to detect keyboard input  = true
zero memory on int 21h memory allocation         = false
dos clipboard device enable                      = true
dos clipboard device name                        = CLIP$
dos clipboard api                                = true

[ipx]
# ipx: Enable ipx over UDP/IP emulation.
ipx = false

[ne2000]
#  ne2000: Enable NE2000 Ethernet emulation.
# nicbase: The base address of the NE2000 board.
#  nicirq: The interrupt it uses. Note serial2 uses IRQ3 as default.
# macaddr: The MAC address the emulator will use for its network adapter.
#            If you have multiple DOSBox-Xes running on the same network,
#            this has to be changed for each. AC:DE:48 is an address range reserved for
#            private use, so modify the last three number blocks, e.g. AC:DE:48:88:99:AB.
# backend: The backend (either pcap or slirp is supported) used for the NE2000 Ethernet emulation.
#            If set to "auto", then "slirp" is selected when available, otherwise "pcap" is selected when available.
#            NE2000 Ethernet emulation will be disabled if no backend is available (or the specified backend if unavailble).
#            Possible values: pcap, slirp, auto, none.
ne2000  = false
nicbase = 300
nicirq  = 3
macaddr = AC:DE:48:88:99:AA
backend = pcap

[ethernet, pcap]
# realnic: Specifies which of your host network interfaces is used for pcap.
#            Write 'list' here to see the list of devices from the Help
#            menu ('List network interfaces') or from the Status Window.
#            Then make your choice and put either the interface number
#            (e.g. 2) or a part of your adapters name (e.g. VIA here).
# timeout: Specifies the read timeout for the device in milliseconds for the pcap backend, or the default value will be used.
realnic = list
timeout = default

[ethernet, slirp]
#            restricted: Disables access to the host from the guest.
#                          Services such as libslirp's DHCP server will no longer work.
# disable_host_loopback: Disables guest access to the host's loopback interfaces.
#                   mtu: The maximum transmission unit for Ethernet packets transmitted from the guest.
#                          Specifying 0 will use libslirp's default MTU.
#                   mru: The maximum recieve unit for Ethernet packets transmitted to the guest.
#                          Specifying 0 will use libslirp's default MRU.
#          ipv4_network: The IPv4 network the guest and host services are on.
#          ipv4_netmask: The netmask for the IPv4 network.
#             ipv4_host: The address of the guest on the IPv4 network.
#       ipv4_nameserver: The address of the nameserver service provided by the host on the IPv4 network.
#       ipv4_dhcp_start: The start address used for DHCP by the host services on the IPv4 network.
restricted            = false
disable_host_loopback = false
mtu                   = 0
mru                   = 0
ipv4_network          = 10.0.2.0
ipv4_netmask          = 255.255.255.0
ipv4_host             = 10.0.2.2
ipv4_nameserver       = 10.0.2.3
ipv4_dhcp_start       = 10.0.2.15

[ide, primary]
#                  enable: Enable IDE interface
#                     pnp: List IDE device in ISA PnP BIOS enumeration
#                     irq: IRQ used by IDE controller. Set to 0 for default.
#                            WARNING: Setting the IRQ to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the IDE controller.
#                                     Setting the IRQ to one already occupied by another device or IDE controller will trigger "resource conflict" errors in Windows 95.
#                                     Using IRQ 9, 12, 13, or IRQ 2-7 may cause problems with MS-DOS CD-ROM drivers.
#                      io: Base I/O port for IDE controller. Set to 0 for default.
#                            WARNING: Setting the I/O port to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the IDE controller.
#                                     Using any port other than 1F0, 170, 1E8 or 168 can prevent MS-DOS CD-ROM drivers from detecting the IDE controller.
#                   altio: Alternate I/O port for IDE controller (alt status, etc). Set to 0 for default.
#                            WARNING: Setting the I/O port to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the IDE controller.
#                                     For best compatability set this value to io+0x206, for example, io=1F0 altio=3F6.
#                                     The primary IDE controller will not claim port 3F7 if the primary floppy controller is enabled due to I/O port overlap in the 3F0-3F7 range.
#             int13fakeio: If set, force IDE state change on certain INT 13h commands.
#                            IDE registers will be changed as if BIOS had carried out the action.
#                            If you are running Windows 3.11 or Windows 3.11 Windows for Workgroups
#                            you must enable this option (and use -reservecyl 1) if you want 32-bit
#                            disk access to work correctly in DOSBox-X.
#          int13fakev86io: If set, and int13fakeio is set, certain INT 13h commands will cause IDE emulation to
#                            issue fake CPU I/O traps (GPF) in virtual 8086 mode and a fake IRQ signal. You must
#                            enable this option if you want 32-bit disk access in Windows 95 to work with DOSBox-X.
#            enable pio32: If set, 32-bit I/O reads and writes are handled directly (much like PCI IDE implementations)
#                            If clear, 32-bit I/O will be handled as if two 16-bit I/O (much like ISA IDE implementations)
#            ignore pio32: If 32-bit I/O is enabled, attempts to read/write 32-bit I/O will be ignored entirely.
#                            In this way, you can have DOSBox-X emulate one of the strange quirks of 1995-1997 era
#                            laptop hardware
#      cd-rom spinup time: Emulated CD-ROM time in ms to spin up if CD is stationary.
#                            Set to 0 to use controller or CD-ROM drive-specific default.
# cd-rom spindown timeout: Emulated CD-ROM time in ms that drive will spin down automatically when not in use
#                            Set to 0 to use controller or CD-ROM drive-specific default.
#  cd-rom insertion delay: Emulated CD-ROM time in ms that drive will report "medium not present"
#                            to emulate the time it takes for someone to take out a CD and insert a new one when
#                            DOSBox-X is instructed to swap or change CDs.
#                            When running Windows 95 or higher a delay of 4000ms is recommended to ensure that
#                            auto-insert notification triggers properly.
#                            Set to 0 to use controller or CD-ROM drive-specific default.
enable                  = true
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, secondary]
enable                  = true
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, tertiary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, quaternary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, quinternary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, sexternary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, septernary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[ide, octernary]
enable                  = false
pnp                     = true
irq                     = 0
io                      = 0
altio                   = 0
int13fakeio             = false
int13fakev86io          = false
enable pio32            = false
ignore pio32            = false
cd-rom spinup time      = 0
cd-rom spindown timeout = 0
cd-rom insertion delay  = 0

[fdc, primary]
#                 enable: Enable floppy controller interface
#                    pnp: List floppy controller in ISA PnP BIOS enumeration
#                    irq: IRQ used by floppy controller. Set to 0 for default.
#                           WARNING: Setting the IRQ to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the floppy controller.
#                                    Setting the IRQ to one already occupied by another device or IDE controller will trigger "resource conflict" errors in Windows 95.
#                                    Normally, floppy controllers use IRQ 6.
#                     io: Base I/O port for floppy controller. Set to 0 for default.
#                           WARNING: Setting the I/O port to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the IDE controller.
#                                    Standard I/O ports are 3F0 and 370.
#                    dma: DMA channel for floppy controller. Set to -1 for default.
#                           WARNING: Setting the DMA channel to non-standard values will not work unless the guest OS is using the ISA PnP BIOS to detect the IDE controller.
#                                    Standard DMA channel is 2.
#         int13fakev86io: If set, certain INT 13h commands will cause floppy emulation to issue fake CPU I/O
#                           traps (GPF) in virtual 8086 mode and a fake IRQ signal. You must enable this
#                           option if you want 32-bit floppy access in Windows 95 to work with DOSBox-X.
#           instant mode: If set, all floppy operations are 'instantaneous', they are carried
#                           out without any delay. Real hardware of course has motor, command
#                           and data I/O delays and so this option is off by default for realistic
#                           emulation.
# auto-attach to int 13h: If set, DOSBox-X will automatically attach a disk image as being
#                           inserted into a floppy drive attached to the controller when imgmount is used
#                           to mount a disk image to drive 0/1 or A/B. If not set, you must specify
#                           the -fdc option to imgmount to attach drive A/B to the floppy controller
#                           manually. You must use the -fdc option regardless if loading floppies into
#                           drives attached to any other FDC than the primary controller
#                   mode: Floppy controller mode. What the controller acts like.
#                             ps2                          PS/2 mode (most common)
#                             ps2_model30                  PS/2 model 30
#                             at                           AT mode
#                             xt                           PC/XT mode
#                   chip: Floppy controller chipset
#                             82077aa                      Intel 82077AA chipset
#                             82072                        Intel 82072 chipset
#                             nec_uPD765                   NEC uPD765 chipset
#                             none                         No chipset (For PC/XT mode)
enable                 = false
pnp                    = true
irq                    = 0
io                     = 0
dma                    = -1
int13fakev86io         = false
instant mode           = false
auto-attach to int 13h = true
mode                   = ps2
chip                   = 82077aa

[4dos]
rem = This section is the 4DOS.INI file, if you use 4DOS as the command shell
swapping       = xms
win95lfn       = YES
win95sfnsearch = YES
colordir       = ws ws7 ws4 sez boo ok? _t?:bright green on black;txt asc tra:green on black;com exe:bright cyan on cyan;bat btm:bright white on green;dirs bak wbk dcc dct lnk ark ar1 ar2 ar3 ar4 ''':purple on black;bmp cdr gif jpg pcx png thn tif:bright cyan on yellow;pdf:bright white on red;doc rtf pub xls ppt pmd: bright white on blue;sez pst: bright yellow on black;ncd zip: red on black;___:bright yellow on green;azw epu mob pdb:cyan on black;wsm wsh fou fad:bright yellow on black
alias          = 11000
ampm           = no
fuzzycd        = 1
batchecho      = no
beepfreq       = 0
beeplength     = 0
escapechar     = Ctrl-U
up             = Ctrl-E
down           = Ctrl-X
left           = Ctrl-S
right          = Ctrl-D
wordleft       = Ctrl-A
wordright      = Ctrl-F
beginline      = Ctrl-Q
endline        = Ctrl-Z
del            = Ctrl-G
ins            = Ctrl-V
delwordright   = Ctrl-T
delwordleft    = Alt-T
eraseline      = Ctrl-Y
execline       = Ctrl-K
histwinopen    = Ctrl-R
helpoptions    = 
environment    = 2560
history        = 1024
editmode       = Overstrike
cursorover     = 10
cursorins      = 100
uppercase      = Yes
ansi           = Auto
umbload        = Yes
umbenvironment = Yes
umbalias       = Yes
umbdirhistory  = Yes
umbfunction    = Yes
umbhistory     = Yes

[config]
#       rem: Records comments (remarks).
#     break: Sets or clears extended CTRL+C checking.
#              Possible values: on, off.
#   numlock: Sets the initial state of the NumLock key.
#              Possible values: on, off.
#     shell: Specifies the command shell (COMMAND.COM or 4DOS.COM).
#       dos: Reports whether DOS occupies HMA and allocates UMB memory (if available).
#      fcbs: Number of FCB handles available to DOS programs (1-255).
#     files: Number of file handles available to DOS programs (8-255).
#   country: Country code for date/time formats and optionally code page for TTF output and language files.
# lastdrive: The maximum drive letter (A-Z) that can be accessed by programs.
#              Possible values: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z.
rem         = This section is DOS's CONFIG.SYS file, not all CONFIG.SYS options supported
break       = off
numlock     = off
shell       = 4DOS.COM
dos         = high, umb
fcbs        = 100
files       = 200
country     = 
lastdrive   = z
set path    = Z:\;W:\;M:\F\BAT
set prompt  = $P$G
set temp    = 
install     = 
installhigh = 
device      = 
devicehigh  = 

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount M: C:\Sync\ /q > nul
mount C: C:\ /q > nul
mount F: M:\F\ /q > nul
mount G: G:\ /q > nul
mount H: M:\Inbox\Health\ /q > nul
mount d I:\ -t cdrom -usecd
cls
mount J: M:\F\Journals\ /q > nul
mount L: M:\F\Ltr\ /q > nul
mount N: M:\N\ /q > nul
mount O: M:\F\Novels\Oppie\ /q > nul
mount P: M:\PP\ /q > nul
mount R: M:\N\-Res\ /q > nul
mount S: M:\S\ /q > nul
mount T: M:\T\ /q > nul
mount V: M:\DOSBox-X\ /q > nul
mount W: M:\WS\ /q > nul
mount X: M:\F\Novels\ /q > nul
mount A: C:\Users\sawye\Desktop\ /q > nul
m:\f\4dos\dosbox-x.bat

Emulator log

No response

Additional context

No response

Wengier commented 3 years ago

Looks like a bug (only) in the last version (0.83.18) of DOSBox-X. The previous version (0.83.17) of DOSBox-X did not have this issue. Doing a git bisect shows that this is the first commit having this issue: https://github.com/joncampbell123/dosbox-x/commit/9a00b9f0e7c4b62163077e40c55ba6f219a3eb93 ("Fix to open devices added by device.com to allow IOCTL and other operations"). @nanshiki probably wants to take a look at this, since it is related to the IOCTL device driver fix.

nanshiki commented 3 years ago

@RobertJSawyer @Wengier

3015 to fix.

Wengier commented 3 years ago

@nanshiki It appears to fix the said problem. @RobertJSawyer can also try the latest build with the fix applied:

RobertJSawyer commented 3 years ago

You guys are the best! Thank you! Quick testing with the updated DOSBox-X shows the problem to be gone. THANK YOU AGAIN!

Rob in Toronto

viki-t-s commented 3 years ago

@RobertJSawyer can you please close this issue since it is resolved?

Dobby233Liu commented 3 years ago

@viki-t-s: Before that PR is merged this issue shouldn't be closed (also why i can't quote comments???)

Wengier commented 3 years ago

That PR is already merged, so closing.