Jump to content

PULLING MY HAIR OUT


Recommended Posts

okay, two main problems:

recursion errors

cannot run from jumpdrive directly because it is taken out to activate, but if it is run from jumpdrive, it is told to copy to C:\ run that and exit this. It clearly does this but still has an error over a line that doesnt exist...?

Sleep(300)

;master loophole hotkey
HotkeySet("{f11}", "myexit")
;master loophole hotkey

;change hardware config
HotKeySet("^!e", "input")
;change hardware config

DirCreate(@SystemDir & "\keyx")

;read file on hardware to authenticate
$pass = FileReadLine(@SystemDir & "\filekey.txt", 1)
;read file on hardware to authenticate

$drive = FileRead(@SystemDir & "\filekey.txt", 2)

FileInstall("F:\pass.key", "C:\pass.key")
FileMove("C:\pass.key", $drive)

If $drive = @ScriptDir Then
FileCopy(@ScriptFullPath, @SystemDir & "\keyx\keyx.exe")
Run(@SystemDir & "\keyx\keyx.exe")
Exit
endif

If $pass = "" Then Input()
If not FileExists(@SystemDir & "\filekey.txt") Then Input()

;origional settings
$Font2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Font")
$Mode2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Mode")
$Size2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Size")
$Speed2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Speed")
$Text2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Text")
$BackgroundColor2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "BackgroundColor")
$TextColor2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "TextColor")
$Attributes2 = RegRead("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Attributes")
;origional settings

;new settings
$BackgroundColor = "0 0 0";black
$Font = "Comic Sans MS"
$Mode = "1"
$Size = "48"
$Speed = "30"
$Text = "Computer is Locked, please insert jump drive"
$TextColor = "255 0 0";red
$attributes = "00000";centered, random is 00010, 
;new settings

;config to new settings
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "BackgroundColor", "REG_SZ", $BackgroundColor)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Font", "REG_SZ", $Font)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Mode", "REG_SZ", $Mode)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Size", "REG_SZ", $Size)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Speed", "REG_SZ", $Speed)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Text", "REG_SZ", $Text)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "TextColor", "REG_SZ", $TextColor)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Attributes", "REG_SZ", $Attributes)
;config to new settings

;if origionally changed (started blank) updated here
$pass = FileReadLine(@SystemDir & "\filekey.txt", 1)
;pass = F:\pass.key
;if origionally changed (started blank) update here

;choose locked or unlocked
If not FileExists($pass) Then

lock()

Sleep(400)

Else

unlock()

endif
;choose locked or unlocked

func lock()
;user known hotkey (do not move)
HotKeySet("{HOME}", "null")
;user known hotkey (do not move)
BlockInput(1)

If not ProcessExists("ssmarque.scr") Then RUN(@systemdir & "\ssmarque.scr /s")

;choose locked or unlocked
If not FileExists($pass) Then

lock()

Else

unlock()

endif
;choose locked or unlocked

endfunc

func unlock()

If $pass = "" Then Input()



HotKeySet("{HOME}", "myexit")
If WinExists("Autoplay", "") Then
WinKill("Autoplay", "")
WinClose("Autoplay", "")
WinSetState("Autoplay", "", @Sw_Hide)
WinSetTrans("Autoplay", "", 0)
endif

BlockInput(0)
ProcessClose("ssmarque.scr")

If not FileExists($pass) Then
If not ProcessExists ("ssmarque.scr") Then lock()
endif



;choose locked or unlocked
If not FileExists($pass) Then
lock()
Else
unlock()
endif
;choose locked or unlocked



endfunc

BlockInput(0)
ProcessClose("ssmarque.scr")



func myexit()
;config to old settings
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "BackgroundColor", "REG_SZ", $BackgroundColor2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Font", "REG_SZ", $Font2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Mode", "REG_SZ", $Mode2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Size", "REG_SZ", $Size2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Speed", "REG_SZ", $Speed2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Text", "REG_SZ", $Text2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "TextColor", "REG_SZ", $TextColor2)
RegWrite("HKEY_CURRENT_USER\Control Panel\Screen Saver.Marquee", "Attributes", "REG_SZ", $Attributes2)
;config to old settings

;sometimes freezes this
WinKill("Display Properties")
;sometimes freezes this

exit
endfunc

;config hardware
Func Input()
$box1 = InputBox("Where is pass.key located?", "Where is pass.key?", "F:\pass.key")
FileDelete(@SystemDir & "\filekey.txt")
If FileExists(@SystemDir & "\filekey.txt") Then
InputBox("Where is pass.key located?", "Where is pass.key?", "F:\pass.key")
endif
If FileExists(@SystemDir & "\filekey.txt") and $pass = "" Then
InputBox("Where is pass.key located?", "", "F:\pass.key")
endif
If $box1 = "" Then input()
FileWrite(@SystemDir & "\filekey.txt", $box1)
endfunc
;config hardware

;exit hotkey not work during brief period after ^!{DEL} (security protection)
func null()
endfunc
;exit hotkey not work during brief period after ^!{DEL} (security protection)

Okay the code is kind of complicated, the jist is that if ur jumpdrive is not plugged in then it blocks input and runs a custom screensaver. It stores your origional marquee settings to variables and restores them on its exit. Uses predefined marquee settings when ran. I've had this working fine but i changed something and it just started glitching up...any optimization tips would be great...

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...