Well well I just made some AutoIt script take of that message at it's root.
... so run it once and patch Teamviewer.exe and bye,bye
ShowSponsoredSessionDialog()
... well at least till the next update of Teamviewer.
(Then it'll be the nag will there again - and you need to reapply this patch)
That just as addition to the Autoit nag Windows click away scripts posted here before.
Maybe in some situations that'll be more useful.
http://bit.do/TeamViewerNAbit.do/TeamViewerNA
Mirror
Well script got a little big - about here some part to get the idea:
Global Const $app_title = "Teamviewer - NagAway"
Global Const $app_rel_date = "May 2017"
Global Const $app_store = "http://bit.do/TeamviewerNA"
Global Const $TargetFileName = "Teamviewer.exe"
Global Const $Debugging = False;True ; enables script line numbers ( for SciTE ) in log output
; Known problem a character is not byte
; but StringRegExp operates on String and character level
; as long you stay in range of 0x00 to 0x7f you may say character <=> byte
; but in the 8 bit area 0x7f to 0xff this don't works anymore
; which chars/bytes works or fails depends on current code page
;
Global Const $UseHexNumberString = False ;True; fucking slow + doubles memory usage but more save
#Region Main
Main()
Func Main()
ShowIntro()
SeekForTargetFile( $TargetFileName )
...
myLog(@ScriptLineNumber, "=========== Patch sequence started ========")
myLog(@ScriptLineNumber, " WorkingDir: " & @TAB & "'" & @WorkingDir & "'")
myLog(@ScriptLineNumber, " Opening: " & @TAB & $TargetFileNameIn)
$FileData = FileRead($hFileIn)
If @error <> 0 Then App_Terminate("FileRead " & $TargetFileNameIn & " with " & @error, 8)
If @extended = 0 Then App_Terminate("FileRead " & $TargetFileNameIn & " returned an empty file", 8)
If Not $UseHexNumberString Then _
$FileData = BinaryToString($FileData)
myLog(@ScriptLineNumber, " => Succeed - " & _
BitShift(StringLen($FileData), 10) & "K chars read into memory")
; ---------- P a t c h # 1 ----------
...
; ---------- P a t c h # 1 ----------
; ...
;~ ; 0210E6AD C2 0800 RETN 8
;~ ;
; Patch target Code >>>
;~ ; 0210E6B0 6A FF PUSH -1
;~ ; $+2 > 68 3C890103 PUSH 0301893C
;~ ; $+7 > 64:A1 00000000 MOV EAX, [FS:0]
;~ ; $+D > 50 PUSH EAX
;~ ; $+E > 81EC 60010000 SUB ESP, 160
;~ ; $+14 > A1 50A86003 MOV EAX, [360A850]
;~ ; $+19 > 33C4 XOR EAX, ESP
;~ ; ...
;~ ; $+474 > 25 DD5DFFFF AND EAX, FFFF5DDD
;~ ; $+479 > 68 8F000000 PUSH 8F
;~ ; $+47E > 05 B7A20000 ADD EAX, 0A2B7
;~ ; $+483 > 50 PUSH EAX
;~ ; $+484 > EB 1E JMP SHORT 0210EB54
;~ ;
;~ ; $+486 > 0FB6C0 MOVZX EAX, AL
;~ ; $+489 > F7D8 NEG EAX
;~ ; $+48B > 1BC0 SBB EAX, EAX
;~ ; $+48D > 83E0 0B AND EAX, 0B
;~ ; $+490 > 83C0 06 ADD EAX, 6
;~ ; $+493 > 50 PUSH EAX
;~ ; $+494 > FFB2 8C000000 PUSH [DWORD EDX+8C]
;~ ; $+49A > 68 6C040000 PUSH 46C // 1132 Gesponserte Sitzung
;~ ; $+49F > 68 6D040000 PUSH 46D // 1133 Dies war eine kostenlose Sitzung mit Unterstützung von
;~ ; $+4A4 > 8B0D CC177603 MOV ECX, [37617CC]
;~ ; $+4AA > E8 41C80E00 CALL 021FB3A0 ; GUI MessageBox
Local $bPatch1_succeed = _
SeekNPatch($FileData, $hFileOut, _
" 6A FF.{256,1300}" & " 68 6C 04 00 00", _
0, Chr(0xC3), _
"Patch #1 - ShowSponsoredSessionDialog", _
@ScriptLineNumber)
...
Func ShowIntro()
myLog(@ScriptLineNumber, _
$app_title & " v" & $app_ver_major & "." & $app_ver_minor & " [" & $app_rel_date & "]" & @CRLF & _
"=======================================" & @CRLF & _
"" & @CRLF & _
"This patch will remove the well known 'sponsored by' dialog box in Teamviewer" & @CRLF & _
"That pops up after each Teamviewer session that lasted longer than a minute." & @CRLF & _
"" & @CRLF & _
"This Autoit script uses RegExp pattern search & replace pattern and targets the Teamviewer binary." & @CRLF & _
"Tested with Teamviewer 12.1 but it will hopefullly also work for some still coming versions" & @CRLF & _
"Teamviewer or older versions." & @CRLF & _
"" & @CRLF & _
"32-Bit only. So far patch pattern are only made for 32-bit code and won't work for a X64 binary." & @CRLF & _
"" & @CRLF & _
"" & @CRLF _
)
EndFunc ;==>ShowIntro
#EndRegion Main
....
#EndRegion FileWork
#Region Patcher
; #FUNCTION# ====================================================================================================================
; Name ..........: SeekNPatch
; Description ...:
; Syntax ........: SeekNPatch($FileData, $hFileOut, $FindThis, $ReplaceOffsetDelta, $ReplaceWith[, $Name = "Offset: "[,
; $LineNumber = 0]])
; Parameters ....: $FileData - an unknown value.
; $hFileOut - a handle value.
; $FindThis - an unknown value.
; $ReplaceOffsetDelta - an unknown value.
; $ReplaceWith - an unknown value.
; $Name - [optional] an unknown value. Default is "Offset: ".
; $LineNumber - [optional] an unknown value. Default is 0.
; Return values .: None
; Author ........: Your Name
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func SeekNPatch($FileData, $hFileOut, _
$FindThis, _
$ReplaceOffsetDelta, $ReplaceWith, _
$Name = "Offset: ", _
$LineNumber = 0)
myLog($LineNumber, " _______________________________________________")
myLog($LineNumber, " " & $Name & " - " & $FindThis)
Local $iOffsetPatch ;
Local $aArray = 0, _
$iOffset = 1
; convert from nice looking to real RegExp pattern
If $UseHexNumberString Then _
$FindThis = StringReplace($FindThis, " ", "")
$xdigit = "." ;"[0-9A-Fa-f]"
$FindThis = StringReplace($FindThis, ".", "(?:" & $xdigit & $xdigit & ")")
Else
$FindThis = "(?s)" & StringReplace($FindThis, " ", "\x")
EndIf
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $FindThis = ' & $FindThis & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Local $OccurrenceCounter = 0
While 1
$aArray = BinRegExp( _
$FileData, _
$FindThis, _
$STR_REGEXPARRAYMATCH, $iOffset _
)
$iOffset = @extended
If @error = 2 Then
myLog(@ScriptLineNumber, " Error in search pattern: " & $FindThis & @CRLF & _
" The correct part is : " & StringLeft($FindThis, $iOffset))
App_Terminate("invalid RegExp pattern", 123)
EndIf
If @error Then ExitLoop
For $i = 0 To UBound($aArray) - 1
$Len = StringLen($aArray[$i])
$iOffsetPatch = $iOffset
$iOffsetPatch -= $Len
If $UseHexNumberString Then
;Discard pseudomatches
If BitAND($iOffsetPatch, 1) = 0 Then ExitLoop
$iOffsetPatch = DivBy2($iOffsetPatch)
EndIf
$iOffsetPatch -= 1
myLog(@ScriptLineNumber, ' Pattern found at' & @TAB & '0x' & Hex($iOffsetPatch))
$OccurrenceCounter += 1
Next
WEnd
If $OccurrenceCounter = 0 Then
myLog(@ScriptLineNumber, ' Whoops pattern not found - maybe file is already patched.')
Return False
EndIf
;================ PatchFile ======================
;~ $iOffsetPatch = 0xD6DAB0
If $iOffsetPatch > 0 Then
$bBackupCreated = CreateBackup($TargetFileName)
$iOffsetPatch = $iOffsetPatch + $ReplaceOffsetDelta
myLog(@ScriptLineNumber, ' Writing patch data @' & @TAB & '0x' & Hex($iOffsetPatch) & _
' ( offset delta: ' & $ReplaceOffsetDelta & ' )')
FileSetPos($hFileOut, $iOffsetPatch, $FILE_BEGIN)
If 0 = FileWrite($hFileOut, $ReplaceWith) Then
myLogErr(@ScriptLineNumber, "FileWrite")
Return False
EndIf
EndIf
If $bBackupCreated Then myLog(@ScriptLineNumber, " ... and created backup: " & $BackupFile)
Return True
EndFunc ;==>SeekNPatch
#EndRegion Patcher
#Region Logging
Func App_Terminate($Reason = "", $ExitCode = 64)
If $Reason Then _
ConsoleWriteError("App_quit: " & $Reason & @CRLF)
ConsoleWrite(@CRLF & _
$app_store & @TAB & @TAB & @TAB & @TAB & $app_contact & @CRLF)
$nextline = _ConsoleReadLn()
Exit $ExitCode
EndFunc ;==>App_Terminate
Func init_NotWorkingBytes()
;Create TestData
local $TestData = "0x"
for $i=00 to 0xff
$TestData &= StringFormat( "%02X", $i)
Next
$TestData = BinaryToString ($TestData)
Global $RegExpNotWorkingBytes = "(?|\\x80)"
for $i=0x0 to 0xFF
$pat = StringFormat( "\x%02X", $i)
$match = StringRegExp( $TestData ,$pat ,$STR_REGEXPARRAYFULLMATCH)
if @error<>0 then
;~ ConsoleWrite('$match = ' & _
;~ $pat& ' - ' & $match & ' > ' & chr($i) ) ;### Debug Console
$RegExpNotWorkingBytes &= "|(?|\" & $pat & ")"
;~ ConsoleWrite( @CRLF)
EndIf
Next
Return $RegExpNotWorkingBytes
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: BinRegExp
; Description ...: Use RegExp with binary data
; Syntax ........: BinRegExp($test, $pattern[, $flag = 0[, $offset = 1]])
; Parameters ....: $test - a dll struct value.
; $pattern - a pointer value.
; $flag - [optional] a floating point value. Default is 0.
; $offset - [optional] an object. Default is 1.
; Return values .: None
; Remarks .......: That's kind of workaround since the
;That's a kinda hybrid for /x00-/x7F it uses StringRegExp with binary data and
; checks each match again with the slower StringRegExp hexnumberstring binary data
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func BinRegExp($test, $pattern, $flag = 0, $offset = 1)
$RegExpNotWorkingBytes = init_NotWorkingBytes()
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $RegExpNotWorkingBytes = ' & $RegExpNotWorkingBytes & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
;~ $RegExpNotWorkingBytes = '\\x[7-9A-Fa-f][0-9A-Fa-f]'
;Replace not working in Range of /x7F-/xFF with .
$SafePattern = StringRegExpReplace( $pattern, _
$RegExpNotWorkingBytes, _
'.')
;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $SafePattern = ' & $SafePattern & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
for $Round = 1 to 0x7FFFFFFF
Local $RetVal = StringRegExp($test, $SafePattern, $flag, $offset)
Local $RetError = @error
Local $RetExtended = @extended
If $RetError = 0 Then
$MatchData = $RetVal[0]
$MatchLength = StringLen($MatchData)
$MatchStart = $RetExtended
$MatchStart -= $MatchLength
$MatchStart -= 1
$RetVal2 = _BinRegExp($MatchData, $pattern, $flag)
If @error = 0 Then
; Match is valid
ExitLoop
ElseIf @error = 3 Then
; the match was to big - apply delta; seek back from end of current match
$offset = $MatchStart + @extended
else
; ... was not a real match - look for more
$offset = $RetExtended
EndIf
Else
ExitLoop
EndIf
ConsoleWrite('.')
;~ myLog(@ScriptLineNumber ,"$offset = " & hex($offset) )
Next
Return SetError($RetError, $RetExtended, $RetVal)
EndFunc ;==>BinRegExp
Func _BinRegExp($test, $pattern, $flag = 0, $offset = 1)
const $xdigit = "." ;"[0-9A-Fa-f]"
; Replace \xXX with .
$Numberstring = StringReplace($pattern, '\x', '')
$Numberstring = StringReplace($Numberstring, ".", "(?:" & $xdigit & $xdigit & ")")
$test = StringToBinary($test)
Local $RetVal = StringRegExp( $test, $Numberstring, $STR_REGEXPARRAYMATCH )
Local $RetError = @error
Local $RetExtended = @extended
If $RetError = 0 Then
$MatchData = $RetVal[0]
$MatchLength = StringLen($MatchData)
$testLength = StringLen( $test ) - 2 ; no '0x'
$delta = $testLength - $MatchLength
if $delta >= 2 then
; the match was to big - set Error 4 and return adjustment delta
;~ $delta = $MatchLength - $delta ; set delta to how many bytes to seek back from end of current match
$delta = DivBy2($delta)
Return SetError(3, $delta)
EndIf
endif
Return SetError($RetError, $RetExtended, $RetVal)
EndFunc ;==>_BinRegExp
Func DivBy2($Divident)
Return BitShift($Divident, 1)
EndFunc ;==>DivBy2