Jump to content

Lock CD/DVD


Recommended Posts

I would like to be able to make a CD/DVD be unreadable until a correct username and password is created. I have a login script, but im not sure exactly what I would have to do in order to lock the CD/DVD until then.

Link to comment
Share on other sites

you are going to want to look into unmounting the device.... well.... thats all I can think of anyway... Im sure that the next post will be somebody proving me wrong though LOL

And the post after that will be somebody telling me to use less "..." LOL

What would happen if i unmounted the device and then ejected the disk? Would it leave the drive unmounted?

Link to comment
Share on other sites

I think that the disc would come out... did I misunderstand this question?

Yeah, i think you did lol. I know the disc would eject, my question is what would happen to the machine it was ejected from. Would the drive stay unmounted and unusable for normal user or would the drive become mounted again once my dvd is ejected

Link to comment
Share on other sites

OK, you could make the disc drive empty. Then add a recurring loop with a couple of functions, that will keep the disc drive shut, then add a hotkey for an inputbox and ask for a password. If its correct, "unlock the drive".

That sounds more like what I would want. How would I go about doing that?

Link to comment
Share on other sites

Something like:

#include <Misc.au3>
#include <String.au3>

HotKeySet("{F8}", "CDPass")
HotKeySet("{F9}", "CDFunc")

Global $File = @ScriptDir & '\password.ini'
Global $Encryption = "S4DC3"
Global $Drive = DriveGetDrive("CDROM")
Local $Locked = False

If Not _Singleton("CDL0CK", 1) Then
    MsgBox(262144, "Error", "CD Locker is already running!")
    Exit
EndIf

While 1
    Sleep(100)
    If $Locked = False Then
        CDTray($Drive, "open")
    ElseIf $Locked = True Then
        CdTray($Drive, "closed")
    EndIf
Wend

Func CDFunc()
    $OpenCD = InputBox("Password", "Please enter password, to unlock CD Drive:", "", "*")
    $Decrypted = _StringEncrypt(0, $OpenCD, $Encryption)
    $PassCheck = IniReadSection($File, "Password")
    If $PassCheck = $Decrypted Then
        MsgBox(4096, "CDLocker", "CD Draw unclocked!")
        $Locked = False
    ElseIf @error Then
        MsgBox(16, "CDLocker", "Invalid password!")
        Do
            $Locked = True
        Until $OpenCD = $Decrypted
    EndIf
EndFunc

Func CDPass()
    $Password = InputBox("Password", "Please specify a password:", "", "*")
    $Encrypted = _StringEncrypt(1, $Password, $Encryption)
    IniWrite($File, "Password", "Password", $Encrypted)
    MsgBox(4096, "Completed", "New password, saved and encrypted!")
EndFunc

I only made it quickly. I know it doesn't work. I made it a while ago, then I went ill and forgot about it. Try fix it up.

Link to comment
Share on other sites

Something like:

#include <Misc.au3>
#include <String.au3>

HotKeySet("{F8}", "CDPass")
HotKeySet("{F9}", "CDFunc")

Global $File = @ScriptDir & '\password.ini'
Global $Encryption = "S4DC3"
Global $Drive = DriveGetDrive("CDROM")
Local $Locked = False

If Not _Singleton("CDL0CK", 1) Then
    MsgBox(262144, "Error", "CD Locker is already running!")
    Exit
EndIf

While 1
    Sleep(100)
    If $Locked = False Then
        CDTray($Drive, "open")
    ElseIf $Locked = True Then
        CdTray($Drive, "closed")
    EndIf
Wend

Func CDFunc()
    $OpenCD = InputBox("Password", "Please enter password, to unlock CD Drive:", "", "*")
    $Decrypted = _StringEncrypt(0, $OpenCD, $Encryption)
    $PassCheck = IniReadSection($File, "Password")
    If $PassCheck = $Decrypted Then
        MsgBox(4096, "CDLocker", "CD Draw unclocked!")
        $Locked = False
    ElseIf @error Then
        MsgBox(16, "CDLocker", "Invalid password!")
        Do
            $Locked = True
        Until $OpenCD = $Decrypted
    EndIf
EndFunc

Func CDPass()
    $Password = InputBox("Password", "Please specify a password:", "", "*")
    $Encrypted = _StringEncrypt(1, $Password, $Encryption)
    IniWrite($File, "Password", "Password", $Encrypted)
    MsgBox(4096, "Completed", "New password, saved and encrypted!")
EndFunc

I only made it quickly. I know it doesn't work. I made it a while ago, then I went ill and forgot about it. Try fix it up.

Thanks for the start. I will let you know how it goes.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...