The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Don't just stand around saying somebody should do something: Be someone
Jan 18, 2011
Post comments count 0
Post likes count 0

Don't just stand around saying somebody should do something: Be someone

Raymond Chen
Raymond Chen

On one of the frivolous mailing lists in the Windows project, somebody spotted some behavior that seemed pretty bad and filed a bug on it. The project was winding down, with fewer and fewer bugs being accepted by the release management team each day, so it was not entirely surprising that this particular bug was also rejected. News of this smackdown threw the mailing list into an fit of apoplexy. Don't they realize how bad this bug is? Somebody should reactivate this bug. Yeah, this is really serious. I don't think they understood the scope of the problem. Somebody should mark the bug for reconsideration. D...

Was showing the column header in all Explorer views a rogue feature?
Jan 17, 2011
Post comments count 0
Post likes count 0

Was showing the column header in all Explorer views a rogue feature?

Raymond Chen
Raymond Chen

User :( asks whether the Explorer feature that shows the column headers in all views was a rogue feature or a planned one. If it was a rogue feature, it was a horribly badly hidden one. One of the important characteristics of the rogue feature is that you not be able to tell that the feature is there unless you go looking for it. If the feature is right there on the screen as soon as you open an Explorer window, odds are that somebody is going to notice and say something about it. (For example, the designer who is responsible for Explorer is probably going to notice that every screenshot of Explorer doesn't...

What's the difference between an asynchronous PIPE_WAIT pipe and a PIPE_NOWAIT pipe?
Jan 14, 2011
Post comments count 0
Post likes count 0

What's the difference between an asynchronous PIPE_WAIT pipe and a PIPE_NOWAIT pipe?

Raymond Chen
Raymond Chen

When you operate on named pipes, you have a choice of opening them in mode or mode. When you read from a pipe, the read blocks until data becomes available in the pipe. When you read from a pipe, then the read completes immediately even if there is no data in the pipe. But how is this different from a pipe opened in asynchronous mode by passing ? The difference is in when the I/O is deemed to have completed. When you issue an overlapped read against a pipe, the call to returns immediately, but the completion actions do not occur until there is data available in the pipe. (Completion actions are things l...

The MARGINS parameter to the DwmExtendFrameIntoClientArea function controls how far the frame extends into the client area
Jan 13, 2011
Post comments count 0
Post likes count 0

The MARGINS parameter to the DwmExtendFrameIntoClientArea function controls how far the frame extends into the client area

Raymond Chen
Raymond Chen

A customer wrote a program that calls to extend the frame over the entire client area, but then discovered that this made programming difficult: I have a window which I want to have a glassy border but an opaque body. I made my entire window transparent by calling , and I understand that this means that I am now responsible for managing the alpha channel when drawing so that the body of my window remains opaque while the glassy border is transparent. Since most GDI functions are not alpha-aware, this management is frustrating. Is there a better way? In pictures, I only want the red portion of the diagram below ...

My, what strange NOPs you have!
Jan 12, 2011
Post comments count 0
Post likes count 0

My, what strange NOPs you have!

Raymond Chen
Raymond Chen

While cleaning up my office, I ran across some old documents which reminded me that there are a lot of weird NOP instructions in Windows 95. Certain early versions of the 80386 processor (manufactured prior to 1987) are known as B1 stepping chips. These early versions of the 80386 had some obscure bugs that affected Windows. For example, if the instruction following a string operation (such as ) uses opposite-sized addresses from that in the string instruction (for example, if you performed a followed by a ) or if the following instruction accessed an opposite-sized stack (for example, if you performed a...

The message text limit for the Marquee screen saver is 255, even if you bypass the dialog box that prevents you from entering more than 255 characters
Jan 11, 2011
Post comments count 0
Post likes count 0

The message text limit for the Marquee screen saver is 255, even if you bypass the dialog box that prevents you from entering more than 255 characters

Raymond Chen
Raymond Chen

If you find an old Windows XP machine and fire up the configuration dialog for the Marquee screen saver, you'll see that the text field for entering the message won't let you type more than 255 characters. That's because the Marquee screen saver uses a 255-character buffer to hold the message, and the dialog box figure there's no point in letting you type in a message longer than the screen saver can display. A customer decided to bypass the configuration dialog and change the text in the screen saver by editing the settings directly, and then complained that the Marquee screen saver truncated the message ...

Why does pasting a string containing an illegal filename character into a rename edit box delete the characters from the clipboard, too?
Jan 10, 2011
Post comments count 0
Post likes count 0

Why does pasting a string containing an illegal filename character into a rename edit box delete the characters from the clipboard, too?

Raymond Chen
Raymond Chen

Ane asks why, if you have a string with an illegal filename character on the clipboard, and you paste that string into a rename edit box, do the illegal characters get deleted not just from the edit box but also the clipboard? Basically, it's a bug, the result of a poor choice of default in an internal helper class. There is an internal helper class for "monitoring an edit control" with options to do things like remove illegal characters. This helper class was written back in 1998, presumably with the intention of being used somewhere, but it never did get hooked up. Maybe the feature it was originally written...

When does a process ID become available for reuse?
Jan 7, 2011
Post comments count 0
Post likes count 0

When does a process ID become available for reuse?

Raymond Chen
Raymond Chen

A customer wanted some information about process IDs: I'm writing some code that depends on process IDs and I'd like to understand better problem of process ID reuse. When can PIDs be reused? Does it happen when the process handle becomes signaled (but before the zombie object is removed from the system) or does it happen only after last handle to process is released (and the process object is removed from the system)? If its the former, will OpenProcess() succeed for a zombie process? (i.e. the one that has been terminated, but not yet removed from the system)? The process ID is a value associated with ...

Processes, commit, RAM, threads, and how high can you go?
Jan 6, 2011
Post comments count 0
Post likes count 0

Processes, commit, RAM, threads, and how high can you go?

Raymond Chen
Raymond Chen

Back in 2008, Igor Levicki made a boatload of incorrect assumptions in an attempt to calculate the highest a process ID can go on Windows NT. Let's look at them one at a time. So if you can't create more than 2,028 threads in one process (because of 2GB per process limit) and each process needs at least one thread, that means you are capped by the amount of physical RAM available for stack. One assumption is that each process needs at least one thread. Really? What about a process that has exited? (Some people call these zombie processes.) There are no threads remaining in this process, but the proces...