A Hole In My Head

Doron Holan's musings on drivers and other nibbles and bits

Browse by Tags

Tagged Content List
  • Blog Post: What should you change in a sample before you ship it?

    I was going to write about how to do this, but the awesome folks at WHDC got to it before I did.  I did get to review it before it was published, so I did have some influence in what is in the tip ;). So on this one my job is easy, just go read the tip !
  • Blog Post: one of the books that started it all...

    During my sophomore year at Cal Poly , I decided that I wanted to learn about threads, synchronization techniques and other topics associated modern operating systems. Windows 95 had made its debut (yes, it is not a modern OS, but I didn't know that at the time!) and I had heard about Windows NT, but...
  • Blog Post: User empathy is a weird thing

    I figured that I had a good deal of empathy for a developer who had to write a driver. I have spent nearly 5 years creating and supporting WDF, learning from the community and drawing on my own experience in how drivers are written. Two of the most common questions is "what IDE should I use" and "can...
  • Blog Post: Better control over /GS stack checking in your driver

    Michael Howard has a great posting on improvements made in the compiler with respect to the /GS flag (stack checking using a "canary" on function exit). Before these changes, #pragmas to explicitly turn the functionality on or off, the compiler itself decided where it was appropriate to add the stack...
  • Blog Post: Creating your own InterlockedXxx operation

    Sometimes your design requires an Interlocked operation that is not currently supported by the OS, runtime libraries, or the compiler (as an intrinsic). You then have a choice to make. Either remove all Interlocked operations for that particular field and use a lock or roll you own Interlocked function...
  • Blog Post: Weird side affect of the day: #defines can be used in your .def file

    I found this one out the hard way today. I was experimenting with the KMDF loader driver (wdfldr.sys). I added the following #define to my sources file so that I could share code between wdfldr and another component and control some functionality based on who was including the file sources: TARGETNAME...
  • Blog Post: The override keyword can be used in C++ afterall (redux on refactoring virtual functions)

    Yesterday I wrote about the two methods I use to refactor a virtual function and make sure that I find all of the derived implementations. In the entry I lamented that I would like to have the C# keyword override implemented in C++. Well, apparently it is (at least in the Microsoft compiler)! Check it...
  • Blog Post: How I refactor virtual functions

    As with many development projects, I had to refactor some code in KMDF. This refactor involved changing the signature of a virtual function to take additional parameters. The problem I faced is that C++ makes no distinction between declaring a new virtual function and a virtual function which overrides...
  • Blog Post: Hindsight is 20/20, EvtDriverUnload should have not been in KMDF

    The KMDF model evolved over the entire development cycle. It was refined and refactored multiple times. A lot of WDM abstractions leak through the to the KMDF model. These leaks usually forced their way into the model because without them, KMDF cannot function properly. Other abstraction leaks were just...
  • Blog Post: Annotating fall through case statements in a switch

    Accidental fall throughs in a switch statement can lead to some nasty bugs. I have used the following banner for quite a long time to indicate that the fall through is intentional and not an oversite (this banner is also a part of the KMDF coding guidelines). It has definitely helped me debug coding...
  • Blog Post: Using ntintsafe.h is a great idea, but I don't know how readable the results are

    The addition of ntintsafe.h for detecting integer overflow/underflow is a great addition to the WDK. It unifies how everyone detects these math errors, leading to common code that anyone can pickup and see what it does...BUT, I have found it does have a "tax." What is actually being computed can be become...
  • Blog Post: Apple's Secure Coding Guide

    While I don't write apps or drivers for the Macintosh, some of you out there probably do. If you have not already seen it, they posted a Secure Coding Guide ( PDF ) which is focused on OS X, but has generic recommendations as well. I just started reading it, so I don't have much of an opinion about it...
  • Blog Post: Not a big fan of #ifdef or #ifndef

    I am not a big fan of the C/C++ preprocessor directives #ifdef or #ifndef . I am not denying that they certainly have their place and usage in the language. I'll first write about where I think they are useful and then about the situations where I feel they are not. #ifndef is very useful...
  • Blog Post: How to break in at the call site that invokes the break point

    I think everyone at some point in time wants to embed a break point in there code, whether it be for debugging purposes, path tracing, or detecting edge conditions that have not yet been tested. When I hit a break point, I would prefer that the debugger break in at the call frame which needs the break...
  • Blog Post: Avoiding #defines for constant data and using enums instead

    I think that the C preprocessor is a very powerful tool, but I like to limit my use of #defines. I have already touched on this when i talked about why I liked FORCEINLINE and I want to talk about it some more. I realize I can't eliminate the use of #defines throughout all of my code for various reasons...
  • Blog Post: When is string constant not really constant?

    While this is not necessarily specific to a driver, the affects can be, so read on. A string constant (e.g. "Foo") all by itself is harmless, but if you use the string constant when initializing a variable, it depends on how you declar the variable and then use it. If you intialize the variable this...
  • Blog Post: I like FORCEINLINE

    For kernel mode code, if I have choice between using a #define or a FORCEINLINE function, the FORCEINLINE function wins every time. #defines have their place, especially for quotifying (the # operator) or concatenating (the ## operator), but they have no place in my heart for constants or pseudo functions...
Page 1 of 1 (17 items)