Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How does the window manager adjust ptMaxSize and ptMaxPosition for multiple...

There is a note down in the documentation for the MIN­MAX­INFO structure: For systems with multiple monitors, the ptMaxSize and ptMaxPosition members describe the maximized size and position of the...

View Article


Image may be NSFW.
Clik here to view.

That'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 Article


Image may be NSFW.
Clik here to view.

Creating 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 Article

Image may be NSFW.
Clik here to view.

What 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 Article

Image may be NSFW.
Clik here to view.

Why 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 Article


Image may be NSFW.
Clik here to view.

Hidden 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 Article

Image may be NSFW.
Clik here to view.

Documentation 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 Article

Image may be NSFW.
Clik here to view.

Can 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 Article


Image may be NSFW.
Clik here to view.

How 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 Get­Tick­Count/Get­Tick­Count64? Task Manager calculates...

View Article


Image may be NSFW.
Clik here to view.

Why 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_GET­MIN­MAX­INFO and clamp the results?" I'm going to assume the question is...

View Article

Image may be NSFW.
Clik here to view.

Low-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 Article

Image may be NSFW.
Clik here to view.

MapGenericMask is just a convenience function for converting generic access...

For some reason, people call the Map­Generic­Mask function in order to calculate what access mask to pass to request access to something. That's not what Map­Generic­Mask is for. The Map­Generic­Mask...

View Article

Image may be NSFW.
Clik here to view.

Determining 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: /LARGE­ADDRESS­AWARE/DYNAMIC­BASE, also known as Address Space Layout Randomization (ASLR)...

View Article


Image may be NSFW.
Clik here to view.

It rather involved being on the other side of this airtight hatchway: Code...

A security vulnerability report arrived that took the following form: The Queue­User­APC function can be used to effect an elevation of privilege, as follows: Identify a process you wish to attack....

View Article

Image may be NSFW.
Clik here to view.

When 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 Article


Image may be NSFW.
Clik here to view.

If 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 Article

Image may be NSFW.
Clik here to view.

So you decided to call SHFileOperation from a service, at least remember to...

I noted some time ago that it is highly inadvisable to call SHFile­Operation 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 Article


Image may be NSFW.
Clik here to view.

New 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 Article

Image may be NSFW.
Clik here to view.

The 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 Article

Image may be NSFW.
Clik here to view.

Dubious 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
Browsing all 3085 articles
Browse latest View live