Monday, August 23, 2010

Loading the strings from the MUI file ?

It was a less than thirty four months ago that I wrote Cracking the binary (aka How to open .MUI files?). And it was a less than 24 hours ago that reader Vinzy asked in a comment to that blog:
Is there a way to read strings from loaded MUI files, say shell32.dll.mui using C#?
I'll admit my first thought was that the answer was in the original blog, albeit buried a bit. I mean after all, if you could open up the resources by making Visual Studio treat the files the same way they would treat other binaries like DLLs, then it kind of implies that they are in the exact same format, from a resources point of view. But I thought about it a bit. I mean it isn't like C# or even .Net has a bunch of built in methods to load traditional Wine32 resources built in, right ?
Basically you have to P/Invoke the Win32 functions, like LoadString, for example:

  1. [DllImport(
"user32.dll", CharSet=CharSet.Unicode, EntryPoint="LoadStringW", ExactSpelling=true)]  

  •             internal static extern int LoadString(  



  •                 IntPtr hInstance,   



  •                 uint uID,   



  •                 StringBuilder lpBuffer,   



  •                 int nBufferMax);  


  • Read more: Sorting it all Out