Skip to content

Commit 24cf727

Browse files
authored
v2.1.0-alpha
1 parent 0c624cc commit 24cf727

36 files changed

Lines changed: 3663 additions & 0 deletions

bin/RegCleaner.au3

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#RequireAdmin
2+
#AutoIt3Wrapper_Run_AU3Check=Y
3+
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
4+
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
5+
#Tidy_Parameters=/reel
6+
7+
#include <GUIConstantsEx.au3>
8+
#include <GuiListView.au3>
9+
#include <MsgBoxConstants.au3>
10+
#include <WindowsConstants.au3>
11+
#include "..\NetWebView2Lib.au3"
12+
13+
; RegCleaner.au3
14+
15+
Global $_g_s_ELEMENTs = ''
16+
17+
_Cleaner()
18+
19+
Func _Cleaner()
20+
ConsoleWrite("! MicrosoftEdgeWebview2 : version check: " & _NetWebView2_IsAlreadyInstalled() & ' ERR=' & @error & ' EXT=' & @extended & @CRLF)
21+
22+
; === Configuration ===
23+
Local $sSearchTerm = "NetWebView2Lib" ; NetWebView2Lib
24+
Local $aTargets[2] = ["HKEY_LOCAL_MACHINE64\SOFTWARE\Classes", "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes"]
25+
26+
; GUICreate
27+
Local $iWidth = @DesktopWidth * 0.7, $iHeight = @DesktopHeight * 0.9
28+
Local $hGUI = GUICreate("NetWebView2 - Registry Deep Cleaner", $iWidth, $iHeight)
29+
#forceref $hGUI
30+
31+
GUISetFont(9, 400, 0, "Segoe UI")
32+
$iWidth -= 20
33+
$iHeight -= 90
34+
Local $idListView = GUICtrlCreateListView("Registry Key Path|Details", 10, 10, $iWidth, $iHeight, $LVS_REPORT + $LVS_SHOWSELALWAYS)
35+
_GUICtrlListView_SetExtendedListViewStyle($idListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
36+
_GUICtrlListView_SetColumnWidth($idListView, 0, $iWidth * 0.6)
37+
_GUICtrlListView_SetColumnWidth($idListView, 1, $iWidth * 0.4)
38+
$iHeight += 20
39+
Local $idStatus = GUICtrlCreateLabel("Scanning registry... please wait...", 10, $iHeight, $iWidth - 210 - 10, 20)
40+
$iHeight += 20
41+
Local $idBtnCancel = GUICtrlCreateButton("Cancel", $iWidth - 100, $iHeight, 100, 40)
42+
Local $idBtnDelete = GUICtrlCreateButton("Delete Selected", $iWidth - 210, $iHeight, 100, 40)
43+
GUISetState(@SW_SHOW)
44+
45+
; Scan
46+
Local $iTotalFound = 0
47+
Local $bCanceled = False
48+
For $sRoot In $aTargets
49+
__Registry_Scan_Recursive($sRoot, $sSearchTerm, $idListView, $iTotalFound, $idStatus, $idBtnCancel)
50+
If @error Then
51+
$bCanceled = True
52+
ExitLoop
53+
EndIf
54+
Next
55+
If $bCanceled = True Then
56+
GUICtrlSetData($idStatus, "Scan canceled. Found " & $iTotalFound & " keys.")
57+
Else
58+
GUICtrlSetData($idStatus, "Scan complete. Found " & $iTotalFound & " keys.")
59+
EndIf
60+
61+
ConsoleWrite($_g_s_ELEMENTs & @CRLF)
62+
63+
64+
While 1
65+
Switch GUIGetMsg()
66+
Case $GUI_EVENT_CLOSE
67+
Exit
68+
69+
Case $idBtnDelete
70+
Local $iCheckedCount = 0
71+
; Count checked items first
72+
For $i = 0 To _GUICtrlListView_GetItemCount($idListView) - 1
73+
If _GUICtrlListView_GetItemChecked($idListView, $i) Then $iCheckedCount += 1
74+
Next
75+
76+
If $iCheckedCount = 0 Then
77+
MsgBox($MB_ICONEXCLAMATION, "Nothing selected", "Please check the keys you want to remove.")
78+
ContinueLoop
79+
EndIf
80+
81+
If MsgBox($MB_YESNO + $MB_ICONWARNING, "Confirm Deletion", "Are you sure you want to delete the " & $iCheckedCount & " selected keys?") = $IDYES Then
82+
__Delete_Checked_Items($idListView)
83+
MsgBox($MB_ICONINFORMATION, "Done", "Cleanup finished successfully.")
84+
Exit
85+
EndIf
86+
EndSwitch
87+
WEnd
88+
89+
EndFunc ;==>_Cleaner
90+
91+
;---------------------------------------------------------------------------------------
92+
Func __Registry_Scan_Recursive($sKey, $sSearch, $hLV, ByRef $iCount, $idStatus, $idBtnCancel)
93+
Local $iIndex = 1
94+
While 1
95+
Local $sSubKey = RegEnumKey($sKey, $iIndex)
96+
If @error Then ExitLoop
97+
98+
If Mod($iIndex, 100) = 0 Then
99+
GUICtrlSetData($idStatus, "Scanning: " & $iIndex & " keys in " & StringLeft($sKey, 40) & "...")
100+
If GUIGetMsg() = $idBtnCancel Then Return SetError(1)
101+
EndIf
102+
103+
Local $sFull = $sKey & "\" & $sSubKey
104+
Local $sData = RegRead($sFull, "")
105+
106+
If StringInStr($sSubKey, $sSearch) Or StringInStr($sData, $sSearch) Then
107+
$iCount += 1
108+
Local $sDisplayData = ($sData <> "" ? $sData : "Folder/Container")
109+
Local $s_ELEMENT = $sFull & "|" & $sDisplayData
110+
$_g_s_ELEMENTs &= $sFull & "|" & $sDisplayData & @CRLF
111+
GUICtrlCreateListViewItem($s_ELEMENT, $hLV)
112+
_GUICtrlListView_SetItemChecked($hLV, _GUICtrlListView_GetItemCount($hLV) - 1)
113+
EndIf
114+
115+
__Registry_Scan_Recursive($sFull, $sSearch, $hLV, $iCount, $idStatus, $idBtnCancel)
116+
If @error Then Return SetError(1)
117+
118+
$iIndex += 1
119+
WEnd
120+
EndFunc ;==>__Registry_Scan_Recursive
121+
122+
;---------------------------------------------------------------------------------------
123+
Func __Delete_Checked_Items($hLV)
124+
; backwards deletion to avoid index shifting
125+
For $i = _GUICtrlListView_GetItemCount($hLV) - 1 To 0 Step -1
126+
If _GUICtrlListView_GetItemChecked($hLV, $i) Then
127+
Local $sKeyPath = _GUICtrlListView_GetItemText($hLV, $i)
128+
If RegDelete($sKeyPath) Then
129+
ConsoleWrite("[-] Deleted: " & $sKeyPath & @CRLF)
130+
EndIf
131+
EndIf
132+
Next
133+
EndFunc ;==>__Delete_Checked_Items
134+
;---------------------------------------------------------------------------------------

bin/Register_web2.au3

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#RequireAdmin
2+
#AutoIt3Wrapper_Run_AU3Check=Y
3+
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
4+
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
5+
#Tidy_Parameters=/reel
6+
7+
#include <MsgBoxConstants.au3>
8+
#include <Misc.au3>
9+
#include "..\NetWebView2Lib.au3"
10+
11+
; Register_web2.au3
12+
13+
_Register()
14+
15+
Func _Register()
16+
ConsoleWrite("! MicrosoftEdgeWebview2 : version check: " & _NetWebView2_IsAlreadyInstalled() & ' ERR=' & @error & ' EXT=' & @extended & @CRLF)
17+
18+
; === Configuration ===
19+
20+
Local $sDllName = "NetWebView2Lib.dll"
21+
Local $sNet4_x86 = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe"
22+
Local $sNet4_x64 = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe"
23+
24+
Local $bSuccess = False
25+
Local $bAbort = False
26+
Local $sLog = "Registration Report:" & @CRLF & "--------------------" & @CRLF
27+
28+
; === Check for WebView2 Runtime ===
29+
Local $sMinReq = "128.0.2739.15" ; Updated for Full API Compatibility with SDK 1.0.2739.15
30+
Local $bNeedUpdated = False
31+
Local $sWV2Version = WebView2Exist()
32+
33+
If $sWV2Version <> "" Then
34+
If _VersionCompare($sWV2Version, $sMinReq) < 0 Then
35+
$bNeedUpdated = True
36+
Else
37+
$sLog &= "[+] WebView2 Runtime: Found (" & $sWV2Version & ")" & @CRLF
38+
EndIf
39+
EndIf
40+
41+
If $sWV2Version = "" Or $bNeedUpdated Then
42+
Local $sUrl = "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
43+
$sLog &= ($bNeedUpdated ? "[!] WebView2 Runtime: Found (" & $sWV2Version & ") is too old. Requires " & $sMinReq : "[-] WebView2 Runtime: NOT FOUND") & @CRLF
44+
45+
; Ask the user to install
46+
Local $iAnswer = MsgBox($MB_YESNO + $MB_ICONEXCLAMATION, "Runtime Missing", _
47+
"The Microsoft Edge WebView2 Runtime is required to run this application." & @CRLF & @CRLF & _
48+
"Would you like to open the download page now?" & @CRLF & @CRLF & _
49+
"Note: Please return and click YES after the installation is complete.")
50+
51+
If $iAnswer = $IDYES Then
52+
ShellExecute($sUrl)
53+
; Wait for user confirmation that installation is done
54+
MsgBox($MB_ICONINFORMATION, "Waiting", "Click OK once the WebView2 installation is finished to proceed with DLL registration.")
55+
Else
56+
$sLog &= "[!] User skipped WebView2 installation. Aborting." & @CRLF
57+
MsgBox($MB_ICONSTOP, "Aborted", "Registration cannot continue without WebView2 Runtime.")
58+
$bAbort = True
59+
EndIf
60+
EndIf
61+
62+
; === Registration 'NetWebView2Lib.dll' COM ===
63+
If Not $bAbort Then
64+
65+
Local $iExitCode
66+
67+
; Registration for x86 (32-bit)
68+
If FileExists($sNet4_x86) Then
69+
$iExitCode = RunWait('"' & $sNet4_x86 & '" "' & @ScriptDir & '\x86\' & $sDllName & '" /codebase /tlb', @ScriptDir, @SW_HIDE)
70+
If $iExitCode = 0 Then
71+
$sLog &= "[+] x86 Registration: SUCCESS" & @CRLF
72+
$bSuccess = True
73+
Else
74+
$sLog &= "[-] x86 Registration: FAILED (Code: " & $iExitCode & ")" & @CRLF
75+
EndIf
76+
Else
77+
$sLog &= "[!] x86 RegAsm not found" & @CRLF
78+
EndIf
79+
80+
; Registration for x64 (64-bit)
81+
If FileExists($sNet4_x64) Then
82+
$iExitCode = RunWait('"' & $sNet4_x64 & '" "' & @ScriptDir & '\x64\' & $sDllName & '" /codebase /tlb', @ScriptDir, @SW_HIDE)
83+
If $iExitCode = 0 Then
84+
$sLog &= "[+] x64 Registration: SUCCESS" & @CRLF
85+
$bSuccess = True
86+
Else
87+
$sLog &= "[-] x64 Registration: FAILED (Code: " & $iExitCode & ")" & @CRLF
88+
EndIf
89+
Else
90+
$sLog &= "[!] x64 RegAsm not found" & @CRLF
91+
EndIf
92+
EndIf
93+
94+
; === Final Message ===
95+
If $bSuccess Then
96+
ConsoleWrite("+ Registration Complete" & @CRLF)
97+
$sLog &= @CRLF
98+
$sLog &= "Validation:" & @CRLF
99+
$sLog &= " _NetWebView2_IsRegisteredCOMObject() =" & _NetWebView2_IsRegisteredCOMObject() & @CRLF
100+
101+
ConsoleWrite($sLog & @CRLF)
102+
103+
MsgBox($MB_ICONINFORMATION, "Registration Complete", $sLog)
104+
Else
105+
ConsoleWrite("! Registration Error" & @CRLF)
106+
ConsoleWrite($sLog & @CRLF)
107+
108+
MsgBox($MB_ICONERROR, "Registration Error", "Library registration failed." & @CRLF & @CRLF & $sLog)
109+
EndIf
110+
111+
EndFunc ;==>_Register
112+
113+
;---------------------------------------------------------------------------------------
114+
Func WebView2Exist()
115+
;~ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
116+
Local $aKeys[3] = [ _
117+
"HKLM\SOFTWARE\Microsoft\EdgeUpdate\Clients", _
118+
"HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients", _
119+
"HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients" _
120+
]
121+
Local $sSubKey, $sName, $sPv, $iIndex
122+
123+
For $sRootKey In $aKeys
124+
For $iIndex = 1 To 500
125+
$sSubKey = RegEnumKey($sRootKey, $iIndex)
126+
If @error Then ExitLoop ; No more keys
127+
$sName = RegRead($sRootKey & "\" & $sSubKey, "name")
128+
ConsoleWrite("- Checking:" & $sRootKey & "\" & $sSubKey & "\name = " & $sName & @CRLF)
129+
If StringInStr($sName, "Microsoft Edge WebView2") Then
130+
ConsoleWrite("+ Found:" & $sRootKey & "\" & $sSubKey & "\name = " & $sName & @CRLF)
131+
$sPv = RegRead($sRootKey & "\" & $sSubKey, "pv")
132+
If $sPv <> "" Then Return $sPv ; Found it
133+
EndIf
134+
Next
135+
Next
136+
137+
Local $sSysPathX86 = @WindowsDir & "\System32\Microsoft-Edge-WebView\EBWebView\x86\EmbeddedBrowserWebView.dll"
138+
Local $sSysPathX64 = @WindowsDir & "\System32\Microsoft-Edge-WebView\EBWebView\x64\EmbeddedBrowserWebView.dll"
139+
140+
If FileExists($sSysPathX86) Or FileExists($sSysPathX64) Then
141+
Return "Detected via System Files"
142+
EndIf
143+
144+
Return "" ; Not found
145+
EndFunc ;==>WebView2Exist

bin/Unregister.au3

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#RequireAdmin
2+
#AutoIt3Wrapper_Run_AU3Check=Y
3+
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
4+
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
5+
#Tidy_Parameters=/reel
6+
7+
#include <MsgBoxConstants.au3>
8+
#include "..\NetWebView2Lib.au3"
9+
10+
; Unregister.au3
11+
12+
_Unregister()
13+
14+
Func _Unregister()
15+
ConsoleWrite("! MicrosoftEdgeWebview2 : version check: " & _NetWebView2_IsAlreadyInstalled() & ' ERR=' & @error & ' EXT=' & @extended & @CRLF)
16+
17+
; === Configuration ===
18+
Local $sDllName = "NetWebView2Lib.dll"
19+
Local $sTlbName = "NetWebView2Lib.tlb"
20+
#forceref $sTlbName
21+
22+
Local $sNet4_x86 = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe"
23+
Local $sNet4_x64 = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe"
24+
25+
Local $sLog = "Unregistration Report:" & @CRLF & "----------------------" & @CRLF
26+
Local $iExitCode
27+
28+
; === Unregister x86 ===
29+
If FileExists($sNet4_x86) Then
30+
$iExitCode = RunWait('"' & $sNet4_x86 & '" /u "' & @ScriptDir & '\x86\' & $sDllName & '"', @ScriptDir, @SW_HIDE)
31+
$sLog &= ($iExitCode = 0 ? "[+] x86 Unregistration: SUCCESS" : "[-] x86 Unregistration: FAILED") & @CRLF
32+
EndIf
33+
34+
; === Unregister x64 ===
35+
If FileExists($sNet4_x64) Then
36+
$iExitCode = RunWait('"' & $sNet4_x64 & '" /u "' & @ScriptDir & '\x64\' & $sDllName & '"', @ScriptDir, @SW_HIDE)
37+
$sLog &= ($iExitCode = 0 ? "[+] x64 Unregistration: SUCCESS" : "[-] x64 Unregistration: FAILED") & @CRLF
38+
EndIf
39+
40+
MsgBox($MB_ICONINFORMATION, "Unregistration process completed", $sLog)
41+
EndFunc ;==>_Unregister
575 KB
Binary file not shown.
37.5 KB
Binary file not shown.
80.5 KB
Binary file not shown.

bin/x64/NetWebView2Lib.dll

107 KB
Binary file not shown.

bin/x64/Newtonsoft.Json.dll

704 KB
Binary file not shown.

bin/x64/WebView2Loader.dll

162 KB
Binary file not shown.
575 KB
Binary file not shown.

0 commit comments

Comments
 (0)