Showing tag results for Code

May 25, 2007
Post comments count0
Post likes count0

The parameters to PostQueuedCompletionStatus are not interpreted

Raymond Chen
Raymond Chen

Larry Osterman mentioned this almost in passing quite a while ago, that the parameters to are not interpreted by the operating system. Well, obviously the first parameter, the handle to the completion port, is interpreted as the handle to the completion port. But the other parameters, , , and are not interpreted at all. Even though they have na...

Code
May 21, 2007
Post comments count0
Post likes count0

Don't be helpless: I don't know anything about MFC modal loops, but unlike some people, I'm not afraid to find out

Raymond Chen
Raymond Chen

Commenter Tom Grelinger asks via the Suggestion Box: If I have a modal CDialog that is visible and usable to the user. Let's say I receive an event somewhere else in the program and I call DestroyWindow on the modal CDialog from within the event. I notice that the OnDestroy is called on the CDialog, but DoModal never exits until a WM_QUIT is po...

Code
May 8, 2007
Post comments count0
Post likes count0

Session 0 isolation: Where backward compatibility loses to security

Raymond Chen
Raymond Chen

One of the major changes to services in Windows Vista is session 0 isolation. After reading the summary, you can follow that first supplementary link, Impact of Session 0 Isolation on Services and Drivers in Windows Vista, to dig deeper and receive guidance on how you need to modify your service. Then again, some of the questions I see regar...

Code
May 7, 2007
Post comments count0
Post likes count0

Drag and drop is a general purpose transfer model, not exclusive to Explorer directories

Raymond Chen
Raymond Chen

If you've designed your program so that it assumes that the the only thing a user can use drag/drop for is dropping your object into a file system directory, then you've already lost. piers wants to be able to determine the destination of a drag/drop operation. From the description, it appears that what piers really wants is the destination path,...

Code
May 4, 2007
Post comments count0
Post likes count1

How my lack of understanding of how processes exit on Windows XP forced a security patch to be recalled

Raymond Chen
Raymond Chen

Last year, a Windows security update got a lot of flack for causing some machines to hang, and it was my fault. (This makes messing up a demo at the Financial Analysts Meeting look like small potatoes.) The security fix addressed a category of attacks wherein people could construct shortcut files or other items which specified a CLSID that was neve...

Code
May 2, 2007
Post comments count0
Post likes count0

The old-fashioned theory on how processes exit

Raymond Chen
Raymond Chen

Life was simpler back in the old days. Back in the old days, processes were believed to be in control of their threads. You can see this in the "old fashioned" way of exiting a process, namely by exiting all the threads. This method works only if the process knows about all the threads running in it and can get each one to clean up when it's time ...

Code
Apr 30, 2007
Post comments count0
Post likes count0

The default verb is not necessarily "open"

Raymond Chen
Raymond Chen

If you hunt around the Internet you'll find lots of people† who hard-code the string as the second parameter to the function, indicating that they want to open the document specified as the third parameter. While that's a nice thing to want to do, it might not be the right thing. When the user double-clicks a document, the shell executes ...

Code
Apr 27, 2007
Post comments count0
Post likes count0

Stupid debugger tricks: Calling functions and methods

Raymond Chen
Raymond Chen

Back in the old days, if you wanted to call a function from inside the debugger, you had to do it by hand: Save the registers, push the parameters onto the stack (or into registers if the function uses or ) push the address of the function, move the instruction pointer to the start of the function you want to call, then hit "g" to resume executi...

Code
Apr 20, 2007
Post comments count0
Post likes count0

The format of bitmap resources

Raymond Chen
Raymond Chen

The next entry in the continuing sporadic series on resource formats is the bitmap. You thought accelerator tables were simple; bitmaps are even simpler. A bitmap resource takes the same form as a file, except that there is no . That's all.

Code
Apr 18, 2007
Post comments count0
Post likes count0

Psychic debugging: Why you can't control page navigation when using PSP_DLGINDIRECT

Raymond Chen
Raymond Chen

Here's a problem that floated past a few years ago. We switched our wizard from using dialog resource IDs to using because [reasons deleted since they aren't important]. But once we did that, the Next button doesn't work! Anybody have any ideas what's going on? I made things a little easier by deleting the information that isn't relevant to the...

Code