The Old New Thing

The C language specification describes an abstract computer, not a real one

If a null pointer is zero, how do you access the memory whose address is zero? And if C allows you to take the address one past the end of an array, how do you make an array that ends at , since adding one to that value would wrap around? First of all, who says that there is a byte zero? Or a byte ? The C language does not describe an ...

“Adjust visual effects for best performance” should really be called “Adjust visual effects for crappiest appearance”

In the Performance Options control panel, on the tab labeled Visual Effects, there is a radio button called Adjust for best performance. If you select it, then all the visual effects are disabled. But the name of that radio button has been wrong for a long time. It doesn't actually adjust your visual effects for best performance. It just ...

There’s no law that says two people can’t have the same thing to eat

Some time ago, my group went out for a team lunch. It was to a restaurant we were not familiar with, so there was quite a bit of time studying the menu. As everybody looked over the menu, discussion naturally turned to "So what are you going to have?" "I think I'll have the salmon sandwich." One of my colleagues replied, "Oh, rats. I was ...

Using accessibility to monitor windows as they come and go

Today's Little Program monitors windows as they come and go. When people contemplate doing this, they come up with ideas like installing a WH_CBT hook or a WH_SHELL hook, but one of the major problems with those types of hooks is that they are injected hooks. Injection is bad for a number of reasons. It forces the hook to be in a DLL so it ...
Comments are closed.0 0
Code

When will GetMessage return -1?

A source of great consternation is the mysterious return value from : If there is an error, the return value is −1. For example, the function fails if is an invalid window handle or is an invalid pointer. That paragraph has caused all sorts of havoc, because it throws into disarray the standard message pump: But don't worry, the ...
Comments are closed.0 1
Code

Does this operation work when file system redirection is disabled? The default answer is NO

A customer reported that when their program called to get the icon for a folder, the call failed. "It works on some machines but not others. We don't know what the difference is between the working and non-working machines." They included the offending function from their program, but everything in the function looked good. The problem was ...
Comments are closed.0 0
Code

The x86 architecture is the weirdo: Structured exception handling

If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it's the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured exception handling, "It would ...