Sign in to follow this  
Followers 0
SandelPerieanu

Help Me! Anyone!

15 posts in this topic

hi!

Help me to convert lockmedia.txt -> try.au3

lockmedia.txt - work very good. TESTED!

try.au3 - don't work! WHY?

Share this post


Link to post
Share on other sites



that doesnt work for me both msgbox have 1 in the title and my cd is locked


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

OMG i just ran it again, my cd drive started spinning at what seemeed faster than full speed, then explorer froze for 5 minutes. im not running it again!


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

This uses an actual boolean pointer... instead of int... works same for me, but perhaps safer for others... needs beta.

MsgBox(4096,LockDevice("e:",1),"Try yo CD")
MsgBox(4096,LockDevice("e:",0),"All Better")

Func LockDevice($szDriveWithColon,$bLock)
    Local Const $INVALID_HANDLE_VALUE = -1
    Local Const $OPEN_EXISTING = 3
    Local Const $FILE_ATTRIBUTE_NORMAL = 128
    Local Const $FILE_SHARE_WRITE = 2
    Local Const $GENERIC_READ = 2147483648
    Local Const $IOCTL_STORAGE_MEDIA_REMOVAL = 2967556

    $bLock = Not(Not $bLock)
    $szDriveWithColon = StringReplace($szDriveWithColon,"\","")
    If StringLen($szDriveWithColon) <> 2 Then Return -1
    
    $szDriveWithColon = "\\.\" & $szDriveWithColon

    $hDrive = DllCall("kernel32.dll","int","CreateFile","str",$szDriveWithColon, _
            "int",$GENERIC_READ,"int",$FILE_SHARE_WRITE,"ptr",0,"int",$OPEN_EXISTING, _
            "int",$FILE_ATTRIBUTE_NORMAL,"ptr",0)

    If $hDrive[0] = $INVALID_HANDLE_VALUE Then Return -2
    
    $bool = DLLStructCreate("byte")
    DLLStructSetData($bool,1,$bLock)

    $LockMediaRslt = DllCall("kernel32.dll","int","DeviceIoControl","int",$hDrive[0], _
            "int",$IOCTL_STORAGE_MEDIA_REMOVAL, "ptr",DllStructGetPtr($bool),"int",1, _
            "int",0,"int",0,"int_ptr",0,"ptr",0)
    DllCall("kernel32.dll","int","CloseHandle","int",$hDrive[0])
    
    $bool = 0
    
    Return $LockMediaRslt[0]
EndFunc

10x very much. it works on me very good!

Share this post


Link to post
Share on other sites

;===============================================================================
; Description:  Open, Close, and Toggle CD Door
; Usage       _OpenCDDoor(DriveName)
;               _CloseCDDoor(DriveName)
;               _ToggleCDDoor(DriveName)
; Author(s):    Ward
;===============================================================================

Func _MCISendString($Str)
    DllCall("winmm.dll", "int", "mciSendString", "str", $str, "int", 0, "int", 0, "int", 0)
EndFunc

Func _OpenCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Open")
EndFunc

Func _CloseCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Closed")
EndFunc

Func _ToggleCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    $Timer = TimerInit()
    _MCISendString("Set Drive" & $Drive & " Door Open")
    If TimerDiff($Timer) < 200 Then
        _MCISendString("Set Drive" & $Drive & " Door Closed")
    EndIf
EndFunc


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

;===============================================================================
; Description:  Open, Close, and Toggle CD Door
; Usage       _OpenCDDoor(DriveName)
;               _CloseCDDoor(DriveName)
;               _ToggleCDDoor(DriveName)
; Author(s):    Ward
;===============================================================================

Func _MCISendString($Str)
    DllCall("winmm.dll", "int", "mciSendString", "str", $str, "int", 0, "int", 0, "int", 0)
EndFunc

Func _OpenCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Open")
EndFunc

Func _CloseCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Closed")
EndFunc

Func _ToggleCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    $Timer = TimerInit()
    _MCISendString("Set Drive" & $Drive & " Door Open")
    If TimerDiff($Timer) < 200 Then
        _MCISendString("Set Drive" & $Drive & " Door Closed")
    EndIf
EndFunc

it's ok! works!

but

i try to convert

BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device

IOCTL_CHANGER_GET_PARAMETERS, // dwIoControlCode

NULL, // lpInBuffer

0, // nInBufferSize

(LPVOID) lpOutBuffer, // output buffer

(DWORD) nOutBufferSize, // size of output buffer

(LPDWORD) lpBytesReturned, // number of bytes returned

(LPOVERLAPPED) lpOverlapped //

OVERLAPPED structure);

into au3

this function detect if cd-rom is lock, unlock, opened, closed and much more parameters....

try: Autorun Pascal Builder 2

function CD_DoorIsLocked(DRIVE : DWORD) : boolean;

function CD_DoorIsOpen(DRIVE : DWORD) : boolean;

Edited by psandu.ro

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

hm.. how would I make the _ToggleCDDoor($Drive) by using CdTray() ? Or is it not possible?:)

Edit: Or get just the status of the cd tray (opened or closed)

Edit 2: I just read some old posts, I think it's possible heh.

Edited by forger

Share this post


Link to post
Share on other sites

Well actually, it's not necessary to get the cd tray status, at least how I see it. If you want it open, you set it to open :)

Share this post


Link to post
Share on other sites

i use base function:

Toggle_CD_Door()

Func Toggle_CD_Door()

$cddrive = DriveGetDrive('CDROM')

$togglecronos = TimerInit()

CDTray($cddrive[1], 'Close')

If TimerDiff($togglecronos) < 500 Then CDTray($cddrive[1], 'Open')

EndFunc ;==>Toggle_CD_Door

but, how i can detect if drive (cd_door) is open(close;lock;unlock)???

Share this post


Link to post
Share on other sites

I don't think you can. You can check with the DiskStatus(NOTREADY) if they have inserted a cd-rom disc, if that's what you're planning it for.

Share this post


Link to post
Share on other sites

check please test.rar

how ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0