Suppression "Insert a diskette into drive X:"

I am trying to check which drive contains drive A: (after installing my program, I need to make sure that the computer does not boot from the installation diskette). I tried to use the _access (undefined reference ...), FILE * method and make a directory inside a floppy disk and delete it after checking. Unfortunately, DOS displays an ugly piece of text about placing a disk on a disk (destroying my TUI and making the user think that a diskette is important). So, how to suppress this message or safely check if a disk is present on disk?

+5
source share
2 answers

OK I understood:

char far * bufptr; union REGS inregs, outregs; struct SREGS segregs; char buf [1024]; avaliable(){ redo: segread(&segregs); bufptr = (char far *) buf; segregs.es = FP_SEG(bufptr); inregs.x.bx = FP_OFF(bufptr); inregs.h.ah = 2; inregs.h.al = 1; inregs.h.ch = 0; inregs.h.cl = 1; inregs.h.dh = 0; inregs.h.dl = 0; int86x(0x13, &inregs, &outregs, &segregs); return outregs.x.cflag; } 

Returns true if the disk is in the disk.

+1
source

Perhaps BIOS INT 13H 16H: Media change detection - it has the status:

80H = diskette drive not ready or not installed

What can solve your problem - I do not have enough antique equipment and software to check it personally.

 #include <dos.h> unsigned int DetectMediaChange() { union REGS regs; regs.h.ah = 0x16; // Detect Media Change regs.h.dl = 0; // Drive A int86( 0x13, &regs, &regs ); // BIOS Disk I/O INT 13h return regs.h.ah ; // Status : 00H = diskette change line not active // 01H = invalid drive number // 06H = either change line is not supported or // disk change line is active (media was swapped) // 80H = diskette drive not ready or not installed // else= BIOS disk error code if CF is set to CY } 
+1
source

All Articles