-5

trying to change resource languages into an exe/dll file programatically, I've tried to do that with UpdateResource but it doesn't work since the language per item is not part of the resource template, it seems to be in a structure caller RESOURCEHEADER which is located at the beginning of each resource type...

Thus accessing to this part seems to be a bit complicated, no API to do that.

The only thing left would be to reverse engineer the structure and update the binary directly, but I prefer asking before.

Machavity
  • 30,841
  • 27
  • 92
  • 100
user3806924
  • 23
  • 1
  • 4
  • 1
    You might have better luck if you explain what you're trying to accomplish. – Scott Solmer Sep 12 '14 at 18:58
  • trying to change the resource languages into an exe/dll file programatically, to change a resource like a dialog you need to do a beginupdateresource/updateresource/endupdateresoure but doing this doesn't allow you to change the language of this resource... – user3806924 Sep 12 '14 at 19:18
  • 1
    I'm not sure what you expect to happen. Have you read [The Resource Reference](http://msdn.microsoft.com/en-us/library/windows/desktop/ff468901%28v=vs.85%29.aspx)? From my experience creating a mui app in WPF, the standard behavior makes you restart the application for the change to take effect. I followed [this example](http://www.codeproject.com/Articles/22967/WPF-Runtime-Localization) to get it working on the fly. – Scott Solmer Sep 12 '14 at 19:27
  • winapi, nothing to do with wpf, what i'm trying to do is not in the resource reference. – user3806924 Sep 12 '14 at 19:44
  • You might want to look at that link again, the resource reference **is for the winapi**. – Scott Solmer Sep 12 '14 at 19:51
  • I know this resource reference by heart, it's not what I was expecting, thanks anyway for your help. – user3806924 Sep 12 '14 at 20:02
  • 1
    What, exactly, are you trying to do? Are you saying that you have resources in Language A, and you want to change those resources so that they're in Language B and update the header to reflect the new language? – Jim Mischel Sep 12 '14 at 20:05

1 Answers1

1

I can't think why you'd want to do this, but anyway...

Call

UpdateResource(hUpdate, lpType, lpName, wOldLanguage,  0, 0);

to delete the existing language resource and

UpdateResource(hUpdate, lpType, lpName, wNewLanguage, lpData, cbData);

to write a new resource with the new language identifier, where lpData and cbData refer to a copy of the existing resource data.

Note that it gets a lot more complicated if you are using MUI. The UpdateResource docs have the details.

arx
  • 16,686
  • 2
  • 44
  • 61
  • actually most of the dll exe files are false multilanguage dll/exe since the developers carelessly put different language perr dialogs/stringtables etc ... thus when I run muicrt tool to generate a mui files it tells me that it cannot proceed on multilanguage dlls... so I'm making a console tool to cahange the languages into one only... Thanks this answers to my question ... – user3806924 Sep 12 '14 at 20:33
  • I'm happy to help. Rather than editing the title, you can indicate that the question is solved by clicking the tick to the left of the answer. – arx Sep 12 '14 at 21:27
  • @user please accept the answer, I rolled back your question edit. Accepting is the correct way to acknowledge this. – David Heffernan Sep 12 '14 at 21:36