Monthly Archive for July, 2011

How to repackage a NDIS driver

Several months ago I met a new challenge in shape of a device driver I’ve never seen before called…

NDIS – Network Driver Interface Specification.

I dont want to loose much time with talking about the “driver type” itself, because you can get all information from a well written wikipedia article.

Such a driver usually consists of the very typical driver files:

Inf File, Cat File & Sys File. Everything signed as you might expect of course.

My first attempt was to install the driver the “Ontrex Best Practices” way which usually means either to use the difxapp merge module or the dpinst.exe executable (custom action).

Unfortunately, none of them led to to same result as the original package had behave.

After googling around a bit I finally came to the tipping point: netcfg.exe

This executable is present on every windows at least since windows 2000 and basically helps you to automate any “Network Card” related installation tasks like

- Installing/servicing/uninstalling Network Protocols (e.g. Internet Protocol Version 4 (TCP/IPv4)

- Installing/servicing/uninstalling Network services (e.g. QoS Packet Scheduler)

- Installing/servicing/uninstalling Network Clients (e.g. Client for Microsoft Networks)

Kindly asked the program offers me the following command line parameters:

So the last missing information in the puzzle is how do I know the component id for my driver?

Solution was simple: I had installed the original package and searched through the registry  using the INF Filename and this offered me the following result:

 

Now I had all required information to schedule a custom action in my package to install the driver.

Because netcfg.exe is already on every windows installation I used the type “Execute Program From Destination” (MSI SDK: Custom Action Type 34)

[System64Folder]netcfg.exe -l “[#netlwf.inf]” -c s -i BNNS_NdisLwf

In our case the target operating system  was a x64 OS and therefore we needed to specify the [System64Folder].

Because the action changes the system state it logicaly belongs to the “deferred” installation sequence.

 

 

 

 

 

 

 

 

Ontrex Best Practices Part II – ProductVersion

Our Ontrex Best Practices series continues with a very underestimated topic.

We are talking about the ProductVersion Property today.  As many of you already may know the property has to be formatted as follows:

major / minor / build 255.255.65535 (Source: http://goo.gl/Dj3l2)

Usually when we are repackaging we try to adapt the original Product Version as good as possible. But Unfortunately sometimes the vendor’s intended product version does not really fit in this schema which causes several problems like

  • Not possible to take over the version at all (eg. 2010.10.10) because it simply doesnt fit into the maxium values of 255.255.65535
  • They only increment the fourth field which is simply non-existent in Windows Installer
  • They add some strange leading zeros into some fields (Why?)

We have now enforced some general guidelines regarding this to encounter any problems which may be caused by those strange vendor habits:

  1. We only keep the first three  fields of any original product version (e.g 10.3.181.14 becomes 10.3.181), Major Upgrade is still possible (however limited) but causes an ICE error. Joining 2 fields together is strictly forbidden.
  2. Leading zero’s have to be eliminated from any field (e.g 1.09.10 becomes 1.9.10)
  3. Any non fitting Product version will be resetted to 1.0.0 (eg. 2010.23.1)

To conclude my blog article i really want to appeal to all developers out there:

Please try to adapt the windows installer product version schema. And avoid, at all costs, having only incremented the fourth field for any reasons. The fourth field should, if present, be used as build number only.

Therefore my recommendation for a versioning schema is as follows:

Major Release(255) . Feature Enhancements (255) .  Bugfixes / Patches (65535) . Build Number (Unrelevant and ignored by Windows Installer anyway)

And, of course, do not use any kind of date for the versioning schema! :)

 

 

 

 

 

SPA Blog goes international

The Ontrex SPA Team is proud to announce that our future Blogs will be authored in English as the growing amount of visitors are from international destinations.

This is our first step to provide our technical know how to a wider audience.

We also would like to introduce our offical Ontrex SPA Twitter Account:

http://twitter.com/ontrexspa

Feel free to follow us. we are looking forward to interesting discussions about packaging, software virtualization and other related subjects in the twittersphere.

Yours Sincerely,

Ontrex SPA Team