Advertisement
Najeebsk

ATTRIBUTES-TOOL.au3

Nov 28th, 2022
2,332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 76.73 KB | None | 0 0
  1. #EndRegion Attributes Tool
  2. #NoTrayIcon
  3. ;FileInstall("F:\AUTOIT\ATTRIBUTES-TOOL\ATTRIBUTES-TOOL.au3", @ScriptDir & "\ATTRIBUTES-TOOL.au3")
  4. ;FileSetAttrib(@ScriptDir & "\ATTRIBUTES-TOOL.au3", "+H")
  5. #RequireAdmin
  6. ;~ Opt("MustDeclareVars", 1)
  7. Opt("GUICloseOnESC", 0)
  8. Opt("TrayAutoPause", 0)
  9. #Region ###include###
  10. ;~ #include <APIConstants.au3>
  11. ;~ #include <ButtonConstants.au3>
  12. ;~ #include <EditConstants.au3>
  13. ;~ #include <GUIConstantsEx.au3>
  14. ;~ #include <ProgressConstants.au3>
  15. ;~ #include <StaticConstants.au3>
  16. ;~ #include <WindowsConstants.au3>
  17. ;~ #include <File.au3>
  18. ;~ #include <WinAPIEx.au3>
  19. ;~ #include <WinAPIShPath.au3>
  20. ;~ #include <Misc.au3>
  21. Global Const $MSGFLT_ALLOW = 1
  22. Global Const $UBOUND_DIMENSIONS = 0
  23. Global Const $UBOUND_ROWS = 1
  24. Global Const $UBOUND_COLUMNS = 2
  25. Global Const $DT_ALL = "ALL"
  26. Global Const $DS_READY = "READY"
  27. Global Const $FT_MODIFIED = 0
  28. Global Const $FT_CREATED = 1
  29. Global Const $FT_ACCESSED = 2
  30. Global Const $FD_MULTISELECT = 4
  31. Global Const $FLTA_FILESFOLDERS = 0
  32. Global Const $FLTAR_FILESFOLDERS = 0
  33. Global Const $FLTAR_NORECUR = 0
  34. Global Const $FLTAR_NOSORT = 0
  35. Global Const $FLTAR_RELPATH = 1
  36. Global Const $STR_NOCASESENSEBASIC = 2
  37. Global Const $STR_STRIPLEADING = 1
  38. Global Const $STR_STRIPTRAILING = 2
  39. Global Const $BS_MULTILINE = 0x2000
  40. Global Const $BS_VCENTER = 0x0C00
  41. Global Const $BS_FLAT = 0x8000
  42. Global Const $GUI_SS_DEFAULT_CHECKBOX = 0
  43. Global Const $GUI_EVENT_CLOSE = -3
  44. Global Const $GUI_EVENT_DROPPED = -13
  45. Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG'
  46. Global Const $GUI_CHECKED = 1
  47. Global Const $GUI_DROPACCEPTED = 8
  48. Global Const $GUI_BKCOLOR_TRANSPARENT = -2
  49. Global Const $GUI_WS_EX_PARENTDRAG = 0x00100000
  50. Global Const $PBS_SMOOTH = 1
  51. Global Const $SS_CENTER = 0x1
  52. Global Const $SS_CENTERIMAGE = 0x0200
  53. Global Const $WS_EX_ACCEPTFILES = 0x00000010
  54. Global Const $WS_EX_TOPMOST = 0x00000008
  55. Global Const $WS_EX_WINDOWEDGE = 0x00000100
  56. Global Const $WM_COPYGLOBALDATA = 0x0049
  57. Global Const $WM_COPYDATA = 0x004A
  58. Global Const $WM_DROPFILES = 0x0233
  59. Func _ArrayConcatenate(ByRef $aArrayTarget, Const ByRef $aArraySource, $iStart = 0)
  60.     If $iStart = Default Then $iStart = 0
  61.     If Not IsArray($aArrayTarget) Then Return SetError(1, 0, -1)
  62.     If Not IsArray($aArraySource) Then Return SetError(2, 0, -1)
  63.     Local $iDim_Total_Tgt = UBound($aArrayTarget, $UBOUND_DIMENSIONS)
  64.     Local $iDim_Total_Src = UBound($aArraySource, $UBOUND_DIMENSIONS)
  65.     Local $iDim_1_Tgt = UBound($aArrayTarget, $UBOUND_ROWS)
  66.     Local $iDim_1_Src = UBound($aArraySource, $UBOUND_ROWS)
  67.     If $iStart < 0 Or $iStart > $iDim_1_Src - 1 Then Return SetError(6, 0, -1)
  68.     Switch $iDim_Total_Tgt
  69.         Case 1
  70.             If $iDim_Total_Src <> 1 Then Return SetError(4, 0, -1)
  71.             ReDim $aArrayTarget[$iDim_1_Tgt + $iDim_1_Src - $iStart]
  72.             For $i = $iStart To $iDim_1_Src - 1
  73.                 $aArrayTarget[$iDim_1_Tgt + $i - $iStart] = $aArraySource[$i]
  74.             Next
  75.         Case 2
  76.             If $iDim_Total_Src <> 2 Then Return SetError(4, 0, -1)
  77.             Local $iDim_2_Tgt = UBound($aArrayTarget, $UBOUND_COLUMNS)
  78.             If UBound($aArraySource, $UBOUND_COLUMNS) <> $iDim_2_Tgt Then Return SetError(5, 0, -1)
  79.             ReDim $aArrayTarget[$iDim_1_Tgt + $iDim_1_Src - $iStart][$iDim_2_Tgt]
  80.             For $i = $iStart To $iDim_1_Src - 1
  81.                 For $j = 0 To $iDim_2_Tgt - 1
  82.                     $aArrayTarget[$iDim_1_Tgt + $i - $iStart][$j] = $aArraySource[$i][$j]
  83.                 Next
  84.             Next
  85.         Case Else
  86.             Return SetError(3, 0, -1)
  87.     EndSwitch
  88.     Return UBound($aArrayTarget, $UBOUND_ROWS)
  89. EndFunc   ;==>_ArrayConcatenate
  90. Func _ArrayReverse(ByRef $aArray, $iStart = 0, $iEnd = 0)
  91.     If $iStart = Default Then $iStart = 0
  92.     If $iEnd = Default Then $iEnd = 0
  93.     If Not IsArray($aArray) Then Return SetError(1, 0, 0)
  94.     If UBound($aArray, $UBOUND_DIMENSIONS) <> 1 Then Return SetError(3, 0, 0)
  95.     If Not UBound($aArray) Then Return SetError(4, 0, 0)
  96.     Local $vTmp, $iUBound = UBound($aArray) - 1
  97.     If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound
  98.     If $iStart < 0 Then $iStart = 0
  99.     If $iStart > $iEnd Then Return SetError(2, 0, 0)
  100.     For $i = $iStart To Int(($iStart + $iEnd - 1) / 2)
  101.         $vTmp = $aArray[$i]
  102.         $aArray[$i] = $aArray[$iEnd]
  103.         $aArray[$iEnd] = $vTmp
  104.         $iEnd -= 1
  105.     Next
  106.     Return 1
  107. EndFunc   ;==>_ArrayReverse
  108. Func _ArraySort(ByRef $aArray, $iDescending = 0, $iStart = 0, $iEnd = 0, $iSubItem = 0, $iPivot = 0)
  109.     If $iDescending = Default Then $iDescending = 0
  110.     If $iStart = Default Then $iStart = 0
  111.     If $iEnd = Default Then $iEnd = 0
  112.     If $iSubItem = Default Then $iSubItem = 0
  113.     If $iPivot = Default Then $iPivot = 0
  114.     If Not IsArray($aArray) Then Return SetError(1, 0, 0)
  115.     Local $iUBound = UBound($aArray) - 1
  116.     If $iUBound = -1 Then Return SetError(5, 0, 0)
  117.     If $iEnd = Default Then $iEnd = 0
  118.     If $iEnd < 1 Or $iEnd > $iUBound Or $iEnd = Default Then $iEnd = $iUBound
  119.     If $iStart < 0 Or $iStart = Default Then $iStart = 0
  120.     If $iStart > $iEnd Then Return SetError(2, 0, 0)
  121.     If $iDescending = Default Then $iDescending = 0
  122.     If $iPivot = Default Then $iPivot = 0
  123.     If $iSubItem = Default Then $iSubItem = 0
  124.     Switch UBound($aArray, $UBOUND_DIMENSIONS)
  125.         Case 1
  126.             If $iPivot Then
  127.                 __ArrayDualPivotSort($aArray, $iStart, $iEnd)
  128.             Else
  129.                 __ArrayQuickSort1D($aArray, $iStart, $iEnd)
  130.             EndIf
  131.             If $iDescending Then _ArrayReverse($aArray, $iStart, $iEnd)
  132.         Case 2
  133.             If $iPivot Then Return SetError(6, 0, 0)
  134.             Local $iSubMax = UBound($aArray, $UBOUND_COLUMNS) - 1
  135.             If $iSubItem > $iSubMax Then Return SetError(3, 0, 0)
  136.             If $iDescending Then
  137.                 $iDescending = -1
  138.             Else
  139.                 $iDescending = 1
  140.             EndIf
  141.             __ArrayQuickSort2D($aArray, $iDescending, $iStart, $iEnd, $iSubItem, $iSubMax)
  142.         Case Else
  143.             Return SetError(4, 0, 0)
  144.     EndSwitch
  145.     Return 1
  146. EndFunc   ;==>_ArraySort
  147. Func __ArrayQuickSort1D(ByRef $aArray, Const ByRef $iStart, Const ByRef $iEnd)
  148.     If $iEnd <= $iStart Then Return
  149.     Local $vTmp
  150.     If ($iEnd - $iStart) < 15 Then
  151.         Local $vCur
  152.         For $i = $iStart + 1 To $iEnd
  153.             $vTmp = $aArray[$i]
  154.             If IsNumber($vTmp) Then
  155.                 For $j = $i - 1 To $iStart Step -1
  156.                     $vCur = $aArray[$j]
  157.                     If ($vTmp >= $vCur And IsNumber($vCur)) Or (Not IsNumber($vCur) And StringCompare($vTmp, $vCur) >= 0) Then ExitLoop
  158.                     $aArray[$j + 1] = $vCur
  159.                 Next
  160.             Else
  161.                 For $j = $i - 1 To $iStart Step -1
  162.                     If (StringCompare($vTmp, $aArray[$j]) >= 0) Then ExitLoop
  163.                     $aArray[$j + 1] = $aArray[$j]
  164.                 Next
  165.             EndIf
  166.             $aArray[$j + 1] = $vTmp
  167.         Next
  168.         Return
  169.     EndIf
  170.     Local $L = $iStart, $R = $iEnd, $vPivot = $aArray[Int(($iStart + $iEnd) / 2)], $bNum = IsNumber($vPivot)
  171.     Do
  172.         If $bNum Then
  173.             While ($aArray[$L] < $vPivot And IsNumber($aArray[$L])) Or (Not IsNumber($aArray[$L]) And StringCompare($aArray[$L], $vPivot) < 0)
  174.                 $L += 1
  175.             WEnd
  176.             While ($aArray[$R] > $vPivot And IsNumber($aArray[$R])) Or (Not IsNumber($aArray[$R]) And StringCompare($aArray[$R], $vPivot) > 0)
  177.                 $R -= 1
  178.             WEnd
  179.         Else
  180.             While (StringCompare($aArray[$L], $vPivot) < 0)
  181.                 $L += 1
  182.             WEnd
  183.             While (StringCompare($aArray[$R], $vPivot) > 0)
  184.                 $R -= 1
  185.             WEnd
  186.         EndIf
  187.         If $L <= $R Then
  188.             $vTmp = $aArray[$L]
  189.             $aArray[$L] = $aArray[$R]
  190.             $aArray[$R] = $vTmp
  191.             $L += 1
  192.             $R -= 1
  193.         EndIf
  194.     Until $L > $R
  195.     __ArrayQuickSort1D($aArray, $iStart, $R)
  196.     __ArrayQuickSort1D($aArray, $L, $iEnd)
  197. EndFunc   ;==>__ArrayQuickSort1D
  198. Func __ArrayQuickSort2D(ByRef $aArray, Const ByRef $iStep, Const ByRef $iStart, Const ByRef $iEnd, Const ByRef $iSubItem, Const ByRef $iSubMax)
  199.     If $iEnd <= $iStart Then Return
  200.     Local $vTmp, $L = $iStart, $R = $iEnd, $vPivot = $aArray[Int(($iStart + $iEnd) / 2)][$iSubItem], $bNum = IsNumber($vPivot)
  201.     Do
  202.         If $bNum Then
  203.             While ($iStep * ($aArray[$L][$iSubItem] - $vPivot) < 0 And IsNumber($aArray[$L][$iSubItem])) Or (Not IsNumber($aArray[$L][$iSubItem]) And $iStep * StringCompare($aArray[$L][$iSubItem], $vPivot) < 0)
  204.                 $L += 1
  205.             WEnd
  206.             While ($iStep * ($aArray[$R][$iSubItem] - $vPivot) > 0 And IsNumber($aArray[$R][$iSubItem])) Or (Not IsNumber($aArray[$R][$iSubItem]) And $iStep * StringCompare($aArray[$R][$iSubItem], $vPivot) > 0)
  207.                 $R -= 1
  208.             WEnd
  209.         Else
  210.             While ($iStep * StringCompare($aArray[$L][$iSubItem], $vPivot) < 0)
  211.                 $L += 1
  212.             WEnd
  213.             While ($iStep * StringCompare($aArray[$R][$iSubItem], $vPivot) > 0)
  214.                 $R -= 1
  215.             WEnd
  216.         EndIf
  217.         If $L <= $R Then
  218.             For $i = 0 To $iSubMax
  219.                 $vTmp = $aArray[$L][$i]
  220.                 $aArray[$L][$i] = $aArray[$R][$i]
  221.                 $aArray[$R][$i] = $vTmp
  222.             Next
  223.             $L += 1
  224.             $R -= 1
  225.         EndIf
  226.     Until $L > $R
  227.     __ArrayQuickSort2D($aArray, $iStep, $iStart, $R, $iSubItem, $iSubMax)
  228.     __ArrayQuickSort2D($aArray, $iStep, $L, $iEnd, $iSubItem, $iSubMax)
  229. EndFunc   ;==>__ArrayQuickSort2D
  230. Func __ArrayDualPivotSort(ByRef $aArray, $iPivot_Left, $iPivot_Right, $bLeftMost = True)
  231.     If $iPivot_Left > $iPivot_Right Then Return
  232.     Local $iLength = $iPivot_Right - $iPivot_Left + 1
  233.     Local $i, $j, $k, $iAi, $iAk, $iA1, $iA2, $iLast
  234.     If $iLength < 45 Then
  235.         If $bLeftMost Then
  236.             $i = $iPivot_Left
  237.             While $i < $iPivot_Right
  238.                 $j = $i
  239.                 $iAi = $aArray[$i + 1]
  240.                 While $iAi < $aArray[$j]
  241.                     $aArray[$j + 1] = $aArray[$j]
  242.                     $j -= 1
  243.                     If $j + 1 = $iPivot_Left Then ExitLoop
  244.                 WEnd
  245.                 $aArray[$j + 1] = $iAi
  246.                 $i += 1
  247.             WEnd
  248.         Else
  249.             While 1
  250.                 If $iPivot_Left >= $iPivot_Right Then Return 1
  251.                 $iPivot_Left += 1
  252.                 If $aArray[$iPivot_Left] < $aArray[$iPivot_Left - 1] Then ExitLoop
  253.             WEnd
  254.             While 1
  255.                 $k = $iPivot_Left
  256.                 $iPivot_Left += 1
  257.                 If $iPivot_Left > $iPivot_Right Then ExitLoop
  258.                 $iA1 = $aArray[$k]
  259.                 $iA2 = $aArray[$iPivot_Left]
  260.                 If $iA1 < $iA2 Then
  261.                     $iA2 = $iA1
  262.                     $iA1 = $aArray[$iPivot_Left]
  263.                 EndIf
  264.                 $k -= 1
  265.                 While $iA1 < $aArray[$k]
  266.                     $aArray[$k + 2] = $aArray[$k]
  267.                     $k -= 1
  268.                 WEnd
  269.                 $aArray[$k + 2] = $iA1
  270.                 While $iA2 < $aArray[$k]
  271.                     $aArray[$k + 1] = $aArray[$k]
  272.                     $k -= 1
  273.                 WEnd
  274.                 $aArray[$k + 1] = $iA2
  275.                 $iPivot_Left += 1
  276.             WEnd
  277.             $iLast = $aArray[$iPivot_Right]
  278.             $iPivot_Right -= 1
  279.             While $iLast < $aArray[$iPivot_Right]
  280.                 $aArray[$iPivot_Right + 1] = $aArray[$iPivot_Right]
  281.                 $iPivot_Right -= 1
  282.             WEnd
  283.             $aArray[$iPivot_Right + 1] = $iLast
  284.         EndIf
  285.         Return 1
  286.     EndIf
  287.     Local $iSeventh = BitShift($iLength, 3) + BitShift($iLength, 6) + 1
  288.     Local $iE1, $iE2, $iE3, $iE4, $iE5, $t
  289.     $iE3 = Ceiling(($iPivot_Left + $iPivot_Right) / 2)
  290.     $iE2 = $iE3 - $iSeventh
  291.     $iE1 = $iE2 - $iSeventh
  292.     $iE4 = $iE3 + $iSeventh
  293.     $iE5 = $iE4 + $iSeventh
  294.     If $aArray[$iE2] < $aArray[$iE1] Then
  295.         $t = $aArray[$iE2]
  296.         $aArray[$iE2] = $aArray[$iE1]
  297.         $aArray[$iE1] = $t
  298.     EndIf
  299.     If $aArray[$iE3] < $aArray[$iE2] Then
  300.         $t = $aArray[$iE3]
  301.         $aArray[$iE3] = $aArray[$iE2]
  302.         $aArray[$iE2] = $t
  303.         If $t < $aArray[$iE1] Then
  304.             $aArray[$iE2] = $aArray[$iE1]
  305.             $aArray[$iE1] = $t
  306.         EndIf
  307.     EndIf
  308.     If $aArray[$iE4] < $aArray[$iE3] Then
  309.         $t = $aArray[$iE4]
  310.         $aArray[$iE4] = $aArray[$iE3]
  311.         $aArray[$iE3] = $t
  312.         If $t < $aArray[$iE2] Then
  313.             $aArray[$iE3] = $aArray[$iE2]
  314.             $aArray[$iE2] = $t
  315.             If $t < $aArray[$iE1] Then
  316.                 $aArray[$iE2] = $aArray[$iE1]
  317.                 $aArray[$iE1] = $t
  318.             EndIf
  319.         EndIf
  320.     EndIf
  321.     If $aArray[$iE5] < $aArray[$iE4] Then
  322.         $t = $aArray[$iE5]
  323.         $aArray[$iE5] = $aArray[$iE4]
  324.         $aArray[$iE4] = $t
  325.         If $t < $aArray[$iE3] Then
  326.             $aArray[$iE4] = $aArray[$iE3]
  327.             $aArray[$iE3] = $t
  328.             If $t < $aArray[$iE2] Then
  329.                 $aArray[$iE3] = $aArray[$iE2]
  330.                 $aArray[$iE2] = $t
  331.                 If $t < $aArray[$iE1] Then
  332.                     $aArray[$iE2] = $aArray[$iE1]
  333.                     $aArray[$iE1] = $t
  334.                 EndIf
  335.             EndIf
  336.         EndIf
  337.     EndIf
  338.     Local $iLess = $iPivot_Left
  339.     Local $iGreater = $iPivot_Right
  340.     If (($aArray[$iE1] <> $aArray[$iE2]) And ($aArray[$iE2] <> $aArray[$iE3]) And ($aArray[$iE3] <> $aArray[$iE4]) And ($aArray[$iE4] <> $aArray[$iE5])) Then
  341.         Local $iPivot_1 = $aArray[$iE2]
  342.         Local $iPivot_2 = $aArray[$iE4]
  343.         $aArray[$iE2] = $aArray[$iPivot_Left]
  344.         $aArray[$iE4] = $aArray[$iPivot_Right]
  345.         Do
  346.             $iLess += 1
  347.         Until $aArray[$iLess] >= $iPivot_1
  348.         Do
  349.             $iGreater -= 1
  350.         Until $aArray[$iGreater] <= $iPivot_2
  351.         $k = $iLess
  352.         While $k <= $iGreater
  353.             $iAk = $aArray[$k]
  354.             If $iAk < $iPivot_1 Then
  355.                 $aArray[$k] = $aArray[$iLess]
  356.                 $aArray[$iLess] = $iAk
  357.                 $iLess += 1
  358.             ElseIf $iAk > $iPivot_2 Then
  359.                 While $aArray[$iGreater] > $iPivot_2
  360.                     $iGreater -= 1
  361.                     If $iGreater + 1 = $k Then ExitLoop 2
  362.                 WEnd
  363.                 If $aArray[$iGreater] < $iPivot_1 Then
  364.                     $aArray[$k] = $aArray[$iLess]
  365.                     $aArray[$iLess] = $aArray[$iGreater]
  366.                     $iLess += 1
  367.                 Else
  368.                     $aArray[$k] = $aArray[$iGreater]
  369.                 EndIf
  370.                 $aArray[$iGreater] = $iAk
  371.                 $iGreater -= 1
  372.             EndIf
  373.             $k += 1
  374.         WEnd
  375.         $aArray[$iPivot_Left] = $aArray[$iLess - 1]
  376.         $aArray[$iLess - 1] = $iPivot_1
  377.         $aArray[$iPivot_Right] = $aArray[$iGreater + 1]
  378.         $aArray[$iGreater + 1] = $iPivot_2
  379.         __ArrayDualPivotSort($aArray, $iPivot_Left, $iLess - 2, True)
  380.         __ArrayDualPivotSort($aArray, $iGreater + 2, $iPivot_Right, False)
  381.         If ($iLess < $iE1) And ($iE5 < $iGreater) Then
  382.             While $aArray[$iLess] = $iPivot_1
  383.                 $iLess += 1
  384.             WEnd
  385.             While $aArray[$iGreater] = $iPivot_2
  386.                 $iGreater -= 1
  387.             WEnd
  388.             $k = $iLess
  389.             While $k <= $iGreater
  390.                 $iAk = $aArray[$k]
  391.                 If $iAk = $iPivot_1 Then
  392.                     $aArray[$k] = $aArray[$iLess]
  393.                     $aArray[$iLess] = $iAk
  394.                     $iLess += 1
  395.                 ElseIf $iAk = $iPivot_2 Then
  396.                     While $aArray[$iGreater] = $iPivot_2
  397.                         $iGreater -= 1
  398.                         If $iGreater + 1 = $k Then ExitLoop 2
  399.                     WEnd
  400.                     If $aArray[$iGreater] = $iPivot_1 Then
  401.                         $aArray[$k] = $aArray[$iLess]
  402.                         $aArray[$iLess] = $iPivot_1
  403.                         $iLess += 1
  404.                     Else
  405.                         $aArray[$k] = $aArray[$iGreater]
  406.                     EndIf
  407.                     $aArray[$iGreater] = $iAk
  408.                     $iGreater -= 1
  409.                 EndIf
  410.                 $k += 1
  411.             WEnd
  412.         EndIf
  413.         __ArrayDualPivotSort($aArray, $iLess, $iGreater, False)
  414.     Else
  415.         Local $iPivot = $aArray[$iE3]
  416.         $k = $iLess
  417.         While $k <= $iGreater
  418.             If $aArray[$k] = $iPivot Then
  419.                 $k += 1
  420.                 ContinueLoop
  421.             EndIf
  422.             $iAk = $aArray[$k]
  423.             If $iAk < $iPivot Then
  424.                 $aArray[$k] = $aArray[$iLess]
  425.                 $aArray[$iLess] = $iAk
  426.                 $iLess += 1
  427.             Else
  428.                 While $aArray[$iGreater] > $iPivot
  429.                     $iGreater -= 1
  430.                 WEnd
  431.                 If $aArray[$iGreater] < $iPivot Then
  432.                     $aArray[$k] = $aArray[$iLess]
  433.                     $aArray[$iLess] = $aArray[$iGreater]
  434.                     $iLess += 1
  435.                 Else
  436.                     $aArray[$k] = $iPivot
  437.                 EndIf
  438.                 $aArray[$iGreater] = $iAk
  439.                 $iGreater -= 1
  440.             EndIf
  441.             $k += 1
  442.         WEnd
  443.         __ArrayDualPivotSort($aArray, $iPivot_Left, $iLess - 1, True)
  444.         __ArrayDualPivotSort($aArray, $iGreater + 1, $iPivot_Right, False)
  445.     EndIf
  446. EndFunc   ;==>__ArrayDualPivotSort
  447. Func _FileListToArray($sFilePath, $sFilter = "*", $iFlag = $FLTA_FILESFOLDERS, $bReturnPath = False)
  448.     Local $sDelimiter = "|", $sFileList = "", $sFileName = "", $sFullPath = ""
  449.     $sFilePath = StringRegExpReplace($sFilePath, "[\\/]+$", "") & "\"
  450.     If $iFlag = Default Then $iFlag = $FLTA_FILESFOLDERS
  451.     If $bReturnPath Then $sFullPath = $sFilePath
  452.     If $sFilter = Default Then $sFilter = "*"
  453.     If Not FileExists($sFilePath) Then Return SetError(1, 0, 0)
  454.     If StringRegExp($sFilter, "[\\/:><\|]|(?s)^\s*$") Then Return SetError(2, 0, 0)
  455.     If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 0, 0)
  456.     Local $hSearch = FileFindFirstFile($sFilePath & $sFilter)
  457.     If @error Then Return SetError(4, 0, 0)
  458.     While 1
  459.         $sFileName = FileFindNextFile($hSearch)
  460.         If @error Then ExitLoop
  461.         If ($iFlag + @extended = 2) Then ContinueLoop
  462.         $sFileList &= $sDelimiter & $sFullPath & $sFileName
  463.     WEnd
  464.     FileClose($hSearch)
  465.     If $sFileList = "" Then Return SetError(4, 0, 0)
  466.     Return StringSplit(StringTrimLeft($sFileList, 1), $sDelimiter)
  467. EndFunc   ;==>_FileListToArray
  468. Func _FileListToArrayRec($sFilePath, $sMask = "*", $iReturn = $FLTAR_FILESFOLDERS, $iRecur = $FLTAR_NORECUR, $iSort = $FLTAR_NOSORT, $iReturnPath = $FLTAR_RELPATH)
  469.     If Not FileExists($sFilePath) Then Return SetError(1, 1, "")
  470.     If $sMask = Default Then $sMask = "*"
  471.     If $iReturn = Default Then $iReturn = $FLTAR_FILESFOLDERS
  472.     If $iRecur = Default Then $iRecur = $FLTAR_NORECUR
  473.     If $iSort = Default Then $iSort = $FLTAR_NOSORT
  474.     If $iReturnPath = Default Then $iReturnPath = $FLTAR_RELPATH
  475.     If $iRecur > 1 Or Not IsInt($iRecur) Then Return SetError(1, 6, "")
  476.     Local $bLongPath = False
  477.     If StringLeft($sFilePath, 4) == "\\?\" Then
  478.         $bLongPath = True
  479.     EndIf
  480.     Local $sFolderSlash = ""
  481.     If StringRight($sFilePath, 1) = "\" Then
  482.         $sFolderSlash = "\"
  483.     Else
  484.         $sFilePath = $sFilePath & "\"
  485.     EndIf
  486.     Local $asFolderSearchList[100] = [1]
  487.     $asFolderSearchList[1] = $sFilePath
  488.     Local $iHide_HS = 0, $sHide_HS = ""
  489.     If BitAND($iReturn, 4) Then
  490.         $iHide_HS += 2
  491.         $sHide_HS &= "H"
  492.         $iReturn -= 4
  493.     EndIf
  494.     If BitAND($iReturn, 8) Then
  495.         $iHide_HS += 4
  496.         $sHide_HS &= "S"
  497.         $iReturn -= 8
  498.     EndIf
  499.     Local $iHide_Link = 0
  500.     If BitAND($iReturn, 16) Then
  501.         $iHide_Link = 0x400
  502.         $iReturn -= 16
  503.     EndIf
  504.     Local $iMaxLevel = 0
  505.     If $iRecur < 0 Then
  506.         StringReplace($sFilePath, "\", "", 0, $STR_NOCASESENSEBASIC)
  507.         $iMaxLevel = @extended - $iRecur
  508.     EndIf
  509.     Local $sExclude_List = "", $sExclude_List_Folder = "", $sInclude_List = "*"
  510.     Local $aMaskSplit = StringSplit($sMask, "|")
  511.     Switch $aMaskSplit[0]
  512.         Case 3
  513.             $sExclude_List_Folder = $aMaskSplit[3]
  514.             ContinueCase
  515.         Case 2
  516.             $sExclude_List = $aMaskSplit[2]
  517.             ContinueCase
  518.         Case 1
  519.             $sInclude_List = $aMaskSplit[1]
  520.     EndSwitch
  521.     Local $sInclude_File_Mask = ".+"
  522.     If $sInclude_List <> "*" Then
  523.         If Not __FLTAR_ListToMask($sInclude_File_Mask, $sInclude_List) Then Return SetError(1, 2, "")
  524.     EndIf
  525.     Local $sInclude_Folder_Mask = ".+"
  526.     Switch $iReturn
  527.         Case 0
  528.             Switch $iRecur
  529.                 Case 0
  530.                     $sInclude_Folder_Mask = $sInclude_File_Mask
  531.             EndSwitch
  532.         Case 2
  533.             $sInclude_Folder_Mask = $sInclude_File_Mask
  534.     EndSwitch
  535.     Local $sExclude_File_Mask = ":"
  536.     If $sExclude_List <> "" Then
  537.         If Not __FLTAR_ListToMask($sExclude_File_Mask, $sExclude_List) Then Return SetError(1, 3, "")
  538.     EndIf
  539.     Local $sExclude_Folder_Mask = ":"
  540.     If $iRecur Then
  541.         If $sExclude_List_Folder Then
  542.             If Not __FLTAR_ListToMask($sExclude_Folder_Mask, $sExclude_List_Folder) Then Return SetError(1, 4, "")
  543.         EndIf
  544.         If $iReturn = 2 Then
  545.             $sExclude_Folder_Mask = $sExclude_File_Mask
  546.         EndIf
  547.     Else
  548.         $sExclude_Folder_Mask = $sExclude_File_Mask
  549.     EndIf
  550.     If Not ($iReturn = 0 Or $iReturn = 1 Or $iReturn = 2) Then Return SetError(1, 5, "")
  551.     If Not ($iSort = 0 Or $iSort = 1 Or $iSort = 2) Then Return SetError(1, 7, "")
  552.     If Not ($iReturnPath = 0 Or $iReturnPath = 1 Or $iReturnPath = 2) Then Return SetError(1, 8, "")
  553.     If $iHide_Link Then
  554.         Local $tFile_Data = DllStructCreate("struct;align 4;dword FileAttributes;uint64 CreationTime;uint64 LastAccessTime;uint64 LastWriteTime;" & "dword FileSizeHigh;dword FileSizeLow;dword Reserved0;dword Reserved1;wchar FileName[260];wchar AlternateFileName[14];endstruct")
  555.         Local $hDLL = DllOpen('kernel32.dll'), $aDLL_Ret
  556.     EndIf
  557.     Local $asReturnList[100] = [0]
  558.     Local $asFileMatchList = $asReturnList, $asRootFileMatchList = $asReturnList, $asFolderMatchList = $asReturnList
  559.     Local $bFolder = False, $hSearch = 0, $sCurrentPath = "", $sName = "", $sRetPath = ""
  560.     Local $iAttribs = 0, $sAttribs = ''
  561.     Local $asFolderFileSectionList[100][2] = [[0, 0]]
  562.     While $asFolderSearchList[0] > 0
  563.         $sCurrentPath = $asFolderSearchList[$asFolderSearchList[0]]
  564.         $asFolderSearchList[0] -= 1
  565.         Switch $iReturnPath
  566.             Case 1
  567.                 $sRetPath = StringReplace($sCurrentPath, $sFilePath, "")
  568.             Case 2
  569.                 If $bLongPath Then
  570.                     $sRetPath = StringTrimLeft($sCurrentPath, 4)
  571.                 Else
  572.                     $sRetPath = $sCurrentPath
  573.                 EndIf
  574.         EndSwitch
  575.         If $iHide_Link Then
  576.             $aDLL_Ret = DllCall($hDLL, 'handle', 'FindFirstFileW', 'wstr', $sCurrentPath & "*", 'struct*', $tFile_Data)
  577.             If @error Or Not $aDLL_Ret[0] Then
  578.                 ContinueLoop
  579.             EndIf
  580.             $hSearch = $aDLL_Ret[0]
  581.         Else
  582.             $hSearch = FileFindFirstFile($sCurrentPath & "*")
  583.             If $hSearch = -1 Then
  584.                 ContinueLoop
  585.             EndIf
  586.         EndIf
  587.         If $iReturn = 0 And $iSort And $iReturnPath Then
  588.             __FLTAR_AddToList($asFolderFileSectionList, $sRetPath, $asFileMatchList[0] + 1)
  589.         EndIf
  590.         $sAttribs = ''
  591.         While 1
  592.             If $iHide_Link Then
  593.                 $aDLL_Ret = DllCall($hDLL, 'int', 'FindNextFileW', 'handle', $hSearch, 'struct*', $tFile_Data)
  594.                 If @error Or Not $aDLL_Ret[0] Then
  595.                     ExitLoop
  596.                 EndIf
  597.                 $sName = DllStructGetData($tFile_Data, "FileName")
  598.                 If $sName = ".." Then
  599.                     ContinueLoop
  600.                 EndIf
  601.                 $iAttribs = DllStructGetData($tFile_Data, "FileAttributes")
  602.                 If $iHide_HS And BitAND($iAttribs, $iHide_HS) Then
  603.                     ContinueLoop
  604.                 EndIf
  605.                 If BitAND($iAttribs, $iHide_Link) Then
  606.                     ContinueLoop
  607.                 EndIf
  608.                 $bFolder = False
  609.                 If BitAND($iAttribs, 16) Then
  610.                     $bFolder = True
  611.                 EndIf
  612.             Else
  613.                 $bFolder = False
  614.                 $sName = FileFindNextFile($hSearch, 1)
  615.                 If @error Then
  616.                     ExitLoop
  617.                 EndIf
  618.                 $sAttribs = @extended
  619.                 If StringInStr($sAttribs, "D") Then
  620.                     $bFolder = True
  621.                 EndIf
  622.                 If StringRegExp($sAttribs, "[" & $sHide_HS & "]") Then
  623.                     ContinueLoop
  624.                 EndIf
  625.             EndIf
  626.             If $bFolder Then
  627.                 Select
  628.                     Case $iRecur < 0
  629.                         StringReplace($sCurrentPath, "\", "", 0, $STR_NOCASESENSEBASIC)
  630.                         If @extended < $iMaxLevel Then
  631.                             ContinueCase
  632.                         EndIf
  633.                     Case $iRecur = 1
  634.                         If Not StringRegExp($sName, $sExclude_Folder_Mask) Then
  635.                             __FLTAR_AddToList($asFolderSearchList, $sCurrentPath & $sName & "\")
  636.                         EndIf
  637.                 EndSelect
  638.             EndIf
  639.             If $iSort Then
  640.                 If $bFolder Then
  641.                     If StringRegExp($sName, $sInclude_Folder_Mask) And Not StringRegExp($sName, $sExclude_Folder_Mask) Then
  642.                         __FLTAR_AddToList($asFolderMatchList, $sRetPath & $sName & $sFolderSlash)
  643.                     EndIf
  644.                 Else
  645.                     If StringRegExp($sName, $sInclude_File_Mask) And Not StringRegExp($sName, $sExclude_File_Mask) Then
  646.                         If $sCurrentPath = $sFilePath Then
  647.                             __FLTAR_AddToList($asRootFileMatchList, $sRetPath & $sName)
  648.                         Else
  649.                             __FLTAR_AddToList($asFileMatchList, $sRetPath & $sName)
  650.                         EndIf
  651.                     EndIf
  652.                 EndIf
  653.             Else
  654.                 If $bFolder Then
  655.                     If $iReturn <> 1 And StringRegExp($sName, $sInclude_Folder_Mask) And Not StringRegExp($sName, $sExclude_Folder_Mask) Then
  656.                         __FLTAR_AddToList($asReturnList, $sRetPath & $sName & $sFolderSlash)
  657.                     EndIf
  658.                 Else
  659.                     If $iReturn <> 2 And StringRegExp($sName, $sInclude_File_Mask) And Not StringRegExp($sName, $sExclude_File_Mask) Then
  660.                         __FLTAR_AddToList($asReturnList, $sRetPath & $sName)
  661.                     EndIf
  662.                 EndIf
  663.             EndIf
  664.         WEnd
  665.         If $iHide_Link Then
  666.             DllCall($hDLL, 'int', 'FindClose', 'ptr', $hSearch)
  667.         Else
  668.             FileClose($hSearch)
  669.         EndIf
  670.     WEnd
  671.     If $iHide_Link Then
  672.         DllClose($hDLL)
  673.     EndIf
  674.     If $iSort Then
  675.         Switch $iReturn
  676.             Case 2
  677.                 If $asFolderMatchList[0] = 0 Then Return SetError(1, 9, "")
  678.                 ReDim $asFolderMatchList[$asFolderMatchList[0] + 1]
  679.                 $asReturnList = $asFolderMatchList
  680.                 __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0])
  681.             Case 1
  682.                 If $asRootFileMatchList[0] = 0 And $asFileMatchList[0] = 0 Then Return SetError(1, 9, "")
  683.                 If $iReturnPath = 0 Then
  684.                     __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList)
  685.                     __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0])
  686.                 Else
  687.                     __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList, 1)
  688.                 EndIf
  689.             Case 0
  690.                 If $asRootFileMatchList[0] = 0 And $asFolderMatchList[0] = 0 Then Return SetError(1, 9, "")
  691.                 If $iReturnPath = 0 Then
  692.                     __FLTAR_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList)
  693.                     $asReturnList[0] += $asFolderMatchList[0]
  694.                     ReDim $asFolderMatchList[$asFolderMatchList[0] + 1]
  695.                     _ArrayConcatenate($asReturnList, $asFolderMatchList, 1)
  696.                     __ArrayDualPivotSort($asReturnList, 1, $asReturnList[0])
  697.                 Else
  698.                     Local $asReturnList[$asFileMatchList[0] + $asRootFileMatchList[0] + $asFolderMatchList[0] + 1]
  699.                     $asReturnList[0] = $asFileMatchList[0] + $asRootFileMatchList[0] + $asFolderMatchList[0]
  700.                     __ArrayDualPivotSort($asRootFileMatchList, 1, $asRootFileMatchList[0])
  701.                     For $i = 1 To $asRootFileMatchList[0]
  702.                         $asReturnList[$i] = $asRootFileMatchList[$i]
  703.                     Next
  704.                     Local $iNextInsertionIndex = $asRootFileMatchList[0] + 1
  705.                     __ArrayDualPivotSort($asFolderMatchList, 1, $asFolderMatchList[0])
  706.                     Local $sFolderToFind = ""
  707.                     For $i = 1 To $asFolderMatchList[0]
  708.                         $asReturnList[$iNextInsertionIndex] = $asFolderMatchList[$i]
  709.                         $iNextInsertionIndex += 1
  710.                         If $sFolderSlash Then
  711.                             $sFolderToFind = $asFolderMatchList[$i]
  712.                         Else
  713.                             $sFolderToFind = $asFolderMatchList[$i] & "\"
  714.                         EndIf
  715.                         Local $iFileSectionEndIndex = 0, $iFileSectionStartIndex = 0
  716.                         For $j = 1 To $asFolderFileSectionList[0][0]
  717.                             If $sFolderToFind = $asFolderFileSectionList[$j][0] Then
  718.                                 $iFileSectionStartIndex = $asFolderFileSectionList[$j][1]
  719.                                 If $j = $asFolderFileSectionList[0][0] Then
  720.                                     $iFileSectionEndIndex = $asFileMatchList[0]
  721.                                 Else
  722.                                     $iFileSectionEndIndex = $asFolderFileSectionList[$j + 1][1] - 1
  723.                                 EndIf
  724.                                 If $iSort = 1 Then
  725.                                     __ArrayDualPivotSort($asFileMatchList, $iFileSectionStartIndex, $iFileSectionEndIndex)
  726.                                 EndIf
  727.                                 For $k = $iFileSectionStartIndex To $iFileSectionEndIndex
  728.                                     $asReturnList[$iNextInsertionIndex] = $asFileMatchList[$k]
  729.                                     $iNextInsertionIndex += 1
  730.                                 Next
  731.                                 ExitLoop
  732.                             EndIf
  733.                         Next
  734.                     Next
  735.                 EndIf
  736.         EndSwitch
  737.     Else
  738.         If $asReturnList[0] = 0 Then Return SetError(1, 9, "")
  739.         ReDim $asReturnList[$asReturnList[0] + 1]
  740.     EndIf
  741.     Return $asReturnList
  742. EndFunc   ;==>_FileListToArrayRec
  743. Func __FLTAR_AddFileLists(ByRef $asTarget, $asSource_1, $asSource_2, $iSort = 0)
  744.     ReDim $asSource_1[$asSource_1[0] + 1]
  745.     If $iSort = 1 Then __ArrayDualPivotSort($asSource_1, 1, $asSource_1[0])
  746.     $asTarget = $asSource_1
  747.     $asTarget[0] += $asSource_2[0]
  748.     ReDim $asSource_2[$asSource_2[0] + 1]
  749.     If $iSort = 1 Then __ArrayDualPivotSort($asSource_2, 1, $asSource_2[0])
  750.     _ArrayConcatenate($asTarget, $asSource_2, 1)
  751. EndFunc   ;==>__FLTAR_AddFileLists
  752. Func __FLTAR_AddToList(ByRef $aList, $vValue_0, $vValue_1 = -1)
  753.     If $vValue_1 = -1 Then
  754.         $aList[0] += 1
  755.         If UBound($aList) <= $aList[0] Then ReDim $aList[UBound($aList) * 2]
  756.         $aList[$aList[0]] = $vValue_0
  757.     Else
  758.         $aList[0][0] += 1
  759.         If UBound($aList) <= $aList[0][0] Then ReDim $aList[UBound($aList) * 2][2]
  760.         $aList[$aList[0][0]][0] = $vValue_0
  761.         $aList[$aList[0][0]][1] = $vValue_1
  762.     EndIf
  763. EndFunc   ;==>__FLTAR_AddToList
  764. Func __FLTAR_ListToMask(ByRef $sMask, $sList)
  765.     If StringRegExp($sList, "\\|/|:|\<|\>|\|") Then Return 0
  766.     $sList = StringReplace(StringStripWS(StringRegExpReplace($sList, "\s*;\s*", ";"), $STR_STRIPLEADING + $STR_STRIPTRAILING), ";", "|")
  767.     $sList = StringReplace(StringReplace(StringRegExpReplace($sList, "[][$^.{}()+\-]", "\\$0"), "?", "."), "*", ".*?")
  768.     $sMask = "(?i)^(" & $sList & ")\z"
  769.     Return 1
  770. EndFunc   ;==>__FLTAR_ListToMask
  771. Func _PathFull($sRelativePath, $sBasePath = @WorkingDir)
  772.     If Not $sRelativePath Or $sRelativePath = "." Then Return $sBasePath
  773.     Local $sFullPath = StringReplace($sRelativePath, "/", "\")
  774.     Local Const $sFullPathConst = $sFullPath
  775.     Local $sPath
  776.     Local $bRootOnly = StringLeft($sFullPath, 1) = "\" And StringMid($sFullPath, 2, 1) <> "\"
  777.     If $sBasePath = Default Then $sBasePath = @WorkingDir
  778.     For $i = 1 To 2
  779.         $sPath = StringLeft($sFullPath, 2)
  780.         If $sPath = "\\" Then
  781.             $sFullPath = StringTrimLeft($sFullPath, 2)
  782.             Local $nServerLen = StringInStr($sFullPath, "\") - 1
  783.             $sPath = "\\" & StringLeft($sFullPath, $nServerLen)
  784.             $sFullPath = StringTrimLeft($sFullPath, $nServerLen)
  785.             ExitLoop
  786.         ElseIf StringRight($sPath, 1) = ":" Then
  787.             $sFullPath = StringTrimLeft($sFullPath, 2)
  788.             ExitLoop
  789.         Else
  790.             $sFullPath = $sBasePath & "\" & $sFullPath
  791.         EndIf
  792.     Next
  793.     If StringLeft($sFullPath, 1) <> "\" Then
  794.         If StringLeft($sFullPathConst, 2) = StringLeft($sBasePath, 2) Then
  795.             $sFullPath = $sBasePath & "\" & $sFullPath
  796.         Else
  797.             $sFullPath = "\" & $sFullPath
  798.         EndIf
  799.     EndIf
  800.     Local $aTemp = StringSplit($sFullPath, "\")
  801.     Local $aPathParts[$aTemp[0]], $j = 0
  802.     For $i = 2 To $aTemp[0]
  803.         If $aTemp[$i] = ".." Then
  804.             If $j Then $j -= 1
  805.         ElseIf Not ($aTemp[$i] = "" And $i <> $aTemp[0]) And $aTemp[$i] <> "." Then
  806.             $aPathParts[$j] = $aTemp[$i]
  807.             $j += 1
  808.         EndIf
  809.     Next
  810.     $sFullPath = $sPath
  811.     If Not $bRootOnly Then
  812.         For $i = 0 To $j - 1
  813.             $sFullPath &= "\" & $aPathParts[$i]
  814.         Next
  815.     Else
  816.         $sFullPath &= $sFullPathConst
  817.         If StringInStr($sFullPath, "..") Then $sFullPath = _PathFull($sFullPath)
  818.     EndIf
  819.     Do
  820.         $sFullPath = StringReplace($sFullPath, ".\", "\")
  821.     Until @extended = 0
  822.     Return $sFullPath
  823. EndFunc   ;==>_PathFull
  824. Global Const $tagRECT = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  825. Global Const $tagREBARBANDINFO = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagRECT & ";uint uChevronState")
  826. Global Const $tagOSVERSIONINFO = 'struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct'
  827. Global Const $__WINVER = __WINVER()
  828. Func _WinAPI_GetString($pString, $bUnicode = True)
  829.     Local $iLength = _WinAPI_StrLen($pString, $bUnicode)
  830.     If @error Or Not $iLength Then Return SetError(@error + 10, @extended, '')
  831.     Local $tString = DllStructCreate(__Iif($bUnicode, 'wchar', 'char') & '[' & ($iLength + 1) & ']', $pString)
  832.     If @error Then Return SetError(@error, @extended, '')
  833.     Return SetExtended($iLength, DllStructGetData($tString, 1))
  834. EndFunc   ;==>_WinAPI_GetString
  835. Func _WinAPI_PathIsDirectory($sFilePath)
  836.     Local $aRet = DllCall('shlwapi.dll', 'bool', 'PathIsDirectoryW', 'wstr', $sFilePath)
  837.     If @error Then Return SetError(@error, @extended, False)
  838.     Return $aRet[0]
  839. EndFunc   ;==>_WinAPI_PathIsDirectory
  840. Func _WinAPI_StrLen($pString, $bUnicode = True)
  841.     Local $W = ''
  842.     If $bUnicode Then $W = 'W'
  843.     Local $aRet = DllCall('kernel32.dll', 'int', 'lstrlen' & $W, 'struct*', $pString)
  844.     If @error Then Return SetError(@error, @extended, 0)
  845.     Return $aRet[0]
  846. EndFunc   ;==>_WinAPI_StrLen
  847. Func __Inc(ByRef $aData, $iIncrement = 100)
  848.     Select
  849.         Case UBound($aData, $UBOUND_COLUMNS)
  850.             If $iIncrement < 0 Then
  851.                 ReDim $aData[$aData[0][0] + 1][UBound($aData, $UBOUND_COLUMNS)]
  852.             Else
  853.                 $aData[0][0] += 1
  854.                 If $aData[0][0] > UBound($aData) - 1 Then
  855.                     ReDim $aData[$aData[0][0] + $iIncrement][UBound($aData, $UBOUND_COLUMNS)]
  856.                 EndIf
  857.             EndIf
  858.         Case UBound($aData, $UBOUND_ROWS)
  859.             If $iIncrement < 0 Then
  860.                 ReDim $aData[$aData[0] + 1]
  861.             Else
  862.                 $aData[0] += 1
  863.                 If $aData[0] > UBound($aData) - 1 Then
  864.                     ReDim $aData[$aData[0] + $iIncrement]
  865.                 EndIf
  866.             EndIf
  867.         Case Else
  868.             Return 0
  869.     EndSelect
  870.     Return 1
  871. EndFunc   ;==>__Inc
  872. Func __Iif($bTest, $vTrue, $vFalse)
  873.     Return $bTest ? $vTrue : $vFalse
  874. EndFunc   ;==>__Iif
  875. Func __WINVER()
  876.     Local $tOSVI = DllStructCreate($tagOSVERSIONINFO)
  877.     DllStructSetData($tOSVI, 1, DllStructGetSize($tOSVI))
  878.     Local $aRet = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVI)
  879.     If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0)
  880.     Return BitOR(BitShift(DllStructGetData($tOSVI, 2), -8), DllStructGetData($tOSVI, 3))
  881. EndFunc   ;==>__WINVER
  882. Func _WinAPI_CommandLineToArgv($sCmd)
  883.     Local $aResult[1] = [0]
  884.     $sCmd = StringStripWS($sCmd, $STR_STRIPLEADING + $STR_STRIPTRAILING)
  885.     If Not $sCmd Then
  886.         Return $aResult
  887.     EndIf
  888.     Local $aRet = DllCall('shell32.dll', 'ptr', 'CommandLineToArgvW', 'wstr', $sCmd, 'int*', 0)
  889.     If @error Or Not $aRet[0] Or (Not $aRet[2]) Then Return SetError(@error + 10, @extended, 0)
  890.     Local $tPtr = DllStructCreate('ptr[' & $aRet[2] & ']', $aRet[0])
  891.     Dim $aResult[$aRet[2] + 1] = [$aRet[2]]
  892.     For $i = 1 To $aRet[2]
  893.         $aResult[$i] = _WinAPI_GetString(DllStructGetData($tPtr, 1, $i))
  894.     Next
  895.     DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aRet[0])
  896.     Return $aResult
  897. EndFunc   ;==>_WinAPI_CommandLineToArgv
  898. Func _WinAPI_PathAddBackslash($sFilePath)
  899.     Local $tPath = DllStructCreate('wchar[260]')
  900.     DllStructSetData($tPath, 1, $sFilePath)
  901.     Local $aRet = DllCall('shlwapi.dll', 'ptr', 'PathAddBackslashW', 'struct*', $tPath)
  902.     If @error Or Not $aRet[0] Then Return SetError(@error, @extended, '')
  903.     Return DllStructGetData($tPath, 1)
  904. EndFunc   ;==>_WinAPI_PathAddBackslash
  905. Global Const $tagPRINTDLG = __Iif(@AutoItX64, '', 'align 2;') & 'dword Size;hwnd hOwner;handle hDevMode;handle hDevNames;handle hDC;dword Flags;word FromPage;word ToPage;word MinPage;word MaxPage;word Copies;handle hInstance;lparam lParam;ptr PrintHook;ptr SetupHook;ptr PrintTemplateName;ptr SetupTemplateName;handle hPrintTemplate;handle hSetupTemplate'
  906. Func _WinAPI_ChangeWindowMessageFilterEx($hWnd, $iMsg, $iAction)
  907.     Local $tCFS, $aRet
  908.     If $hWnd And ($__WINVER > 0x0600) Then
  909.         Local Const $tagCHANGEFILTERSTRUCT = 'dword cbSize; dword ExtStatus'
  910.         $tCFS = DllStructCreate($tagCHANGEFILTERSTRUCT)
  911.         DllStructSetData($tCFS, 1, DllStructGetSize($tCFS))
  912.         $aRet = DllCall('user32.dll', 'bool', 'ChangeWindowMessageFilterEx', 'hwnd', $hWnd, 'uint', $iMsg, 'dword', $iAction, 'struct*', $tCFS)
  913.     Else
  914.         $tCFS = 0
  915.         $aRet = DllCall('user32.dll', 'bool', 'ChangeWindowMessageFilter', 'uint', $iMsg, 'dword', $iAction)
  916.     EndIf
  917.     If @error Or Not $aRet[0] Then Return SetError(@error + 10, @extended, 0)
  918.     Return SetExtended(DllStructGetData($tCFS, 2), 1)
  919. EndFunc   ;==>_WinAPI_ChangeWindowMessageFilterEx
  920. Func _WinAPI_DragQueryFileEx($hDrop, $iFlag = 0)
  921.     Local $aRet = DllCall('shell32.dll', 'uint', 'DragQueryFileW', 'handle', $hDrop, 'uint', -1, 'ptr', 0, 'uint', 0)
  922.     If @error Then Return SetError(@error, @extended, 0)
  923.     If Not $aRet[0] Then Return SetError(10, 0, 0)
  924.     Local $iCount = $aRet[0]
  925.     Local $aResult[$iCount + 1]
  926.     For $i = 0 To $iCount - 1
  927.         $aRet = DllCall('shell32.dll', 'uint', 'DragQueryFileW', 'handle', $hDrop, 'uint', $i, 'wstr', '', 'uint', 4096)
  928.         If Not $aRet[0] Then Return SetError(11, 0, 0)
  929.         If $iFlag Then
  930.             Local $bDir = _WinAPI_PathIsDirectory($aRet[3])
  931.             If (($iFlag = 1) And $bDir) Or (($iFlag = 2) And Not $bDir) Then
  932.                 ContinueLoop
  933.             EndIf
  934.         EndIf
  935.         $aResult[$i + 1] = $aRet[3]
  936.         $aResult[0] += 1
  937.     Next
  938.     If Not $aResult[0] Then Return SetError(12, 0, 0)
  939.     __Inc($aResult, -1)
  940.     Return $aResult
  941. EndFunc   ;==>_WinAPI_DragQueryFileEx
  942. #EndRegion ###include###
  943.  
  944. Global Const $sAppRegKey = "HKEY_CURRENT_USER\Software\Trong\AttributesTool"
  945. Global Const $sKeyREGexp = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
  946. Global Const $OSArch = @OSArch
  947. Global Const $WindowsDir = @WindowsDir
  948. Global Const $TempDir = @TempDir
  949. Global Const $HomeDrive = @HomeDrive
  950. Global Const $UserProfileDir = @UserProfileDir
  951. Global Const $AppDataDir = @AppDataDir
  952. Global Const $AppDataCommonDir = @AppDataCommonDir
  953. Local $ComSpecX = @ComSpec
  954. If StringInStr($OSArch, "64") Then
  955.     DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0)
  956.     If FileExists($WindowsDir & "\System32\cmd.exe") Then $ComSpecX = '"' & $WindowsDir & '\System32\cmd.exe"'
  957. EndIf
  958. ;~  If StringInStr($OSArch, "64") Then DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 1)
  959. Global Const $ComSpec = $ComSpecX
  960. Global Const $sOption1 = "-RAHS", $sOption2 = "+RAHS", $sOption3 = "+RH", $sOption4 = "+RS", $sOption5 = "+SH"
  961. Global Const $sOption6 = "+R", $sOption7 = "+S", $sOption8 = "+H", $sOption9 = "Delete", $sOption10 = "Rename Unicode"
  962. Global Const $sOption11 = "Set files/folders timestamp:", $sOption12 = "+C", $sOption13 = "+M", $sOption14 = "+A"
  963. Global $AppTitle = "Najeeb Attributes Tool"
  964. #Region # GUI
  965. Global $AppWindows = GUICreate($AppTitle, 564, 79, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
  966. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  967. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  968. GUICtrlCreateLabel("Select Option > ", 4, 20, 91, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG)
  969. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  970. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  971. Global $rOpt1 = GUICtrlCreateRadio("-RAHS", 103, 9, 55, 17, BitOR($BS_VCENTER, $BS_FLAT))
  972. GUICtrlSetTip(-1, "Bỏ thuộc tính: Chỉ Đọc,Lưu Trữ,Ẩn và Hệ Thống", "Clear Attributes: ReadOnly,Archive,Hidden and System", 1, 1)
  973. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  974. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  975. Global $rOpt2 = GUICtrlCreateRadio("+RAHS", 163, 9, 55, 17, BitOR($BS_VCENTER, $BS_FLAT))
  976. GUICtrlSetTip(-1, "Đặt thuộc tính: Chỉ Đọc,Lưu Trữ,Ẩn và Hệ Thống", "Set Attributes: ReadOnly,Archive,Hidden and System", 1, 1)
  977. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  978. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  979. Global $rOpt3 = GUICtrlCreateRadio("+RH", 223, 9, 42, 17, BitOR($BS_VCENTER, $BS_FLAT))
  980. GUICtrlSetTip(-1, "Đặt thuộc tính: Chỉ Đọc và Ẩn", "Set Attributes: ReadOnly and Hidden", 1, 1)
  981. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  982. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  983. Global $rOpt4 = GUICtrlCreateRadio("+RS", 268, 9, 42, 17, BitOR($BS_VCENTER, $BS_FLAT))
  984. GUICtrlSetTip(-1, "Đặt thuộc tính: Chỉ Đọc và Hệ Thống", "Set Attributes: ReadOnly and System", 1, 1)
  985. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  986. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  987. Global $rOpt5 = GUICtrlCreateRadio("+SH", 315, 9, 42, 17, BitOR($BS_VCENTER, $BS_FLAT))
  988. GUICtrlSetTip(-1, "Đặt thuộc tính: Ẩn và Hệ Thống", "Set Attributes: Hidden and System", 1, 1)
  989. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  990. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  991. Global $rOpt6 = GUICtrlCreateRadio("+R", 365, 9, 33, 17, BitOR($BS_VCENTER, $BS_FLAT))
  992. GUICtrlSetTip(-1, "Đặt thuộc tính: Chỉ Đọc", "Set Attributes: ReadOnly", 1, 1)
  993. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  994. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  995. Global $rOpt7 = GUICtrlCreateRadio("+S", 407, 9, 33, 17, BitOR($BS_VCENTER, $BS_FLAT))
  996. GUICtrlSetTip(-1, "Đặt thuộc tính: Hệ Thống", "Set Attributes: System", 1, 1)
  997. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  998. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  999. Global $rOpt8 = GUICtrlCreateRadio("+H", 447, 9, 33, 17, BitOR($BS_VCENTER, $BS_FLAT))
  1000. GUICtrlSetTip(-1, "Đặt thuộc tính: Ẩn", "Set Attributes: Hidden", 1, 1)
  1001. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1002. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1003. Global $rOpt9 = GUICtrlCreateRadio("Delete", 102, 56, 55, 17)
  1004. GUICtrlSetTip(-1, "Xóa tập tin và thư mục!", "Delete Files/Folders", 1, 1)
  1005. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1006. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1007. Global $rOpt10 = GUICtrlCreateRadio("Rename Unicode", 160, 56, 105, 17, BitOR($BS_VCENTER, $BS_FLAT))
  1008. GUICtrlSetTip(-1, "Loại bỏ ký tự Unicode (dấu Tiếng Việt) ở tên tập tin/thư mục!", "Removing Unicode characters in name of Files/Folders!", 1, 1)
  1009. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1010. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1011. Global $rOpt11 = GUICtrlCreateRadio("Set files/folders timestamp:", 102, 32, 148, 17)
  1012. GUICtrlSetTip(-1, "Đặt thời gian TẠO/SỬA/TRUY CẬP cho tập tin và thư mục", "Set time CREATED/MODIFIED/ACCESSED for files/folders", 1, 1)
  1013. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1014. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1015. Global $iTimestamp = GUICtrlCreateInput(@YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC, 250, 32, 110, 19)
  1016. GUICtrlSetTip(-1, 'The new time to set in the format "YYYYMMDDHHMMSS" ' & @CRLF & '(Year, month, day, hours (24hr clock), minutes, seconds). ' & @CRLF & 'If the time is blank then the current time is used.', 'Định dạng: NămThángNgàyGiờPhútGiây (Thêm dấu 0 trước Số nhỏ hơn 10)', 1, 1)
  1017. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1018. Global $cCreated = GUICtrlCreateCheckbox("+C", 366, 32, 33, 17)
  1019. GUICtrlSetTip(-1, "Đặt giờ Tạo!", "The timestamp to change: Created", 1, 1)
  1020. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1021. Global $cModified = GUICtrlCreateCheckbox("+M", 408, 32, 33, 17)
  1022. GUICtrlSetTip(-1, "Đặt giờ lần thay đổi cuối cùng!", "The timestamp to change: Last modified", 1, 1)
  1023. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1024. Global $cAccessed = GUICtrlCreateCheckbox("+A", 448, 32, 33, 17)
  1025. GUICtrlSetTip(-1, "Đặt giờ lần truy cập/mở cuối cùng!", "The timestamp to change: Last accessed", 1, 1)
  1026. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1027. Global $cRecurseFolder = GUICtrlCreateCheckbox("Recurse Folder", 267, 56, 90, 17, BitOR($BS_VCENTER, $BS_FLAT))
  1028. GUICtrlSetTip(-1, "Áp dụng bao gồm cả các tập tin và thư mục con!", "Includes files/folder on subfolders.", 1, 1)
  1029. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1030. Global $bFixAutorunUSB = GUICtrlCreateButton("USB Hidden Folder Fix", 362, 52, 115, 25, BitOR($BS_VCENTER, $BS_FLAT))
  1031. GUICtrlSetTip(-1, "Tự động xóa/sửa lỗi và hiện file bị ẩn do virus trên USB", "Fix hidden file/folder on USB", 1, 1)
  1032. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1033. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1034. Global $bSelectFileIN = GUICtrlCreateButton("Drag and Drop Files/Folders HERE", 482, 8, 79, 69, BitOR($BS_VCENTER, $BS_MULTILINE, $BS_FLAT))
  1035. GUICtrlSetTip(-1, "Kéo và thả các tập tin và thư mục muốn áp dụng vào đây!", "Drag and Drop Files/Folders HERE", 1, 1)
  1036. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1037. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1038. Global $bRemoveTemp = GUICtrlCreateButton("R", 16, 40, 15, 15, BitOR($BS_VCENTER, $BS_FLAT))
  1039. GUICtrlSetTip(-1, "Dọn dẹp file tạm trong windows!", "Remove template files", 1, 1)
  1040. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1041. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1042. Global $bAbout = GUICtrlCreateButton("A", 32, 40, 15, 15, BitOR($BS_VCENTER, $BS_FLAT))
  1043. GUICtrlSetTip(-1, "Thông tin tác giả!", "About", 1, 1)
  1044. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1045. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1046. Global $bHideFile = GUICtrlCreateButton("H", 48, 40, 15, 15, BitOR($BS_VCENTER, $BS_FLAT))
  1047. GUICtrlSetTip(-1, "Ẩn tập tin ẨN và thư mục ẨN trên Windows!", "Hide Hidden File/Folder", 1, 1)
  1048. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1049. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1050. Global $bShowFile = GUICtrlCreateButton("S", 64, 40, 15, 15, BitOR($BS_VCENTER, $BS_FLAT))
  1051. GUICtrlSetTip(-1, "Hiện tập tin ẨN và thư mục ẨN trên Windows!", "Show Hidden File/Folder", 1, 1)
  1052. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1053. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1054. Global $cForce = GUICtrlCreateCheckbox("Try Force", 16, 60, 65, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_VCENTER))
  1055. GUICtrlSetTip(-1, "Cố gắng thực hiện lệnh!", "Try to enforce the the command!", 1, 1)
  1056. Global $pStatus = GUICtrlCreateProgress(0, 0, 565, 5, $PBS_SMOOTH)
  1057. GUICtrlSetState(-1, $GUI_DROPACCEPTED)
  1058. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
  1059. WinSetTrans($AppWindows, "", 236)
  1060. #EndRegion # GUI
  1061. Global $__aDropFiles, $sPercent
  1062. GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES")
  1063. GUISetState(@SW_SHOW, $AppWindows)
  1064. _WinAPI_ChangeWindowMessageFilterEx($AppWindows, $WM_DROPFILES, $MSGFLT_ALLOW)
  1065. _WinAPI_ChangeWindowMessageFilterEx($AppWindows, $WM_COPYDATA, $MSGFLT_ALLOW)
  1066. _WinAPI_ChangeWindowMessageFilterEx($AppWindows, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW)
  1067. GUICtrlSetData($pStatus, 100)
  1068. Global $sOption = RegRead($sAppRegKey, "Mode")
  1069. Global $sRecurse = RegRead($sAppRegKey, "Recurse")
  1070. If @error Or $sRecurse <> 0 Then GUICtrlSetState($cRecurseFolder, $GUI_CHECKED)
  1071. Global $sTimestamp = RegRead($sAppRegKey, "Timestamp")
  1072. If (StringLen($sTimestamp) <> 14) Or (Not StringIsInt($sTimestamp)) Then $sTimestamp = ""
  1073. GUICtrlSetData($iTimestamp, $sTimestamp)
  1074. Global $sCreated = RegRead($sAppRegKey, "Created")
  1075. If @error Or $sCreated <> 0 Then GUICtrlSetState($cCreated, $GUI_CHECKED)
  1076. Global $sModified = RegRead($sAppRegKey, "Modified")
  1077. If @error Or $sModified <> 0 Then GUICtrlSetState($cModified, $GUI_CHECKED)
  1078. Global $sAccessed = RegRead($sAppRegKey, "Accessed")
  1079. If @error Or $sAccessed <> 0 Then GUICtrlSetState($cAccessed, $GUI_CHECKED)
  1080. Global $sForce = RegRead($sAppRegKey, "TryForce")
  1081. If $sForce = 1 Then GUICtrlSetState($cForce, $GUI_CHECKED)
  1082. If $sOption = $sOption11 Then
  1083.     GUICtrlSetState($rOpt11, $GUI_CHECKED)
  1084. ElseIf $sOption = $sOption10 Then
  1085.     GUICtrlSetState($rOpt10, $GUI_CHECKED)
  1086. ElseIf $sOption = $sOption9 Then
  1087.     GUICtrlSetState($rOpt9, $GUI_CHECKED)
  1088. ElseIf $sOption = $sOption8 Then
  1089.     GUICtrlSetState($rOpt8, $GUI_CHECKED)
  1090. ElseIf $sOption = $sOption7 Then
  1091.     GUICtrlSetState($rOpt7, $GUI_CHECKED)
  1092. ElseIf $sOption = $sOption6 Then
  1093.     GUICtrlSetState($rOpt6, $GUI_CHECKED)
  1094. ElseIf $sOption = $sOption5 Then
  1095.     GUICtrlSetState($rOpt5, $GUI_CHECKED)
  1096. ElseIf $sOption = $sOption4 Then
  1097.     GUICtrlSetState($rOpt4, $GUI_CHECKED)
  1098. ElseIf $sOption = $sOption3 Then
  1099.     GUICtrlSetState($rOpt3, $GUI_CHECKED)
  1100. ElseIf $sOption = $sOption2 Then
  1101.     GUICtrlSetState($rOpt2, $GUI_CHECKED)
  1102. Else
  1103.     $sOption = $sOption1
  1104.     GUICtrlSetState($rOpt1, $GUI_CHECKED)
  1105. EndIf
  1106. Global $nMsg, $sPercent, $iPercent, $sMode, $isONE
  1107. Local $aCmdLineRaw = StringReplace($CmdLineRaw, '/ErrorStdOut "' & @ScriptFullPath & '"', "")
  1108. Local $aCmdLine = _WinAPI_CommandLineToArgv($aCmdLineRaw)
  1109. If IsArray($aCmdLine) And $aCmdLine[0] > 0 Then
  1110.     _GetSetStatus()
  1111.     If $sMode = 3 Then
  1112.         If StringInStr($sTimestamp, "Invalid") Then
  1113.             MsgBox(48, "Time is Invalid: Thời gian sai định dạng!", 'The new time to set in the format "YYYYMMDDHHMMSS" ' & @CRLF & '(Year, month, day, hours (24hr clock), minutes, seconds). ' & @CRLF & 'If the time is blank then the current time is used.' & @CRLF & ' Using a date earlier than 1980-01-01 will have no effect.' & @CRLF & @CRLF & 'Định dạng: NămThángNgàyGiờPhútGiây ' & @CRLF & '(Thêm dấu 0 trước Số nhỏ hơn 10)' & @CRLF & 'Thời gian phải lớn hơn 1980-01-01', Default, $AppWindows)
  1114.             Exit
  1115.         EndIf
  1116.     EndIf
  1117.     WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1118.     If $aCmdLine[0] = 1 Then
  1119.         _DoIt($aCmdLine[1], 1, 1, 1)
  1120.     Else
  1121.         For $i = 1 To $aCmdLine[0]
  1122.             _DoIt($aCmdLine[$i], $i, $aCmdLine[0])
  1123.         Next
  1124.     EndIf
  1125.     GUICtrlSetData($pStatus, 100)
  1126.     WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1127.     Exit
  1128. Else
  1129.     While 1
  1130.         $nMsg = GUIGetMsg()
  1131.         Switch $nMsg
  1132.             Case $rOpt1, $rOpt2, $rOpt3, $rOpt4, $rOpt5, $rOpt6, $rOpt7, $rOpt8, $rOpt9, $rOpt10, $rOpt11, $cRecurseFolder, $iTimestamp, $cCreated, $cModified, $cAccessed, $cForce
  1133.                 _GetSetStatus()
  1134.             Case $GUI_EVENT_DROPPED
  1135.                 _GetSetStatus()
  1136.                 If $sMode = 3 Then
  1137.                     If StringInStr($sTimestamp, "Invalid") Then
  1138.                         MsgBox(48, "Time is Invalid: Thời gian sai định dạng!", 'The new time to set in the format "YYYYMMDDHHMMSS" ' & @CRLF & '(Year, month, day, hours (24hr clock), minutes, seconds). ' & @CRLF & 'If the time is blank then the current time is used.' & @CRLF & ' Using a date earlier than 1980-01-01 will have no effect.' & @CRLF & @CRLF & 'Định dạng: NămThángNgàyGiờPhútGiây ' & @CRLF & '(Thêm dấu 0 trước Số nhỏ hơn 10)' & @CRLF & 'Thời gian phải lớn hơn 1980-01-01', Default, $AppWindows)
  1139.                         ContinueLoop
  1140.                     EndIf
  1141.                 EndIf
  1142.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1143.                 If $__aDropFiles[0] > 0 Then
  1144.                     If $__aDropFiles[0] = 1 Then
  1145.                         _DoIt($__aDropFiles[1], 1, 1, 1)
  1146.                     Else
  1147.                         For $i = 1 To $__aDropFiles[0]
  1148.                             _DoIt($__aDropFiles[$i], $i, $__aDropFiles[0])
  1149.                         Next
  1150.                     EndIf
  1151.                 EndIf
  1152.                 GUICtrlSetData($pStatus, 100)
  1153.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1154.             Case $bSelectFileIN
  1155.                 Local $zListFileIN, $zFileIN = FileOpenDialog("Select Files to Apply", @WorkingDir, "All Files(*.*)", $FD_MULTISELECT, "", $AppWindows)
  1156.                 If Not @error Then
  1157.                     _GetSetStatus()
  1158.                     If $sMode = 3 Then
  1159.                         If StringInStr($sTimestamp, "Invalid") Then
  1160.                             MsgBox(48, "Time is Invalid: Thời gian sai định dạng!", 'The new time to set in the format "YYYYMMDDHHMMSS" ' & @CRLF & '(Year, month, day, hours (24hr clock), minutes, seconds). ' & @CRLF & 'If the time is blank then the current time is used. ' & @CRLF & 'Using a date earlier than 1980-01-01 will have no effect.' & @CRLF & @CRLF & 'Định dạng: NămThángNgàyGiờPhútGiây ' & @CRLF & '(Thêm dấu 0 trước Số nhỏ hơn 10)' & @CRLF & 'Thời gian phải lớn hơn 1980-01-01', Default, $AppWindows)
  1161.                             ContinueLoop
  1162.                         EndIf
  1163.                     EndIf
  1164.                     WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1165.                     If StringInStr($zFileIN, "|") Then
  1166.                         $zListFileIN = StringSplit($zFileIN, "|")
  1167.                         If IsArray($zListFileIN) Then
  1168.                             For $i = 2 To $zListFileIN[0]
  1169.                                 _DoIt($zListFileIN[1] & "\" & $zListFileIN[$i], $i, $zListFileIN[0])
  1170.                             Next
  1171.                         EndIf
  1172.                     Else
  1173.                         _DoIt($zFileIN, 1, 1, 1)
  1174.                     EndIf
  1175.                 EndIf
  1176.                 GUICtrlSetData($pStatus, 100)
  1177.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1178.             Case $bAbout
  1179.                 MsgBox(64, "Najeeb Attributes Tool: About", "Najeeb Attributes Tool: v2.5" & @CRLF & @CRLF & @YEAR & " © Najeeb Software World - Trong.CF", Default, $AppWindows)
  1180.             Case $bShowFile
  1181.                 _ShowHiddenFile(1)
  1182.             Case $bHideFile
  1183.                 _ShowHiddenFile(0)
  1184.             Case $bRemoveTemp
  1185.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & " Cleaning....")
  1186.                 _RemoveTemp()
  1187.                 GUICtrlSetData($pStatus, 100)
  1188.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1189.             Case $bFixAutorunUSB
  1190.                 _FixUSB()
  1191.                 GUICtrlSetData($pStatus, 100)
  1192.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1193.             Case $GUI_EVENT_CLOSE
  1194.                 _GetSetStatus()
  1195.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & "Setting Saved!")
  1196.                 For $i = 255 To 0 Step -10
  1197.                     WinSetTrans($AppWindows, "", $i)
  1198.                 Next
  1199.                 GUIDelete($AppWindows)
  1200.                 Exit
  1201.         EndSwitch
  1202.     WEnd
  1203. EndIf
  1204.  
  1205. #Region # Function
  1206. Func _DoIt($sFileIN, $iNum, $tNum, $inONE = 0)
  1207.     $sPercent = Int(($iNum / $tNum) * 10000) / 100
  1208.     If $sPercent > 100 Then $sPercent = 100
  1209.     If $inONE = 1 Then $sPercent = $sPercent / 2
  1210.     GUICtrlSetData($pStatus, $sPercent)
  1211.     WinSetTitle($AppWindows, "", $AppTitle & " - " & $sFileIN)
  1212.     If $sMode = 1 Then
  1213.         _DeleteIT($sFileIN, $sRecurse)
  1214.     ElseIf $sMode = 2 Then
  1215.         _RenameUnicode($sFileIN, $sRecurse)
  1216.     ElseIf $sMode = 3 Then
  1217.         If StringInStr($sTimestamp, "Invalid") Then MsgBox(48, $AppTitle, "Time is Invalid")
  1218.         _SetTimestamp($sFileIN, $sRecurse)
  1219.     Else
  1220.         _SetAttributes($sFileIN, $sOption, $sRecurse)
  1221.     EndIf
  1222.     Sleep(100)
  1223. EndFunc   ;==>_DoIt
  1224. Func _RemoveTemp()
  1225.     MsgBox(48, "Warring!", "Please save your work and close all web session before Press OK", Default, $AppWindows)
  1226.     Local $xBefore = DriveSpaceFree($HomeDrive)
  1227.     Local $xTimer = TimerInit()
  1228.     FileRecycleEmpty()
  1229.     Local $vNum = 100
  1230.     While $vNum
  1231.         ProcessClose("opera.exe")
  1232.         If ProcessExists("opera.exe") = 0 Then ExitLoop
  1233.         $vNum -= 1
  1234.     WEnd
  1235.     $vNum = 100
  1236.     While $vNum
  1237.         ProcessClose("firefox.exe")
  1238.         If ProcessExists("firefox.exe") = 0 Then ExitLoop
  1239.         $vNum -= 1
  1240.     WEnd
  1241.     $vNum = 100
  1242.     While $vNum
  1243.         ProcessClose("chrome.exe")
  1244.         If ProcessExists("chrome.exe") = 0 Then ExitLoop
  1245.         $vNum -= 1
  1246.     WEnd
  1247.     $vNum = 100
  1248.     While $vNum
  1249.         ProcessClose("old_chrome.exe")
  1250.         If ProcessExists("old_chrome.exe") = 0 Then ExitLoop
  1251.         $vNum -= 1
  1252.     WEnd
  1253.     _DeleteIT($TempDir, 1, 1)
  1254.     _DeleteIT($WindowsDir & "\Temp", 1, 1)
  1255.     _DeleteIT($WindowsDir & "\System32\config\systemprofile\Local Settings\Temp", 1, 1)
  1256.     _DeleteIT($WindowsDir & "\System32\config\systemprofile\Local Settings\Temporary Internet Files", 1, 1)
  1257.     _DeleteIT($WindowsDir & "\SoftwareDistribution\Download", 1, 1)
  1258.     _DeleteIT($WindowsDir & "\ie8updates", 1, 0)
  1259.     _DeleteIT($HomeDrive & "\$WINDOWS.~BT", 1, 0)
  1260.     _DeleteIT($HomeDrive & "\Windows.old", 1, 0)
  1261.     _DeleteIT($HomeDrive & "\swsetup", 1, 0)
  1262.     _DeleteIT($WindowsDir & "\$hf_mig$", 1, 0)
  1263.     _DeleteIT($HomeDrive & "\Temp", 1, 1)
  1264.     _DeleteIT($HomeDrive & "\Temp\Temporary Internet Files", 1, 1)
  1265.     _DeleteIT($UserProfileDir & "\Local Settings\Temp", 1, 1)
  1266.     _DeleteIT($UserProfileDir & "\Local Settings\History", 1, 1)
  1267.     _DeleteIT($UserProfileDir & "\Local Settings\Temporary Internet Files", 1, 1)
  1268.     _DeleteIT($UserProfileDir & "\Recent", 1, 1)
  1269.     _DeleteIT($UserProfileDir & "\Cookies", 1, 1)
  1270.     _DeleteIT($AppDataDir & "\Microsoft\Office\Recent", 1, 1)
  1271.     _DeleteIT($UserProfileDir & "\AppData\Local\Temp", 1, 1)
  1272.     _DeleteIT($UserProfileDir & "\AppData\LocalLow\Temp", 1, 1)
  1273.     _DeleteIT($UserProfileDir & "\Appdata\Local\Microsoft\Windows\History", 1, 1)
  1274.     _DeleteIT($UserProfileDir & "\Appdata\Local\Microsoft\Windows\WER\ReportArchive", 1, 1)
  1275.     _DeleteIT($UserProfileDir & "\AppData\Local\Microsoft\Windows\Temporary Internet Files", 1, 1)
  1276.     _DeleteIT($UserProfileDir & "\AppData\Local\Microsoft\Windows\INetCache", 1, 1)
  1277.     _DeleteIT($UserProfileDir & "\AppData\Local\Microsoft\Windows\INetCookies", 1, 1)
  1278.     _DeleteIT($UserProfileDir & "\Appdata\Local\Microsoft\Terminal Server Client\Cache", 1, 1)
  1279.     _DeleteIT($AppDataCommonDir & "\Microsoft\Windows\WER\ReportArchive", 1, 1)
  1280.     _DeleteIT($AppDataCommonDir & "\Microsoft\Windows Defender\Scans\History\Results\Resource", 1, 1)
  1281.     _DeleteIT($AppDataDir & "\Sun\Java\Deployment\Cache", 1, 1)
  1282.     _DeleteIT($AppDataDir & "\Microsoft\Windows\Cookies", 1, 1)
  1283.     _DeleteIT($AppDataDir & "\Microsoft\Windows\Recent", 1, 1)
  1284.     _DeleteIT($AppDataDir & "\Microsoft\Office\Recent", 1, 1)
  1285.     _DeleteIT($UserProfileDir & "\AppData\Local\Opera Software\Opera Stable\Cache", 1, 1)
  1286.     _DeleteIT($UserProfileDir & "\Local Settings\Application Data\Opera Software\Opera Stable\Cache", 1, 1)
  1287.     Local $sListFile = _FileListToArray($UserProfileDir & "\Local Settings\Application Data\Mozilla\Firefox\Profiles", "*", 2, 1)
  1288.     For $x = 1 To UBound($sListFile) - 1
  1289.         If FileExists($sListFile[$x] & "\Cache\*.*") Then
  1290.             _DeleteIT($sListFile[$x] & "\Cache", 1, 1)
  1291.             _DeleteIT($sListFile[$x] & "\Cache2", 1, 1)
  1292.             _DeleteIT($sListFile[$x] & "\thumbnails", 1, 1)
  1293.             _DeleteIT($sListFile[$x] & "\startupCache", 1, 1)
  1294.             _DeleteIT($sListFile[$x] & "\jumpListCache", 1, 1)
  1295.             _DeleteIT($sListFile[$x] & "\OfflineCache", 1, 1)
  1296.             _DeleteIT($sListFile[$x] & "\cookies.sqlite", 1, 1)
  1297.         EndIf
  1298.     Next
  1299.     Local $sListFile = _FileListToArray($UserProfileDir & "\Appdata\Local\Mozilla\Firefox\Profiles", "*", 2, 1)
  1300.     For $x = 1 To UBound($sListFile) - 1
  1301.         If FileExists($sListFile[$x] & "\Cache\*.*") Then
  1302.             _DeleteIT($sListFile[$x] & "\Cache", 1, 1)
  1303.             _DeleteIT($sListFile[$x] & "\Cache2", 1, 1)
  1304.             _DeleteIT($sListFile[$x] & "\thumbnails", 1, 1)
  1305.             _DeleteIT($sListFile[$x] & "\startupCache", 1, 1)
  1306.             _DeleteIT($sListFile[$x] & "\jumpListCache", 1, 1)
  1307.             _DeleteIT($sListFile[$x] & "\OfflineCache", 1, 1)
  1308.             _DeleteIT($sListFile[$x] & "\cookies.sqlite", 1, 1)
  1309.         EndIf
  1310.     Next
  1311.     Local $sListFile = _FileListToArray($UserProfileDir & "\AppData\Local\Google\Chrome\User Data", "*", 2, 1)
  1312.     For $x = 1 To UBound($sListFile) - 1
  1313.         If FileExists($sListFile[$x] & "\Cache\*.*") Then
  1314.             _DeleteIT($sListFile[$x] & "\Cache", 1, 1)
  1315.             _DeleteIT($sListFile[$x] & "\Cookies-journal", 1, 1)
  1316.             _DeleteIT($sListFile[$x] & "\Current Session", 1, 1)
  1317.             _DeleteIT($sListFile[$x] & "\History", 1, 1)
  1318.             _DeleteIT($sListFile[$x] & "\History-journal", 1, 1)
  1319.         EndIf
  1320.     Next
  1321.     Local $sListFile = _FileListToArray($UserProfileDir & "\Local Settings\Application Data\Google\Chrome\User Data", "*", 2, 1)
  1322.     For $x = 1 To UBound($sListFile) - 1
  1323.         If FileExists($sListFile[$x] & "\Cache\*.*") Then
  1324.             _DeleteIT($sListFile[$x] & "\Cache", 1, 1)
  1325.             _DeleteIT($sListFile[$x] & "\Cookies-journal", 1, 1)
  1326.             _DeleteIT($sListFile[$x] & "\Current Session", 1, 1)
  1327.             _DeleteIT($sListFile[$x] & "\History", 1, 1)
  1328.             _DeleteIT($sListFile[$x] & "\History-journal", 1, 1)
  1329.         EndIf
  1330.     Next
  1331.     _DeleteIT(@ProgramFilesDir & "\Google\Update\Download", 1, 1)
  1332.     _DeleteIT(@ProgramFilesDir & "\Google\Update\Install", 1, 1)
  1333.     _DeleteIT(@ProgramFilesDir & "\Google\Chrome\Application\old_chrome.exe", 1, 0)
  1334.     Local $xListFile = _FileListToArray(@ProgramFilesDir & "\Google\Chrome\Application", "*", 2, 0)
  1335.     Local $xLargestVersion
  1336.     For $x = 0 To UBound($xListFile) - 1
  1337.         StringReplace($xListFile[$x], ".", "")
  1338.         If @extended > 2 Then $xLargestVersion &= $xListFile[$x] & "|"
  1339.     Next
  1340.     If StringRight($xLargestVersion, 1) = "|" Then $xLargestVersion = StringTrimRight($xLargestVersion, 1)
  1341.     Local $xArray = StringSplit($xLargestVersion, "|")
  1342.     _ArraySort($xArray, 0, 0, 0, 0, "_CompareVersion")
  1343.     Local $sLargestVersion = $xArray[UBound($xArray) - 1]
  1344.     For $x = 1 To UBound($xArray) - 1
  1345.         If $xArray[$x] <> $sLargestVersion Then _DeleteIT(@ProgramFilesDir & "\Google\Chrome\Application\" & $xArray[$x], 1, 0)
  1346.     Next
  1347.     Local $sListFile = _FileListToArray($WindowsDir, "$*Uninstall*$", 2, 1)
  1348.     For $x = 1 To UBound($sListFile) - 1
  1349.         _DeleteIT($sListFile[$x], 1, 0)
  1350.     Next
  1351.     Local $sListFile = _FileListToArray($WindowsDir, "KB*.log", 2, 1)
  1352.     For $x = 1 To UBound($sListFile) - 1
  1353.         _DeleteIT($sListFile[$x], 1, 0)
  1354.     Next
  1355.     WinSetTitle($AppWindows, "", $AppTitle & " - " & " Cleaning....")
  1356.     RunWait($ComSpec & ' /c Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase', "", @SW_MINIMIZE)
  1357.     RunWait($ComSpec & ' /c Dism.exe /online /Cleanup-Image /SPSuperseded', "", @SW_MINIMIZE)
  1358.     ShellExecuteWait("RunDll32.exe", " InetCpl.cpl,ClearMyTracksByProcess 255")
  1359.     _ClipEmpty()
  1360.     Local $xAfter = DriveSpaceFree($HomeDrive)
  1361.     Local $xFinishTimer = TimerDiff($xTimer)
  1362.     WinSetTitle($AppWindows, "", $AppTitle & " - " & " All Done!")
  1363.     MsgBox(64, "Finished", Round($xAfter - $xBefore, 1) & "MB has been removed" & @CRLF & "in " & Round(($xFinishTimer / 1000), 3) & " seconds!", Default, $AppWindows)
  1364. EndFunc   ;==>_RemoveTemp
  1365. Func _ClipEmpty()
  1366.     Local $Success = 0
  1367.     DllCall('user32.dll', 'int', 'OpenClipboard', 'hwnd', 0)
  1368.     If @error = 0 Then
  1369.         DllCall('user32.dll', 'int', 'EmptyClipboard')
  1370.         If @error = 0 Then $Success = 1
  1371.         DllCall('user32.dll', 'int', 'CloseClipboard')
  1372.         If $Success Then Return 1
  1373.     EndIf
  1374.     DllCall('user32.dll', 'int', 'CloseClipboard')
  1375.     Return 0
  1376. EndFunc   ;==>_ClipEmpty
  1377. Func _FixUSB()
  1378.     Local $aArray = DriveGetDrive($DT_ALL)
  1379.     If @error Then Return SetError(1, 0, 0)
  1380.     If $sForce = 1 Then _FixVirusUserInit()
  1381.     For $i = 1 To $aArray[0]
  1382.         Local $sDrive = StringUpper($aArray[$i])
  1383.         If DriveStatus($sDrive & "\") = $DS_READY Then
  1384.             If _IsUSB($sDrive) Then
  1385.                 WinSetTitle($AppWindows, "", $AppTitle & " - Fix USB: " & "Please waitting...")
  1386.                 Local $sListFile = _FileListToArray($sDrive, "*.*", 1, 1)
  1387.                 For $x = 1 To UBound($sListFile) - 1
  1388.                     FileSetAttrib($sListFile[$x], "-RASH", 0)
  1389.                     If StringLower(_SplitPath($sListFile[$x], 4)) = ".lnk" Then _DeleteIT($sListFile[$x])
  1390.                 Next
  1391.             EndIf
  1392.         EndIf
  1393.     Next
  1394.     For $i = 1 To $aArray[0]
  1395.         Local $sDrive = StringUpper($aArray[$i])
  1396.         If DriveStatus($sDrive & "\") = $DS_READY Then
  1397.             If _IsUSB($sDrive) Then
  1398.                 WinSetTitle($AppWindows, "", $AppTitle & " - Fix USB: " & "Please waitting...")
  1399.                 Local $sListFile = _FileListToArrayRec($sDrive, "*", 0, $sRecurse, 2, 2)
  1400.                 For $x = 1 To UBound($sListFile) - 1
  1401.                     Local $sFileDir = $sListFile[$x]
  1402.                     FileSetAttrib($sFileDir, "-RASH")
  1403.                     If FileExists(_SplitPath($sFileDir, 7)) Then
  1404.                         If StringLower(_SplitPath($sFileDir, 4)) = ".exe" And _IsFile($sFileDir) Then _DeleteIT($sFileDir)
  1405.                     EndIf
  1406.                 Next
  1407.                 If FileExists($sDrive & "\System Volume Information") Then _DeleteIT($sDrive & "\System Volume Information", 1)
  1408.                 If FileExists($sDrive & "\RECYCLER") Then _DeleteIT($sDrive & "\RECYCLER", 1)
  1409.                 FileWrite($sDrive & "\RECYCLER", "Protection from viruses!")
  1410.                 FileSetAttrib($sDrive & "\RECYCLER", "+RASHO")
  1411.                 If FileExists($sDrive & "\RECYCLER") Then _DeleteIT($sDrive & "\$RECYCLE.BIN", 1)
  1412.                 FileWrite($sDrive & "\$RECYCLE.BIN", "Protection from viruses!")
  1413.                 FileSetAttrib($sDrive & "\$RECYCLE.BIN", "+RASHO")
  1414.             EndIf
  1415.             Local $sDriverType = DriveGetType($sDrive)
  1416.             If $sDriverType = "Removable" Or $sDriverType = "Fixed" Then
  1417.                 WinSetTitle($AppWindows, "", $AppTitle & " - Fix USB: " & "Please waitting...")
  1418.                 Local $sListFile = _FileListToArray($sDrive, "FOUND.*", 0, 1)
  1419.                 For $x = 1 To UBound($sListFile) - 1
  1420.                     _DeleteIT($sListFile[$x], 1)
  1421.                 Next
  1422.                 Local $sProcessList = StringSplit("Images.exe|SysAnti.exe|SafeSys.exe|svcshot.exe|System.exe|phimnguoilon.exe|phim nguoi lon.exe|phimhot.exe|phim hot.exe|special.exe|secret.exe|bimat.exe|bi mat.exe|forever.exe|romantic.exe|mixa.exe|nhacmoi.exe|new folder.exe|newfolder.exe|image.exe|images.exe|My Music.exe|MyMusic.exe|Music.exe|my picture.exe|mypicture.exe|picture.exe", "|")
  1423.                 For $v = 1 To UBound($sProcessList) - 1
  1424.                     If _IsFile($sDrive & "\" & $sProcessList[$v]) Then
  1425.                         _DeleteIT($sDrive & "\" & $sProcessList[$v])
  1426.                     Else
  1427.                         FileDelete($sDrive & "\" & $sProcessList[$v] & "\*.*")
  1428.                         If FileExists($sDrive & "\" & $sProcessList[$v]) Then FileSetAttrib($sDrive & "\" & $sProcessList[$v], "+RASHO")
  1429.                     EndIf
  1430.                 Next
  1431.                 If FileExists($sDrive & "\Autorun.bak") Then _DeleteIT($sDrive & "\Autorun.bak", 1)
  1432.                 If FileExists($sDrive & "\Autorun.inf") Then
  1433.                     If StringInStr(FileRead($sDrive & "\Autorun.inf"), "SETUP.exe") Then
  1434.                         FileSetAttrib($sDrive & "\Autorun.inf", "-RASH", 0)
  1435.                         FileMove($sDrive & "\Autorun.inf", $sDrive & "\Autorun.bak", 1)
  1436.                         If @error And $sForce = 1 Then
  1437.                             _TakeOwnership($sDrive & "\Autorun.inf")
  1438.                             FileMove($sDrive & "\Autorun.inf", $sDrive & "\Autorun.bak", 1)
  1439.                         EndIf
  1440.                     EndIf
  1441.                     If _IsFile($sDrive & "\Autorun.inf") Then _DeleteIT($sDrive & "\Autorun.inf", 1)
  1442.                 EndIf
  1443.                 DirCreate($sDrive & "\Autorun.inf")
  1444.                 FileSetAttrib($sDrive & "\Autorun.inf", "+RASHO")
  1445.             EndIf
  1446.         EndIf
  1447.     Next
  1448.     _UpdateExplorer()
  1449. EndFunc   ;==>_FixUSB
  1450. Func _FixVirusUserInit()
  1451.     Local $sWinlogonKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
  1452.     Local $dUserInit = RegRead($sWinlogonKEY, "Userinit")
  1453.     Local $dShell = RegRead($sWinlogonKEY, "Shell")
  1454.     Local $dUIHost = RegRead($sWinlogonKEY, "UIHost")
  1455.     Local $dShellInfrastructure = RegRead($sWinlogonKEY, "ShellInfrastructure")
  1456.     Local $sModifl = $dUIHost <> "" And StringLower($dUIHost) <> StringLower("LogonUI.exe")
  1457.     Local $sModifi = StringLower($dShell) <> StringLower("explorer.exe")
  1458.     Local $sModify = StringLower($dUserInit) <> StringLower("C:\WINDOWS\system32\userinit.exe,")
  1459.     Local $sModif1 = $dShellInfrastructure <> "" And StringLower($dShellInfrastructure) <> StringLower("sihost.exe")
  1460.     Local $sProcess, $sListProcess = StringSplit("Images.exe|SysAnti.exe|SafeSys.exe|svcshot.exe|System.exe|phimnguoilon.exe|phim nguoi lon.exe|phimhot.exe|phim hot.exe|special.exe|secret.exe|bimat.exe|bi mat.exe|forever.exe|romantic.exe|mixa.exe|nhacmoi.exe|new folder.exe|newfolder.exe|image.exe|images.exe|My Music.exe|MyMusic.exe|Music.exe|my picture.exe|mypicture.exe|picture.exe", "|")
  1461.     For $i = 1 To UBound($sListProcess) - 1
  1462.         If ProcessExists($sListProcess[$i]) Then $sProcess &= ' /IM "' & $sListProcess[$i] & '"'
  1463.     Next
  1464.     If $sProcess <> "" Then RunWait(@ComSpec & " /c taskkill /F " & $sProcess, "", @SW_HIDE)
  1465.     If $sModifl Or $sModifi Or $sModify Or $sModif1 Then
  1466.         RegWrite($sWinlogonKEY, "Userinit", "REG_SZ", "C:\WINDOWS\system32\userinit.exe,")
  1467.         RegWrite($sWinlogonKEY, "Shell", "REG_SZ", "explorer.exe")
  1468.         If $dUIHost <> "" Then RegWrite($sWinlogonKEY, "UIHost", "REG_EXPAND_SZ", "LogonUI.exe")
  1469.         If $dShellInfrastructure <> "" Then RegWrite($sWinlogonKEY, "ShellInfrastructure", "REG_SZ", "sihost.exe")
  1470.         RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies")
  1471.         RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies")
  1472.         _DeleteIT($WindowsDir & "\System32\system.exe")
  1473.         _DeleteIT($WindowsDir & "\System32\task.exe")
  1474.         _DeleteIT($WindowsDir & "\userinit.exe")
  1475.         _DeleteIT($WindowsDir & "\kdcoms.dll")
  1476.         _DeleteIT($WindowsDir & "\kdcoms32.dll")
  1477.     EndIf
  1478. EndFunc   ;==>_FixVirusUserInit
  1479. Func _IsUSB($sDrive)
  1480.     Local $sIsUSB = 0, $sType = DriveGetType($sDrive, 3)
  1481.     If DriveGetType($sDrive, 1) = "Removable" Or $sType = "USB" Or $sType = "SD" Or $sType = "MMC" Then $sIsUSB = 1
  1482.     Return $sIsUSB
  1483. EndFunc   ;==>_IsUSB
  1484. Func _ShowHiddenFile($iShow)
  1485.     If $iShow Then
  1486.         RegWrite($sKeyREGexp, "HideFileExt", "REG_DWORD", 0)
  1487.         RegWrite($sKeyREGexp, "Hidden", "REG_DWORD", 1)
  1488.         RegWrite($sKeyREGexp, "SuperHidden", "REG_DWORD", 1)
  1489.         RegWrite($sKeyREGexp, "ShowSuperHidden", "REG_DWORD", 1)
  1490.         MsgBox(0, $AppTitle, "Files/folders Hidden are displayed!" & @CRLF & _UpdateExplorer() & @CRLF & "Các tập tin/thư mục ẨN đã được hiển thị.", Default, $AppWindows)
  1491.     Else
  1492.         RegWrite($sKeyREGexp, "HideFileExt", "REG_DWORD", 0)
  1493.         RegWrite($sKeyREGexp, "Hidden", "REG_DWORD", 2)
  1494.         RegWrite($sKeyREGexp, "SuperHidden", "REG_DWORD", 0)
  1495.         RegWrite($sKeyREGexp, "ShowSuperHidden", "REG_DWORD", 0)
  1496.         MsgBox(0, $AppTitle, "Files/folders Hidden are hide!" & @CRLF & _UpdateExplorer() & @CRLF & "Các tập tin/thư mục ẨN đã được ẨN.", Default, $AppWindows)
  1497.     EndIf
  1498. EndFunc   ;==>_ShowHiddenFile
  1499. Func _UpdateExplorer()
  1500.     Local $bold = Opt("WinSearchChildren", True)
  1501.     Local $a = WinList("[CLASS:SHELLDLL_DefView]")
  1502.     For $i = 0 To UBound($a) - 1
  1503.         DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 273, "int", 28931, "int", 0)
  1504.     Next
  1505.     Opt("WinSearchChildren", $bold)
  1506.     Return ">"
  1507. EndFunc   ;==>_UpdateExplorer
  1508. Func _SetTimestamp($sFileDirIN, $sRecurseDir = 0)
  1509.     WinSetTitle($AppWindows, "", $AppTitle & " - Sets timestamp: " & $sFileDirIN)
  1510.     ConsoleRead("!" & $sTimestamp & @CRLF)
  1511.     If $sRecurseDir = 1 Then
  1512.         If StringInStr(FileGetAttrib($sFileDirIN), 'D') <> 1 Then $sRecurseDir = 0
  1513.     EndIf
  1514.     If $sModified = 1 Then FileSetTime($sFileDirIN, $sTimestamp, $FT_MODIFIED, $sRecurseDir)
  1515.     If $sCreated = 1 Then FileSetTime($sFileDirIN, $sTimestamp, $FT_CREATED, $sRecurseDir)
  1516.     If $sAccessed = 1 Then FileSetTime($sFileDirIN, $sTimestamp, $FT_ACCESSED, $sRecurseDir)
  1517.     Return 1
  1518. EndFunc   ;==>_SetTimestamp
  1519. Func _DeleteIT($sFileDirIN, $sRecurseDir = 0, $oEmtyDir = 0)
  1520.     If Not $oEmtyDir Then
  1521.         If $sRecurseDir = 1 Then
  1522.             If StringInStr(FileGetAttrib($sFileDirIN), 'D') <> 1 Then $sRecurseDir = 0
  1523.         EndIf
  1524.         If StringInStr($sFileDirIN, "*") Then
  1525.             Local $sTMPdir = _SplitPath($sFileDirIN, 6)
  1526.             Local $sTMPext = _SplitPath($sFileDirIN, 5)
  1527.             $sTMPext = StringReplace($sTMPext, "**", "*")
  1528.             If $sTMPext == "*.*" Then $sTMPext = "*"
  1529.             If $sRecurseDir Then
  1530.                 WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1531.                 Local $xList = _FileListToArray($sFileDirIN, $sTMPext, 0, 1)
  1532.                 For $f = 0 To UBound($xList) - 1
  1533.                     _DeleteIT($xList[$f], $sRecurseDir)
  1534.                 Next
  1535.             EndIf
  1536.         Else
  1537.             If Not FileExists($sFileDirIN) Then Return SetError(1, 0, 0)
  1538.             WinSetTitle($AppWindows, "", $AppTitle & " - " & "Delete " & $sFileDirIN & " ...")
  1539.             If _IsFile($sFileDirIN) Then
  1540.                 FileDelete($sFileDirIN)
  1541.                 If FileExists($sFileDirIN) Then
  1542.                     FileSetAttrib($sFileDirIN, "-RASH")
  1543.                     If $sForce = 1 Then _TakeOwnership($sFileDirIN)
  1544.                     If $sRecurseDir Then
  1545.                         RunWait($ComSpec & ' /c DEL /F /S /Q "' & $sFileDirIN & '"', '', @SW_HIDE)
  1546.                     Else
  1547.                         RunWait($ComSpec & ' /c DEL /F /Q "' & $sFileDirIN & '"', '', @SW_HIDE)
  1548.                     EndIf
  1549.                     FileDelete($sFileDirIN)
  1550.                 EndIf
  1551.                 If FileExists($sFileDirIN) Then WinSetTitle($AppWindows, "", $AppTitle & " - " & "Error on delete " & $sFileDirIN)
  1552.             Else
  1553.                 If StringInStr($sFileDirIN, ":") And StringLen($sFileDirIN) > 3 Then
  1554.                     DirRemove($sFileDirIN, $sRecurseDir)
  1555.                     If FileExists($sFileDirIN) Then
  1556.                         FileSetAttrib($sFileDirIN, "-RASH", $sRecurseDir)
  1557.                         If $sForce = 1 Then _TakeOwnership($sFileDirIN)
  1558.                         DirRemove($sFileDirIN, $sRecurseDir)
  1559.                         If FileExists($sFileDirIN) Then
  1560.                             If $sRecurseDir Then
  1561.                                 RunWait($ComSpec & ' /c RD /S /Q "' & $sFileDirIN & '"', '', @SW_HIDE)
  1562.                             Else
  1563.                                 RunWait($ComSpec & ' /c RD /Q "' & $sFileDirIN & '"', '', @SW_HIDE)
  1564.                             EndIf
  1565.                         EndIf
  1566.                     EndIf
  1567.                     If FileExists($sFileDirIN) Then WinSetTitle($AppWindows, "", $AppTitle & " - " & "Error on delete " & $sFileDirIN)
  1568.                 Else
  1569.                     If $sRecurseDir Then
  1570.                         WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1571.                         Local $xList = _FileListToArray($sFileDirIN, "*", 0, 1)
  1572.                         For $c = 0 To UBound($xList) - 1
  1573.                             _DeleteIT($xList[$c], $sRecurseDir)
  1574.                         Next
  1575.                         If FileExists(_WinAPI_PathAddBackslash($sFileDirIN) & '*.*') Then WinSetTitle($AppWindows, "", $AppTitle & " - " & "Error on delete " & $sFileDirIN)
  1576.                     Else
  1577.                         WinSetTitle($AppWindows, "", $AppTitle & " - " & "Error on delete " & $sFileDirIN)
  1578.                     EndIf
  1579.                 EndIf
  1580.             EndIf
  1581.         EndIf
  1582.     Else
  1583.         If $sRecurseDir And (Not _IsFile($sFileDirIN)) Then
  1584.             WinSetTitle($AppWindows, "", $AppTitle & " - " & "Please waitting...")
  1585.             Local $xList = _FileListToArray($sFileDirIN, "*", 0, 1)
  1586.             For $x = 0 To UBound($xList) - 1
  1587.                 _DeleteIT($xList[$x], $sRecurseDir)
  1588.             Next
  1589.         EndIf
  1590.     EndIf
  1591. EndFunc   ;==>_DeleteIT
  1592. Func _IsFile($sPath)
  1593.     If Not FileExists($sPath) Then Return SetError(1, 0, -1)
  1594.     If StringInStr(FileGetAttrib($sPath), 'D') <> 0 Then
  1595.         Return SetError(0, 0, 0)
  1596.     Else
  1597.         Return SetError(0, 0, 1)
  1598.     EndIf
  1599. EndFunc   ;==>_IsFile
  1600. Func _RenameUnicode($sFileDirIN, $sRecurseDir)
  1601.     If Not FileExists($sFileDirIN) Then Return SetError(1, 0, 3)
  1602.     Local $sFileDirOUT
  1603.     If StringInStr(FileGetAttrib($sFileDirIN), 'D') <> 0 Then
  1604.         If $sRecurseDir Then
  1605.             Local $sFileList = _FileListToArrayRec($sFileDirIN, "*", 1, 1, 1, 2)
  1606.             For $x = 1 To UBound($sFileList) - 1
  1607.                 GUICtrlSetData($pStatus, Int(($x / $sFileList[0]) * 10000) / 200)
  1608.                 $sFileDirOUT = _SplitPath($sFileList[$x], 6) & _StringToASCII(_SplitPath($sFileList[$x], 5))
  1609.                 _MoveFile($sFileList[$x], $sFileDirOUT)
  1610.             Next
  1611.             Local $sDirList = _FileListToArrayRec($sFileDirIN, "*", 2, 1, 1, 2)
  1612.             Local $nn, $nTotal = UBound($sDirList)
  1613.             For $x = 1 To $nTotal - 1
  1614.                 GUICtrlSetData($pStatus, 50 + Int(($x / $sFileList[0]) * 10000) / 200)
  1615.                 $nn = $nTotal - $x
  1616.                 $sFileDirOUT = _SplitPath($sDirList[$nn], 6) & _StringToASCII(_SplitPath($sDirList[$nn], 3))
  1617.                 _MoveDir($sDirList[$nn], $sFileDirOUT)
  1618.             Next
  1619.         EndIf
  1620.         $sFileDirOUT = _SplitPath($sFileDirIN, 6) & _StringToASCII(_SplitPath($sFileDirIN, 3))
  1621.         Return SetError(0, 0, _MoveDir($sFileDirIN, $sFileDirOUT))
  1622.     Else
  1623.         $sFileDirOUT = _SplitPath($sFileDirIN, 6) & _StringToASCII(_SplitPath($sFileDirIN, 5))
  1624.         Return SetError(0, 0, _MoveFile($sFileDirIN, $sFileDirOUT))
  1625.     EndIf
  1626. EndFunc   ;==>_RenameUnicode
  1627. Func _MoveDir($sFileDirIN, $sFileDirOUT)
  1628.     If Not FileExists($sFileDirOUT) Then
  1629.         DirMove($sFileDirIN, $sFileDirOUT, 1)
  1630.         If @error And $sForce = 1 Then
  1631.             _TakeOwnership($sFileDirIN)
  1632.             DirMove($sFileDirIN, $sFileDirOUT, 1)
  1633.         EndIf
  1634.         Return SetError(0, 0, FileExists($sFileDirOUT))
  1635.     EndIf
  1636. EndFunc   ;==>_MoveDir
  1637. Func _MoveFile($sFileDirIN, $sFileDirOUT)
  1638.     If Not FileExists($sFileDirOUT) Then
  1639.         FileMove($sFileDirIN, $sFileDirOUT, 1)
  1640.         If @error And $sForce = 1 Then
  1641.             _TakeOwnership($sFileDirIN)
  1642.             FileMove($sFileDirIN, $sFileDirOUT, 1)
  1643.         EndIf
  1644.         Return SetError(0, 0, FileExists($sFileDirOUT))
  1645.     EndIf
  1646.     Return SetError(0, 1, 0)
  1647. EndFunc   ;==>_MoveFile
  1648. Func _StringToASCII($xString)
  1649.     If $xString = "" Or StringIsASCII($xString) Then Return $xString
  1650.     Local $sCharVN[14][2] = [["á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ", "a"], ["Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ", "A"], ["đ", "d"], ["Đ", "D"], ["ê|é|è|ẻ|ẽ|ẹ|ế|ề|ể|ễ|ệ", "e"], ["Ê|É|È|Ẻ|Ẽ|Ẹ|Ế|Ề|Ể|Ễ|Ệ", "E"], ["ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự", "u"], ["Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự", "U"], ["ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ", "o"], ["Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ", "O"], ["í|ì|ỉ|ĩ|ị", "i"], ["Í|Ì|Ỉ|Ĩ|Ị", "I"], ["ý|ỳ|ỷ|ỹ|ỵ", "y"], ["Ý|Ỳ|Ỷ|Ỹ|Ỵ", "Y"]]
  1651.     For $i = 0 To 13
  1652.         $xString = StringRegExpReplace($xString, $sCharVN[$i][0], $sCharVN[$i][1])
  1653.     Next
  1654.     $xString = StringRegExpReplace($xString, '[[:^print:]]', "_")
  1655.     Do
  1656.         $xString = StringReplace($xString, "_-_", "_")
  1657.     Until Not StringInStr($xString, "_-_")
  1658.     Do
  1659.         $xString = StringReplace($xString, "__", "_")
  1660.     Until Not StringInStr($xString, "__")
  1661.     Return SetError(0, 0, $xString)
  1662. EndFunc   ;==>_StringToASCII
  1663. Func _SetAttributes($sFileDirIN, $sAttribSet = Default, $sRecurseDir = 1)
  1664.     If ($sAttribSet <> $sOption1 And $sAttribSet <> $sOption2 And $sAttribSet <> $sOption3 And $sAttribSet <> $sOption4 And $sAttribSet <> $sOption5 And $sAttribSet <> $sOption6 And $sAttribSet <> $sOption7 And $sAttribSet <> $sOption8) Or $sAttribSet = "" Or $sAttribSet = -1 Or $sAttribSet = Default Then $sAttribSet = $sOption1
  1665.     If ($sFileDirIN <> "") And ((Not StringInStr($sFileDirIN, "\")) Or (Not StringInStr($sFileDirIN, ":")) Or StringInStr($sFileDirIN, "..\")) Then $sFileDirIN = _PathFull($sFileDirIN, @WorkingDir)
  1666.     Local $SetAttrib, $sFileDirNameIN = _SplitPath($sFileDirIN, 5)
  1667.     If FileExists($sFileDirIN) Then
  1668.         If $sRecurseDir = 1 Then
  1669.             If StringInStr(FileGetAttrib($sFileDirIN), 'D') <> 1 Then $sRecurseDir = 0
  1670.         EndIf
  1671.         $SetAttrib = FileSetAttrib($sFileDirIN, $sAttribSet, $sRecurseDir)
  1672.         If (@error Or $SetAttrib = 0) And $sForce = 1 Then
  1673.             _TakeOwnership($sFileDirIN)
  1674.             $SetAttrib = FileSetAttrib($sFileDirIN, $sAttribSet, $sRecurseDir)
  1675.         EndIf
  1676.         If $SetAttrib <> 0 Then
  1677.             WinSetTitle($AppWindows, "", $AppTitle & " - " & "Set attribute " & $sAttribSet & " file " & $sFileDirNameIN & " success!")
  1678.         Else
  1679.             WinSetTitle($AppWindows, "", $AppTitle & " - " & "Set attribute " & $sAttribSet & " file " & $sFileDirNameIN & " failure!")
  1680.         EndIf
  1681.         Return SetError($SetAttrib = 0, 0, $SetAttrib > 0)
  1682.     Else
  1683.         WinSetTitle($AppWindows, "", $AppTitle & " - " & "File Not Found " & $sFileDirNameIN)
  1684.         Return SetError(1, 0, 0)
  1685.     EndIf
  1686. EndFunc   ;==>_SetAttributes
  1687. Func _TakeOwnership($xFile)
  1688.     If Not FileExists($xFile) Then Return SetError(1, 0, $xFile)
  1689.     If StringInStr(FileGetAttrib($xFile), 'D') <> 0 Then
  1690.         RunWait($ComSpec & ' /c takeown /f "' & $xFile & '" /R /D Y', '', @SW_HIDE)
  1691.         RunWait($ComSpec & ' /c Echo y|cacls "' & $xFile & '" /T /C /G Administrators:F', '', @SW_HIDE)
  1692.         RunWait($ComSpec & ' /c icacls "' & $xFile & '" /grant Administrators:F /T /C /Q', '', @SW_HIDE)
  1693.         Return SetError(0, 0, 0)
  1694.     Else
  1695.         RunWait($ComSpec & ' /c takeown /f "' & $xFile & '"', '', @SW_HIDE)
  1696.         RunWait($ComSpec & ' /c Echo y|cacls "' & $xFile & '" /C /G Administrators:F', '', @SW_HIDE)
  1697.         RunWait($ComSpec & ' /c icacls "' & $xFile & '" /grant Administrators:F /Q', '', @SW_HIDE)
  1698.         Return SetError(0, 0, 1)
  1699.     EndIf
  1700.     Return $xFile
  1701. EndFunc   ;==>_TakeOwnership
  1702. Func _GetSetStatus()
  1703.     $sOption = $sOption1
  1704.     $sMode = 0
  1705.     $sRecurse = 0
  1706.     $sTimestamp = ""
  1707.     $sCreated = -1
  1708.     $sModified = -1
  1709.     $sAccessed = -1
  1710.     $sForce = 0
  1711.     If GUICtrlRead($rOpt11) = $GUI_CHECKED Then
  1712.         $sOption = $sOption11
  1713.         $sMode = 3
  1714.     EndIf
  1715.     If GUICtrlRead($rOpt10) = $GUI_CHECKED Then
  1716.         $sOption = $sOption10
  1717.         $sMode = 2
  1718.     EndIf
  1719.     If GUICtrlRead($rOpt9) = $GUI_CHECKED Then
  1720.         $sOption = $sOption9
  1721.         $sMode = 1
  1722.     EndIf
  1723.     If GUICtrlRead($rOpt8) = $GUI_CHECKED Then $sOption = $sOption8
  1724.     If GUICtrlRead($rOpt7) = $GUI_CHECKED Then $sOption = $sOption7
  1725.     If GUICtrlRead($rOpt6) = $GUI_CHECKED Then $sOption = $sOption6
  1726.     If GUICtrlRead($rOpt5) = $GUI_CHECKED Then $sOption = $sOption5
  1727.     If GUICtrlRead($rOpt4) = $GUI_CHECKED Then $sOption = $sOption4
  1728.     If GUICtrlRead($rOpt3) = $GUI_CHECKED Then $sOption = $sOption3
  1729.     If GUICtrlRead($rOpt2) = $GUI_CHECKED Then $sOption = $sOption2
  1730.     If GUICtrlRead($cRecurseFolder) = $GUI_CHECKED Then $sRecurse = 1
  1731.     If GUICtrlRead($cForce) = $GUI_CHECKED Then $sForce = 1
  1732.     $sTimestamp = GUICtrlRead($iTimestamp, 0)
  1733.     If GUICtrlRead($cCreated) = $GUI_CHECKED Then $sCreated = 1
  1734.     If GUICtrlRead($cModified) = $GUI_CHECKED Then $sModified = 1
  1735.     If GUICtrlRead($cAccessed) = $GUI_CHECKED Then $sAccessed = 1
  1736.     RegWrite($sAppRegKey, "Created", "REG_DWORD", $sCreated)
  1737.     RegWrite($sAppRegKey, "Modified", "REG_DWORD", $sModified)
  1738.     RegWrite($sAppRegKey, "Accessed", "REG_DWORD", $sAccessed)
  1739.     RegWrite($sAppRegKey, "Timestamp", "REG_SZ", $sTimestamp)
  1740.     RegWrite($sAppRegKey, "Mode", "REG_SZ", $sOption)
  1741.     RegWrite($sAppRegKey, "Recurse", "REG_DWORD", $sRecurse)
  1742.     RegWrite($sAppRegKey, "TryForce", "REG_DWORD", $sForce)
  1743.     If $sTimestamp <> "" Then
  1744.         If (StringLen($sTimestamp) <> 14) Or (Not StringIsInt($sTimestamp)) Then $sTimestamp = "Time is Invalid"
  1745.     EndIf
  1746.     Return 1
  1747. EndFunc   ;==>_GetSetStatus
  1748. Func WM_DROPFILES($hWnd, $iMsg, $iwParam, $ilParam)
  1749.     #forceref $hWnd, $ilParam
  1750.     Switch $iMsg
  1751.         Case $WM_DROPFILES
  1752.             Local $aReturn = _WinAPI_DragQueryFileEx($iwParam)
  1753.             If IsArray($aReturn) Then
  1754.                 $__aDropFiles = $aReturn
  1755.             Else
  1756.                 Local $aError[1] = [0]
  1757.                 $__aDropFiles = $aError
  1758.             EndIf
  1759.     EndSwitch
  1760.     Return $GUI_RUNDEFMSG
  1761. EndFunc   ;==>WM_DROPFILES
  1762. Func _SplitPath($sFilePath, $sType = 0)
  1763.     Local $sDrive, $sDir, $sFileName, $sExtension, $sReturn
  1764.     Local $aArray = StringRegExp($sFilePath, "^\h*((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\]\h*)?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1)
  1765.     If @error Then
  1766.         ReDim $aArray[5]
  1767.         $aArray[0] = $sFilePath
  1768.     EndIf
  1769.     $sDrive = $aArray[1]
  1770.     If StringLeft($aArray[2], 1) == "/" Then
  1771.         $sDir = StringRegExpReplace($aArray[2], "\h*[\/\\]+\h*", "\/")
  1772.     Else
  1773.         $sDir = StringRegExpReplace($aArray[2], "\h*[\/\\]+\h*", "\\")
  1774.     EndIf
  1775.     $aArray[2] = $sDir
  1776.     $sFileName = $aArray[3]
  1777.     $sExtension = $aArray[4]
  1778.     If $sType = 1 Then Return $sDrive
  1779.     If $sType = 2 Then Return $sDir
  1780.     If $sType = 3 Then Return $sFileName
  1781.     If $sType = 4 Then Return $sExtension
  1782.     If $sType = 5 Then Return $sFileName & $sExtension
  1783.     If $sType = 6 Then Return $sDrive & $sDir
  1784.     If $sType = 7 Then Return $sDrive & $sDir & $sFileName
  1785.     Return $aArray
  1786. EndFunc   ;==>_SplitPath
  1787. #EndRegion # Function
  1788.  
  1789. #Region # Author C490C3A06F2056C4836E2054726F6E67
  1790.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement