Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

What did Windows 3.1 do when you hit Ctrl+Alt+Del?

This is the end of Ctrl+Alt+Del week, a week that sort of happened around me and I had to catch up with. The Windows 3.1 virtual machine manager had a clever solution for avoiding deadlocks: There was...

View Article


Image may be NSFW.
Clik here to view.

Enumerating all the ways of making change

Today's Little Program enumerates all the ways of making change for a particular amount given a set of available denominations. The algorithm is straightforward. To make change for a specific amount...

View Article


Image may be NSFW.
Clik here to view.

Microspeak: spend

Remember, Microspeak is not merely for jargon exclusive to Microsoft, but it's jargon you need to know. We don't encounter the term spend much in the engineering side of the company, but it's in...

View Article

Image may be NSFW.
Clik here to view.

Poor man's comments: Inserting text that has no effect into a configuration file

Consider a program which has a configuration file, but the configuration file format does not have provisions for comments. Maybe the program has a "list of authorized users", where each line takes...

View Article

Image may be NSFW.
Clik here to view.

The citizenship test is pass/fail; there's no blue ribbon for acing it

The civics portion of the United States citizenship test is an oral exam wherein you must correctly answer six out of ten questions. One of my friends studiously prepared for his examination, going so...

View Article


Image may be NSFW.
Clik here to view.

The stream pointer position in IDataObject::GetData and...

An oft-overlooked detail of the IData­Object::Get­Data and IData­Object::Get­Data­Here methods is the position of the stream pointer when the result is a stream. These rules are buried in the...

View Article

Image may be NSFW.
Clik here to view.

I marked my parameter as [optional], so why do I get an RPC error when I pass...

Consider the following interface declaration in an IDL file: // Code in italics is wrong interface IFoo : IUnknown { HRESULT Cancel([in, optional, string] LPCWSTR pszReason); }; The idea here is that...

View Article

Image may be NSFW.
Clik here to view.

Receiving a notification any time the selection changes in an Explorer window

Today's Little Program merely prints a message whenever the user changes the selection on the desktop. I chose the desktop for expediency, since it saves me the trouble of coming up with a way for the...

View Article


Image may be NSFW.
Clik here to view.

The grand ambition of giving your project the code name Highlander

Code name reuse is common at Microsoft, and there have been several projects at code-named Highlander, the movie with the tag line There can be only one. (Which makes the whole thing kind of ironic.)...

View Article


Image may be NSFW.
Clik here to view.

What is the story of the mysterious DS_RECURSE dialog style?

There are a few references to the DS_RECURSE dialog style scattered throughout MSDN, and they are all of the form "Don't use it." But if you look in your copy of winuser.h, there is no sign of...

View Article

Image may be NSFW.
Clik here to view.

If a process crashes while holding a mutex, why is its ownership magically...

A customer was observing strange mutex ownership behavior. They had two processes that used a mutex to coordinate access to some shared resource. When the first process crashed while owning the mutex,...

View Article

Image may be NSFW.
Clik here to view.

Marshaling won't get in your way if it isn't needed

I left an exercise at the end of last week's article: "Why is the RPC_X_NULL_REF_POINTER error raised only sometimes?" COM subscribes to the principle that if no marshaling is needed, then an...

View Article

Image may be NSFW.
Clik here to view.

Simulating media controller buttons like Play and Pause

Today's Little Program simulates pressing the Play/Pause button on your fancy keyboard. This might be useful if you want to write a program that converts some other input (say, gesture detection) into...

View Article


Image may be NSFW.
Clik here to view.

Why does misdetected Unicode text tend to show up as Chinese characters?

If you take an ASCII string and cast it to Unicode,¹ the results are usually nonsense Chinese. Why does ASCII→Unicode mojibake result in Chinese? Why not Hebrew or French? The Latin alphabet in ASCII...

View Article

Image may be NSFW.
Clik here to view.

You can name your car, and you can name your kernel objects, but there is a...

A customer reported that the Wait­For­Single­Object appeared to be unreliable. We have two threads, one that waits on an event and the other that signals the event. But we found that sometimes,...

View Article


Image may be NSFW.
Clik here to view.

In the red corner, EXCEPTION_INT_DIVIDE_BY_ZERO and...

The exception code EXCEPTION_INT_DIVIDE_BY_ZERO (and its doppelgänger STATUS_INTEGER_DIVIDE_BY_ZERO) is raised, naturally enough, when the denominator of an integer division is zero. The x86 and x64...

View Article

Image may be NSFW.
Clik here to view.

Why is 0x00400000 the default base address for an executable?

The default base address for a DLL is 0x10000000, but the default base address for an EXE is 0x00400000. Why that particular value for EXEs? What's so special about 4 megabytes It has to do with the...

View Article


Image may be NSFW.
Clik here to view.

Enumerating cyclical decompositions with Stirling numbers

This whole enumeration nightmare-miniseries started off with Stirling numbers of the second kind. But what about Stirling numbers of the first kind? Those things ain't gonna enumerate themselves! The...

View Article

Image may be NSFW.
Clik here to view.

Microspeak: All-up

Here are some citations. Let's see if we can figure out what it means. I think a presentation of these results would be a fun boost for the team. Is this something we should handle in a bunch of...

View Article

Image may be NSFW.
Clik here to view.

Standard handles are really meant for single-threaded programs

When I discussed the conventions for managing standard handles, Sven2 noted that I implied that you need to call Set­Std­Handle with a new handle if you close the current handle and asked "Wouldn't it...

View Article
Browsing all 3085 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>