The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
QueryPerformanceCounter counts elapsed time, not CPU cycles
An anonymous coward asks whether the function counts elapsed time or CPU cycles. It counts elapsed time. It has to, since its value is governed by the function, which returns a number specifying the number of units per second, and the frequency is spec'd as not changing while the system is running. For CPUs that can run at variable speed, this means that the HAL cannot use an instruction like , since that does not correlate with elapsed time. Commenter "A" appears to have found a buggy HAL that failed to take this into account and returns values that do not correlate with elapsed time. What would it t...
Tales from the interview: Anticipating your own incompetence is not a good interview strategy
Some years ago, there was a candidate who was interviewing for a programming position in my group. The first interviewer asked the candidate about career plans with that old standby, "Where do you see yourself in five years?" — In five years, I see myself in program management. This is a fair answer. Many people see programming as a stepping stone to management. It doesn't have to be, but it's certainly a career path more than one person has taken. My colleague decided to probe further. "What is it about program management that appeals to you?" — Well, after five years, all the kids gradua...
Tales from the interview: Lunch is not a competition, episode 2
Last time, we saw the consequences of failing to recognize that lunch is not a competition. Today we'll see an even more unfortunate result. One candidate went to lunch with my colleague the economist. (Claim to fame: "Jenna von Oÿ is my cousin!") They went to a local Thai restaurant, Thai being a very popular cuisine here in the Seattle area. The afternoon interviews showed a marked change for the worse from the morning interviews, and the afternoon interviewers began to ask, "What happened at lunch? The candidate was doing really well in the morning, but in the afternoon, had difficulty concentrating a...
Tales from the interview: Lunch is not a competition
One thing that many interview candidates fail to comprehend is that lunch is not a competition. You're not auditioning for Fear Factor. No matter how many times we explain this, candidates don't believe it. One of my colleagues took a candidate to lunch. As is typical, the candidate is asked whether there was any particular preference or phobia, and as is also typical, the candidate expressed no preference (trying not to look difficult). My colleague explained, "Okay, well, I like sushi, but please, if you don't like sushi, please just say so, and we can go to an Italian or Mexican place or even just grab a bu...
Tales from the interview: Can you rotate this two-dimensional array?
My colleague jeffdav told me about one job interview with a graduating college senior that didn't go well because the candidate simply gave up. He offered a simple programming task: Write a function that takes a 4×4 two-dimensional array and rotates it clockwise by 90 degrees. For example, the entry in the upper left corner of the array goes to the upper right corner. The interview candidate simply gave up without even writing so much as a function prototype. "I can't do it." — Okay, well, let's take it a step at a time. Maybe take a specific example and see what we can learn from it. ...
It helps if you write a cover letter and remember the name of your interviewer
It's not a big thing, but it shows that you have your act together and does a lot towards distinguishing you from everybody else. A story of the importance of writing a cover letter and remembering the name of your interviewer. (Then again, what do I know. JobsBlog probably is a better source for this type of info. Earlier this year, Angela McLaughlin shared her thoughts on cover letters.)
How do I convert an error code to text when FORMAT_MESSAGE_FROM_SYSTEM doesn’t work?
For the same reason that not all error codes are defined in , not all error strings are defined in the system message table. If you've ever played with the message compiler, you'd quickly have recognized the file as the header file associated with a message resource. In other words, there's a file that gets processed by the message compiler, and out pops the message resource (which becomes the system message table) and the header file. As we saw a few years ago, not all error messages live in , which means that not all error messages live in the system message table. Each component that provides error code...
What possible use are those extra bits in kernel handles? Part 3: New object types
Last time, we saw how those extra bits can be used to multiplex HANDLE with other values. That was a specific case of a more general scenario: Expanding the handle namespace to include things that aren't handles. (You can also view today's example as a generalization of the sentinel value problem, where we need to generate an arbitrary number of sentinel values dynamically. Actually, multiplexing HANDLE with HRESULT is also just another special case: We expanded the handle namespace to include error codes too.) As I noted in the base article, the people who are most interested in this sort of thing are peopl...
The stroke-count-based sort isn’t random, although it looks that way if you only see it in translation
During the NBC coverage of the opening ceremony of the Beijing Olympics, the announcers more than once said that the teams will not be entering in the normal order, but rather in a random order based on the number of strokes in the team's name as translated into Chinese. This is an odd use of the word random. You might say that at the Athens Olympics, the teams did not enter in the normal order, but rather in a random order based on the collation of the characters in the team's name as translated into Greek. Teams enter the stadium in the collation order customary for the host nation, with the exception that...