We don't discuss malware here, so we don't need to know where it's "inspired" from. This program - rename .com to .con - is kind of a stupid thing to do, but not actually "malicious"... I guess...
mov dx,file ;what files to search for, use [] as offset
This code is right, but the last part of the comment appears misleading...
mov di,[REAL_NAME]
This is wrong. You don't want the "[]".
mov dx,[REAL_NAME]
Likewise here. Translated from Masm/Tasm perhaps? When Masm/Tasm says "offset", we don't want the "[]". When Masm/Tasm doesn't say offset (possibly "byte ptr"), we want the "[]". There are exceptions to that, but it's the "general rule". Easy to make an error with this!
I can't test your code at the moment (probably wouldn't anyway - although it would be easy enough to modify this to change it back). I assembled it - came to 238 bytes. So when NTDVM hits an error at cs:0538, we know we're "off in the weeds" not executing intended code. The errors where you use "[contents]" where you wanted address/offset probably account for it.
I guess this is the part you were asking about...
mov si,DTA + 1EH ;DTA name address to dx
; comment does not match code
push si
mov di, REAL_NAME ; <- corrected
STEP:
lodsb ;load char from si to al
stosb ;store char from al to di
or al,al ;if char is null
jnz STEP ;jump if not null
mov byte [si-2],'N' ; <- byte, not word!
pop di
You want to move a byte 'N' into position, not a word. That (word) should just overwrite the zero terminator with another zero, so probably won't hurt. Fix loading dx, and I guess it should work.
Please don't post anything more "malicious" than this, okay?
Best,
Frank