Showing archive results for 2010

Jan 28, 2010
Post comments count0
Post likes count1

What idiot would hard-code the path to Notepad?

Raymond Chen
Raymond Chen

There seemed to be a great deal of disbelief that anybody would hard-code the path to Notepad. Here's one example and here's another. There's a large class of problems that go like this: I'm running Program X, and when I tell it to view the error log, I get this error message: What is wrong and how do I fix it? Obviously, the file is ...

Code
Jan 27, 2010
Post comments count0
Post likes count1

If you are trying to understand an error, you may want to look up the error code to see what it means instead of just shrugging

Raymond Chen
Raymond Chen

A customer had a debug trace log and needed some help interpreting it. The trace log was generated by an operating system component, but the details aren't important to the story. I've attached the log file. I think the following may be part of the problem. Any ideas? Thanks, Bob Smith Senior Test Engineer Tailspin Toys What struck me i...

Tips/Support
Jan 26, 2010
Post comments count0
Post likes count1

Microspeak: Zap

Raymond Chen
Raymond Chen

You may hear an old-timer developer use the verb zap. That proposed fix will work. Until everybody gets the fix, they can just zap the assert. The verb to zap means to replace a breakpoint instruction with an appropriate number of NOP instructions (effectively ignoring it). The name comes from the old Windows 2.x kernel debugger. (Actually, ...

CodeMicrospeak
Jan 25, 2010
Post comments count0
Post likes count1

Why doesn't the window manager have a SetClipboardDataEx helper function?

Raymond Chen
Raymond Chen

Jonathan Wilson asks why the clipboard APIs still require GlobalAlloc and friends. Why is there not a or something that does what does but without needing to call ? Okay, here's your function: Whoop-dee-doo. Historically, Windows doesn't go out of its way to include functions like this because you can easily write them yourself, or you ...

Code
Jan 22, 2010
Post comments count0
Post likes count1

During process termination, the gates are now electrified

Raymond Chen
Raymond Chen

It turns out that my quick overview of how processes exit on Windows XP was already out of date when I wrote it. Mind you, the information is still accurate for Windows XP (as far as I know), but the rules changed in Windows Vista. What about critical sections? There is no "Uh-oh" return value for critical sections; doesn't have a...

Code
Jan 21, 2010
Post comments count0
Post likes count1

Historically, Windows didn't tend to provide functions for things you can already do yourself

Raymond Chen
Raymond Chen

Back in the old days, programmers were assumed to be smart and hardworking. Windows didn't provide functions for things that programs could already do on their own. Windows worried about providing functionality for thing that programs couldn't do. That was the traditional separation of responsibilities in operating systems of that era. If you want...

Other
Jan 20, 2010
Post comments count0
Post likes count1

The wrong way to determine the size of a buffer

Raymond Chen
Raymond Chen

A colleague of mine showed me some code from a back-end program on a web server. Fortunately, the company that wrote this is out of business. Or at least I hope they're out of business!

Code
Jan 19, 2010
Post comments count0
Post likes count1

The hardest part of writing the video game Monty Python's Complete Waste of Time

Raymond Chen
Raymond Chen

Many years ago, I happened to have lunch with one of the programmers who worked on the video game Monty Python's Complete Waste of Time (read a review). This program was notable in many ways, most geekily that it was brought on board the Mir space station by astronaut Michael Foale. Anyway, during the course of lunch, I learned something unusual...

Non-Computer
Jan 18, 2010
Post comments count0
Post likes count1

People just like you, for certain values of you

Raymond Chen
Raymond Chen

I received a brochure in the mail for a local church which says that it's "full of people just like you." Everybody in the brochure is white. "You'll fit right in!" it concludes. Bonus chatter: My friends guessed that perhaps the church members are all computer programmers who work at Microsoft and speak Swedish badly.

Non-Computer
Jan 18, 2010
Post comments count0
Post likes count1

It's fine to rename a function in your DEF file, but when you do, you have to link to that function by its new name

Raymond Chen
Raymond Chen

Jeffrey Riaboy asks why, if he renames a function in his DEF file, attempts to link to the function by its old name fail. Well, um, yeah, because you renamed it. Let's take the situation apart a bit; maybe it'll make more sense. I'm going to ignore a lot of details (, calling conventions) since they are not relevant to the discussion and wou...

Code