Monday, September 01, 2008

Unified versioning for windows drivers

Every new release of a windows driver involved updating the version number in a lot of places, mainly:
- The resource file
- The inf file
- The source file (Mainly for debug purposes)
This was a lot hectic until one day I sat down to unify the version updation to one file, which can be used in all places.

The result is the following file, which we shall call 'version.h'



#ifndef _VERSION_H_
#define _VERSION_H_

#if 0
STAMPINF_VERSION=1,0,0,1
STAMPINF_VERSION_STR="01.00.00.01"
STAMPINF_DATE="12/21/2007"
#else
#define VER_PRODUCTVERSION 1,0,0,1
#define VER_PRODUCTVERSION_STR "01.00.00.01"
#endif

#endif

It can be included in the source and resource file and the defines VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR can be used.

It can also be safely included in makefile.inc and the defines STAMPINF_VERSION, STAMPINF_VERSION_STR and STAMPINF_DATE can be used to update the inf files using the stampinf utility that comes with WDK.

Now, every new release requires updating only a single file and has become a lot easier.

No comments: