Skip to content

Commit

Permalink
Added new method for a more reliable uninstall string
Browse files Browse the repository at this point in the history
  • Loading branch information
PaaaulZ authored Jul 3, 2023
1 parent 1bc45ef commit 9b05146
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions SilentClickOnce/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Public Class Form1

End Sub

Private Sub Uninstall(ByVal applicationName As String)
Private Sub Uninstall(ByVal applicationName As String)

' Kill process if open
Try
Expand All @@ -128,13 +128,21 @@ Public Class Form1
Dim extractedInfo As String() = ExtractInfo(uninstallString)

WriteLog($"[?] PublicKeyToken: {extractedInfo(0)}, Culture: {extractedInfo(1)}, processorArchitecture: {extractedInfo(2)}")
WriteLog($"[?] Uninstall string: {uninstallString}")
If IsNothing(extractedInfo(0)) Or IsNothing(extractedInfo(1)) Or IsNothing(extractedInfo(2)) Then
WriteLog("[-] Some data is missing from uninstall string ")
Environment.Exit(1)
End If

Dim textualSubId As String
If uninstallString.Contains("rundll32.exe dfshim.dll,ShArpMaintain ") Then
textualSubId = uninstallString.Replace("rundll32.exe dfshim.dll,ShArpMaintain ", "")
WriteLog("[?] Using new method")
Else
textualSubId = $"{fullApplicationName}, Culture={extractedInfo(1)}, PublicKeyToken={extractedInfo(0)}, processorArchitecture={extractedInfo(2)}"
WriteLog("[?] Using old method")
End If

Dim textualSubId As String = $"{fullApplicationName}, Culture={extractedInfo(1)}, PublicKeyToken={extractedInfo(0)}, processorArchitecture={extractedInfo(2)}"
Dim deploymentServiceCom As New System.Deployment.Application.DeploymentServiceCom()
Dim _r_m_GetSubscriptionState As Reflection.MethodInfo = GetType(System.Deployment.Application.DeploymentServiceCom).GetMethod("GetSubscriptionState", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
Dim subState As Object = _r_m_GetSubscriptionState.Invoke(deploymentServiceCom, New Object() {textualSubId})
Expand Down

0 comments on commit 9b05146

Please sign in to comment.