Determining how each Explorer window is sorted
Today’s Little Program lists all the open Explorer windows and their current sort criteria. (I will refrain from mentioning how auto-sort makes this meaningful.) Remember that Little Programs do...
View ArticleWhy are Windows setup logs stored in a Panther directory? Does it have...
Some time ago, I discussed the fates of the various cat projects that led to Windows 95, which was in turn a follow-up to a list of cat-related code names from projects that led to Windows 95. In...
View ArticleWhy is my call to ChangeTimerQueueTimer having no effect? (And another case...
A customer had a question about the ChangeTimerQueueTimer function, and they shared a sample program that demonstrated the issue. (Hooray for reduction.) #include <windows.h> #include...
View Article2015 year-end link clearance
The year-end link clearance is here! You may have noticed that the link clearances are getting shorter and shorter. I may have to cut back to only one link clearance per year. Not Even Close: The...
View ArticleIf you want to receive a message that is broadcast to top-level windows, you...
A customer wanted to suppress autorun from a wizard page. They started with this page on MSDN but found that their wizard page did not receive the QueryCancelAutoPlay message. default: if...
View ArticleSo how bad is it that I’m calling RegOpenKey instead of RegOpenKeyEx?
A customer had some code that called the RegOpenKey function and was concerned by the remark in MSDN: Note This function is provided only for compatibility with 16-bit versions of Windows....
View ArticleWhat does the /V (verify) flag to XCOPY mean, and how did it get that way?
The XCOPY command has a flag called /V, which stands for verify. Sort of. /V Verifies the size of each new file. First, the easy question: What does this flag do? Answer: If this flag is set, then...
View ArticleIf I’m going to store a SID in a file, should I store the string form or the...
A customer needed to save some user SIDs into a file and wanted guidance on whether to use string format or binary format. Here are some pros and cons. String format: To save the SID, use the...
View ArticleHow can I tell whether my console program was launched from Explorer or from...
So you have a console program. This console program could be run by typing its name at the command prompt, or it could be run by the user double-clicking it from Explorer. And you want to know which...
View ArticleSome senior executives are afraid to provide feedback, because they know that...
I recall a conversation I had with Steve Sinofsky, back when he was in charge of Windows. As you might expect, he gets to see early versions of a lot of things, his laptop is running dogfood...
View ArticleWhy does CryptDestroyHash crash, but only sometimes?
A customer was having a problem with the cryptographic hashing functions. They reported that their function ran successfully most of the time, but once in a while, it crashed at the call to...
View ArticleWhy is getting the HP_HASHSIZE so weird?
A comment on the documentation page for CryptGetHashParam notes that the “obvious” way to get the HP_HASHSIZE is incorrect. // Version 1: wrong. DWORD size = 0; if (CryptGetHashParam(hash,...
View ArticleDoes the thread pool have different handle access privileges? Why am I...
A customer was observing strange behavior in their application with handles and the thread pool. We have a service that spawns a child process, and under certain conditions, we need to terminate that...
View ArticleA brief tour of the console alias functions
Today’s Little Program exercises the console alias functions. These functions let you define console aliases which are active when a target program reads a line of text from the console. The alias is...
View ArticleWhat happened to the ability to use … (three dots) to refer to the...
In Windows 95, you could type cd ... to go up two directories, or cd .... to go up three directories, and so on. (You could also use triple-dots in paths passed to functions like CreateFile.) Where...
View ArticleWhy does the date disappear from my taskbar, sometimes?
A customer reported that the date vanished from their taskbar, but it was there yesterday. They included a screen shot, which showed a vertically-docked taskbar on a Chinese system, and the clock...
View ArticleA static_cast is not always just a pointer adjustment
Even without considering virtual base classes, a static_cast to move between a base class and a derived class can be more than just a pointer adjustment. Consider the following classes and functions....
View ArticleHow do I preload a chunk of memory into a memory-mapped file?
A customer had a moderate-sized memory-mapped file (a few dozen megabytes), and they wanted to preload the entire file into memory because their program accesses the contents of the file...
View ArticleChanging a loop into a promise or task chain
If you are dealing with PPL Tasks in C++ or Promises in JavaScript, you run into the problem of having to rephrase loops in the form of callbacks. (On the other hand, if you’re using Tasks in C#, then...
View ArticleHow can I get the original shortcut target path with environment variables...
A customer wanted to be able to get the target of a shortcut with environment variables unexpanded. The IShellLink::GetPath method will expand environment variables. The way to get the unexpanded...
View Article