How does the window manager adjust ptMaxSize and ptMaxPosition for multiple...
There is a note down in the documentation for the MINMAXINFO structure: For systems with multiple monitors, the ptMaxSize and ptMaxPosition members describe the maximized size and position of the...
View ArticleThat's not how you start a boat
Tomorrow is Opening Day of the Seattle boating season. (Which, as I noted some time ago, is purely a social occasion with no legal significance.) One of my colleagues is not much of a boat person, but...
View ArticleCreating a window that can be resized in only one direction
Today's Little Program shows a window that can be resized in only one direction, let's say vertically but not horizontally. Start with the scratch program and make these changes: UINT OnNcHitTest(HWND...
View ArticleWhat does it mean when the Advanced Security Settings dialog says that an ACE...
The Advanced Security Settings dialog shows the ACEs in an object's ACL, and one of the pieces of information is a column labeled Inherited from which identifies whether the ACE was inherited, and if...
View ArticleWhy is there an invisible U+202A at the start of my file name?
There's something strange about this property sheet page: IMG31415 Properties × General Security Details Object name: C:\Users\Bob\Desktop\IMG31415.jpg Group or user names: 👤 👤 SYSTEM 👤 Bob 👤...
View ArticleHidden message in a T-shirt, it's been done before
While everybody is trying to figure out the hidden message in Joe Belfiore's T-shirt,¹ I figure I'd give you an easier puzzle. Here is the pattern of 0's and 1's printed on the T-shirt handed given...
View ArticleDocumentation creates contract, which is why you need to be very careful what...
A person with a rude name asks, "Why does MS not document the system metrics used by classic/pre-uxtheme windows and common controls? This image is really useful and I wish all of this was actually...
View ArticleCan I run a service executable from a network location?
A customer liaison wanted to know whether it is possible to run a service executable from a network location. The customer was doing so and running into problems, and they wanted to know whether it is...
View ArticleHow does Task Manager compute Up Time, and why doesn't it agree with...
Task Manager shows a piece of information called "Up time". How is this value calculated, and why doesn't it agree with the value reported by GetTickCount/GetTickCount64? Task Manager calculates...
View ArticleWhy don't you forward WM_GETMINMAXINFO and clamp the results?
In my illustration of how to make a window resizable in only one direction, commenter Josua asks, "Why don't you forward WM_GETMINMAXINFO and clamp the results?" I'm going to assume the question is...
View ArticleLow-level hooks have thread affinity, so make sure you keep an eye on the thread
A customer was having a problem with their automated testing tool. We have an automation testing tool that, among other things, installs a low-level mouse hook. Sometimes, the hook takes too long to...
View ArticleMapGenericMask is just a convenience function for converting generic access...
For some reason, people call the MapGenericMask function in order to calculate what access mask to pass to request access to something. That's not what MapGenericMask is for. The MapGenericMask...
View ArticleDetermining programmatically whether a file was built with LAA, ASLR, DEP, or...
Today's Little Program parses a module to determine whether or not it was built with the following flags: /LARGEADDRESSAWARE/DYNAMICBASE, also known as Address Space Layout Randomization (ASLR)...
View ArticleIt rather involved being on the other side of this airtight hatchway: Code...
A security vulnerability report arrived that took the following form: The QueueUserAPC function can be used to effect an elevation of privilege, as follows: Identify a process you wish to attack....
View ArticleWhen you inadvertently become a collector of something you really aren't all...
As I was heading home at the end of the day, I ran into one of my colleagues who was also going home, and he was carrying a Star Wars-themed metal lunchbox similar to this one. For those who didn't...
View ArticleIf you can set enforcement for a rule, you can set up lack of enforcement
One of the things you can do with an internal tool I've been calling Program Q is run a program any time somebody wants to add or modify a record. The program has wide latitude in what it can do. It...
View ArticleSo you decided to call SHFileOperation from a service, at least remember to...
I noted some time ago that it is highly inadvisable to call SHFileOperation from a service, and then I thought about it some more and concluded, it's flat-out wrong, at least in the case where you...
View ArticleNew C++ experimental feature: The tadpole operators
How often have you had to write code like this: x = (y + 1) % 10; x = (y + 1) * (z - 1); x = (double)(f(y) + 1); Since the + and - operators have such low precedence, you end up having to parenthesize...
View ArticleThe tadpole operators explained
Last time,¹ I introduced the tadpole operators. As you have probably figured out by now, it was a joke. There are no new tadpole operators. But the sample code works. What's going on? The tadpole...
View ArticleDubious security vulnerability: Luring somebody into your lair
A security report was received that went something like this: The XYZ application does not load its DLLs securely. Create a directory, say, C:\Vulnerable, and copy XYZ.EXE and a rogue copy of ABC.DLL...
View Article