How did protected-mode 16-bit Windows fix up jumps to functions that got...
Commenter Neil presumes that Windows 286 and later simply fixed up the movable entry table with jmp selector:offset instructions once and for all. It could have, but it went one step further. Recall...
View ArticleSetting, 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...
View ArticleThe Softsel Hot List for the week of December 22, 1986
Back in the days before Internet-based software distribution, heck back even before the Internet existed in a form resembling what it is today, one of the most important ways of keeping track of the...
View ArticleHow 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...
View ArticleMy pants are fancy!
During the development of Windows, the 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...
View ArticleDebugging 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. rax=00007fff219c5000 rbx=00000000023c8380 rcx=00000000023c8380 rdx=0000000000000000...
View ArticleInteger signum in SSE
The signum function is defined as follows: signum(x) = −1 if x< 0signum(x) = 0 if x = 0signum(x) = +1 if x> 0 There are a couple of ways of calculating this in SSE integers. One way is to...
View ArticleHow did that program manage to pin itself to my taskbar when I installed it?
Occasionally, somebody will notice that upon installing a program, it managed to pin itself to the taskbar. But just like there is no PinToStartMenu function, there is also no PinToTaskbar...
View ArticleEven the publishing department had its own Year 2000 preparedness plan
On December 31, 1999, Microsoft Product Support Services were ready in case something horrible happened as the calendar rolled over into the new year. I'm told that Microsoft Press also had its own...
View Article2014 year-end link clearance
Another round of the semi-annual link clearance. Do you hear any Christmas music right now? Good. Christmas songs can be played only 1/12 of the year, and people who write algorithms for...
View ArticleHorrifically nasty gotcha: FindResource and FindResourceEx
The FindResourceEx function is an extension of the FindResource function in that it allows you to specify a particular language fork in which to search for the resource. Calilng the FindResource...
View ArticleHow do you prevent the linker from discarding a function you want to make...
We saw some time ago that you can ask the Windows symbolic debugger engine to call a function directly from the debugger. To do this, of course, the function needs to exist. But what if you want a...
View ArticleMore notes on calculating constants in SSE registers
A few weeks ago I noted some tricks for creating special bit patterns in all lanes, but I forgot to cover the case where you treat the 128-bit register as one giant lane: Setting all of the least...
View ArticleNo good deed goes unpunished: Marking a document as obsolete
I was contacted by a customer support liaison who was hoping that I could help them understand Feature X. I saw your name on a "Feature X technical specification" document in the Windows specification...
View ArticleWhy is there a BSTR cache anyway?
The SysAllocString function uses a cache of BSTRs which can mess up your performance tracing. There is a switch for disabling it for debugging purposes, but why does the cache exist at all? The BSTR...
View ArticleWhat happens if I don't pass a pCreateExParams to CreateFile2?
The final pCreateExParams parameter to the CreateFile2 function is optional. What happens if I pass NULL? If you pass NULL as the pCreateExParams parameter, then the function behaves as if you had...
View ArticleFinding the leaked object reference by scanning memory: Example
An assertion failure was hit in some code. // There should be no additional references to the object at this point assert(m_cRef == 1); But the reference count was 2. That's not good. Where is that...
View ArticleLimiting the bottom byte of an XMM register and clearing the other bytes
Suppose you have a value in an XMM register and you want to limit the bottom byte to a particular value and set all the other bytes to zero. (Yes, I needed to do this.) One way to do this is to apply...
View ArticleMicrospeak: landing (redux)
In a meeting, my colleague Martyn Lovell said, "The plan is shifting and hasn't landed anywhere yet." This was generally understood to mean "The plan is shifting and the issue is not yet settled." I...
View ArticleWhere can I find the standard asynchronous stream?
In the documentation for XmlLite, one of the features called out is that XmlLite is a non-blocking parser. If the input stream returns E_PENDING, then XmlLite propagates that status to its caller, and...
View Article