如何摆脱“禁用开发人员模式扩展”弹出窗口

时间:2015-05-17 14:30:38

标签: windows google-chrome

最近谷歌将这个恼人的弹出窗口添加到开发频道。

有人在这里回答(Disable developer mode extensions pop up in Chrome)编辑chrome.dll以摆脱弹出窗口。

但是,那里描述的方法似乎不再起作用了。

此外,如果谷歌推出新的更新,那么有一个批量修补chrome.dll的批处理脚本会很不错。

编辑:打开新的黑客,因为wOxxOm停止维护他的有用脚本(手动方法似乎也已过时)

3 个答案:

答案 0 :(得分:88)

该修补程序不再适用于新的Chrome版本,因此存档在下面的代码段中。

只需使用Chrome Canary,但不会显示警告。

或者您可以使用HIEW手动修补它:

  1. 完全退出Chrome,方法是按 Ctrl Shift Q 并终止Windows任务管理器chrome.exe中的所有Processes进程选项卡(它是第二个选项卡,而不是默认选项卡)。
  2. 在hiew中打开chrome.dll
  3. 输入切换视图
  4. F7 ,在第一个输入字段中粘贴ExtensionDeveloperModeWarning,按 Enter
  5. F3 进入编辑模式
  6. 输入00
  7. F9 保存
  8. 将光标定位在00
  9. F6 查找参考

    enter image description here

  10. 在屏幕上查找cmp eax,3cmp eax,2以及上下相邻的几页

    enter image description here

  11. 使用 Up Down 将光标导航到该行的二进制代码(左侧列)
  12. F3 进入编辑模式
  13. 使用导航光标到该行代码中的0302
  14. 输入09
  15. F9 保存
  16. 关闭hiew,否则Chrome将无法启动。
  17. <# :
    @echo off
    copy/b "%~f0" "%temp%\%~n0.ps1" >nul
    powershell -v 2 -ep bypass -noprofile "%temp%\%~n0.ps1" "'%cd% '" "'%~1'"
    del "%temp%\%~n0.ps1"
    echo: & pause
    exit /b
    #>
    param([string]$cwd='.', [string]$dll)
    
    function main {
      write-host -f white -b black `
        "Chrome 'developer mode extensions' warning disabler 2017.12.08"
      $pathsDone = @{}
      if ($dll -and (gi -literal $dll)) {
        doPatch "DRAG'n'DROPPED" ((gi -literal $dll).directoryName + '\')
        exit
      }
      doPatch 'CURRENT DIRECTORY' ((gi -literal $cwd).fullName + '\')
      ('HKLM', 'HKCU') | %{ $hive = $_
        ('', '\Wow6432Node') | %{
          $key = "${hive}:\SOFTWARE$_\Google\Update\Clients"
          gci -ea silentlycontinue $key -r | gp | ?{ $_.CommandLine } | %{
            $path = $_.CommandLine -replace '"(.+?\\\d+\.\d+\.\d+\.\d+\\).+', '$1'
            if (!$pathsDone[$path.toLower()]) {
              doPatch REGISTRY $path
              $pathsDone[$path.toLower()] = $true
            }
          }
        }
      }
    }
    
    function doPatch([string]$pathLabel, [string]$path) {
      $dll = Join-Path $path chrome.dll
      if (!(Test-Path -literal $dll)) {
        return
      }
      ''
      $localAppData = [Environment]::GetFolderPath('LocalApplicationData')
      "$pathLabel $((split-path $dll).Replace($localAppData, '%LocalAppData%'))"
    
      "`tREADING Chrome.dll..."
      $bin = [IO.BinaryReader][IO.File]::OpenRead($dll)
      $bytes = $bin.ReadBytes(1MB)
    
      # process PE headers
      $BC = [BitConverter]
      $coff = $BC::ToUInt32($bytes,0x3C) + 4
      $is64 = $BC::ToUInt16($bytes,$coff) -eq 0x8664
      $opthdr = $coff+20
      $codesize = $BC::ToUInt32($bytes,$opthdr+4)
      $imagebase32 = $BC::ToUInt32($bytes,$opthdr+28)
    
      # patch the flag in data section
      $bin.BaseStream.Position = $codesize
      $data = $BC::ToString($bin.ReadBytes($bin.BaseStream.Length - $codesize))
      $bin.Close()
      $flag = 'ExtensionDeveloperModeWarning'
      $stroffs = $data.IndexOf($BC::ToString($flag[1..99]))
      if ($stroffs -lt 0) {
        write-host -f red "`t$flag not found"
        return
      }
      if ($data.substring($stroffs-3, 2) -eq '00') {
        write-host -f darkgreen "`tALREADY PATCHED"
        return
      }
      $stroffs = $stroffs/3 - 1 + $codesize
    
      $centbrowser = $data.indexOf($BC::ToString('CentBrowser'[0..99])) -gt 0
    
      $EA = $ErrorActionPreference
      $ErrorActionPreference = 'silentlyContinue'
      $exe = join-path (split-path $path) chrome.exe
      while ((get-process chrome -module | ?{ $_.FileName -eq $exe })) {
        forEach ($timeout in 15..0) {
          write-host -n -b yellow -f black `
            "`rChrome is running and will be terminated in $timeout sec. "
          write-host -n -b yellow -f darkyellow "Press ENTER to do it now. "
          if ([console]::KeyAvailable) {
            $key = $Host.UI.RawUI.ReadKey("AllowCtrlC,IncludeKeyDown,NoEcho")
            if ($key.virtualKeyCode -eq 13) { break }
            if ($key.virtualKeyCode -eq 27) { write-host; exit }
          }
          sleep 1
        }
        write-host
        get-process chrome | ?{
          $_.MainWindowHandle.toInt64() -and ($_ | gps -file).FileName -eq $exe
        } | %{
          "`tTrying to exit gracefully..."
          if ($_.CloseMainWindow()) {
            sleep 1
          }
        }
        $killLabelShown = 0
        get-process chrome | ?{
          ($_ | gps -file | select -expand FileName) -eq $exe
        } | %{
          if (!$killLabelShown++) {
            "`tTerminating background chrome processes..."
          }
          stop-process $_ -force
        }
        sleep -milliseconds 200
      }
      $ErrorActionPreference = $EA
    
      $bytes = [IO.File]::ReadAllBytes($dll)
      $bytes[$stroffs] = 0
      "`tPATCHED $flag flag"
    
      # patch the channel restriction code for stable/beta
      $rxChannel = '(?!<41-)83-F8-(?:03-7D|02-7F|02-0F-8F)'
      # old code: cmp eax,3; jge ...
      # new code: cmp eax,2; jg ... (jg can be 2-byte)
      function patch64 {
        $patterns = @(
          "(?<ch>$rxChannel)-.{1,100}-(?<flag>48-8D-)"
          # 48-8D-15-F3-78-87-00 first flag ref
          # 48-8D-15-A4-78-87-00 second flag ref
          "(?<flag>4[8C]-8D-).{9}(.{6}).{100,600}4[8C]-8D-.{9}\1.{600,2000}(?<ch>$rxChannel)"
          "84-C0.{18,48}(?<ch>$rxChannel)-.{30,60}84-C0"
        )
        forEach ($pattern in $patterns) {
          $pos = 0
          $rx = [regex]$pattern
          $patternDisplay = $pattern -replace '^(.{40}).+', '$1'
          write-host -n -f darkgray "`tLooking for $patternDisplay"
          do {
            $m = $rx.match($code, $pos)
            write-host -n -f darkgray .
            if (!$m.success) { break }
            $chanpos = $searchBase + $m.groups['ch'].index/3 + 2
            $pos = $m.groups['flag'].index + $m.groups['flag'].length
            $offs = $BC::ToUInt32($bytes, $searchBase + $pos/3+1)
            $diff = $searchBase + $pos/3+5+$offs - $stroffs
            #write-host ("`n{0,16:x}`t{1}" -f ($offs, $diff))
          } until ($diff -ge 0 -and $diff -le 6000 -and $diff % 256 -eq 0)
          write-host
          #write-host ("{0,16:x}" -f ($searchBase + $pos/3))
          if ($m.success) { break }
          $chanpos = 0
        }
        $chanpos
      }
      function patch86 {
        $flagOffs = [uint32]$stroffs + [uint32]$imagebase32
        $flagOffsStr = $BC::ToString($BC::GetBytes($flagOffs))
        #write-host $flagOffsStr
        $variants = "(?<ch>$rxChannel-.{1,300})-(68-(?<flag>`$1-.{6}`$2.{100,200})){2}",
                    "68-(?<flag>`$1-.{6}`$2).{300,500}E8.{12,32}(?<ch>$rxChannel)",
                    "E8.{12,32}(?<ch>$rxChannel).{300,500}68-(?<flag>`$1-.{6}`$2)"
        forEach ($variant in $variants) {
          $pattern = $flagOffsStr -replace '^(..)-.{6}(..)', $variant
          $patternDisplay = $pattern -replace '^(.{40}).+', '$1'
          write-host -f darkgray "`tLooking for $patternDisplay..."
          $minDiff = 65536
          foreach ($m in [regex]::matches($code, $pattern)) {
            $maybeFlagOffs = $BC::toUInt32($bytes, $searchBase + $m.groups['flag'].index/3)
            $diff = [Math]::abs($maybeFlagOffs - $flagOffs)
            #write-host ("`n{0,16:x}`t{1}" -f ($maybeFlagOffs, $diff))
            if ($diff % 256 -eq 0 -and $diff -lt $minDiff) {
              $minDiff = $diff
              $chanpos = $searchBase + $m.groups['ch'].index/3 + 2
            }
          }
        }
        $chanpos
      }
      $passes = 3
      foreach ($pass in $passes..1) {
        if ($centbrowser) { break }
        $searchBase = [int]($codesize/$passes * ($pass-1))
        $code = $BC::ToString($bytes, $searchBase, [int]($codesize/$passes) + 2000)
        $chanpos = if ($is64) { patch64 } else { patch86 }
        if ($chanpos) { break }
        $searchBase = 0
      }
      if ($chanpos) {
        #write-host ('{0:x}' -f $chanpos)
        $bytes[$chanpos] = 9
        "`tPATCHED Chrome release channel restriction"
      } elseif (!$centbrowser) {
        write-host -f red "`tUnable to find the channel code, try updating me"
        write-host -f red "`thttp://stackoverflow.com/a/30361260"
        return
      }
    
      "`tWriting to a temporary dll..."
      [IO.File]::WriteAllBytes("$dll.new",$bytes)
    
      "`tBacking up the original dll..."
      move -literal $dll "$dll.bak" -force
    
      "`tRenaming the temporary dll as the original dll..."
      move -literal "$dll.new" $dll -force
    
      write-host -f green "`tDONE.`n"
      [GC]::Collect()
    }
    
    main
    # DevWarningPatch.bat Dec 08, 2017 
    **for 32/64-bit Chrome 44.0.2398.0 and newer, stable/beta/dev/canary**
    
    1. Save the code to `DevWarningPatch.bat` somewhere  
      (on the Desktop, for example or in the folder with chrome.dll)
    2. Exit Chrome.  
      Or let the script close it including its hidden background processes.
    3. Rightclick the batch file and run it as administrator: it will find & patch all applicable chrome.dll  
      Alternatively you can drag'n'drop chrome.dll onto the batch file
    
    **If the pop-up message occurs after running the batch file** try renaming the file `chrome.dll.bak` to `chrome.dll` inside Chrome's application folder, then run the batch file again.

答案 1 :(得分:3)

我在这里添加了解决这个问题的官方方法,我知道它们不是最优的,但这些解决方案存在于此处是有意义的。

第一个解决方案和最复杂的解决方案是创建Google Store Account并完成所有步骤以激活它,您可以上传extension package并保留Private,因此,您可以将此软件包的链接共享给需要安装的人,这样一来,该消息将永远不会显示,因为该扩展程序已获得Google团队的批准且安全。

第二个选项是下载Chrome Dev Browser,链接Here,它不会在屏幕上显示您正在下载Dev Channel,您必须相信它正在发生。此版本的浏览器与官方版本并排运行,因此您无需卸载或进行任何操作,并且所有设置都是分开的,因此它实际上就像是一个不同的浏览器。

我正在使用它的第64版,它解决了扩展程序的问题。

答案 2 :(得分:1)

如果您无法使用dev / canary构建,删除弹出窗口的最简单方法是打包您的扩展程序,然后使用组策略将其列入白名单,如下所示:https://stackoverflow.com/a/38011386/991321