A simple media-locking program for Win95

This program is a sample on how to lock removable media, preventing its removal, by using MS-DOS in21h calls under Win95. Some caveats, however: It will NOT work on NT, and it won’t work on all drives, even if the program says it succeeded in locking. For example, my own CD-ROM drive, doesn’t support locking, so the program will not work with it. Floppy drives usually don’t support locking either.

The program can be called : lock <drive letter> [-l | -u | -s]. -l will lock the drive. -u will unlock it and -s will dislay the lock count for the drive. The code has complete explanations on the functions, so here it is: lock.c