Bonus material for The Old New Thing (the book) is now available for download

Date:February 6, 2007 / year-entry #42
Orig Link:
Comments:    28
Summary:I've just been informed by my publisher that the bonus chapters from my book are now available for download. Click on "Sample Chapters". Sorry they're late. The source code for the programs in the book can be downloaded from the "Source Code" link. And on a more embarrassing note, there's that "Errata" link, too.

I've just been informed by my publisher that the bonus chapters from my book are now available for download. Click on "Sample Chapters". Sorry they're late.

The source code for the programs in the book can be downloaded from the "Source Code" link. And on a more embarrassing note, there's that "Errata" link, too.

Comments (28)
  1. The URL to your book on your publisher’s website doesn’t work at the moment. You need to remove the trailing slash from the link.

    [Fixed, thanks. -Raymond]
  2. J says:

    Nah, the errata isn’t long enough to be embarassing yet.  I’ve bought books before where the errata list is like half the number of pages of the book itself.  But I guess that’s a little beyond embarassing at that point.

    Here’s another one for the list though, from page 12 of sample chapter 2 (sorry, I don’t know where to submit corrections on the publisher’s site):

    "Again, the iret will not restore interrupts. It doesn’t matter how you get those values onto

    the stack before you do the iret. The iret instruction doesn’t care; it will won’t enable


    The phrase "will won’t" probably should be "still won’t".

  3. tsrblke says:

    Are you really up at 4AM PST typing these Raymond?

    On the note of errata, don’t feel bad, I’ve got biology books in my room with enough errata to fill a smallish (20-30 pages or more) of factual stuff that’s wrong (and I”m not talking updated here, I’m talking just plain wrong.)  A typo here or there is nothing to compared to that kind of bad.

    [No, I’m up at 7am, but for some reason the blog backdates everything three hours and sometimes I forget to compensate when posting. -Raymond]
  4. Spire says:

    Thanks for going insane.

  5. Sweet! I’ll have to check them out. Will there be more bonus stuff like this in the future?

    [That’s all there is. -Raymond]
  6. SI says:

    Is this intentional and I dont understand the irony, or an extra not?

    Writing a DOS extender is not something that should be left in the hands of qualified professionals.

    [It is correct as-written. -Raymond]
  7. JS says:

    Wow, Windows performs in-memory patches of third-party binaries?  I had no idea you went to such lengths.

    Is it possible for this patching mechanism to be subverted (i.e., a malware app making Windows dynamically patch an antivirus program so as not to detect it)?

  8. GregM says:

    Great, my copy of the book arrived yesterday.

  9. David Walker says:

    The 2 bonus chapters are available under the misleading category "Sample Chapters".  

    I downloaded the sample chapters long before I had the book.  Putting the bonus chapters under "Sample Chapters" kind of obfuscated them, since I didn’t want to look there again.  But the bonus chapters are there!

  10. David Walker says:

    The "Errata" is a text file, but looks horrible in Notepad.  The linefeeds are black squares (in my American English version of Windows XP, at least).

    It’s best to open the Errata file with Word or Wordpad or something other than Notepad.

    Another code page issue, I think… which I am sure Raymond has talked about in this very blog.

  11. Zian says:

    It’s interesting to see that in only 1 out of the 101 examples did someone take the time to apologize to the Windows team.

    [Though the epilogue definately takes the cake.]

  12. Zian says:

    The publishes needs to fix your table of contents. The following line should be split accross 2 lines:

    Multiple users 444 Roaming user profiles 445

    [It’s correct in the printed book. While you’re at it, you might want to complain that in the online version (which is clearly just a text extraction from the real table of contents) the page numbers don’t line up and the indentation is wrong. -Raymond]
  13. Norman Diamond says:

    there’s that "Errata" link, too

    I agree with others that you don’t need to be embarrassed by that (at least not yet ^_^).  Making corrections available to customers is commendable.  I hope the idea will spread further.

  14. Cheong says:

    Have partially read the bonus chapters.

    Something come in the mind when reading about version numbers: I think I’ve seen some version tweaking entry in win.ini(or it is system.ini? I can’t remember well…) Won’t that serve the same purpose as SETVER in DOS? (I always thought it is when I saw this)

  15. SM says:

    I finally ordered the book, which just arrived yesterday!  Looks great so far — congrats Raymond.

  16. MooD says:

    >> [Program 6 ran just fine once we fixed the interrupt flag problem. -Raymond]

    In the book it gets mentioned thrice; two times for allocating all the memory for cache. And it ran, but it ran better if you limited the amount of memory in the properties sheet :)

    But I mean from the program’s perspective, and not only for DOS programs. As in “I want to manage my own cache because I’ll do it much better than the OS since I have specific requirements”. An example of this is the read cache that media players use. But what if the amount of memory I need to manage is very large? Is what that image manipulation program does the optimal way?

    [Oh, then I mis-remembered what program 6 was. I wrote that bonus chapter nearly twelve years ago. I don’t remember the details of any of the programs off the top of my head. -Raymond]
  17. David Walker says:

    Wow.  I would LOVE to know what those old programs were, that are referred to in the examples in "How to Ensure that Your Program Does Not Run under Windows 95".

  18. some guy 95 says:

    Was that around the time you started wearing a suit to work?

  19. The more I read of bonus chapter 1, the harder I find it to believe that neither you nor one of the other people on the compatibility team have ever lost it and stabbed a 3rd party developer to death with a pen, or some other manner of semi-sharp object.

  20. MooD says:

    I think I know who Program 6 is. The game required only 4 MB of RAM but swapping could get heavy in some places, so this method was very beneficial and it used optimally the machine resources.

    Now, what solutions do you suggest, if you detect virtual memory? To cap the memory allocation at some arbitrary value? That’s what the next game from the same vendor did: in pure DOS mode it behaved the same; in a DOS box it would allocate always 8 megs for the heap. I believe this is sub-optimal.

    There are modern programs that handle their own memory too and have to resort to similar methods – a certain very popular image manipulation program has a setting to set what percentage of physical memory it will use. So if you set it to 50% and you have 512 MB of RAM, it will use 256 megs of “managed heap”, and then it’s own swap-file. That doesn’t mean that the heap can’t be paged out to the system pagefile, or that the application’s swap-file can’t be disk-cached in RAM.

    So, how do you solve that? Using the “normal” virtual memory isn’t an option because:

    * The datasets exceed the addressing space, specially in 32-bit mode

    * The performance would be abysmal, it’s much better if the application does this itself that to rely on a generic paging mechanism, since the application knows better what it’ll need (in these particular cases this was specially true; Program 6 is going to need all of and exactly one sprite or sound; and the image manipulation program wants an entire multi-MB image layer which it can read very fast since it laid it out contiguously into it’s swap-file)

    Ugly, ugly, ugly…

    [Program 6 ran just fine once we fixed the interrupt flag problem. -Raymond]
  21. asdf says:

    So what exciting things happen when your desktop gets minimized?

  22. Dan McCarty says:

    From the book Showstopper! by Zachary, NT had a last-minute showstopper with Aldus Pagemaker where Pagemaker would hang or not print large files.  It turned out to be two bugs: one in the font manager (reserving the wrong amount of memory) and one in Pagemaker.

    Moshe Dunie, Michael Abrash and Gilman Wong tracked it down and fixed the showstopper 41 hours before RTM.

  23. David Walker says:

    The bonus chapter "How to Ensure that Your Program Does Not Run under Windows 95" is great.

    "Example 74:

    Program 34 has a similar problem. It complains about insufficient disk space if the drive that

    holds the database has more than 2GB of disk space free."

    This kind of thing is still going on.  A popular contact management system (whose name rhymes with Fact), version 2006, has a downloadable update that uses an installer (whose name rhymes with BigTallField) that will fail if the amount of free space on the target disk was any multiple of 4GB (or close to a multiple).

    The error message claims that the target disk has insufficient free space.

    The customer is required to manually install a new version of the *installer* progam so the update to the contact management system can be installed.  

    Or use the suggested workaround: "add or delete files on your computer until the free disk space is no longer a multiple of 4-gigabytes."

    I suppose the moral is, arithmetic is hard.

  24. Cheong says:

    Just finished reading. Nice Articles. :)

    Regarding the problem with tilde in filename, you can’t believe me when an installer from account manipulation application of a commercial bank nowadays that still refuse tildes and space still exist nowadays.

    Whenever you wish to install it in "Program Files" folder, it complains the path is invalid. Changing the path to short filename doesn’t help. I gave up and choose to installed it on root folder instead, and it happily started the installation process.

  25. Laura T. says:

    I started reading the first bonus chapter and after a while I was already typing my credit card number to order your Book.

    From what I have read so far, it should be included in every MOC (dev and tec). IMHO, your book is a must-to-read for every Windows(r) developer. Some chapters should be included in the MSDN documentation.

    Great job!

  26. AlexCohn says:

    Hi, I just wanted to thank your for the book and especially for that bonus "Tales" chapter, which is more thrilling than bestselling detective stories.

  27. Erik says:

    Thank you from me too, Raymond. The second bonus chapter was particularly interesting to me, it reminded me of the countless I spent editing CONFIG.SYS trying to get games to run (under DOS, not Windows 95). The information from that chapter probably could have saved me a few hundred reboots + crashes 13 years ago.

    One question though: why did Windows 95’s DMPI server return high addresses? It seems this was just asking for trouble.

    [Because Win32 was using the lower addresses. (Not strictly true but a fuller explanation would take too long.) -Raymond]

Comments are closed.

*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index