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

我正在使用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).

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...