The Old New Thing

Memory allocation functions can give you more memory than you ask for, and you are welcome to use the freebies too, but watch out for the free lunch

Memory allocation functions like , , , and all have the property that they can return more memory than you requested. For example, if you ask for 13 bytes, you may very well get a pointer to 16 bytes. The corresponding functions return the actual size of the memory block, and you are welcome to use all the memory in the block up to the ...

Why does the VerQueryValue function give me the wrong file version number?

A customer was writing a test to verify that their patching system was working properly, but they found that even after the patch was installed, a call to reported that the file was still the original version. Why was the function reporting the wrong version? Recall that the version resource is, well, a resource. And one of the things that ...

How do I get mouse messages faster than WM_MOUSEMOVE?

We saw some time ago that the rate at which you receive messages is entirely up to how fast your program calls . But what if your program is calling as fast as it can, and it's still not fast enough? You can use the function to ask the window manager, "Hey, can you tell me about the mouse messages I missed?" I can think of two cases ...

Microspeak: Friction

In physics, friction is a force that resists motion. In Microspeak, friction is an obstacle which prevents somebody from doing something you want them to do. (The preferred verb phrase for getting over an obstacle is overcoming friction.) There is friction in the system for X that is reduced when developing with Y. Using X reduces friction ...

If you have multiple versions of Windows installed, why do they all try to adjust the clock?

Commenter Martin notes that if you have multiple copies of Windows installed on your machine, then each one will try to adjust the clock when you enter or exit daylight saving time. "I cannot believe that this feature is a bug. Please could you comment this?" This falls into a category of issue that I like to call "So what did you expect?" (...

Alt text for images are important in email, too

Apparently the IT department gave up on getting everybody to read email in plain text, and other service departments at Microsoft have moved beyond simply using HTML for markup and started adding banner images to the top of each email message. Because the best way to promote your brand to other parts of the company is to stick a banner logo ...

Why do program files go into the Program Files directory?

Some of Microsoft's software certification programs (such as the Windows Logo) require that applications set their default installation location to the Program Files directory. What is the reason for this? One technical reason is that this ensures that the directory receives an appropriate default security descriptor. But the Program Files ...