String Table resources...

Is anyone able to tell me how to replace ONE string in the stringtable resource of some external exe or dll?

In this example the ID number of the string I wish to update is 2001

At the moment I am able to call LoadString after calling LoadLibrary to get a handle to the external module (the exe / dll). My code looks something like :

LoadString(hFileModule, 2001, newBuffer, MAX_PATH);

and sure enough the text of the string resource 2001 gets copied into newBuffer. However, now say for example I wish to change the string and overwrite the string resource 2001... how do i do it?

Using BeginUpdateResource in conjunction with UpdateResource and finally EndUpdateResource seems to work fine during debugging, but when I open the exe with Resource Hacker, the string hasn't been updated.

I also have tried using FindResource, LoadResource, and LockResource to get a pointer to the resource data. However, when I do it this way, it fails if I specify 2001 as the ID of the resource. However, when I specify 126 as the ID of the resource, it works but the contents of the buffer returned by LockResource contain all 15 strings in position 126 in the string table.

Actually, the only reason why I thought to use 126 was that strings 2001 - 2015 are all in the subfolder 126 when I look at the stringtable resource in Resource Hacker. I have no idea where this 126 comes from... can anyone tell me?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!