Скрипты от скуки

Discussion in 'PHP' started by bul.666, 9 Jan 2008.

  1. demond

    demond Member

    Joined:
    5 Nov 2008
    Messages:
    101
    Likes Received:
    22
    Reputations:
    5
    cdrom eject

    Скрипт на PERL под ВИНДУ. выдвигает cdrom и обратно задвигает через пять секунд.
    Code:
    #!/usr/bin/perl
    
    # cdrom_eject.pl
    
    # извлечение и загрузка CDRom
    
    # by [email protected]  -  16.03.08
    
    use Win32API::File 0.08 qw( :ALL );
    
    
    
    $hCdRom= CreateFile( "\\\\.\\CdRom0", GENERIC_READ()|GENERIC_WRITE(),FILE_SHARE_READ()|FILE_SHARE_WRITE(), [], OPEN_EXISTING(), 0, [] )
    
          or  die "Can't CREATEFILE CDROM: $^E\n";
    
    $rez=DeviceIoControl($hCdRom, IOCTL_STORAGE_EJECT_MEDIA,[],[],[],[],[],[]);
    
    sleep(5);
    
    $rez=DeviceIoControl($hCdRom, IOCTL_STORAGE_LOAD_MEDIA,[],[],[],[],[],[]);
    
    CloseHandle($hCdRom);