给 inno setup 源码打补丁
本帖最后由 qqycra 于 2023-9-27 15:51 编辑首先下载源码:
curl -x 127.0.0.1:8888 https://codeload.github.com/jrsoftware/issrc/zip/refs/heads/main -o issrc-main.zip
下载后先解压缩。
有几个地方要改改:
1、修改默认快捷键
Compile -------------------------------- 改为F9
Generate &GUID -----------------------改为F2
MessageBox Designer------------------改为F4
Open Output Folder--------------------改为F11
Run to &Cursor-------------------------去掉快捷键
Terminate--------------------------------改为F6
2、去掉插入GUID的确认对话框,去掉停止调试的确认对话框
3、增加《Compil32.exe编辑iss时,iss文件有改动自动重新加载》功能
确定目标,开整!
1/修改快捷键,通过对比修改前后的form文件,确定dfm文件变动内容。
2/安装对话框内容搜索源码找到对应位置,注释掉对应源码。
3/打开issrc-main\Projects\Compil32.dproj,在界面设计器找到StatusBar新增1个Panels,
然后再OpenFile(Memo, Memo.Filename, False);下面增加
StatusBar.Panels.Text := '文件重新加载完成。。。';
WaitedTime:=0;
while (WaitedTime < 3500) do
begin
SleepEx(100,False);
Inc(WaitedTime,100);
Application.ProcessMessages ;
end;
StatusBar.Panels.Text :='';
inno setup总更新,不能每次手动改源码。那么使用sfk 制作补丁模板。
模板格式:
:patch "InnoSetup" 名称
:info InnoSetup 信息
:root InnoSetup 目录
:file issrc-main\Projects\CompForm.dfm 应用到哪个文件
:from
查找内容
:to
替换内容
下面是补丁全文:
:patch "InnoSetup"
:info InnoSetup
:root InnoSetup
:# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:file issrc-main\Projects\CompForm.dfm
:from
Width = 50
end>
OnDrawPanel = StatusBarDrawPanel
OnResize = StatusBarResize
:to
//
Width = 400
end
item
Bevel = pbNone
Width = 50
end>
OnDrawPanel = StatusBarDrawPanel
OnResize = StatusBarResize
:from
Caption = '&Compile'
ShortCut = 16504
:to
Caption = '&Compile'
ShortCut = 121
:from
Caption = '&Open Output Folder'
:to
Caption = '&Open Output Folder'
ShortCut = 122
:from
Caption = 'Run to &Cursor'
ShortCut = 115
:to
Caption = 'Run to &Cursor'
:from
Caption = '&Terminate'
Enabled = False
ShortCut = 16497
:to
Caption = '&Terminate'
Enabled = False
ShortCut = 117
:from
Caption = 'Generate &GUID'
ShortCut = 24647
:to
Caption = 'Generate &GUID'
ShortCut = 113
:from
Caption = '&MessageBox Designer...'
ShortCut = 24653
:to
Caption = '&MessageBox Designer...'
ShortCut = 115
:done
:# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:file issrc-main\Projects\CompForm.pas
:from
if MsgBox('The generated GUID will be inserted into the editor at the cursor position. Continue?',
SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES then
:to
//
//if MsgBox('The generated GUID will be inserted into the editor at the cursor position. Continue?',
//SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES then
:from
if MsgBox(S, 'Terminate', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) <> IDYES then
Exit;
:to
//if MsgBox(S, 'Terminate', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) <> IDYES then
//Exit;
:from
Changed: Boolean;
:to
Changed: Boolean;
I:Integer;
WaitedTime:Cardinal;
:from
if MsgBox(Format(ReloadMessages, ),
SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES then
:to
//if MsgBox(Format(ReloadMessages, ),
//SCompilerFormCaption, mbConfirmation, MB_YESNO) = IDYES then
:from
OpenFile(Memo, Memo.Filename, False);
:to
OpenFile(Memo, Memo.Filename, False);
StatusBar.Panels.Text := '文件重新加载完成。。。';
WaitedTime:=0;
while (WaitedTime < 3500) do
begin
SleepEx(100,False);
Inc(WaitedTime,100);
Application.ProcessMessages ;
end;
StatusBar.Panels.Text :='';
:done
将上面内容保存到 paApp.txt 文件。
以后,如果inno setup 源码更新了,只要特征没变,打补丁就完成相应功能修改。
打补丁的命令:sfk.exe patch -anyroot paApp.txt
(sfk.exe 下载地址http://stahlworks.com/dev/sfk/sfk.exe)
看看成果吧。
这种文章不会有啥流量哈哈,innosetup不吸睛 学习了,有时间试试,我用的 HM NIS Edit 这个大补丁的确实很少有人用 你也可以用 git 导出补丁,维护自己的分支。 爱飞的猫 发表于 2023-9-29 17:57
你也可以用 git 导出补丁,维护自己的分支。
感谢大佬,我还没那么玩过
页:
[1]