Slim reader/writer locks don't remember who the owners are, so you'll have to...
The slim reader/writer lock is a very convenient synchronization facility, but one of the downsides is that it doesn't keep track of who the current owners are. When your thread is stuck waiting to...
View ArticleThe ways people mess up IUnknown::QueryInterface, episode 4
One of the rules for IUnknown::QueryÂInterface is so obvious that nobody even bothers to state it explicitly as a rule: "If somebody asks you for an interface, and you return S_OK, then the pointer...
View ArticleReadDirectoryChangesW reads directory changes, but what if the directory...
The ReadÂDirectoryÂChangesW function reads changes to a directory. But not all changes that happen to files in a directory result in changes to the directory. Now, it so happens that nearly all...
View ArticleWhy does the runas command require its command line to be quoted?
Commenter teo complained that the runas command requires its command line to be quoted. Well, if you think about it, why single out runas? Pretty much all programs require their command line to be...
View ArticleWhy does creating a shortcut to a file change its last-modified time......
A customer observed that sometimes, the last-modified timestamp on a file would change even though nobody modified the file, or at least consciously took any steps to modify the file. In particular,...
View ArticleStarting up inside the box
the shell team received two customer questions about a month apart which seemed unrelated but had the same root cause. I found that in Windows Vista, the xcopy command is ten times slower than it was...
View ArticleWhy does IFileOperation skip junctions even though I passed...
The IFileÂOperation::SetÂOperationÂFlags method accepts a number of flags to modify the file operation, among them today's subject FOFX_NOÂSKIPÂJUNCTIONS. A customer reported that they couldn't get...
View ArticleOw, I'm too safe!
One of my friends is a geek, and, naturally, fully researches everything he does, from cement pouring to bicycle parts, perhaps a bit obsessively. He made sure to get five-point restraints for his...
View ArticleWhy are the alignment requirements for SLIST_ENTRY so different on 64-bit...
The InterlockedÂPushÂEntryÂSList function stipulates that all list items must be aligned on a MEMORY_ALLOCATION_ALIGNMENT boundary. For 32-bit Windows, MEMORY_ALLOCATION_ALIGNMENT is 8, but the...
View ArticleWhy doesn't the Open Files list in the Shared Folders snap-in show all my...
A customer wanted a way to determine which users were using specific files on their server. They fired up the Shared Folders MMC snap-in and went to the Open Files list. They found that the results...
View ArticleWhat do SizeOfStackReserve and SizeOfStackCommit mean for a DLL?
Nothing. Those fields in the IMAGE_OPTIONAL_HEADER structure are meaningful only when they appear in the EXE. The values provided in DLLs are ignored. SizeÂOfÂHeapÂReserve and SizeÂOfÂHeapÂCommit fall...
View ArticleMagic dirt, the fate of former professional athletes, and other sports...
A sports-related (mostly baseball) link dump. A look at the special dirt that is used by Major League Baseball to prepare balls for use. As you might have expected, professional athletes don't fare...
View ArticleStupid command-line trick: Counting the number of lines in stdin
On unix, you can use wc -l to count the number of lines in stdin. Windows doesn't come with wc, but there's a sneaky way to count the number of lines anyway: some-command-that-generates-output | find...
View ArticleRandom musings on the introduction of long file names on FAT
Tom Keddie thinks that the format of long file names on FAT deserves an article. Fortunately, I don't have to write it; somebody else already did. So go read that article first. I'm just going to add...
View ArticleWhy can't I use PSGUID_STORAGE like a GUID?
The stgprop.h header file defines a GUID called PSGUID_STORAGE, but a customer was having trouble using it. GUID guid; ... // This generates a strange compiler error if (IsEqualGUID(guid,...
View ArticleHow can I get information about the items in the Recycle Bin?
For some reason, a lot of people are interested in programmatic access to the contents of the Recycle Bin. They never explain why they care, so it's possible that they are looking at their problem the...
View ArticleModernizing our simple program that retrieves information about the items in...
Last time, we wrote a simple program to print various properties of the items in the Recycle Bin, and we did so in the classical style, using item ID lists and IShellÂFolders. One thing you may have...
View ArticleInvoking commands on items in the Recycle Bin
Once you've found the items you want in the Recycle Bin, you may want to perform some operation on them. This brings us back to our old friend, IContextMenu. At this point, you're just snapping two...
View ArticleWhat's the story with the parameters to the WM_INPUT_DEVICE_CHANGE message?
A customer found these strange macros in winuser.h: #if (_WIN32_WINNT >= 0x0601) #define GET_DEVICE_CHANGE_WPARAM(wParam) (LOWORD(wParam)) #elif (_WIN32_WINNT >= 0x0501) #define...
View ArticleThanks for letting me know what my ideal career and company are
When it's performance review season, all of a sudden you start getting mail about career management. What a coincidence. There are a variety of career management tools available, some mandatory, some...
View Article