The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
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...
What possible use are those extra bits in kernel handles? Part 2: Overcoming limited expressiveness
Last time, we saw how those extra bits can be used to develop safe sentinel values. That is a special case of a more general problem: How do you pack 33 bits of information into a 32-bit value? Whereas last time, we weren't forced into the use of a sentinel value because we could develop a (cumbersome) helper class and switch people over to the helper class (or to pass two parameters to every function that used to take one), there are places where you are forced to try to squeeze 33 bits of information into a 32-bit value, and the helper class simply isn't going to work. (I'm going to assume 32-bit Wi...
What does each country claim for its own?, greatest hits
A little while back, I invited readers to describe what students are taught (or end up believing) are the greatest contributions of their country. Many people strayed from the "what students are taught" part of the exercise, but I didn't mind too much as long as you were funny. Here are some of my favorites: Representing Greece is Pi, who writes, In Greece I was also taught that Greeks invented democracy. Other than that Greeks are supposed to have laid the groundwork for the development of philosophy, mathematics, physics, biology and pretty much every other greek named thing as a science (except for ...
What possible use are those extra bits in kernel handles? Part 1: Sentinels
Kernel handles are always a multiple of four; the bottom two bits are available for applications to use. But why would an application need those bits anyway? The short answer is extending the handle namespace. The long answer will take a few days to play out. (This series was written in response to Igor Levicki being unable to imagine "how this can save anything (in terms of performance)". Then again, who said that it had anything to do with performance? Actually, I'm surprised that my dear readers weren't familiar with the techniques described in this series. Perhaps I shouldn't have written this series and...