Windows started picking up the really big pieces of TerminateThread garbage...
Ah, TerminateThread. There are still people who think that there are valid scenarios for calling TerminateThread. Can you explain how ExitThread works? We are interested because we have a class...
View Articlep/invoke gotcha: C++ bool is not Win32 BOOLEAN is not UnmanagedType.Bool
Welcome to CLR Week. I hope you enjoy your stay. A customer reported that their p/invoke was not working. We aren't getting the proper return codes from the AuditSetSystemPolicy. When the call...
View ArticleIf you are going to call Marshal.GetLastWin32Error, the function whose error...
A customer reported that their p/invoke to a custom DLL was failing, and the error code made no sense. // C# using System; using System.Runtime.InteropServices; using System.Diagnostics; class Program...
View ArticleIf you are going to call Marshal.GetLastWin32Error, the function whose error...
Even if you remember to set SetLastError=true in your p/invoke signature, you still have to be careful with Marshal.GetLastWin32Error because there is only one last-error code, and it gets...
View ArticleI saw a pinvoke signature that passed a UInt64 instead of a FILETIME, what's...
A customer had a question about a pinvoke signature that used a UInt64 to hold a FILETIME structure. [DllImport("kernel32.dll", SetLastError = true) static external bool GetProcessTimes( IntPtr...
View ArticleHandy delegate shortcut hides important details: The hidden delegate
One of my colleagues was having trouble with a little tool he wrote. I installed a low-level keyboard hook following the code in this article, but it crashes randomly. Here's what I know so far: I...
View ArticleInsightful graph: The ship date predictor
The best graphs are the ones that require no explanation. You are just told what the x- and y-axes represent, and the answer just jumps out at you. One of the greatest graphs I've seen at Microsoft is...
View ArticleMicrospeak: DRI, the designated response individual
Someone sent a message to a peer-to-peer discussion group and remarked, "This is critical. I'm a DRI at the moment and have some issues to fix." The term DRI was new to many people on the mailing list...
View ArticleRules can exist not because there's a problem, but in order to prevent future...
I lost the link, but one commenter noted that the ReadFile function documentation says Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using...
View ArticleThe Windows 95 I/O system assumed that if it wrote a byte, then it could read...
In Windows 95, compressed data was read off the disk in three steps. The raw compressed data was read into a temporary buffer. The compressed data was uncompressed into a second temporary buffer. The...
View ArticleDebugging walkthrough: Access violation on nonsense instruction, episode 3
A colleague of mine asked for help debugging a strange failure. Execution halted on what appeared to be a nonsense instruction. eax=022b13a0 ebx=00000000 ecx=02570df4 edx=769f4544 esi=02570dec...
View ArticleHow do I enumerate remembered connections that are not currently connected?
Harry Johnston wanted to know how to get a list of remembered (but not currently connected) drive mappings. The idea here is to make a tweak to the Little Program. Start with what we had and make...
View ArticleMicrospeak: move the needle
The phrase move the needle is part of general business jargon, but it is very popular here at Microsoft. You need to know what it means, and more importantly, you need to be willing to throw it around...
View ArticleI saved some files into the Program Files directory, and now they're gone!
A customer reported that they saved some files in the Program Files directory, but when they went back to check, the files were gone! What happened? What most likely happened is UAC Virtualization....
View ArticleWhen I change the icon in my shortcut, why doesn't it update on the screen?
A customer was having trouble updating the icon in one of their shortcuts. Here's what they shared with us: i_shell_link->SetIconLocation(icon_file.value().c_str(), 0); "Changing the icon from the...
View ArticleUsing an intermediate library to make the main library retargetable
A customer was developing a static library targetting both Windows XP Win32 applications and universal Windows apps. (This was before Windows XP reached end-of-life.) Our library uses critical...
View ArticleI guess this explains why Warren Buffett hasn't retired
Microsoft provides to its employees a retirement calculator that is more detailed than the kinds you can find on the Internet. After gathering all sorts of information, including your savings and...
View ArticleCynical interpretations of various project milestones
Official nameCynical interpretationCoding milestoneWriting new bugsIntegration milestoneMerging bugs from other teamsStabilization milestoneFixing bugs
View ArticleRaymond's Windows Universal Samples API concordance
If you want to find an SDK sample that uses a particular feature of the Universal Windows Platform, you can try my Windows Universal Samples API concordance on...
View ArticleHow do you get network connectivity from the worst PC in the world?
Some time ago, I wrote about the two worst PCs ever. The worst PC of all time, according to PC World magazine was the Packard Bell PC. As installed at the factory, the computer came with every single...
View Article