Showing results for March 2012 - The Old New Thing

Mar 30, 2012
0
0

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

Raymond Chen
Raymond Chen

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 Memor...

Code
Mar 29, 2012
0
0

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

Raymond Chen
Raymond Chen

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 could...

Code
Mar 28, 2012
0
0

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

Raymond Chen
Raymond Chen

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 string as...

Other
Mar 27, 2012
0
0

Amusing message on a whiteboard in the hallway

Raymond Chen
Raymond Chen

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 ...

Non-Computer
Mar 26, 2012
0
0

Why does a maximized window have the wrong window rectangle?

Raymond Chen
Raymond Chen

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 scree...

Code
Mar 23, 2012
0
0

Beverage Gas Division of Central Welding Supply

Raymond Chen
Raymond Chen

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.

Non-Computer
Mar 22, 2012
0
0

Why does my window style change when I call SetWindowText?

Raymond Chen
Raymond Chen

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, at wh...

Code
Mar 21, 2012
0
0

Isn't there a race condition in GetFileVersionInfoSize?

Raymond Chen
Raymond Chen

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 all th...

Code
Mar 20, 2012
0
0

In 1993, Microsoft stole my colleague's car

Raymond Chen
Raymond Chen

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 1993...

Non-Computer