The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Why is it possible to create a toolbar with the wrong HINSTANCE? And what's the right HINSTANCE anyway?
A customer observed that all of the following code fragments are successful in creating a toolbar common control: Furthermore, the customer observed that works regardless of whether you pass the process instance or for the parameter. First of all, what's going on? And second of all, which of the three methods above is most correct? We can dispatch Fragment3 easily, because passing as the instance handle is equivalent to passing the process instance handle. Therefore, whatever happens in Fragment3 is explained by whatever happens in Fragment 1. (Treating a instance as a synonym for th...
Why is it so hard to write a program that requires UI Access privilege?
If you want your program to have the UI Access privilege, you have to jump through a few hoops. The program needs to be digitally signed, and it needs to go into the directory. Why is it so hard to get UI Access? Because UI Access bypasses User Interface Privilege Isolation (UIPI) security measures. The more valuable the target, the more substantial the security measures. UI Access allows low-integrity programs to access and interact with the user interface of high-integrity programs. This has historically been the source of security vulnerabilities. UIPI was created in part to prevent this type of security a...
How am I supposed to free the information returned by the GetSecurityInfo function?
The function returns a copy of the security descriptor for a kernel object, along with pointers to specific portions you request. More than once, a customer has been confused by the guidelines for how to manage the memory returned by the function. Let's look at what the function says: ppsidOwner [out, optional] A pointer to a variable that receives a pointer to the owner SID in the security descriptor returned in ppSecurityDescriptor. The returned pointer is valid only if you set the flag. This parameter can be NULL if you do not need the owner SID. Similar verbiage can be...
Microspeak: v-team
Virtual team. But it's a real team, nothing virtual about it.
I'll tell you what I think of the new University of California logo once it finishes loading
Why do some shortcuts not support editing the command line and other properties?
Ben L observed that some shortcuts do not permit the command line and other options to be edited. "Where is this feature controlled? Is there a way to override this mode?" This question is echoed by "Anonymous (Mosquito buzzing around)" (and don't think we don't know who you are), who in a huge laundry list of questions adds, "Why does the Game Explorer limit customizing command line, target, etc?" These questions are looking at the situation backwards. The issue is not "Why do these shortcuts block editing the command line?" The issue is "Why do some shortcuts allow editing the command line?" Recall that ...
It rather involved being on the other side of this airtight hatchway: Writing to the application directory
We received a security vulnerability report that went roughly like this: There is a security vulnerability in the X component. It loads from the current directory, thereby making it vulnerable to a current directory attack. Here is a sample program that illustrates the problem. Copy a rogue into the current directory and run the program. Observe that the rogue is loaded instead of the system one. If you actually followed the instructions, what you saw depended on your definition of "run the program." Let's assume that the program has been placed in the directory . Setting the current directory to t...
Replaying input is not the same as reprocessing it
Once upon a time, there was an application that received some input and said, "Okay, this input cancels my temporary state. I want to exit my temporary state, but I also want the input that took me out of the temporary state to go to whatever control would have received the input if I hadn't been in the temporary state in the first place." (For example, you might want the input that dismisses a pop-up window to be acted upon rather than eaten by the pop-up.) The application decided to solve this problem by regenerating the input message via , so that it goes back into the input queue. The theory, is that when the...
Why do I get notified for changes to HKEY_CLASSES_ROOT when nobody is writing to HKEY_CLASSES_ROOT?
A customer had a question about the function. We are using it to monitor the tree as follows: If I understand the documentation correctly, this registers for notifications when subkeys are added, deleted, or when values are changed. However, it seems that my event becomes signaled at many other times, for example, when I switch folders in an Explorer window. I fired up Process Monitor and confirmed that nobody (not even Explorer) is writing to . Why are we getting spurious notifications? Have we misunderstood what this function does? Everything is working as expected; it's just that your expectation...