Skip to content

Commit

Permalink
Start on #306
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmaehl committed Aug 28, 2023
1 parent c35d411 commit c862a65
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions MSEdgeRedirect.au3
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,34 @@ Func FixTreeIntegrity($aCMDLine)

Local $iParent = _WinAPI_GetParentProcess()

If _WinAPI_GetProcessName($iParent) = "MSEdge.exe" Then
Switch _WinAPI_GetProcessName($iParent)

Case "MSEdge.exe"

FileWrite($hLogs[$AppGeneral], _NowCalc() & " - " & "Caught MSEdge Parent Process, Launched by " & _WinAPI_GetProcessName(_WinAPI_GetParentProcess($iParent)) & ", Grabbing Parameters." & @CRLF)
FileWrite($hLogs[$AppGeneral], _NowCalc() & " - " & "Caught MSEdge Parent Process, Launched by " & _WinAPI_GetProcessName(_WinAPI_GetParentProcess($iParent)) & ", Grabbing Parameters." & @CRLF)

Local $aAdjust
Local $aAdjust

; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes
Local $hToken = _WinAPI_OpenProcessToken(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY))
; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes
Local $hToken = _WinAPI_OpenProcessToken(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY))

_WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust)
_WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust)

Redim $aCMDLine[2]
$aCMDLine[0] = 0
$aCMDLine[1] = _WinAPI_GetProcessFileName($iParent)
Redim $aCMDLine[2]
$aCMDLine[0] = 0
$aCMDLine[1] = _WinAPI_GetProcessFileName($iParent)

_ArrayConcatenate($aCMDLine, StringSplit(_WinAPI_GetProcessCommandLine($iParent), " ", $STR_NOCOUNT))
_ArrayConcatenate($aCMDLine, StringSplit(_WinAPI_GetProcessCommandLine($iParent), " ", $STR_NOCOUNT))

$aCMDLine[0] = UBound($aCMDLine) - 1
$aCMDLine[0] = UBound($aCMDLine) - 1

ProcessClose($iParent)
ProcessClose($iParent)

EndIf
Case "MSEdgeRedirect.exe"

;;;

EndSwitch
Return $aCMDLine

EndFunc
Expand All @@ -190,7 +195,6 @@ Func ProcessCMDLine()
$CMDLine = RepairCMDLine($CMDLine)

If _ArraySearch($aEdges, $CMDLine[1]) > 0 Then ; Image File Execution Options Mode
RunHTTPCheck()
ActiveMode($CMDLine)
If Not _GetSettingValue("NoUpdates") And Random(1, 10, 1) = 1 Then RunUpdateCheck()
Exit
Expand Down Expand Up @@ -323,7 +327,6 @@ Func ProcessCMDLine()
;;;
ElseIf Not $bForce Then
RunArchCheck($bSilent)
RunHTTPCheck($bSilent)
Else
;;;
EndIf
Expand Down Expand Up @@ -378,6 +381,7 @@ Func ProcessCMDLine()
RunSetup(True, $bSilent, 0, $hFile)
EndSelect
EndIf
RunHTTPCheck()
ReactiveMode($bHide)

EndFunc
Expand Down

0 comments on commit c862a65

Please sign in to comment.