How is this done? I saw very little documentation on it and I think it went something like,
but I wasn't entirely sure.. can anyone clarify?Code:lea dx, ptrtofilename;
mov ah, 41h;
Printable View
How is this done? I saw very little documentation on it and I think it went something like,
but I wasn't entirely sure.. can anyone clarify?Code:lea dx, ptrtofilename;
mov ah, 41h;
It depends. What instruction set are you using? Is it going to be 32-bit or 16-bit? If its 32-bit (well, MASM), it wouldn't be too hard.
chem
INT 21H Function 41H : Delete File
This function deletes a file (but not read-only) from within a program. Load the address in the DX of an ASCII string containing the device path and filename, with no wild-card references:
A valid operation clears the carry flag, marks the filename in the directory as deleted, and releases the file's allocated disk space in the FAT. An error sets the carry flag and returns code 02, 03, or 05 in the AX.Code:ASCstrng DB 'd:\pathname', 00H ; ASCII string
...
MOV AH,41H
LEA DX, ASCstrng
INT 21H
you should get yourself Ralf-Brown's Interrupt List
http://www.cs.cmu.edu/afs/cs/user/ra...WWW/files.html
Thats compiler specific isn't it? I mean, the interrupts wouldn't work in 32-bit assembly?
Which is why I asked what he was using..
chem
compiler specific?
that is MS DOS (operating system) interrupt to delete a file, of course, you must using FAT filesystem.
whether the interrupt would works in 32-bit windows... em.. could create a com file to try. i am not so sure, but i guess it should work.
I'll give it a test when I get my new PC.
chem
k, just confirm, you can use the DOS interrupt to delete file, create directory and much more.
create a file in c:\apple.txt or wat sover place u want to put and (if change then modify the aa variable)Code:ORG 100h
jmp start
aa db 'c:\apple.txt',00h
start:
mov ah,41h
mov dx,aa
int 21h
mov ax,4ch
int 21h
i use fasm assembler (free and open source) http://flatassembler.net
Code:fasm myfile.txt myfile.com
Nice. That will become very useful. I've always had to resort to calling API's. No doubt this would be alot faster aswell (without having to go through all the windows crap beforehand).
Ta.
chem
Uh, in Windows, you should be calling the APIs, not using DOS interrupts. It's always better to do it the supported way.
ya, so that the code works in FAT, NTFS or watever new FS microsoft introduce ;-p
True, but it's always good to experiment (if you've got the money, and decide to ruin your PC :D).Quote:
Originally Posted by penagate
PS: How often do you change your avatar penagate? My god, its like you change it after every meal :p
chem
Change is healthy (or whatever). I refocused it again after twice being accused by RobDog of not seeing things properly :)
Congrats on 2K posts BTW.
lol. RobDog is wise.
Ta :)
chem