The Old New Thing

Integer signum in SSE

The signum function is defined as follows: There are a couple of ways of calculating this in SSE integers. One way is to convert the C idiom The SSE translation of this is mostly straightforward. The quirk is that the SSE comparison functions return −1 to indicate , whereas C uses +1 to represent . But this is easy to take into ...

Debugging walkthrough: Access violation on nonsense instruction

A colleague of mine asked for help puzzling out a mysterious crash dump which arrived via Windows Error Reporting. Well that's a pretty strange instruction. Especially since it doesn't match up with the source code at all. There is no bit-toggling in the actual code. The method calls to , , and are all interface calls and therefore ...

My pants are fancy!

During the development of Windows, the User Research team tried out an early build of some proposed changes on volunteers from the general community. During one of the tests, they invited the volunteer to just play around with a particular component, to explore it the way they would at home. The usability subject scrolled around a bit, ...

How can I let my child use an app that I bought from the Windows Store?

If you buy an app from the Windows Store, you can make it available to other users on the same Windows PC. This is useful if you, say, buy an app for your child to use. Here's how you do it. (This is all explained on the Windows Store blog, but I've converted it into a step-by-step and updated it for Windows 8.1.) First, sign on as yourself ...

Setting, clearing, and testing a single bit in an SSE register

Today I'm going to set, clear, and test a single bit in an SSE register. Why? On Mondays I don't have to explain why. First, we use the trick from last time that lets us generate constants where all set bits are contiguous, and apply it to the case where we want only one bit. We start by setting all bits in . We then shift both 64...

How can I query the location of the taskbar on secondary monitors?

A customer wanted to know how to get the location of the taskbar on secondary monitors. "I know that will tell me the location of the taskbar on the primary monitor, but how do I get its location on secondary monitors?" We asked the customer what their actual problem is, where they think that determining the taskbar location on secondary ...

It rather involved being on the other side of this airtight hatchway: Account vulnerable to Active Directory administrator

A security vulnerability report came in that went something like this: Disclosure of arbitrary data from any user An attacker can obtain arbitrary data from any user by means of the following steps: There's no point continuing, because the first step assumes that you are on the other side of the airtight hatchway. If you have ...