Pavel的很多OneKey Kill.AD程序大家应该不陌生吧!比如OneKey Kill.AD For PPS、OneKey Kill.AD For UUSee、OneKey Kill.AD For QQ2009等等,今天Pavel竟然为大家提供了核心源代码!icech赶快转载过来,让更多喜欢KillAD的朋友研究一下!
下面就是具体的代码了!
QQ2009去广告部分源码:
1 ${NSD_GetState} $_SaveCB $_SaveState
2
3 ${NSD_GetState} $_AD_off $_ADState
4 StrCmp $_ADState 1 0 +8
5 StrCpy $_ADState 1
6 SetFileAttributes $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement 0
7 RMDir /r $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement
8 FileOpen $0 $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement w
9 FileClose $0
10 SetFileAttributes $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement READONLY
11 Goto AD_over
12 StrCpy $_ADState 0
13 SetFileAttributes $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement 0
14 Delete $APPDATA\Tencent\QQ\Misc\com.tencent.advertisement
15 AD_Over:
16
17 SaveState:
18 StrCmp $_SaveState 1 0 Quit
19 IfFileExists "$EXEDir\OneKey.ini" +3 0
20 FileOpen $0 "$EXEDir\OneKey.ini" a
21 FileClose $0
22
23 StrCmp $_ADState 1 0 +3
24 WriteINIStr "$EXEDir\OneKey.ini" Setting cleanad 1
25 Goto +2
26 WriteINIStr "$EXEDir\OneKey.ini" Setting cleanad 2
PPS补丁 hosts文件部分代码:
1 Function _PatchHosts
2 Pop $0
3 Pop $1
4
5 FileOpen $0 '$SYSDIR\drivers\etc\hosts' a
6 FileSeek $0 -24 END
7 FileRead $0 $1
8 StrCmp $1 "0.0.0.0 update.111222.cn" +4 +1
9 FileSeek $0 0 END
10 FileWrite $0 "$\n0.0.0.0 notice.ppstream.com$\n0.0.0.0 update.111222.cn"
11 Goto oNoFF_UP
12 FileSeek $0 -26 END
13 FileRead $0 $1
14 StrCmp $1 "$_Fuck 0.0.0.0 update.111222.cn" oNoFF_UP +1
15 FileSeek $0 -24 END
16 FileWrite $0 "$_Fuck 0.0.0.0 update.111222.cn"
17 oNoFF_UP:
18 FileClose $0 #关闭之前写入的文件
19 StrCmp $_PPSUPState 1 0 re_updateini
20 ${LineFind} "$SYSDIR\drivers\etc\hosts" "" "1:-1" "_offUpdate"
21 FileOpen $0 $_Path\update.ini w
22 FileClose $0
23 SetFileAttributes "$_Path\update.ini" READONLY
24 DeleteRegKey HKCU "Software\PPStream\update"
25 Goto Done
26 re_updateini:
27 SetFileAttributes "$_Path\update.ini" 0
28 Done:
29 FunctionEnd
30
31 Function Replace_notice.asdf
32 StrCpy $1 $R9
33 ${WordReplace} '$R9' 'notice.asdf' 'notice.ppstream' '+*' $R9
34 StrCmp $1 $R9 +2
35 IntOp $R0 $R0 + 1
36 Push $0
37 FunctionEnd
38
39 Function Replace_update.asdf
40 StrCpy $1 $R9
41 ${WordReplace} '$R9' 'update.asdf' 'update.111222' '+*' $R9
42 StrCmp $1 $R9 +2
43 IntOp $R0 $R0 + 1
44 Push $0
45 FunctionEnd
46
47 Function _offUpdate
48 StrCpy $1 $R9
49 ${WordReplace} '$R9' '$_Fuck 0.0.0.0 update.111222.cn' '0.0.0.0 update.111222.cn' '+*' $R9
50 StrCmp $1 $R9 +2
51 IntOp $R0 $R0 + 1
52 Push $0
53 FunctionEnd
离开页面调用:
1 SetFileAttributes $SYSDIR\drivers\etc\hosts 0
2 ${LineFind} "$SYSDIR\drivers\etc\hosts" "" "1:-1" "Replace_notice.asdf"
3 ${LineFind} "$SYSDIR\drivers\etc\hosts" "" "1:-1" "Replace_update.asdf"
4
5 IntFmt $_Fuck "%c" 0x23
6 Call _PatchHosts
Kugoo补丁 xml 文件部分操作源码:
1 IfFileExists "$_Path\KuGoo.xml" +2 0
2 File /oname=$_Path\KuGoo.xml "${PROJECT_PATH}\${PRODUCT_VERSION}\Patcher\KuGoo.xml"
3
4 ${xml::LoadFile} "$_Path\KuGoo.xml" $0
5 ${xml::GotoPath} "/KuGoo/General" $0
6 ${xml::SetAttribute} "ShowDownFinishAd" "0" $0
7 ${xml::SetAttribute} "ShowFlash" "0" $0
8 ${xml::SetAttribute} "ShowPopupAd" "0" $0
9 ${xml::SetAttribute} "MiniToTrayOnClose" "0" $0
10 ${xml::SaveFile} "$_Path\KuGoo.xml" $0
题外话:
Pavel不是什么高手,代码也写的很丑,只是想对一部分爱说别人SB的人说一下,说别人SB之前先看看自己是不是SB,没人有义务给你做什么,这些东西本来就是我无聊时的产物,自己从未在这个过程中想过去得到什么,只是方便自己的同时也想方便部分朋友,仅此而已。
Pavel学这个到发布第一个去广告补丁,中间大概用了不到两周时间,所以Pavel还是个新手,高手看了莫见笑~