Showing results for November 2014 - Page 2 of 3 - The Old New Thing

Nov 14, 2014
0
0

How to view the stack of a user-mode thread when its kernel stack has been paged out

Raymond Chen
Raymond Chen

Suppose you have a machine that has crashed, and your investigation shows that the reason is that there is a critical section that everybody is waiting for. While waiting for that critical section, work piles up, and eventually the machine keels over. Suppose further that this crash is given to you in the form of a kernel debugger. In case it wa...

Other
Nov 13, 2014
0
0

When does GetTickCount consider the system to have started?

Raymond Chen
Raymond Chen

The and functions return "the number of milliseconds that have elapsed since the system was started." (The 32-bit version wraps around after around 50 days.) But when exactly is the system considered to have started? Is it when power is applied to the computer? When the BIOS completes POST? When the user picks the operating system from the boot m...

Code
Nov 12, 2014
0
0

How can I wait until all startup applications have finished launching?

Raymond Chen
Raymond Chen

A customer wanted to know how to detect that all startup applications have finished launching. They wanted to wait until everything settled down before proceeding with some task. What if two programs did this? Suppose two programs both wanted to detect that all startup applications have finished launching. Each one would sit there waiting for the...

Code
Nov 11, 2014
0
0

A little cheat in my Tiger Beat photo homage

Raymond Chen
Raymond Chen

One thing nobody has called out in my tribute to the Bill Gates Tiger Beat photo, either because it was too subtle or too obvious, is that the photo is actually a mirror image. The arrangement of furniture in the room was not correct: The big table was on the wrong side of the room. It was also too heavy to move around, so we cheated. We staged t...

Non-Computer
Nov 10, 2014
0
0

Kicking around a function that formats stuff

Raymond Chen
Raymond Chen

Today's "Little Program" is really a "Little Puzzle" that got out of hand. This started out as a practical question: This code fragment screams out for some sort of simplification. (I've changed the names of the classes.) Clearly, the pattern is Everything here is pretty straightforward, except for the part. Can we write a function that t...

Code
Nov 7, 2014
0
0

Why does an attempt to create a SysLink control in my plug-in sometimes fail?

Raymond Chen
Raymond Chen

A customer had written a plug-in for some application, and they found that their plug-in was unable to create a SysLink control via the function. The same code in a standalone application works fine, but when the code is placed in their plug-in, the code fails. Debugging showed that the call to succeeded, but the call failed with "Cannot find w...

Code
Nov 6, 2014
0
1

How do I get a handle to the primary monitor?

Raymond Chen
Raymond Chen

There are various ways of getting a monitor. You can get the monitor from a point, from a rectangle, or from a window. But how do you get the primary monitor? The primary monitor is defined to be the one which has (0, 0) as its origin. Therefore, one solution is The desktop window by convention is deemed to reside primarily on the primary mo...

Code
Nov 5, 2014
0
0

Passing the incorrect object type for a handle, how bad is it?

Raymond Chen
Raymond Chen

A customer asked a somewhat strange question: "We are calling but passing the handle to a waitable timer. Application Verifier reports, "Incorrect object type for handle." But the code works well. We want to know the risks of passing the wrong object type to . Is the recommendation only to pass handles of type "Event" to ? Let's answer those ques...

Code
Nov 4, 2014
0
0

Microspeak: Line of sight

Raymond Chen
Raymond Chen

I first encountered this term in a meeting I attended. Q: We would like to be able to reverse the polarity of the neutron flow without requiring a reboot. A: Yes, that is something we've been thinking about, but we don't have line of sight to having that feature before the end of the month. From context, having line of sight to a result mean...

OtherMicrospeak