加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 是否可以修改已加载的资源?

发布时间:2020-12-15 09:22:50 所属栏目:大数据 来源:网络整理
导读:我正在使用TResourceStream类来读取资源,知道我想修改内存中的资源,但上述类的 Write方法的文档说: Applications should not use a TResourceStream to write the resources of the running application. Write overrides the inherited method to raise an
我正在使用TResourceStream类来读取资源,知道我想修改内存中的资源,但上述类的 Write方法的文档说:

Applications should not use a TResourceStream to write the resources
of the running application. Write overrides the inherited method to
raise an EStreamError exception when an application tries to write to
the application’s resources.

As all other data-writing methods of TResourceStream (WriteBuffer,
WriteComponent) call Write to do the actual writing,calling any of
the data-writing methods of TResourceStream will raise an exception.

问题是,有没有办法使用任何WinApi函数修改正在运行的应用程序中的资源?或者资源是否只读?

解决方法

资源只是指向映射到内存中的某些可执行部分的指针.

因此,您可以使用VirtualProtectEx更改此内存,就像您可以修补代码的任何部分一样.

请参阅Ok to use VirtualProtect to change resource in Delphi?关于此技术(此处有关resourcestring,但可以在任何锁定的资源上使用相同的API).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读