The Old New Thing
Practical Development Throughout the Evolution of Windows
Raymond Chen
Upper Saddle River, NJ Boston Indianapolis San Francisco
New York Toronto Montreal London Munich Paris Madrid
Cape Town Sydney Tokyo Singapore Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
For sales outside the United States please contact:
International Sales
Visit us on the Web: www.awprofessional.com
Library of Congress Cataloging-in-Publication Data
Chen, Raymond.
The old new thing. Practical development throughout the evolution of Windows / Raymond Chen.
p. cm.
Includes index.
ISBN 0-321-44030-7 (pbk. : alk. paper)
1. Microsoft Windows (Computer file) 2. Operating systems (Computers) 3. Computer softwareDevelopment. I. Title.
QA76.76.O63C45747 2007
005.446dc22 2006028949
Copyright 2007 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise.
For information regarding permissions, write to:
Pearson Education, Inc.
Rights and Contracts Department
75 Arlington Street, Suite 300
Boston, MA 02116
Fax: (617) 848-7047
ISBN 0-321-44030-7
Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts.
First printing, December 2006
FOR MY FAMILY
Praise for The Old New Thing
Raymond Chen is the original raconteur of Windows.
Scott Hanselman, ComputerZen.com
Raymond has been at Microsoft for many years and has seen many nuances of Windows that others could only ever hope to get a glimpse of. With this book, Raymond shares his knowledge, experience, and anecdotal stories, allowing all of us to get a better understanding of the operating system that affects millions of people every day. This book has something for everyone, is a casual read, and I highly recommend it!
Jeffrey Richter, Author/Consultant, Cofounder of Wintellect
Very interesting read. Raymond tells the inside story of why Windows is the way it is.
Eric Gunnerson, Program Manager, Microsoft Corporation
Absolutely essential reading for understanding the history of Windows, its intricacies and quirks, and why they came about.
Matt Pietrek, MSDN Magazines Under the Hood Columnist
Raymond Chen has become something of a legend in the software industry, and in this book youll discover why. From his high-level reminiscences on the design of the Windows Start button to his low-level discussions of GlobalAlloc that only your inner-geek could love, The Old New Thing is a captivating collection of anecdotes that will help you to truly appreciate the difficulty inherent in designing and writing quality software.
Stephen Toub, Technical Editor, MSDN Magazine
Preface
M UCH INK is devoted to describing the how of using and developing software for Windows, but few authors go into the why. What might appear at first to be quirks often turn out to have entirely logical explanations, reflecting the history, evolution, and philosophy of the Microsoft Windows operating system. This book attempts to provide knowledge not so much in the form of telling what needs to be done (although there is certainly plenty of that, too) but rather by helping to understand why things came to be that way. Thus informed of the history and philosophy of Windows, you can become a more effective Windows programmer.
The emphasis here, then, is on the rationale behind Windows. It is not a reference or even a tutorial, but rather a practical history, taking a conversational rather than didactic approach in an attempt to give you an appreciation for the philosophy of Windows through a series of brief, largely independent essays. You can therefore skip freely to topics of momentary interest (or technical expertise). Essays have been grouped into general themes, and there is the occasional sequential pedagogical treatment when a topic is explored in depth; even in those cases, however, the topic is confined to a single self-contained chapter.
Writer and commentator David Sedaris is often asked whether his stories are true. He responds that they are true enough. Like David Sedariss stories, the material in this book is also true enough. The focus is on the big picture, not on the minutiae; on making a single point without getting distracted by nitpicking detail. Key details are highlighted, but unimportant ones are set aside, and potentially interesting digressions may be neglected if they do not serve the topic at hand.
The primary audience is technology-savvy readers with an interest in Windows history. About half of the essays require no programming background. Most of the remaining topics assume a basic background in software design and development, although nothing particularly advanced. Topics specifically related to Windows programming assume reader familiarity with Win32 user interface programming and COM. The table on page xxv provides a breakdown of the chapters for nonprogrammers and for general programmers who do not have an interest in Win32 specifically. Of course, you are welcome to skim chapters not explicitly marked as of interest to you. Perhaps you will find something interesting in them after all.
What will you get out of this book? As noted previously, the primary goal is to convey the philosophy and rationale behind what might at first appear to be an irrational design. You will also understand that when something cant be done in Windows, its often for a good reason; and you will gain an appreciation of the lengths to which Windows goes to preserve backward compatibility (and why its important that it do so). And if nothing else, you will be able to tell amusing stories about Windows history at cocktail parties (that is, cocktail parties thrown by other geeks).
Much of the short-essay material here has already appeared in one form or another on the authors Web site, The Old New Thing (http://blogs.msdn.com/oldnewthing/), but is substantially supplemented by new material better suited to book form.
Visit the Web page for this book (. Think of them if you like as the book version of a movies unique and insightful deleted scenes. The Web page also contains the code samples from the book as well as errata.