The Old New Thing

The normal string manipulation functions stop on a null terminator, so be careful when manipulating double-null-terminated strings

One of the many gotchas of working with double-null-terminated strings is accidentally using functions on them which were designed to operate on single-null-terminated strings. Now, you do need to use those single-null-terminated strings, but you also need to know when they won't do what you want. One of the responses to my psychic ...
Comments are closed.0 0
Code

Don't forget to double-null-terminate those strings you pass to SHFileOperation

About once every two months for the past six months (I stopped checking further back), somebody reports a problem with the SHFileOperation function. Often, they don't include very much information at all. They just say, "I call the function and it doesn't work." Here's an example: I'm hitting a problem with SHFileOperation when using it to...
Comments are closed.0 0
Code

Happy birthday, Windows 2000, and try not to get too hung over

On this date ten years ago, Windows 2000 launched in San Francisco. One of my colleagues was working as a staff member at the Windows 2000 Conference and Expo in San Francisco, an event which accompanied the Windows 2000 launch event. Also working at the event was his boss's boss, and the two shared a hotel room. Their flight ...

It rather involved being on the other side of this airtight hatchway: Dubious escalation

Consider this type of dubious security vulnerability: There is a buffer overflow bug in kernel driver X. To exploit it, call this function with these strange parameters. The exploit works only if you are logged on as administrator, because non-administrators will get ERROR_ACCESS_DENIED. Yes, this is a bug, and yes it needs to be fixed...

Advocating the overthrow of the government of the United States by force or subversion

It has been widely reported that South Carolina now requires "subversive groups" to register with the Secretary of State (and pay a $5 filing fee). Curiously, the list of organizations which must register include "an organization subject to foreign control." I wonder if this means that all consulates have to register, and that when any ...

Private classes, superclassing, and global subclassing

In the suggestion box, A. Skrobov asks why it's impossible to superclass WC_DIALOG, but the example that follows is not actually superclassing. When I register my own class under this atom, and leave NULL in WNDCLASS.hInstance, Windows fills it in for me. Then I have two distinct classes registered: (0,WC_DIALOG) and (hMyInstance,WC_DIALOG...
Comments are closed.0 0
Code

A decidedly Canadian response to the shambles that was the running portion of the modern pentathlon in Beijing

Living so close to the United States-Canada border means that there's a lot of friendly teasing of the many Canadians in our midst. It's a good thing Canadians as a whole seem to have a pretty good sense of humor about it. (Well, except the Quebecers. Those humorless grumps.) The final stage of the modern pentathlon is supposed to be a cross-...

How do I get information about the target of a symbolic link?

Functions like GetFileAttributes and FindFirstFile, when asked to provide information about a symbolic link, returns information about the link itself and not the link destination. If you use the FindFirstFile function, you can tell that you have a symbolic link because the file attributes will have the FILE_ATTRIBUTES_REPARSE_POINT flag set, ...
Comments are closed.0 0
Code

A sense of the term anonymous with which I had previously been unfamiliar

I was filling out one of those online satisfaction surveys, and in the introduction, it reassured me that This survey is anonymous. The first question on the survey: Enter the support request (SR) number below. Yeah, because they'll never be able to trace the support request number back to me. (I suspect that the reason for this ...