The Old New Thing

When should I use the FIND_FIRST_EX_LARGE_FETCH flag to FindFirstFileEx?

Windows 7 introduces a new flag to the function called . The documentation says that it "uses a larger buffer for directory queries, which can increase performance of the find operation." This is classic MSDN-style normative documentation: It provides "just the facts". Far be it for MSDN to tell you how to write your application; the job...

It rather involved being on the other side of this airtight hatchway: Planting DLLs into directories on the PATH for applications whose current directory is always System32

A bunch of security vulnerability reports came in from the same person, all of the form, "Program X is vulnerable to DLL planting if you create a DLL with the name Y in a directory on the PATH," with varying values of X and Y. In all the cases, Program X runs as SYSTEM with the System32 directory as its current directory, so a current ...

The hierarchy of user education, as interpreted by a vice president

One of my colleagues told me a story from his days on the Windows team. He had to give a presentation to his vice president on his feature, and he prepared his presentation and demo obsessively to make sure it went smoothly. At the meeting, there were three presentations on the schedule, all of them with features targeting IT professionals. ...

Using a toy cash register as a keyboard doesn't add up

I dreamed that I was composing a blog entry about one of my dreams, but I had to do it on a toy cash register which had been paired to my computer. It turns out that this is difficult for a number of reasons. For one thing, the cash register has only ten letters of the alphabet on it. You have to switch to the alternate keyboard for the rest...

Opening and manipulating Internet Explorer windows programmatically

Today's Little Program takes the JavaScript application from a few years ago and converts it to C#. This was inspired by a customer who started with the question, "How can I close all Internet Explorer windows programmatically?" This was a strange request. After all, the user may be rather upset that their Amazon shopping spree was ...

The case of the redirected standard handles that won't close even though the child process has exited (and a smidge of Microspeak: reduction)

A customer had a supervisor process whose job is to launch two threads. Each thread in turn launches a child process, let's call them A and B, each with redirected standard handles. They spins up separate threads to read from the child processes' stdout in order to avoid deadlocks. What they've found is that even though child ...

What is the inverse of AdjustWindowRect and AdjustWindowRectEx?

We saw over a decade ago (my goodness I've been doing this way too long) that the and functions do not take menu wrapping into account because they don't take a window handle parameter, so they don't know what menu to test for wrapping. Still, they are useful functions if you aren't worried about menu wrapping because they let you do ...

Why does my window get a WM_ACTIVATE message when it isn't active?

Say you launch a program, and for whatever reason the program takes a long time to start up, so you start doing something else, say launching Calculator and balancing your checkbook. Eventually, the program you launched a while back gets itself off the ground and creates its main window. And the window sits in the background (since the window ...

Just because I don't deny something doesn't make it true

There are a number of tricks people try to pull, and I hate them. Today's trick is one of the many varieties of the BCC trick (sometimes less surreptitiously—but still annoyingly—done as a CC trick). Occasionally, I will be quietly added to an email discussion, typically via BCC, without any indication as to why I was added. ...

The imaginary experience of dining at an underground restaurant

I dreamed that my brother complained, "Dude, you didn't leave room for my car in the garage." Well yeah, because I didn't know you were coming. We decide to go out for dinner, and I see that he squeezed a third car into our two-car garage. We back out, and I watch the car fit through a gap of two feet between my car and the garage door. We ...