Note that there are some explanatory texts on larger screens.

plurals
  1. POHow folder locking works
    primarykey
    data
    text
    <p>As windows doesn't provide password protection for individual folder, there are many third party software like 'Folder Lock' that does the job. I wanted to know the logic behind these kind of applications and found one code like this: <a href="http://code.google.com/p/lock-a-folder/source/browse/lock-a-folder.au3" rel="nofollow">'lock-a-folder'</a>. This is an AutoIt script which I am not familiar with. However, I just want to know the logic used here. </p> <p>These are the main functions of the script I am interested in:</p> <pre><code>Func Lock($slected) Local $Temp,$TempFile If @error or $slected = "" Then Return("Empty selection/Cancel Pressed") If Not FileExists($slected) Then MsgBox(0, $AppName, $slected &amp; " " &amp; Lang('doesntexist'), 0, $WIN1) Return('doesntexist') EndIf Local $l0ckd = RegRead("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders") _DebugOut('RegRead("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders") = ' &amp; $l0ckd) If Not StringInStr($l0ckd, $slected &amp; ".{90F8C996-7C70-4331-9D70-FB357D559FD5}|") = 0 Then MsgBox(0, $AppName, $slected &amp; " " &amp; Lang('alreadyinlist'), 0, $WIN1) Return('alreadyinlist') EndIf If $CmdLine[0] = 0 Then GUICtrlSetData($List1, "") GUICtrlSetData($List1, Lang('plzwait') &amp; "....") GUISetState(@SW_DISABLE) EndIf _DebugOut($slected) If $CmdLine[0] = 0 Then GUISetState(@SW_ENABLE) If DirMove($slected, $slected &amp; ".{90F8C996-7C70-4331-9D70-FB357D559FD5}") = 0 Then FileSetAttrib($slected, "-RSH") MsgBox(0, $AppName, $slected &amp; " " &amp; Lang('unable2lock'), 0, $WIN1) If $CmdLine[0] = 0 Then Readfolders() Return('unable2lock') EndIf $slected = $slected &amp; ".{90F8C996-7C70-4331-9D70-FB357D559FD5}" FileSetAttrib($slected, "+RSH") $l0ckd &amp;= $slected &amp; "|" _DebugOut("$l0ckd &amp;= $slected| = " &amp; $l0ckd) $debug = RegWrite("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders", "REG_SZ", $l0ckd) _DebugOut('RegWrite("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders", "REG_SZ", $l0ckd) = ' &amp; $debug) If $CmdLine[0] = 0 Then Readfolders() Return("Done") EndFunc ;==&gt;Lock Func UnLock($slected) _DebugOut($slected) If $slected = "" Or @error Then MsgBox(0, $AppName, Lang('selectfirst'), 0, $WIN1) Return("Empty selection/Cancel Pressed") EndIf If $CmdLine[0] = 0 Then GUICtrlSetData($List1, "") GUICtrlSetData($List1, Lang('plzwait') &amp; "....") GUISetState(@SW_DISABLE) EndIf Local $Temp = StringReplace($slected, ".{90F8C996-7C70-4331-9D70-FB357D559FD5}", "", 0, 2) _DebugOut("$Temp = " &amp; $Temp) FileSetAttrib($slected, "-RSH") Local $Temp1 $Temp1 = DirMove($slected, $Temp) If $CmdLine[0] = 0 Then GUISetState(@SW_ENABLE) If $Temp1 = 0 Then $Temp1 = DirMove($slected, $Temp &amp; ".recovered") EndIf If $Temp1 = 0 Then MsgBox(0, $AppName, $slected &amp; " " &amp; Lang('unable2unlock'), 0, $WIN1) If $CmdLine[0] = 0 Then Readfolders() Return('unable2unlock') EndIf Local $l0ckd = RegRead("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders") _DebugOut('RegRead("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders") = ' &amp; $l0ckd) $Temp = StringReplace($l0ckd, $slected &amp; "|", "") _DebugOut('StringReplace($l0ckd, $slected &amp; "|", "")' &amp; " = " &amp; $Temp) $debug = RegWrite("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders", "REG_SZ", $Temp) _DebugOut('RegWrite("HKEY_CURRENT_USER\SOFTWARE\" &amp; $AppName, "lockedfolders", "REG_SZ", $l0ckd) = ' &amp; $debug) If $CmdLine[0] = 0 Then Readfolders() Return("Done") EndFunc ;==&gt;UnLock </code></pre> <p>Can anybody please tell me the logic?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload