去掉chrome弹出“开发模式使用插件”提示窗的方法

mmit 2017-02-05 09:29:53
去掉chrome弹出“开发模式使用插件”提示窗的方法:

http://stackoverflow.com/questions/30287907/how-to-hack-chrome-dll-to-get-rid-of-the-disable-developer-mode-extensions-pop/30361260#30361260

用上述网页的代码复制到记事本,保存为一个.bat文件,以管理员模式运行之即可。

其原理是修改chrome.dll。对于绿色版chrome,运行.bat文件时会找不到chrome.dll的路径(可能是根据注册表在查找),这时可以将chrome.dll文件拖放到该.bat文件上运行,生成修改后的chrome.dll (原文件改名为chrome.dll.bak),将此修改后的chrome.dll替换chrome文件夹中的原文件即可。

附:上述网页中的代码(版权属于原作者)

<# :
@echo off
copy/b "%~f0" "%temp%\%~n0.ps1" >nul
powershell -Version 2 -ExecutionPolicy bypass -noprofile "%temp%\%~n0.ps1" "%cd% " "%~1"
del "%temp%\%~n0.ps1"
pause
exit /b
#>
param([string]$cwd='.', [string]$dll)

function main {
"Chrome 'developer mode extensions' warning disabler v1.0.10.20170114`n"
$pathsDone = @{}
if ($dll -and (gi -literal $dll)) {
doPatch "DRAG'n'DROPPED" ((gi -literal $dll).directoryName + '\')
exit
}
doPatch CURRENT ((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'
doPatch REGISTRY $path
}
}
}
}

function doPatch([string]$pathLabel, [string]$path) {
if ($pathsDone[$path.toLower()]) { return }

$dll = $path + "chrome.dll"
if (!(test-path -literal $dll)) {
return
}
"======================="
"$pathLabel PATH $((gi -literal $dll).DirectoryName)"

"`tREADING Chrome.dll..."
$bytes = [IO.File]::ReadAllBytes($dll)

# 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
$data = $BC::ToString($bytes,$codesize)
$flag = "ExtensionDeveloperModeWarning"
$stroffs = $data.IndexOf($BC::ToString($flag[1..99]))/3 - 1
if ($stroffs -lt 0) {
write-host -f red "`t$flag not found"
return
}
$stroffs += $codesize
if ($bytes[$stroffs] -eq 0) {
write-host -f darkgreen "`tALREADY PATCHED"
return
}

$exe = join-path (split-path $path) chrome.exe
$EA = $ErrorActionPreference
$ErrorActionPreference = 'silentlyContinue'
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[$stroffs] = 0
"`tPATCHED $flag flag"

# patch the channel restriction code for stable/beta
$code = $BC::ToString($bytes,0,$codesize)
$rxChannel = '83-F8-(?:03-7D|02-7F)'
# old code: cmp eax,3; jge ...
# new code: cmp eax,2; jg ...
$chanpos = 0
try {
if ($is64) {
$pos = 0
$rx = [regex]"$rxChannel-.{1,100}-48-8D"
do {
$m = $rx.match($code,$pos)
if (!$m.success) { break }
$chanpos = $m.index/3 + 2
$pos = $m.index + $m.length + 1
$offs = $BC::ToUInt32($bytes,$pos/3+1)
$diff = $pos/3+5+$offs - $stroffs
} until ($diff -ge 0 -and $diff -le 4096 -and $diff % 256 -eq 0)
if (!$m.success) {
$rx = [regex]"84-C0.{18,48}($rxChannel)-.{30,60}84-C0"
$m = $rx.matches($code)
if ($m.count -ne 1) { throw }
$chanpos = $m[0].groups[1].index/3 + 2
}
} else {
$flagOffs = [uint32]$stroffs + [uint32]$imagebase32
$flagOffsStr = $BC::ToString($BC::GetBytes($flagOffs))
$variants = "(?<channel>$rxChannel-.{1,100})-68-(?<flag>`$1-.{6}`$2)",
"68-(?<flag>`$1-.{6}`$2).{300,500}E8.{12,32}(?<channel>$rxChannel)",
"E8.{12,32}(?<channel>$rxChannel).{300,500}68-(?<flag>`$1-.{6}`$2)"
forEach ($variant in $variants) {
$pattern = $flagOffsStr -replace '^(..)-.{6}(..)', $variant
"`tLooking for $($pattern -replace '\?<.+?>', '')..."
$minDiff = 65536
foreach ($m in [regex]::matches($code, $pattern)) {
$maybeFlagOffs = $BC::toUInt32($bytes, $m.groups['flag'].index/3)
$diff = [Math]::abs($maybeFlagOffs - $flagOffs)
if ($diff % 256 -eq 0 -and $diff -lt $minDiff) {
$minDiff = $diff
$chanpos = $m.groups['channel'].index/3 + 2
}
}
}
if (!$chanpos) { throw }
}
} catch {
write-host -f red "`tUnable to find the channel code, try updating me"
write-host -f red "`thttp://stackoverflow.com/a/30361260"
return
}
$bytes[$chanpos] = 9
"`tPATCHED Chrome release channel restriction"

"`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

$pathsDone[$path.toLower()] = $true
write-host -f green "`tDONE.`n"
[GC]::Collect()
}

main
...全文
2980 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
家在田塍 2019-10-10
  • 打赏
  • 举报
回复
引用 5 楼 mmit 的回复:
对于最新版的 chrome 以上方法已失效,目前唯一还剩下注册表大法尚有效,大家需要可以自行将以下文字存为 .reg 文件导入注册表即可。 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Google\Update\ClientState\{8A69D345-D564-463c-AFF1-A69D9E530F96}] "ap"="x64-dev"
***************** 我导入注册表之后,依然无效哎,请问这也失效了吗?
mmit 2019-08-17
  • 打赏
  • 举报
回复
对于最新版的 chrome 以上方法已失效,目前唯一还剩下注册表大法尚有效,大家需要可以自行将以下文字存为 .reg 文件导入注册表即可。 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Google\Update\ClientState\{8A69D345-D564-463c-AFF1-A69D9E530F96}] "ap"="x64-dev"
GJ1234_5 2019-07-31
  • 打赏
  • 举报
回复
没有效果 请自行确认
枫Y 2018-06-01
  • 打赏
  • 举报
回复
那怎么删除掉这段代码了
Fanticsen 2017-03-09
  • 打赏
  • 举报
回复
谢谢 分享,我可能会用到
ddianxing 2017-03-06
  • 打赏
  • 举报
回复
老方法是在chrome快捷键里加后缀和组策略加白名单,现在两种方法都不管用了……楼主的方法亲测有效!
Chrome 百科名片 Google Chrome,中文名为“谷歌浏览器”,是一个由Google公司开发的网页浏览器。与苹果公司的safari相抗衡,浏览速度在众多浏览器中走在前列,属于高端浏览器。采用BSD许可证授权并开放源代码,开源计划名为Chromium.本软件的代码是基于其他开放源代码软件所撰写,包括WebKit和Mozilla,目标是提升稳定性、速度和安全性,并创造出简单且有效的使用者界面。软件的名称是来自于又称作“Chrome”的网络浏览器图形使用者界面(GUI)。 目录[隐藏] 版本简介 操作系统 宣布 发布 不支持或未实现的功能 安全性 速度 使用者界面    [编辑本段]版本简介   软件的beta测试版本在2008年9月2日释出,提供43种语言版本,目前仅适用于Microsoft Windows的XP,Vista和最新发布的windows7平台,并不支持Windows 2000或更早期的版本。Mac OS X和Linux版本正在研发中,并于2009年6月5日首次针对开发者推出Mac和Linux版官方Chrome浏览器,正式版将于日后推出。    Google Chrome Logo [编辑本段]操作系统   谷歌公司于2009年7月7日宣布,将在其Chrome网络浏览器的基础上开发一款计算机操作系统。对于其竞争对手微软而言,这无疑是一次最直接的挑战。   报道称,有分析师对此表示,谷歌公司此次的计算机操作系统计划,将使得谷歌与微软之间本已激烈的竞争再次升级。谷歌在其公司博客上表示,此次研发的操作系统将主要适用于上网本,而这也是目前整个市场的热点。谷歌表示,此次这款开源软件将被命名为Chrome OS,并于2010年下半年正式上市。   谷歌在其公司博客上表示:“这款Chrome OS操作系统,将具有高速、简约及安全等主要性能。我们希望这款操作系统能够为用户提供使用的便捷性,并能够更快速的进入互联网。”在此之前,谷歌已经推出了手机操作系统Android,另外,数款上网本也使用了这款操作系统。   长期以来,谷歌一直致力于计算机软件对于互联网的兼容性,以取代以计算机为中心的软件开发方式。谷歌希望,能够开发出通过互联网浏览器直接运行的软件,从而减少对于硬件设备的依赖性。   2008年,谷歌宣布推出Chrome浏览器。该公司表示,这款浏览器将使得用户完全整合谷歌所提供的各种服务。自那以来,谷歌又不断强化这款浏览器的功能,甚至在未能取得互联网连接的情况下,用户也能够通过这款浏览器来运行程序。   对于谷歌而言,究竟要花费多长时间才能将Chrome发展为一款全能型的操作系统目前仍然不得而知。但是Netscape联合创始人安德里森(Marc Andreessen)在最近一次采访时曾表示,Chrome已经取得了长足的进步。他说:“基本上可以说,Chrome已经是一款现代的操作系统。”另外在内部工作中,谷歌长期使用Linux操作系统。   目前谷歌Chrome浏览器Windows 版的最新版本是:6.0.447.0 dev   目前发现过往版本5.0.371.0 Dev与微点主动防御发生冲突 [编辑本段]宣布   官方的正式宣布预定在2008年9月3日举行,并将寄给记者和部落客一则解说新浏览器特色和研发动机的漫画,该漫画由史考特·迈克劳德(Scott McCloud)所绘制,并在创作共享的“姓名标示-非商业性-禁止改作2.5”版权协议下发行。由于要送往欧洲的信件提早寄出,因此德国“Google Blogoscoped”博客的作者菲利普·蓝森(Philipp Lenssen)在2008年9月1日收到漫画后就扫描并放上自己的网站。随后Google就将这则漫画放到Google Books和Google网站上,并在自家的博客中说明了提早释出的原因。 [编辑本段]发布   Google官方Blog在9月2日撰文说,将于第二天在超过100个国家同时发布Chrome的Beta版。   北京时间9月3日凌晨3:02,官方Blog宣布Beta版已经可以下载。   2009-05-22 Google终于发布了Chrome V2.0的首个正式版本。Chrome 2.0正式版版本号为V2.0.172.28,Windows 版最新版本V6.0.427.0 dev   目前发现过往版本5.0.371.0 Dev与微点主动防御发生冲突 [编辑本段]不支持或未实现的功能   ●鼠标手势,但可通过其他应用程序实现,如StrokeIt。   ● Google Toolbar。   ●WebKit引擎限制(自动换页,ActiveX,VBS)。   ●没有WebKit的特别功能。   ● RSS。   ●网页引擎WebKit的版本过旧,因为旧版

5,006

社区成员

发帖
与我相关
我的任务
社区描述
解读Web 标准、分析和讨论实际问题、推动网络标准化发展和跨浏览器开发进程,解决各种兼容性问题。
社区管理员
  • 跨浏览器开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧