From 4354c21ef4d3a8f0690f82f324f72d8882a5bc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:54:59 +0100 Subject: [PATCH 1/6] Update RegCleaner.au3 --- bin/RegCleaner.au3 | 168 ++++++++++++++++++++++++--------------------- 1 file changed, 88 insertions(+), 80 deletions(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index 366f871..ec02125 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -4,94 +4,102 @@ #include #include -; === Configuration === -Local $sSearchTerm = "NetWebView2" -Local $aTargets[2] = ["HKEY_LOCAL_MACHINE64\SOFTWARE\Classes", "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes"] - -; GUICreate -Local $iWidth = @DesktopWidth * 0.7 , $iHeight = @DesktopHeight * 0.9 -Local $hGUI = GUICreate("NetWebView2 - Registry Deep Cleaner", $iWidth, $iHeight) -GUISetFont(9, 400, 0, "Segoe UI") -$iWidth -= 20 -$iHeight -= 90 -Local $idListView = GUICtrlCreateListView("Registry Key Path|Details", 10, 10, $iWidth, $iHeight, $LVS_REPORT + $LVS_SHOWSELALWAYS) -_GUICtrlListView_SetExtendedListViewStyle($idListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) -_GUICtrlListView_SetColumnWidth($idListView, 0, $iWidth * 0.6) -_GUICtrlListView_SetColumnWidth($idListView, 1, $iWidth * 0.4) -$iHeight += 20 -Local $idStatus = GUICtrlCreateLabel("Scanning registry... please wait...", 10, $iHeight, $iWidth - 210 - 10, 20) -$iHeight += 20 -Local $idBtnCancel = GUICtrlCreateButton("Cancel", $iWidth - 100, $iHeight, 100, 40) -Local $idBtnDelete = GUICtrlCreateButton("Delete Selected", $iWidth - 210, $iHeight, 100, 40) -GUISetState(@SW_SHOW) - -; Scan -Local $iTotalFound = 0 -For $sRoot In $aTargets - _Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound) -Next -GUICtrlSetData($idStatus, "Scan complete. Found " & $iTotalFound & " keys.") - -While 1 - Switch GUIGetMsg() - Case $GUI_EVENT_CLOSE, $idBtnCancel - Exit - - Case $idBtnDelete - Local $iCheckedCount = 0 - ; Count checked items first - For $i = 0 To _GUICtrlListView_GetItemCount($idListView) - 1 - If _GUICtrlListView_GetItemChecked($idListView, $i) Then $iCheckedCount += 1 - Next - - If $iCheckedCount = 0 Then - MsgBox($MB_ICONEXCLAMATION, "Nothing selected", "Please check the keys you want to remove.") - ContinueLoop - EndIf - - If MsgBox($MB_YESNO + $MB_ICONWARNING, "Confirm Deletion", "Are you sure you want to delete the " & $iCheckedCount & " selected keys?") = $IDYES Then - _Delete_Checked_Items($idListView) - MsgBox($MB_ICONINFORMATION, "Done", "Cleanup finished successfully.") - Exit - EndIf - EndSwitch -WEnd +_Cleaner() + +Func _Cleaner() + ; === Configuration === + Local $sSearchTerm = "NetWebView2" + Local $aTargets[2] = ["HKEY_LOCAL_MACHINE64\SOFTWARE\Classes", "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes"] + + ; GUICreate + Local $iWidth = @DesktopWidth * 0.7, $iHeight = @DesktopHeight * 0.9 + Local $hGUI = GUICreate("NetWebView2 - Registry Deep Cleaner", $iWidth, $iHeight) + #forceref $hGUI + + GUISetFont(9, 400, 0, "Segoe UI") + $iWidth -= 20 + $iHeight -= 90 + Local $idListView = GUICtrlCreateListView("Registry Key Path|Details", 10, 10, $iWidth, $iHeight, $LVS_REPORT + $LVS_SHOWSELALWAYS) + _GUICtrlListView_SetExtendedListViewStyle($idListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) + _GUICtrlListView_SetColumnWidth($idListView, 0, $iWidth * 0.6) + _GUICtrlListView_SetColumnWidth($idListView, 1, $iWidth * 0.4) + $iHeight += 20 + Local $idStatus = GUICtrlCreateLabel("Scanning registry... please wait...", 10, $iHeight, $iWidth - 210 - 10, 20) + $iHeight += 20 + Local $idBtnCancel = GUICtrlCreateButton("Cancel", $iWidth - 100, $iHeight, 100, 40) + Local $idBtnDelete = GUICtrlCreateButton("Delete Selected", $iWidth - 210, $iHeight, 100, 40) + GUISetState(@SW_SHOW) + + ; Scan + Local $iTotalFound = 0 + For $sRoot In $aTargets + __Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound, $idStatus) + Next + GUICtrlSetData($idStatus, "Scan complete. Found " & $iTotalFound & " keys.") + + While 1 + Switch GUIGetMsg() + Case $GUI_EVENT_CLOSE, $idBtnCancel + Exit + + Case $idBtnDelete + Local $iCheckedCount = 0 + ; Count checked items first + For $i = 0 To _GUICtrlListView_GetItemCount($idListView) - 1 + If _GUICtrlListView_GetItemChecked($idListView, $i) Then $iCheckedCount += 1 + Next + + If $iCheckedCount = 0 Then + MsgBox($MB_ICONEXCLAMATION, "Nothing selected", "Please check the keys you want to remove.") + ContinueLoop + EndIf + + If MsgBox($MB_YESNO + $MB_ICONWARNING, "Confirm Deletion", "Are you sure you want to delete the " & $iCheckedCount & " selected keys?") = $IDYES Then + __Delete_Checked_Items($idListView) + MsgBox($MB_ICONINFORMATION, "Done", "Cleanup finished successfully.") + Exit + EndIf + EndSwitch + WEnd + +EndFunc ;==>_Cleaner ;--------------------------------------------------------------------------------------- -Func _Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount) - Local $iIndex = 1 - While 1 - Local $sSubKey = RegEnumKey($sKey, $iIndex) - If @error Then ExitLoop +Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus) + Local $iIndex = 1 + While 1 + Local $sSubKey = RegEnumKey($sKey, $iIndex) + If @error Then ExitLoop If Mod($iIndex, 100) = 0 Then GUICtrlSetData($idStatus, "Scanning: " & $iIndex & " keys in " & StringLeft($sKey, 40) & "...") EndIf - Local $sFull = $sKey & "\" & $sSubKey - Local $sData = RegRead($sFull, "") + Local $sFull = $sKey & "\" & $sSubKey + Local $sData = RegRead($sFull, "") - If StringInStr($sSubKey, $sSearch) Or StringInStr($sData, $sSearch) Then - $iCount += 1 - Local $sDisplayData = ($sData <> "" ? $sData : "Folder/Container") - GUICtrlCreateListViewItem($sFull & "|" & $sDisplayData, $hLV) - _GUICtrlListView_SetItemChecked($hLV, _GUICtrlListView_GetItemCount($hLV) - 1) - EndIf + If StringInStr($sSubKey, $sSearch) Or StringInStr($sData, $sSearch) Then + $iCount += 1 + Local $sDisplayData = ($sData <> "" ? $sData : "Folder/Container") + GUICtrlCreateListViewItem($sFull & "|" & $sDisplayData, $hLV) + _GUICtrlListView_SetItemChecked($hLV, _GUICtrlListView_GetItemCount($hLV) - 1) + EndIf + + __Registry_Scan_Recursive($sFull, $sSearch, $hLV, $iCount, $idStatus) + $iIndex += 1 + WEnd +EndFunc ;==>__Registry_Scan_Recursive - _Registry_Scan_Recursive($sFull, $sSearch, $hLV, $iCount) - $iIndex += 1 - WEnd -EndFunc ;--------------------------------------------------------------------------------------- -Func _Delete_Checked_Items($hLV) - ; backwards deletion to avoid index shifting - For $i = _GUICtrlListView_GetItemCount($hLV) - 1 To 0 Step -1 - If _GUICtrlListView_GetItemChecked($hLV, $i) Then - Local $sKeyPath = _GUICtrlListView_GetItemText($hLV, $i) - If RegDelete($sKeyPath) Then - ConsoleWrite("[-] Deleted: " & $sKeyPath & @CRLF) - EndIf - EndIf - Next -EndFunc +Func __Delete_Checked_Items($hLV) + ; backwards deletion to avoid index shifting + For $i = _GUICtrlListView_GetItemCount($hLV) - 1 To 0 Step -1 + If _GUICtrlListView_GetItemChecked($hLV, $i) Then + Local $sKeyPath = _GUICtrlListView_GetItemText($hLV, $i) + If RegDelete($sKeyPath) Then + ConsoleWrite("[-] Deleted: " & $sKeyPath & @CRLF) + EndIf + EndIf + Next +EndFunc ;==>__Delete_Checked_Items ;--------------------------------------------------------------------------------------- From 17e6baedbbc69dbd6875f36bacf3b16c2221498c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:57:04 +0100 Subject: [PATCH 2/6] Update RegCleaner.au3 --- bin/RegCleaner.au3 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index ec02125..db30ed5 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -1,8 +1,12 @@ #RequireAdmin #include -#include #include #include +#include + +#AutoIt3Wrapper_Run_AU3Check=Y +#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y +#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 _Cleaner() From 166acd206188cd0c31f74721ce853ddb1085b71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:57:40 +0100 Subject: [PATCH 3/6] Update RegCleaner.au3 --- bin/RegCleaner.au3 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index db30ed5..84bddac 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -1,13 +1,13 @@ #RequireAdmin +#AutoIt3Wrapper_Run_AU3Check=Y +#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y +#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 + #include #include #include #include -#AutoIt3Wrapper_Run_AU3Check=Y -#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y -#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 - _Cleaner() Func _Cleaner() From e04ee51fb4b9ec0e61db5e7de77ddb5cd51e095e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:59:34 +0100 Subject: [PATCH 4/6] Update RegCleaner.au3 --- bin/RegCleaner.au3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index 84bddac..843f3f3 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -2,6 +2,7 @@ #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 +#Tidy_Parameters=/reel #include #include @@ -106,4 +107,3 @@ Func __Delete_Checked_Items($hLV) EndIf Next EndFunc ;==>__Delete_Checked_Items -;--------------------------------------------------------------------------------------- From d584bca8ea8d53202704fe8bf8a1c1446b6c7752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Thu, 22 Jan 2026 00:12:55 +0100 Subject: [PATCH 5/6] $idBtnCancel better support --- bin/RegCleaner.au3 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index 843f3f3..2f2dd48 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -37,14 +37,22 @@ Func _Cleaner() ; Scan Local $iTotalFound = 0 + Local $bCanceled = False For $sRoot In $aTargets - __Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound, $idStatus) + __Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound, $idStatus, $idBtnCancel) + If @error Or GUIGetMsg() = $idBtnCancel Then + $bCanceled = True + EndIf Next - GUICtrlSetData($idStatus, "Scan complete. Found " & $iTotalFound & " keys.") + If $bCanceled = True Then + GUICtrlSetData($idStatus, "Scan canceled. Found " & $iTotalFound & " keys.") + Else + GUICtrlSetData($idStatus, "Scan complete. Found " & $iTotalFound & " keys.") + EndIf While 1 Switch GUIGetMsg() - Case $GUI_EVENT_CLOSE, $idBtnCancel + Case $GUI_EVENT_CLOSE Exit Case $idBtnDelete @@ -70,7 +78,7 @@ Func _Cleaner() EndFunc ;==>_Cleaner ;--------------------------------------------------------------------------------------- -Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus) +Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus, $idBtnCancel) Local $iIndex = 1 While 1 Local $sSubKey = RegEnumKey($sKey, $iIndex) @@ -78,6 +86,7 @@ Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus) If Mod($iIndex, 100) = 0 Then GUICtrlSetData($idStatus, "Scanning: " & $iIndex & " keys in " & StringLeft($sKey, 40) & "...") + If GUIGetMsg() = $idBtnCancel Then Return SetError(1) EndIf Local $sFull = $sKey & "\" & $sSubKey @@ -90,7 +99,9 @@ Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus) _GUICtrlListView_SetItemChecked($hLV, _GUICtrlListView_GetItemCount($hLV) - 1) EndIf - __Registry_Scan_Recursive($sFull, $sSearch, $hLV, $iCount, $idStatus) + __Registry_Scan_Recursive($sFull, $sSearch, $hLV, $iCount, $idStatus, $idBtnCancel) + If @error Then Return SetError(1) + $iIndex += 1 WEnd EndFunc ;==>__Registry_Scan_Recursive @@ -107,3 +118,4 @@ Func __Delete_Checked_Items($hLV) EndIf Next EndFunc ;==>__Delete_Checked_Items +;--------------------------------------------------------------------------------------- From 313c51e3de9e595eeb174c67d0b57db2aa2fec72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipok?= <11089482+mlipok@users.noreply.github.com> Date: Thu, 22 Jan 2026 00:14:16 +0100 Subject: [PATCH 6/6] Update RegCleaner.au3 --- bin/RegCleaner.au3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/RegCleaner.au3 b/bin/RegCleaner.au3 index 2f2dd48..537f296 100644 --- a/bin/RegCleaner.au3 +++ b/bin/RegCleaner.au3 @@ -40,8 +40,9 @@ Func _Cleaner() Local $bCanceled = False For $sRoot In $aTargets __Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound, $idStatus, $idBtnCancel) - If @error Or GUIGetMsg() = $idBtnCancel Then + If @error Then $bCanceled = True + ExitLoop EndIf Next If $bCanceled = True Then