(转)TComboBox patch for Delphi 7
- unit D7ComboBoxStringsGetPatch;
- // The patch fixes TCustomComboBoxStrings.Get method for empty string item in Delphi .
- interface
- {$IF RTLVersion <> 15.0}
- 'This patch is intended for Delphi 7 only';
- {$IFEND}
- implementation
- uses
- Windows, SysUtils, StdCtrls;
- resourcestring
- RsPatchingFailed = 'TCustomComboBoxStrings.Get patching failed.';
- type
- TPatchResult = (prNotNeeded, prOk, prError);
- function PatchCode(RoutineStartAddr: Pointer; PatchOffset: Cardinal; OriginalCode: Pointer;
- OriginalCodeLen: Cardinal; PatchedCode: Pointer; PatchedCodeLen: Cardinal): TPatchResult;
- const
- JmpOpCode = $25FF;
- type
- PPackageThunk = ^TPackageThunk;
- TPackageThunk = packed record
- JmpInstruction: Word;
- JmpAddress: PPointer;
- end;
- var
- CodeStart: Pointer;
- BytesWritten: DWORD;
- begin
- if FindClassHInstance(System.TObject) <> HInstance then
- with PPackageThunk(RoutineStartAddr)^ do
- if JmpInstruction = JmpOpCode then
- RoutineStartAddr := JmpAddress^
- else
- begin
- Result := prError;
- Exit;
- end;
- CodeStart := Pointer(LongWord(RoutineStartAddr) + PatchOffset);
- if CompareMem(CodeStart, OriginalCode, OriginalCodeLen) then
- begin
- if WriteProcessMemory(GetCurrentProcess, CodeStart, PatchedCode, PatchedCodeLen, BytesWritten) and
- (BytesWritten = PatchedCodeLen) then
- begin
- FlushInstructionCache(GetCurrentProcess, CodeStart, PatchedCodeLen);
- Result := prOk;
- end
- else
- Result := prError;
- end
- else
- Result := prNotNeeded;
- end;
- type
- TCustomComboBoxStringsHack = class(TCustomComboBoxStrings);
- function AddrOfTCustomComboBoxStringsGet: Pointer;
- begin
- Result := @TCustomComboBoxStringsHack.Get;
- end;
- procedure PatchTCustomComboBoxStringsGet;
- const
- OriginalCode: Cardinal = $74FFF883; // CMP EAX, - | JZ +$
- PatchedCode: Cardinal = $7E00F883; // CMP EAX, | JLE +$
- PatchOffset = $1F;
- // for DEBUG DCU by Pavel Rogulin
- OriginalCodeD: Cardinal = $FFF07D83;
- PatchedCodeD: Cardinal = $00F07D83;
- PatchOffsetD = $2E;
- var
- PatchResult: TPatchResult;
- begin
- PatchResult := PatchCode(AddrOfTCustomComboBoxStringsGet, PatchOffset, @OriginalCode, SizeOf(OriginalCode),
- @PatchedCode, SizeOf(PatchedCode));
- if PatchResult = prNotNeeded then
- PatchResult := PatchCode(AddrOfTCustomComboBoxStringsGet, PatchOffsetD, @OriginalCodeD, SizeOf(OriginalCodeD),
- @PatchedCodeD, SizeOf(PatchedCodeD));
- case PatchResult of
- prError:
- begin
- if IsConsole then
- WriteLn(ErrOutput, RsPatchingFailed)
- else
- MessageBox(, PChar(RsPatchingFailed), nil, MB_OK or MB_ICONSTOP or MB_TASKMODAL);
- RunError();
- end;
- end;
- end;
- initialization
- PatchTCustomComboBoxStringsGet;
- end.
官方BUG解决地址:
http://cc.embarcadero.com/item/18872
(转)TComboBox patch for Delphi 7的更多相关文章
- Delphi XE2 之 FireMonkey 入门(42) - 控件基础: TComboBox、TComboEdit
Delphi XE2 之 FireMonkey 入门(42) - 控件基础: TComboBox.TComboEdit TListBox 有两个兄弟 TComboListBox.TComboEditL ...
- delphi连接sql存储过程
针对返回结果为参数的 一. 先建立自己的存储过程 ALTER PROCEDURE [dbo].[REName] ) AS BEGIN select ROW_NUMBER() over(order by ...
- 转:Delphi 6 实用函数
来自: daocaoren0824, 时间: -- ::, ID: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...
- delphi里动态创建AlphaControls实现换肤
AlphaControls是一套Delphi下的优秀的皮肤vcl控件.几年前,一般用得比较多的是vclskin,使用很方便,可惜这套2010年已经停止维护了.后来就看到更多的人开始推崇AlphaCon ...
- delphi.指针.应用
注:初稿...有点乱,可能增删改... 因为指针应用,感觉不好写,请大家指出错误,谢谢. 注意: 本文着重点讲的是指针的各类型的应用或使用,而不是说这种方法不应该+不安全+危险+不提倡使用. 其它:本 ...
- Delphi完成的断点续传例子 转
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- Delphi经验总结(1)
先人的DELPHI基础开发技巧 ◇[DELPHI]网络邻居复制文件 uses shellapi; copyfile(pchar('newfile.txt'),pchar('//computername ...
- Delphi xe7 FireMonkey / Mobile (Android, iOS)生成 QR Code完整实例
这个实例在windows.OS X.IOS和Android等平台运行正常.本文参考这个网站提供的方法:http://zarko-gajic.iz.hr/firemonkey-mobile-androi ...
- 2年后的Delphi XE6
1.有幸下载到Delphi XE6,下载地址如下: http://altd.embarcadero.com/download/radstudio/xe6/delphicbuilder_xe6_win. ...
随机推荐
- centos 6 rsync+inotify 实时同步
主机名.ip: server 172.31.82.184 client 172.31.82.185 需求: 1.server端 ”/data/server“ 做为client端 “/data/cli ...
- python文件操作 seek(),tell()
seek():移动文件读取指针到指定位置 tell():返回文件读取指针的位置 seek()的三种模式: (1)f.seek(p,0) 移动当文件第p个字节处,绝对位置 (2)f.seek(p,1) ...
- Poj 1458 Common Subsequence(LCS)
一.Description A subsequence of a given sequence is the given sequence with some elements (possible n ...
- 【转】 Pro Android学习笔记(三五):Menu(6):XML方式 & PopUp菜单
目录(?)[-] 利用XML创建菜单 XML的有关属性 onClick事件 Pop-up菜单 利用XML创建菜单 在代码中对每个菜单项进行设置,繁琐且修改不灵活,不能适配多国语言的要求,可以利用资源进 ...
- DCloud-MUI:文档 UI组件
ylbtech-DCloud-MUI:文档 UI组件 1.返回顶部 1.accordion(折叠面板) 折叠面板从二级列表中演化而来,dom结构和二级列表类似,如下: <ul class=&qu ...
- C++知识点总结(三)
1.字符串查找字符函数strchr strchr函数原型:extern char*strchr(const char *s,char c); 功能:查找字符数组s中首次出现字符c的位置 说明:返回首次 ...
- 进击的菜鸟问题1(设置checkbox全选)
问题:设置页面标签属性时,常常使用jquery.attr("","");在设置checkbox属性时,会出现操作设置checkbox属性后,无法清除,导致第二次 ...
- 共用体的定义和应用【C++】
定义: 使用覆盖技术,几个变量相互覆盖,从而使几个不同变量共占同一段内存的结构,成为共同体类型的结构. 共同体的定义类似结构体,不过共同体的所有成员都在同一段内存中存放,起始地址一样,并且同一时刻只能 ...
- 19. CTF综合靶机渗透(十二)
靶机说明: 靶机主题来自美剧<黑客军团> 本次靶机有三个flag,难度在初级到中级,非常适合新手训练学习,不需要逆向技术,目标就是找到三个key,并且拿到主机root权限. 渗透过程: 本 ...
- C# Collection was modified;enumeration operation may not execute
一.问题描述 在做 数组.列表.集合遍历时,可能我们会遇见这个问题.Collection was modified;enumeration operation may not execute ,翻译的 ...