The format of data and custom resources
Continuing the highly-sporadic series of Win32 resource formats, today we'll look at the format of RT_DATA resources, which are declared in resource files as RCDATA. Also the format of custom...
View ArticleHow can I write to a file only as long as nobody's looking?
A customer wanted to know how to detect that the user has opened Notepad to view a particular file. They had come up with method based on polling and sniffing the Notepad title bar, but they found...
View ArticleCan an x64 function repurpose parameter home space as general scratch space?
We saw some time ago that the x64 calling convention in Windows reserves space for the register parameters on the stack, in case the called function wants to spill them. But can the called function...
View ArticleWhat is the official name of the most popular work visa in the United States?
The most popular work visa in the United States is the H1-B visa. But have you looked at its official name? H-1B Specialty Occupations, DOD Cooperative Research and Development Project Workers, and...
View ArticleIf you had to deal with preschoolers all day, you'd need a nap too
Today, I'm turning it around: This is a dream that one of my friends had about me! She dreamed that she took her camera to school to take some pictures, possibly for the yearbook. She was somewhat...
View ArticleIf your product is client-managed, how do you sell the server?
A friend of mine told me about a project he worked on two decades (and three employers) ago. Let's call it Project Nosebleed. Their project used a client-managed database: You have a central file...
View ArticleHow permanent is the "Remove from this list" action on the Start menu?
From Windows XP to Windows 7, the Start menu showed the programs it thinks you've run most frequently, by employing a conceptually simple but complicated-in-practice algorithm. You can right-click an...
View ArticleWhy are my posted messages getting lost when the user drags my window around?
This question was inspired by an actual customer question, but I changed a lot of it around to make for a more interesting story. (Trust me, the original story was even more boring.) A customer's...
View ArticleHow to rescue a broken stack trace on x64: Recovering the stack pointer
Recovering a broken stack on x64 machines on Windows is trickier because the x64 uses unwind codes for stack walking rather than a frame pointer chain. When you dump the stack, all you're going to see...
View ArticleProgrammatically editing the metadata of an audio file
Today's Little Program edits the metadata of an audio file, ostensibly to correct a spelling error, but really just to show how it's done. Today's smart pointer class library is... (rolls dice)......
View ArticleMom and dad's event-filled first day of school
I dreamed that my wife and I had dropped our daughter off at her new school for the first time, and I made a wrong turn and ended up going the wrong way. We got off at an exit for highway I-5, and the...
View ArticleEarly versions of Aero Peek: Aladdin, Bat Signal, and Squeegee
The feature now known as Aero Peek wasn't born that way. It went through several iterations before becoming what eventually shipped in Windows 7. At the MIX09 conference, Stephan Hoefnagels showed...
View ArticleWhy does Internet Explorer put tab stops at 8-character intervals instead of...
When you embed a TAB character (U+0009) in a <PRE> block (or more precisely, an element whose white-space CSS property is computed to be pre or pre-wrap), Internet Explorer will move the current...
View ArticleIt rather involved being on the other side of this airtight hatchway:...
A security vulnerability report came in that said, "If you create a file with 〈specific name〉 in 〈specific directory〉, then 〈denial of service〉 happens the next time somebody does 〈specific...
View ArticleHow does InterlockedIncrement work internally?
The Interlocked family of functions perform atomic operations on memory. How do they do it? It depends on the underlying CPU architecture. For some CPUs, it's easy: The x86, for example, has direct...
View ArticleForcing a file handle closed when it has been opened remotely
Today's Little Program closes a file handle that was opened remotely. It builds on previous discussion on how to use the NetXxx functions. int __cdecl wmain(int argc, wchar_t **argv) { FILE_INFO_3...
View ArticleEntering the world of competitive Ring-Around-the-Rosie
I dreamed that a friend and I were in line at some sort of summer camp to get into the cafeteria. We noticed a glass cabinet with food out in the dining area and asked about it. Turns out that it was...
View ArticleFacilities jargon: Energize
Over in the product engineering groups, we aren't often exposed to the jargon employed by our Facilities group. But once in a while, it leaks through and then we get to puzzle it out. Emergency...
View ArticleSubtractRect doesn't always give you the exact difference
The SubtractRect function takes a source rectangle and subtracts out the portion which intersects a second rectangle, returning the result in a third rectangle. But wait a second, the result of...
View ArticleWhen a program is launched via DDE, and there are multiple servers, which one...
Although you are more than welcome to stop using DDE (please oh please stop using it), there are still many applications which still use it (*cough*), and as a result, customers still have questions...
View Article