cdosturbo-cfloppy

Suppressing "Insert diskette to drive X:"


I am trying to check does any disk is present in drive A: (after my program installs i need to ensure that computer won't boot from installation diskette). I've tried using _access method (undefined reference...), FILE* and making directory inside diskette and remove it after checking. Unfortunately DOS displays ugly piece of text about putting disk in drive (Destroying my TUI and making user think that diskette in drive is important). So how to suppress this message, or safely check does disk is present in drive?


Solution

  • Okay, I've figured it out:

    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 disk is in drive.