Showing tag results for Code

Jan 8, 2015
Post comments count0
Post likes count1

What happens if I don't pass a pCreateExParams to CreateFile2?

Raymond Chen

The final parameter to the function is optional. What happens if I pass ? If you pass as the parameter, then the function behaves as if you had passed a pointer to this structure:

Code
Dec 29, 2014
Post comments count0
Post likes count1

Integer signum in SSE

Raymond Chen

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 accou...

Code
Dec 22, 2014
Post comments count0
Post likes count2

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

Raymond Chen

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-bit ...

Code
Dec 18, 2014
Post comments count0
Post likes count1

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

Raymond Chen

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 monitors...

Code
Dec 15, 2014
Post comments count0
Post likes count2

Notes on calculating constants in SSE registers

Raymond Chen

There are a few ways to load constants into SSE registers. Load them from memory. Load them from general purpose registers via . Insert selected bits from general purpose registers via . Try to calculate them in clever ways. Loading constants from memory incurs memory access penalties. Loading or inserting them from general purpose reg...

Code
Dec 12, 2014
Post comments count0
Post likes count1

Detecting whether a SID is well-known SID

Raymond Chen

You might think that the function would tell you whether a SID is well-known, but it doesn't. Rather, it tells you whether a SID exactly matches the well-known SID you specified. For example, you can ask, "Is this the Authenticated Users SID?" or "Is this the Everyone SID?" But you can't ask, "Is this any type of well-known SID?" I guess you co...

Code
Dec 11, 2014
Post comments count0
Post likes count1

What states are possible in a DRAWITEMSTRUCT structure?

Raymond Chen

The structure has an member which contains a number of bits describing the state of the item being drawn. How do those states map to the underlying control? Most of the states are rather obvious. For a list box item to be selected, it means that the item is part of the selection. But what does selected mean for a button? Since people like table...

Code