leecher1337 / ntvdmx64

Run Microsoft Windows NTVDM (DOS) on 64bit Editions
808 stars 81 forks source link

DOS Unlink Problem #67

Closed Valsamon closed 4 years ago

Valsamon commented 4 years ago

Correct calls to Int 21/AH=41h allways return with carry set and error code 2 in AX (file not found), but the file is actually deleted.

leecher1337 commented 4 years ago

Sorry, I cannot reproduce this problem, please provide a sample.

I used the following program:

.model tiny
.data
  max1  db  32
  act1  db  ?
  inp1  db  30 dup(0)
  hande dw  ?
  isok  db 'OK$'
  isbad db 'FAIL$'

CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:CODE, DS:CODE, ES:CODE
ORG 100h
start: 
  ;enter the name of the file
  lea dx,max1
  mov ah,0ah
  int 21h

  mov si,offset act1
  lookup:
  inc si
  cmp byte ptr [si],0Dh
  jnz lookup
  mov byte ptr[si],0

  ;delete the file
  mov ah,41h
  lea dx, inp1
  int 21h
  jc exfail
  mov dx, offset isok
  mov ah, 09h
  int 21h
  mov ax, 4c00h
  int 21h
exfail:
  mov dx, offset isbad
  mov ah, 09h
  int 21h
  mov ax, 4C01h
  int 21h

Code ends
End start

Now testing with current ntvdm build:

Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\WORK>echo test>blabla

C:\WORK>deltst
nix
FAIL

C:\WORK>deltst
blabla
OK

C:\WORK>

DELTST.ZIP

Valsamon commented 4 years ago

It seems that with the current ntvdm build the problem is fixed. With the previous build that I had installed (which I think that was the latest when I noticed the problem), each and every correct call to Int 21h/41h was failing with code 2 in AX, including the one from the example you provided.

leecher1337 commented 4 years ago

Yeah, it seems that the mentioned build had multiple strange flaws. Must have been a bad build