Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Nifty Win32 tri... » Things you shouldn't do.   (RSS)
Recently I’ve been working on something that I’ve never done before in my almost 24 years at Microsoft.    For the past 23ish years, I’ve been a plumber – all the work I’ve done has been under the covers.  But for the next version of Windows, Read More...
Eagle Eyed reader Jens Geyer sent me an email yesterday asking: There's a KB article, where there is an example code how to determine if the current process/thread is running from admin account. The sample code changed in the newest revision of that KB Read More...
I always love it when the operating system I run finds new ways to absolutely delight me. Yesterday, due to a stupid pilot error, I accidentally deleted all the music and pictures from my machine at work (8G of pictures and 30G of music). This wasn't Read More...
I got an email from someone using the contacts form asking: There is an article on MSDN about using VirtualAlloc to reserve then commit memory pages. Here is the link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/reserving_and_committing_memory.asp Read More...
This may be the shortest "Bad Code" I've ever done, but it keeps on surprising me how many times I see this problem (people asked me questions about it twice in the past week). // BadCode18.cpp : Defines the entry point for the console application. // Read More...
One of Raymond 's more endearing features is what he calls "Psychic Debugging", it even made his wikipedia entry (wow, he even has a wikipedia entry, complete with picture :)) There's a variant of Psychic Debugging called "Psychic Perf Analysis". It works Read More...
Well, that was certainly interesting. My last "what's wrong with this code" post had to do with a real-world bug in some of the notification infrastructure that's used for audio. I took some sample code done while developing the prototype, and stripped Read More...
Keeping up with the "theme" of COM related bad code examples, here's another real-world example. To avoid any ATL confusion, it's 100% pure C++. Our test team rolled out a new set of tests last week and immediately hit this one. The funny thing is that Read More...
Well, clearly the shorter the example, the quicker people pick up the problem. The problem was: if (!CreateProcessW(NULL, PROCESS_NAME, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation)) The issue here is that you can't pass Read More...
The wired network in my building's being unusually flakey so I'm posting this from my laptop, sorry for the brevety.. Slashdot had a front page story today about an article be Adrian Wong posted in his Rojak Pot: " Virtual Memory Optimization Guide ". Read More...
In yesterdays post I presented a trace log writer that had a subtle bug. As I mentioned, the problem had nothing to do with the code, but instead, the problem had to do with the directory in which the trace log file was written. My second hint to the Read More...
Today, let’s look at a trace log writer. It’s the kind of thing that you’d find in many applications; it simply does a printf and writes its output to a log file. In order to have maximum flexibility, the code re-opens the file every time the application Read More...
Over most of this week, I’ve discussed how ignoring the underlying network architecture can radically hurt an application . Now it’s time for a war story about how things can go awry if you don’t notice these things. One of the basic Read More...
Ok, time for another “what’s wrong with this code” problem. This time, I’m writing a DLL. Nothing complicated, just a plain old DLL. As is expected, I publish a header file for my api: // The following ifdef block is the standard Read More...
In yesterday’s post , there was one huge, glaring issue: It completely ignored internationalization (or i18n in “internet-lingo”). The first problem occurs in the very first line of the routine: if (string1.Length != string2.Length) Read More...
More Posts Next page »
 
Page view tracker