-

         

)


- ( ) CD-ROM'  !

 2.5.434. [/etc/CD.lock.c]  / CD-ROM

/*----------------------------------------------------------------------------

*

* / CD-ROM

* ===================================

*

* build 0x001 @ 04.06.2003

----------------------------------------------------------------------------*/

#include <windows.h>

#include <winioctl.h>

#include <stdio.h>

#define IOCTL_CDROM_MEDIA_REMOVAL 0x24804

main(int argc, char **argv)

{

BOOL act;

DWORD xxxx;

HANDLE hCD;

PREVENT_MEDIA_REMOVAL pmrLockCDROM;



//

if (argc<3){printf("USAGE: CD.lock.exe \\\\.\\X: {+,-}\n"); return -1;}



if (argv[2][0]=='+') act=TRUE; //

else if (argv[2][0]=='-') act=FALSE; //

else {printf(stderr,"-ERR: in arg %c\n",argv[2][0]); return -1;}



//

hCD=CreateFile(argv[1],GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);

if (hCD == INVALID_HANDLE_VALUE) {printf("-ERR: get CD-ROM\n");return -1;}



// / CD-ROM'

pmrLockCDROM.PreventMediaRemoval = act;

DeviceIoControl (hCD, IOCTL_CDROM_MEDIA_REMOVAL,

&pmrLockCDROM, sizeof(pmrLockCDROM), NULL, 0, &xxxx, NULL);

}


    







Forekc.ru
, , , , , , , , , ,