Showing archive results for 2011

May 17, 2011
Post comments count0
Post likes count1

Why does Explorer show a thumbnail for my image that's different from the image?

Raymond Chen

A customer (via a customer liaison) reported that Explorer somestimes showed a thumbnail for an image file that didn't exactly match the image itself. I have an image that consists of a collage of other images. When I switch Explorer to Extra Large Icons mode, the thumbnail is a miniature representation of the image file. But in Large Icons and M...

Tips/Support
May 16, 2011
Post comments count0
Post likes count1

Multithreaded UI code may be just as hard as multithreaded non-UI code, but the consequences are different

Raymond Chen

Commenter Tim Smith claims that the problems with multithreaded UI code are not significantly more than plain multithreaded code. While that may be true on a theoretical level, the situations are quite different in practice. Regardless of whether your multithreaded code does UI or not, you have to deal with race conditions, synchronization, cache...

Code
May 13, 2011
Post comments count0
Post likes count1

If undecorated names are given in the DLL export table, why does link /dump /exports show me decorated names?

Raymond Chen

If you run the command on a DLL which exports only undecorated names, you may find that in addition to showing those undecorated names, it also shows the fully-decorated names. We're building a DLL and for some functions, we have chosen to suppress the names from the export table by using the NONAME keyword. When we dump the exports, we still ...

Other
May 12, 2011
Post comments count0
Post likes count1

Looking at the world through kernel-colored glasses

Raymond Chen

During a discussion of the proper way of cancelling I/O, the question was raised as to whether it was safe to free the I/O buffer, close the event handle, and free the structure immediately after the call to . The response from the kernel developer was telling. That's fine. We write back to the buffer under a try/except, so if the memory is free...

Code
May 11, 2011
Post comments count0
Post likes count1

Why double-null-terminated strings instead of an array of pointers to strings?

Raymond Chen

I mentioned this in passing in my description of the format of double-null-terminated strings, but I think it deserves calling out. Double-null-terminated strings may be difficult to create and modify, but they are very easy to serialize: You just write out the bytes as a blob. This property is very convenient when you have to copy around the lis...

Code
May 10, 2011
Post comments count0
Post likes count1

Why is hybrid sleep off by default on laptops? (and how do I turn it on?)

Raymond Chen

Hybrid sleep is a type of sleep state that combines sleep and hibernate. When you put the computer into a hybrid sleep state, it writes out all its RAM to the hard drive (just like a hibernate), and then goes into a low power state that keeps RAM refreshed (just like a sleep). The idea is that you can resume the computer quickly from sleep, but if...

HistoryTips/Support
May 9, 2011
Post comments count0
Post likes count1

Sorting is a state and a verb (and a floor wax and a dessert topping)

Raymond Chen

Cliff Barbier points out that after you sort an Explorer view by name, new items are not inserted in their sorted position. This goes back to the question of whether sorting is a state or a verb. If you take an Explorer folder and say Sort by Name, do you mean "From now on, always show the contents of this folder sorted by name"? Or do you mean...

Other
May 6, 2011
Post comments count0
Post likes count1

A function pointer cast is a bug waiting to happen

Raymond Chen

A customer reported an application compatibility bug in Windows. We have some code that manages a Win32 button control. During button creation, we subclass the window by calling . On the previous version of Windows, the subclass procedure receives the following messages, in order: We do not handle any of these messages and pass them thro...

Code
May 5, 2011
Post comments count0
Post likes count1

Your program loads libraries by their short name and you don't even realize it

Raymond Chen

In the discussion of the problems that occur if you load the same DLL by both its short and long names, Xepol asserted that any program which loads a DLL by its short name "would have ONLY itself to blame for making stupid, unpredictable, asinine assumptions" and that Windows should "change the loader to NOT load any dll with a short name where the...

Code
May 4, 2011
Post comments count0
Post likes count1

Why don't the file timestamps on an extracted file match the ones stored in the ZIP file?

Raymond Chen

A customer liaison had the following question: My customer has ZIP files stored on a remote server being accessed from a machine running Windows Server 2003 and Internet Explorer Enhanced Security Configuration. When we extract files from the ZIP file, the last-modified time is set to the current time rather than the time specified in the ZIP fil...

Tips/Support