The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

May 1, 2015
Post comments count 0
Post likes count 1

That's not how you start a boat

Raymond Chen

Tomorrow is Opening Day of the Seattle boating season. (Which, as I noted some time ago, is purely a social occasion with no legal significance.) One of my colleagues is not much of a boat person, but his wife is. (In fact, she's a commercial fisherman.) They were on board some fancy boat or other as it sat docked. He was up on the top deck—this being a boat so fancy that it had an upstairs and a downstairs—and as the preparations were made for heading out, his wife called out to him to start the boat, since he's up there already. Now, as I mentioned, my colleague isn't much of a boat person. But h...

May 1, 2015
Post comments count 0
Post likes count 1

How does the window manager adjust ptMaxSize and ptMaxPosition for multiple monitors?

Raymond Chen

Very carefully.

Apr 30, 2015
Post comments count 0
Post likes count 1

How can I tell if a file is an image of some type?

Raymond Chen

The perceived type tells you what kind of file it is, for a very general sense of the word "kind".

Apr 29, 2015
Post comments count 0
Post likes count 1

Is the atom returned by RegisterClass(Ex) a "real" atom?

Raymond Chen

A customer was debugging some code that calls on a class that's already been registered. In this case, it was registered by another DLL in the same process. Normally, this wouldn't be a problem, because each DLL passes its own instance handle to so that there are no name collisions. However, in this case, both DLLs are passing the flag, which means that collisions can occur after all. The customer found that the call to , which makes sense in the case of a collision in the global class table. The code then calls to look up the class name, but fails, saying, "No such atom." Does this mean that the class at...

Apr 28, 2015
Post comments count 0
Post likes count 1

Access to a file's attributes is controlled by two things

Raymond Chen

We saw some time ago that permission to delete a file is granted either File attributes behave in an analogous way. Permission to read a file's attributes is granted either If you want the file's attributes, you could always get it by reading the directory, because one of the pieces of information you get from is the file attributes. Therefore, having permission to read a directory implicitly gives you permission to read the attributes of any file in that directory. (Note, of course, that write permission on attributes is another story.)

Apr 27, 2015
Post comments count 0
Post likes count 1

Wow, they really crammed a lot into those 410 transistors

Raymond Chen

Just an order of magnitude. Or three. Or more.

Apr 27, 2015
Post comments count 0
Post likes count 1

How do I extract the path to Control Panel from this shortcut so I can launch it?

Raymond Chen

You don't need to.

Apr 24, 2015
Post comments count 0
Post likes count 1

Why can't I have variadic COM methods?

Raymond Chen

COM methods cannot be variadic. Why not? Answer: Because the marshaler doesn't know when to stop. Suppose variadic COM methods were possible. And then you wrote this code: How would COM know how to marshal this function call? In other words, suppose that is a pointer to a proxy that refers to an object in another process. The COM marshaler needs to take all the parameters to , package them up, send them to the other process, then unpack the parameters, and pass them to the implementation. And then when the implementation returns, it needs to take the return value and any output parameters, package them u...

Apr 23, 2015
Post comments count 0
Post likes count 1

How did the scopes for the CryptProtectMemory function end up in a strange order?

Raymond Chen

Incremental functionality.