1. 60
    1. 6

      I don’t know whether figuring all of that out would be a fun reversing problem to chew on or a nightmarish trip through ancient hells (or both). But congratulations on figuring all of that out and getting it written out.

      1. 9

        Thanks! Luckily, I kept track of most of this stuff while working on my implementation, but converting that into proper explanations was quite the task, and throughout writing the article I kept having realizations that things didn’t actually work quite like I thought they did.

        1. 6

          I have a similar list for gnulib (the GNU anti-portability library) and the idea of actually compiling it into such a comprehensive and well-formatted page makes me want to run away to the hills and become a goat farmer.

          When I first opened your article I saw the tiny scrollbar, so I assumed there was a huge comments widget near the bottom, but I just kept reading and reading and it was all content.

          1. 4

            Haha, yeah, it might be pretty hard to justify the amount of effort I put into this article.

            1. 10

              Hey, if nothing else, I really enjoyed reading it. Thank you for putting the effort into documenting your journey!

              I also really liked how you outlined elements and added descriptive dialogue boxes to the descriptions. Was that something that took a lot of time to do? It helped a lot with explaining the data format, so I might steal that for my own future blog :)

              1. 3

                Happy to hear it!

                I’d say the time taken for each section was an equal mix of (1) coming up with an illustrative example, (2) ensuring that the example actually works the way I think, and (3) finding a way to show it. For a lot of the hexdump visualization, I was inspired by ImHex which has been very helpful when working on resinator.

                (btw the source of the post is here if you’re curious, but fair warning: it’s a mess of markdown/html/inline css/scoped css)

            2. 2

              if you ever do compile such a document i would love to see it here!

        2. 6

          This is a great example of how there is no file format so simple that it doesn’t have horrible weird undefined bits. Or so simple it isn’t going to grow horribly weird undefined bits over time. I’d bet the original authors of rc.exe probably didn’t know most of these, let alone anyone who’s worked on it since.

          1. 4

            rc.exe is especially susceptible to this as well, since one of its use-cases is/was localization, yet it was written in a time when Unicode was still being figured out. Being able to mix text encodings within a single file is a recipe for an explosion in edge cases.

            1. 5

              Yeah, feature creep as well. I can almost feel the soul of some poor programmer in 1993 or whenever crying out in agony as they are desperately trying to learn how to write a parser without understanding that that’s what they’re doing and there are textbooks about how to do it, when every week someone new comes up to them and say “ok we want to add a new resource type for…”

              I think it’d be kinda cool to compare the feature set of the 16-bit version and 32-bit version of rc.exe to relive some of the process.

              1. 5

                Agreed … although after reading that list of bugs, I suspect that a unpleasantly surprising amount of the 16-bit code was carried over directly, with few changes and fewer tests.

                1. 1

                  Raymond Chen has written a bit about the 16-bit compiler:

                  As @breadbox suspected, I believe almost all features of the 32-bit compiler were present in the 16-bit compiler (and some features that are still present in the 32-bit compiler only had a purpose in the context of 16-bit Windows). However, #pragma code_page is not recognized by the 16-bit version, so dealing with multiple text encodings seems to be exclusive to the 32-bit compiler.

            2. 4

              This is a perfect example of how so much of Microsoft’s infrastructure back then was just ad hoc. Everything, including the Windows kernel, worked “okay” as long as you didn’t probe too hard at the edges of things.