Converting Win32 API results to std::wstring (or std::string)

Hmm. Just realized that this is a bit out of order and should have been published before the previous post . It turns out that there are a significant number of Win32 APIs that have a similar calling pattern – you call the API once to find the size of the buffer needed for the…

2

Recursively Deleting a directory–with long filename support.

I recently was updating some test code to handle long filename (longer than MAX_PATH) support. My initial cut at the function was something like the following (don’t worry about the VERIFY_ macros, they’re functionally equivalent to asserts): const PCWSTR LongPathPrefix=L"\\\\?\\"; void RecursivelyDeleteDirectory(const std::wstring &strDirectory) { // Canonicalize the input path to guarantee it’s a full…

9

What’s wrong with this code–a real world example

I was working on a new feature earlier today and I discovered that while the code worked just fine when run as a 32bit app, it failed miserably when run as a 64bit app. If I was writing code that used polymorphic types (like DWORD_PTR) or something that depended on platform specific differences, this wouldn’t…

15

Insecure vs. Unsecured

A high school classmate of mine recently posted on Facebook: Message just popped up up my screen from Microsoft, I guess. “This site has insecure content.” Really? Is the content not feeling good about itself, or, perchance, did they mean “unsecured?” What the ever-lovin’ ****? I was intrigued, because it was an ambiguous message and…

5

Read-Only and Write-Only computer languages

A colleague and I were chatting the other day and we were talking about STL implementations (in the context of a broader discussion about template meta-programming and how difficult it is).   During our discussion, I described the STL implementation as “read-only” and he instantly knew what I was talking about.  As we dug in…

17

What has Larry been doing for two years (and why has the blog been dark for so long)?

As many of you may know, I tend to blog about things I encounter in my day-to-day work that I think might be of general interest.  And for the past two years, even though I’ve run into things that were “blog-worthy”, I couldn’t write about them in public.  And thus no blog posts. But that’s…

21

Getting started with test driven development

I’m at the build conference in Anaheim this week, and I was in the platform booth when a customer asked me a question I’d not been asked before: “How do you get started with test driven development”.  My answer was simply “just start – it doesn’t matter how much existing code you already have, just…

9

Nobody ever reads the event logs…

In my last post, I mentioned that someone was complaining about the name of the bowser.sys component that I wrote 20 years ago.  In my post, I mentioned that he included a screen shot of the event viewer. What was also interesting thing was the contents of the screen shot. “The browser driver has received…

19