The Old New Thing

How do I perform shell file operations while avoiding shell copy hooks?

Okay, the subject line of the article gives away the answer to the puzzle, but here's the puzzle anyway: A customer reported a problem with the function: Consider the following program: If "a" is a file, then everything works fine, but if it's a directory, then Application Verifier raises the following error: Heap violation detected ...
Comments are closed.0 0
Code

Why can't I delete a file immediately after terminating the process that has the file open?

A customer discovered a bug where terminating a process did not close the handles that the process had open, resulting in their emergency cleanup code not working: Their workaround was to insert a call to before deleting the file. The customer wanted to know whether they discovered a bug in , and they were concerned that their workaround ...
Comments are closed.0 0
Code

Converting to Unicode usually involves, you know, some sort of conversion

A colleague was investigating a problem with a third party application and found an unusual window class name: L"整瑳整瑳". He remarked, "This looks quite odd and could be some problem with the application." The string is nonsense in Chinese, but I immediately recognized what was up. Here's a hint: Rewrite the ...

Amusing message on a whiteboard in the hallway

It is common to see whiteboards mounted in hallways. Sometimes they have official purposes; other times they are just placed for the convenience of hallway conversations or impromptu meetings. One of the hallways near my office has a very large whiteboard, completely blank, save for one note clearly written in the corner. DO NOT ERASE...

Why does a maximized window have the wrong window rectangle?

Commenter configurator wonders why the maximum size for a form is the screen size plus (12,12). Somebody else wonders why it's the screen size plus (16,16). Let's start by rewinding the clock to Windows 3.0. When you maximize a window, the default position of the window is such that all the resizing borders hang "off the edges of the ...
Comments are closed.0 0
Code

Beverage Gas Division of Central Welding Supply

The other day, I saw a van which was labeled Beverage Gas Division of Central Welding Supply. This odd juxtaposition was created by the acquisition of Compressed Gas Western by Central Welding Supply in 2009. I sure hope they don't get their tanks confused...

Why does my window style change when I call SetWindowText?

A customer observed some strange behavior with window styles: We ran some weird behavior: Calling the function causes a change in window styles. Specifically, calling results in the and messages, and sometimes the result is that the style is removed. Is this a bug? What would cause this? The message sends the message to the control, ...
Comments are closed.0 0
Code

Isn't there a race condition in GetFileVersionInfoSize?

In response to my explanation of what the parameter in is used for, Steve Nuchia wonders if there's a race condition between the time you get the size and the time you ask for the data. Yes, there is a race condition, but calling the function in a loop won't help because the function does not report that the buffer is too small to hold ...
Comments are closed.0 0
Code

In 1993, Microsoft stole my colleague's car

I remember walking between buildings at Microsoft back in the 1990's and seeing a moss-covered, rusted-out jalopy in one of the parking spaces. It clearly hadn't moved in ages. The person I was with said, "Oh, yeah, Microsoft owns that car. They stole it from Bob." (Bob is my generic name for a Microsoft employee.) The Inaugural Day Storm of...