Ok to use VirtualProtect to change resource in Delphi?

后端 未结 2 793
一个人的身影
一个人的身影 2020-12-15 14:58

I\'m working on a simple localization effort in D2010. I\'m handling all strings on forms because ETM seems like overkill for my needs, as did other 3rd party tools... (alth

相关标签:
2条回答
  • 2020-12-15 15:19

    Yes, it should be fine, but I have some comments:

    • Make sure to call your HookResourceString function from only one thread at a time. If two threads call it simultaneously, you could end up restoring the wrong permissions.

    • Also for multithreading, make sure you don't use this code at a time when some other thread might be attempting to load a resourcestring. LoadResString reads the Identifier field twice, and it needs to have the same value both times.

    • There's no need to declare the new values as typed constants. Ordinary true constants are fine. (The compiler knows they need to be PChars because they're passed as actual arguments for a PChar parameter.)

    0 讨论(0)
  • 2020-12-15 15:20

    Why not use dxgettext? It's open source, so you could at least take a look at how they do it...
    http://dxgettext.po.dk/

    0 讨论(0)
提交回复
热议问题