Archived
1
0

+ added RegDeleteX() to also delete empty parental registry branches

* raised version to 2.3
(Issue: 24)
This commit is contained in:
mbirth
2007-10-05 18:10:14 +00:00
parent 3c09fbb893
commit a7fa6a6932
4 changed files with 40 additions and 15 deletions

View File

@ -183,7 +183,7 @@ Else
{ {
; file still exists on host ; file still exists on host
Skipped++ Skipped++
Continue Continue
} }
; target directory or file doesn't exist anymore, delete on U3 ; target directory or file doesn't exist anymore, delete on U3
FileSetAttrib -RSH, %CurFile% FileSetAttrib -RSH, %CurFile%
@ -206,7 +206,7 @@ Else
Errors++ Errors++
Else Else
Deleted++ Deleted++
} }
} }
} }
SetWorkingDir %A_ScriptDir% SetWorkingDir %A_ScriptDir%
@ -246,7 +246,7 @@ Else
FileAppend % EnvUnparseStr(A_LoopReadLine) . "`n" FileAppend % EnvUnparseStr(A_LoopReadLine) . "`n"
} }
IfExist %U3_APP_DATA_PATH%\%CurFile% IfExist %U3_APP_DATA_PATH%\%CurFile%
{ {
FileDelete %U3_APP_DATA_PATH%\%TmpFile% FileDelete %U3_APP_DATA_PATH%\%TmpFile%
} }
Else Else
@ -295,7 +295,7 @@ If (KeepSettings = "0" or RevertSettings = "1")
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/regbak0, Removing registry settings #%A_Index% from host ... Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/regbak0, Removing registry settings #%A_Index% from host ...
CurBranch := regbak%A_Index% CurBranch := regbak%A_Index%
SplitFirst(RegRoot, RegSub, CurBranch, "\") SplitFirst(RegRoot, RegSub, CurBranch, "\")
RegDelete %RegRoot%, %RegSub% RegDeleteX(RegRoot, RegSub)
If (RevertSettings = "1") If (RevertSettings = "1")
{ {
Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/regbak0, Restoring registry settings #%A_Index% from backup ... Progress % StepsPos*StepsStep+StepsStep*(A_Index-0.5)/regbak0, Restoring registry settings #%A_Index% from backup ...
@ -319,11 +319,11 @@ If (KeepSettings = "0" or Unattended = "1")
Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/regdel0, Removing add. registry settings #%A_Index% from host ... Progress % StepsPos*StepsStep+StepsStep*(A_Index-1)/regdel0, Removing add. registry settings #%A_Index% from host ...
CurBranch := regdel%A_Index% CurBranch := regdel%A_Index%
SplitFirst(RegRoot, RegSub, CurBranch, "\") SplitFirst(RegRoot, RegSub, CurBranch, "\")
RegDelete %RegRoot%, %RegSub% RegDeleteX(RegRoot, RegSub)
If ErrorLevel If ErrorLevel
{ {
SplitLast(RegSub, RegKey, RegSub, "\") SplitLast(RegSub, RegKey, RegSub, "\")
RegDelete %RegRoot%, %RegSub%, %RegKey% RegDelete %RegRoot%, %RegSub%, %RegKey%
} }
} }
@ -372,13 +372,13 @@ If (KeepSettings = "0" or Unattended = "1")
IfNotExist %CurFile% IfNotExist %CurFile%
{ {
Skipped++ Skipped++
Continue Continue
} }
FileSetAttrib -RSH, %CurFile% FileSetAttrib -RSH, %CurFile%
FileGetAttrib FAttr, %CurFile% FileGetAttrib FAttr, %CurFile%
IfInString FAttr, D IfInString FAttr, D
{ {
; target is a directory ; target is a directory
FileSetAttrib -RSH, %CurFile%\*.*, 1, 1 FileSetAttrib -RSH, %CurFile%\*.*, 1, 1
FileRemoveDir %CurFile%, 1 FileRemoveDir %CurFile%, 1
If ErrorLevel If ErrorLevel
@ -393,7 +393,7 @@ If (KeepSettings = "0" or Unattended = "1")
If ErrorLevel If ErrorLevel
Errors++ Errors++
Else Else
Deleted++ Deleted++
} }
} }
} }
@ -411,7 +411,7 @@ Else
If regsvr0 > 0 If regsvr0 > 0
StepsPos++ StepsPos++
If fildel0 > 0 If fildel0 > 0
StepsPos++ StepsPos++
} }
;****************************************************************************** ;******************************************************************************

View File

@ -2,8 +2,9 @@
#NoEnv #NoEnv
#Include mb_EnvTools.ahk #Include mb_EnvTools.ahk
#Include mb_IniTools.ahk #Include mb_IniTools.ahk
#Include mb_RegTools.ahk
#Include mb_TextTools.ahk #Include mb_TextTools.ahk
U3HVer = 2.2 U3HVer = 2.3
U3HUUID = 0f90f88c-5e05-4cab-8c3a-e1c0112b06fd U3HUUID = 0f90f88c-5e05-4cab-8c3a-e1c0112b06fd
U3_APP_DATA_PATH := EnvValue("U3_APP_DATA_PATH") U3_APP_DATA_PATH := EnvValue("U3_APP_DATA_PATH")

View File

@ -1,7 +1,7 @@
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 2,2,0,0 FILEVERSION 2,3,0,0
PRODUCTVERSION 2,2,0,0 PRODUCTVERSION 2,3,0,0
FILEOS 0x4 FILEOS 0x4
FILETYPE 0x1 FILETYPE 0x1
{ {
@ -10,12 +10,12 @@ BLOCK "StringFileInfo"
BLOCK "040904b0" BLOCK "040904b0"
{ {
VALUE "FileDescription", "U3Helper manages registry settings and data files of ordinary applications to make them U3-compatible. (see http://www.u3.com/ for more info)" VALUE "FileDescription", "U3Helper manages registry settings and data files of ordinary applications to make them U3-compatible. (see http://www.u3.com/ for more info)"
VALUE "FileVersion", "2, 2, 0, 0" VALUE "FileVersion", "2, 3, 0, 0"
VALUE "InternalName", "U3H" VALUE "InternalName", "U3H"
VALUE "LegalCopyright", "(c)2007 Markus Birth <mbirth@webwriters.de>" VALUE "LegalCopyright", "(c)2007 Markus Birth <mbirth@webwriters.de>"
VALUE "OriginalFilename", "U3Helper.exe" VALUE "OriginalFilename", "U3Helper.exe"
VALUE "ProductName", "U3Helper" VALUE "ProductName", "U3Helper"
VALUE "ProductVersion", "2, 2, 0, 0" VALUE "ProductVersion", "2, 3, 0, 0"
} }
} }

24
mb_RegTools.ahk Normal file
View File

@ -0,0 +1,24 @@
#Include mb_TextTools.ahk
RegDeleteX(RegRoot, RegSub)
{
RegDelete %RegRoot%, %RegSub%
StartRDX:
SplitLast(RegSub, RegKey, RegSub, "\")
if (RegCount(RegRoot, RegSub) = 0 and InStr(RegSub, "\") != 0)
{
RegDelete %RegRoot%, %RegSub%
Goto StartRDX
}
Return true
}
RegCount(RegRoot, RegSub)
{
Ct = 0
Loop %RegRoot%, %RegSub%, 1, 0
{
Ct++
}
Return Ct
}