I stumbled across the exerb project which does many things I’m not that interested in but it does parse Windows pe files in pure Ruby and it can write itself to a new file and you can manipulate resources (.rsrc stuff) from Ruby. If it works, there is no need for winject (aka binject.EXE) ‘C’ code which would be a big happy dance in Shoes land – I’ll lead the parade. Even for experience C coders, (b)winject is dense and I still don’t understand where it goes wrong reading MinGW exe’s.
Does it work? It can copy the MinGW compiled shoe-stub.ex and the copied exe works as expected on Windows 7 and with Wine. That’s much better than the winject C code. I know I can add resource directory entries without the subordinate data and it will try to write that incompleteness to the final file. I have high hopes. I just need to learn about Window resource entries and I can inject SHOES_FILENAME and SHOES_PAYLOAD and SHOES_SETUP (if the user asks).
In case you’re wondering, Devyn was a young man on the Shoes mailing list a few years ago who believed Shoes and Ruby could write bootstrap itself and if only someone would do it then all the ‘C’ in the world could be replaced. Me, I’ve seen enough theories about Utopia (or the popular we’re all going to hell in hand basket, real soon now, we’re doomed, doomed). I challenge both these visions. Code (or facts) trump dreams and theories.
So, there is bit irony involved if I can get exerb to work with Shoes. I think I can and I’m going to use what works, theory or not.
NOTE: exerb only handles Little Endian. Since I only bother with Intel and Raspberry Pi’s arch, it’s not a problem for me. (I don’t think it is).