The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
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
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?
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?
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?
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...
Why does SHGetSpecialFolderPath take such a long time before returning a network error?
A customer reported that their program was failing to start up because the call to was taking a long time and then eventually returning with . The account that was experiencing this problem had a redirected network profile, "but even if he's redirecting, why would we get the bad net path error? Does calling actually touch the folder/network? If so, we should probably stop calling this function on the UI thread since network problems could cause our program to hang." The function will access the network if you pass the flag, which says "Check if the folder is there, and if not, create it." The customer had b...
From inside the Redmond Reality Distortion Field: Why publish documents in PDF?
A few years ago, the Windows 7 team developed a document to introduce technology writers to the features of Windows 7. The document was released in PDF format, which created quite a stir among certain people trapped inside the Redmond Reality Distortion Field, who indignantly complained, Why are we releasing this document in PDF format? Shouldn't it be in docx or XPS? I would expect people interested in Windows 7 to be willing to use more Microsoft technology. Um, hello from the real world. It's the people who are critical of Windows 7 who are least likely to use Microsoft technology! "Ok...
Begin feeling
A few years ago, the gas station near Microsoft's main campus (the one which had been run by my colleague in a previous stage of his career) appeared to have suffered some problems with the LCD unit on one of its pumps. Instead of "Please insert card", it said "@leace incebd cabd". As a geek, I quickly determined that bit 4 got wiped out in the ASCII codes for the characters in the message. Undaunted, I set about going through the usual steps for purchasing gasoline, though it took a little longer than normal because I first had to decode the corrupted strings. And then after I thought I had finished all the ne...
2010 year-end link clearance
Another round of the semi-annual link clearance. And, as always, the obligatory plug for my column in TechNet Magazine:
What makes RealGetWindowClass so much more real than GetClassName?
There's and then there's . What makes more real? Recall from last time that the functions were added to support Windows accessibility. The goal with is to help accessibility tools identify what kind of window it is working with, even if the application did a little disguising in the form of superclassing. If you ask for the class name of a window, it digs through all the superclassing and returns the name of the base class (if the base class is one of the standard window manager classes). For example, if your application superclassed the class, a call to would return , but a call to would return . ...