Dave Cutler and the Bill Gates award

image Adam Barr beat me to a post that I wanted to write after the Microsoft company meeting on Thursday - Dave Cutler winning the Bill Gates award. Adam has a nice summary of what the award is and a couple of typical DaveC anecdotes.

What he doesn't describe is the atmosphere in the stadium when Bill Gates announced Cutler's name - you had thousands of employees give DaveC a standing ovation (and laugh at the joke DaveC cracked in his acceptance speech which I see Adam wisely left out :-) ). I remember telling someone sitting next to me "There goes any chance I had of ever winning this thing". When you start of an award series by handing one to Cutler, you're setting a standard which is almost impossible to live upto.

After the event, I sent him a heartfelt 'thank you' mail. I'm not sure whether he read it (I haven't gotten a reply yet) but I wanted to convey the gratitude that all of us felt - no accolade or award is too much for this man. Studying Cutler's life and his work in the past year or so have lead me to my current fascination for how to do good, sound 'engineering' (as opposed to just writing code and hacking together code).

I've talked to a lot of people who have worked with Cutler in the past. Almost everyone I spoke usually had two things to say

The latter is where all the fun anecdotes come from. Here are a couple of anecdotes I've heard from people who had worked with Cutler in the past. All these probably happened over a decade ago.

 

Seriously though, Cutler is probably the greatest programmer to work at Microsoft (a senior friend of mine called him a "contender for the programmer of the century of the century award"). If you're at Microsoft, I would strongly recommend reading through Cutler's code (you can do this if you are a student and have access to the Windows Research Kernel). I learnt a lot about how to write beautiful C code by looking at his scheduler implementation in the NT kernel. Above the level of coding style, it is pretty evident that he was able to make design choices back in the late 1980s that have let the NT kernel scale and adapt itself in a wide variety of ways.

Designing and writing large parts of an operating system that is used by almost a billion people - that's a pretty tough act to follow.

Notes

1. I think the person who told me this anecdote said it was a 'she' but I could be mistaken.


 

Apps of yesteryear (or) The one in which I feel old

A conversation I had with Aarthi yesterday went like this

Me: I feel old.

Aarthi: Why?

Me: In the past, when I saw some good-looking girl on television and looked her up on the web, she would be much older than I am. Today, I looked up Deepika Padukone and to my shock and horror, she's 3 years younger! I feel middle-aged.

 

Seriously though, I've now spent enough time with computers to see a generation of software. I find that my usage of software has changed - I no longer use apps that I used to use all the time 4-5 years ago. Here are some of the apps I used to use a lot in the past but now no longer use at all.

Note - most of the apps below still have thriving user-bases so don't read this as a 'X or Y was used in the past but is now dead' post.

 

Winamp

For several years, Winamp was my music player of choice. I don't remember how exactly I came across it - I must have got it through one of those computer magazine CDs I used to collect back then. I remember collecting hundreds of skins for it and installing a zillion different plugins ( the most memorable were the DSP plugins which did magic to how it *sounded*).

This was back in the day when a new version of some software had new features (as opposed to a security fix :-) ). Whenever there was a new version distributed, I would install it and go straight to the About screen where there would be some funny release notes.

What I use now

Windows Media Player / iTunes

I'm not quite sure why I moved away from Winamp - I do remember spending a long time away from it after the disastrous Winamp 3 and then moving back to Winamp 5. I think over time, WMP caught up and fixed a lot of the annoyances that had stopped me from using it in the past.

To Winamp's credit, a lot of my friends back home in India still swear by it. This may just be a case of me being assimilated by the B0rg :-)

IrfanView

Before the likes of Picasa and Windows Live Photo Gallery, you were out of luck if you had an image in a non-mainstream format (I used to run into this a lot from my past in game map-making) . You can argue that you're still out of luck but I just don't deal with much of those images anymore. IrfanView was the best story in town for image viewing - it could deal with images from almost any format and was *very* light-weight.

From the website, it appears that IrfanView is still going strong. The author appears to be getting..umm... a lot of love from his users. Quoting from his site

...In the years since IrfanView hit the Net I've received more than 50,000 e-mail messages thanking me, congratulating me, and wishing me well. And at least a dozen women have wanted me to be the father of their children ;-)...

What I use now

The picture viewer built into Windows or whichever OS I happen to be using at the moment. I've dabbled with Picasa and Windows Live Photo Gallery but have found plain ol' files and folders good enough for most of my needs.

IrfanView is still a great app - there are lessons to be learnt from the community support it enjoys (check out the number of codecs, skins packs, etc).

Winzip

Winzip was the de-facto archiver pretty much wherever you went. I remember seeing it on all my school computers, all the computers at college and on every friend's PC. However, I always remember seeing the shareware version (which used to pop-up a nag screen) so I'm not sure whether any of the people I saw actually bought a copy of it.

I remember the day when I stopped using the Winzip 'wizard' and just used the plain interface. That was probably the first time I felt like a true 'power user' :-).

I hadn't followed Winzip news for a few years now - they seem to have been acquired by Corel and do have a new version (v11.1) out. They also have support for RAR and Bz2 now so I should probably go and give them a try.

What I use now

I moved to using WinRar and now 7-zip for some of the more esoteric compression formats. For good ol' zip files, I just use the 'Compressed Folders' support built into Windows.

Visual Basic 6.

What more can I say :-). This was the single biggest reason I took up programming full-time. Though I don't use VB day-to-day anymore, I stillimage feel that my life revolves around the VB family. Apart from the fact that I work in the same building as the VB team, what we're doing with  Popfly is in a lot of ways, VB 'for the web'.

It annoys me that VB6 doesn't get the credit it deserves at times. I would rank it as one of Microsoft's greatest applications ever, probably second only to Windows 95 and some of the Office releases.

Sometimes, I miss the days of installing VS 6 and then MSDN from the multiple CDs (ok- maybe not the multiple CDs bit). I should have guessed back then that I'll wind up working for Developer Division and be a part of making Visual Studio :-)

 

What I use now

Too many to list here :-)

 

I can think of a lot more apps that I've used in short bursts - Paintshop Pro, ACDSee, WinAce. Before anyone flames me, this list is Windows only because that's where I've done almost all of my computing. Also, a lot of the open source apps I use (Firefox/Thunderbird) are still apps that I use everyday.

 

I wonder whether someone will go through a similar exercise a few years later with social network sites of today :-). Does anyone have other examples of applications they used a lot in the past?


 

Social Graph = Blogging 2.0?

Is it just me or are the people talking about the 'social graph' and speaking at conferences around the theme the same folks who were speaking at blogging conferences until they became passe ?

It's getting to the point where I just skip over any post in my feed reader which has the term in it.

P.S I don't include people like danah boyd or Dare Obasanjo in the list above as they actually *work* in that area. 


 

A 'Hello World' Windows driver from scratch

One of the advantages of having no social life is that you get to spend long weekends catching up on technical topics that you otherwise wouldn't be able to :-). For this weekend, I decided to take a break from the usual feverish Popfly hacking and catch up on some stuff I've always wanted to dig into but never really found the time for. 

On the top of my list was to go and learn how Windows *really* works in kernel mode (a  pretty long way away from my daily managed code/JS hackery). I ordered a copy of Microsoft Windows Internals by the incomparable Mark Russinovich and David Solomon and after some re-reading (the last time I read it was over a year ago), set out to write my first device driver. 

This is not the first time I've tried to do so and I've often forgotten how to get started . This post is mostly a reference for me to come and look up later.

Note: This really isn't a tutorial. I would strongly suggest that you read all of James Brown's tutorials which do a much better job of *explaining* this stuff.

Pre-requisites (all free downloads)

Code for your driver

1. Create a directory where your driver sources will lie. For the following example, all my source files will lie in C:\testdrv

 

2. Create a file called test.c with the following contents. This is as simple a driver as you can get (in fact, it doesn't even know how to unload itself). When started, it prints a 'Hello World' message which any attached kernel debugger or DbgView will see.

#include <ntddk.h> 
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)  
{
  DbgPrint("Hello World\n");
return STATUS_SUCCESS;
}

3. Create a file called makefile.def with the following line it it. This pulls in the appropriate makefile for your build environment (more on that later).

   !INCLUDE $(NTMAKEENV)\makefile.def


4. Create a file called sources (note that it doesn't have any extension) with the following contents. This specifies which source files you are compiling, that it will build a driver and the headers and lib files to use. 



TARGETNAME = test
TARGETPATH = obj
TARGETTYPE = DRIVER

INCLUDES = %BUILD%\inc
LIBS = %BUILD%\lib

SOURCES = test.c

 

Building your driverimage

1.  Click on Start->All Programs->Windows Driver Kits->WDK 6000->Build Environments->Windows Server 2003->Windows Server 2003 x86 Checked Build. I'm picking this since I have a 32-bit Win2k3  VPC - pick the one which matches the closest with your target machine. For example, if you have a physical Windows Vista x64 machine you want to try out your driver on, you would pick 'Windows Vista and Windows Server Longhorn x64 Checked Build Environment'.  

 This drops you into a command prompt with some nice environment variables (your build environment) already set for you.

 

2. Change to the directory which has your driver source and run 'build'. This invokes build.exe , the de-facto Microsoft build tool for almost two decades until MSBuild came on the scene (and even now, a lot of product groups still use build.exe). Written by Steve Wood over 15 years ago, this is one tool that has withstood the test of time :-) 1

image 

If you've followed along well, you should see a test.sys and a test.pdb (along with other files) in your object build directory.

 

Setting up your target machine for kernel debugging

1. To attach a kernel debugger to a running instance of Windows, you need to do some minor configuration. In the target VPC Win2k3 instance, go to My Computer->Properties->Advance->Settings under Startup and Recovery->Edit. You should see a line like

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /NoExecute=OptOut

Add "/debug /debugport=com1" to the line above (without the quotes).

If you're using Windows Vista as your target operating system, you can't use this technique - you'll have to use the inbuilt bcdedit.exe utility.

2. In the virtual machine's settings, redirect the COM port to a pipe called \\.\pipe\vpc . What we're doing here is telling Windows to redirect all debug spew to the COM1 port and then telling VPC to redirect COM1 to a named pipe.

image

3. Restart the virtual machine (the boot settings need a restart to kick in).

4. One final step - running the kernel debugger! Run windbg with the following command-line (if you already have symbols setup correctly, ignore the -y parameter).

windbg-y SRV*c:\symbols*http://msdl.microsoft.com/download/symbols -k com:pipe,port=\\.\pipe\vpc,resets=0,reconnect

This should open up windbg and connect it to your running instance of Win2k3 on VPC.

 

Registering and running your driver image

Whew. Just a couple of steps more and we'll be home. The last 2 things for us to do are to register the driver and then to run it. Our driver currently cannot be unloaded (the ability to do so would just require 4 more lines of code though) so you'll have to restart the machine manually to see new changes reflected.

1. First, let's register the driver. James Brown's tutorial covers some of the ways you can register the driver but (like him), I'll recommend downloading the 'Driver Loader' utility from http://www.osronline.com which unfortunately requires a free registration. Run it on your target Win2k3 VPC

2. Copy your drivers' binaries over to the VPC (I typically do this using the shared folder feature). Point Driver Loader to your binary and register your driver. This needs to be done only once irrespective of how many times you rebuild your binaries. 


If you've followed along so far, congratulations for you're finally home. Hit 'Start Service' in 'Driver Loader'. This should result in a call to your DriverEntry method and in your WinDBG running on the host computer, you should see this

image 
 
To quote John McClane, Yippie-Ki-ay <insert non-family-friendly-term>!

From here, it is pretty trivial to start exploring. Here's a screenshot of a breakpoint in my DriverEntry routine (the WRK stuff is because I'm running a custom Windows kernel built from the publicly available Windows Research Kernel code).

image


 Happy hacking!


 

Notes

1. If you're interested in the internals of build.exe, you should check out the code that ships with Rotor (online cached copy here). However, I haven't checked to see whether it is from the same code base as the real build.exe.


 

NYTimes on mashups

The NYTimes is running a piece on mashups written by Anne Eisenberg which has a section on Popfly with quotes from John. I was involved with this piece, though quite tangentially.

A few weeks ago, I was going through my check-mail-first-thing-after-waking-up routine with my personal mail account. Instead of clearing out of my junk folder without checking it (as I usually do), I saw a mail there from Anne. My mental reaction in the first few seconds went from "This must be a hoax" to "Oh cr*p - someone from the NYTimes got my email id from my blog. Did I just blog something which I'm going to get fired over?"

Thankfully, neither was true :).

Anne - if you're still reading, thanks for the kind words about my writing skills :-)


Archives

November 2004   January 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006   January 2007   February 2007   March 2007   April 2007   May 2007   June 2007   July 2007   August 2007   September 2007   October 2007   December 2007   January 2008   February 2008   March 2008