The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
How are DLL functions exported in 32-bit Windows?
The designers of 32-bit Windows didn't have to worry quite so much about squeezing everything into 256KB of memory. Since modules in Win32 are based on demand-paging, all you have to do is map the entire image into memory and then run around accessing the parts you need. There is no distinction between resident and non-resident names; the names of exported functions are just stored in the image, with a pointer (well, a relative virtual address) to the name stored in the export table. Unlike the 16-bit ordinal export table, the 32-bit ordinal export table is not sparse. If your DLL exports two functions, one as ...
The day the peloton lost its way
It's the one time a year that more than fifty people in the United States actually give a hoot about bicycle racing. Yes, it's the Tour de France. (Follow the racers live via GPS!) But this story isn't about the Tour. It's about Stage 4 of the 2005 ENECO Tour. You can follow along with the live report. Everything was going pretty much like a typical racing stage, until time code 13:55. Veikkanen is now gone from the back of the lead group, but the peloton appears to have taken a wrong turn!! The peloton is just stopped in the road. nobody knows what happened, riders are getting off their bikes. Zabe...
How were DLL functions imported in 16-bit Windows?
A threaded linked list.
How were DLL functions exported in 16-bit Windows?
The whole point of dynamic link libraries (DLLs) is that the linkage is dynamic. Whereas statically-linked libraries are built into the final product, a module that uses a dynamically-linked library merely says, "I would like function X from Y.DLL, please." This technique has advantages and disadvantages. One advantage is more efficient use of storage, since there is only one copy of Y.DLL in memory rather than a separate copy bound into each module. Another advantage is that an update to Y.DLL can be made without having to re-compile all the programs that used it. On the other hand, the ability to swap in functi...
Glass houses are great places to throw stones
Whenever I write an article explaining that programs should avoid doing X, I can confidently rely on a comment saying, "Well, Microsoft Product Q does this!" as if to say, "Gotcha, you hypocrite!" But they're saying "gotcha" to the wrong person. Because, and I'm sure it's a shock to many people to read this, I did not personally write every line of software Microsoft ever produced. (And even if I did write it, I may have written it as a younger developer, before I learned about said rule. Because, and I'm sure this is also a shock to many people, I was once a beginner, too.) If you find a Micros...
Win $5000 every summer for life (some restrictions on your life apply)
Back in 2003, M&M offered a chance to win $5000 every summer for life, but if you looked more carefully, the offer actually read, "Win $5000 Every Summer For Life*", and the asterisk at the bottom read, "Maximum 50 years". That fine print was filled with strange stuff. For example, 3. Sponsor responsible only for delivery of prize; not responsible for prize utility, quality or otherwise. ... 10. Sponsor: M&M/Mars, High Street, Hackettstown, NJ 07840. One of the prizes was approximately ten pounds of M&Ms. The logical conclusion: "M&M is not responsible for the quality of M&Ms." I was remi...
Pidls and monikers do roughly the same thing, just backwards
When operating with the Windows shell, you will almost certainly find yourself at some point working with a pointer to an item ID list, known also as a "pidl" (rhymes with "middle"). On the other hand, when working with OLE you may find yourself having do deal with monikers. In a sense, they both do the same thing. They let you refer to some sort of object inside a namespace (to which you can bind or otherwise operate on), they have a hierarchical structure, you can persist them, and so on. Why, then, did the Windows shell team invent pidls when monikers do the same thing? The fundamental difference between pid...
News flash: Big houses have bigger heating bills
Big houses have bigger heating bills. Thanks, Associated Press! I learn something new every day. (Previous amazing fact.)
Not everybody with a non-Windows partition type is a geek
In the discussions following why Windows setup lays down a new boot sector, some commenters suggested that Windows setup could detect the presence of a non-Windows partition as a sign that the machine onto which the operating system is being installed belongs to a geek. In that way, the typical consumer would be spared from having to deal with a confusing geeky dialog box that they don't know how to answer. The problem with this plan is that not everybody with a non-Windows partition type is necessarily a geek. Many OEM machines ship with a hard drive split into two partitions, one formatted for Windows and th...