Background
When I discovered that Mike Brutman had released his first version of NetDrive I became curious to see what the code looked like, how it worked etc, so I loaded the device driver (NETDRIVE.SYS) in IDA Pro to take a quick peek. As I was reading the code I saw plenty of room for improvement in the form of optimizations so I figured it would be a fun project to properly reverse engineer it just to see how much I could reduce the size of the driver.
As time went by, Mike would release updates and I would update my version of the driver to keep it up to date with his changes while continuing work on the optimizations. Eventually, the project became more of a fork than just optimizations because I started adding functionality before Mike. (I wanted the ability to use other packet driver applications while having drives connected with NetDrive.) This is why the packet driver emulation is so different between the two drivers and there are pros and cons to each (more on that below).
Well over a year later, this is the result.
Differences
There are many differences between my driver and Mike's but I'll just mention the major ones;
* My driver can be customized with up to eleven different defines when building it. The overall objective is to reduce memory usage so most of the defines will cut some functionality - for example, the packet driver emulation, the read-only RAMDrive, code for collecting statistics etc.
Here's a table for easy comparison:
* If you press Control while my driver is loading you will get 1) additional info about build flags (defines) used when the driver was built (useful for determining the exact version for debugging purposes or to recreate the driver at a later time) and 2) the option of not loading the driver (useful if the driver causes a hang at boot under older DOS versions where stepping through CONFIG.SYS is not possible).
* My driver has HLT instructions in the polling loops where the driver is waiting for a response from the server. The idea is to reduce power usage and heat emission. Note that this can in rare cases cause problems (hangs) on some buggy CPU:s such as early revisions of the 486DX4-100 CPU:s. If so, adding NOHALT to the end of the command line in CONFIG.SYS will disable this functionality. (Please let me know if this is required for any of your machines.)
* The packet driver emulation in Mike's driver can only accept one protocol registration at a time. This means that it will only work with applications that uses just one protocol, or, with applications that registers themselves as receivers of all packet types - the mTCP applications all belong to this group. Any application that uses more than one protocol and does not register itself as a receiver of all packet types will not work with Mike's driver.
My driver will accept one registration each for IP and ARP, or one registration for all packet types. Any registration attempts for other protocols will be passed on to the real packet driver (where they will probably fail since NETDRIVE.SYS is already registered for all packet types).
In practice there's very little difference between the drivers in this regard. The mTCP applications seems to work just fine with my driver but I've not been able to get ARACHNE or LINKS to work. Please let me know if you find a packet driver application that works with my driver but not Mike's (or vice versa).
* My driver's packet driver emulation feature hooks the same interrupt as the actual packet driver. In other words, it won't use the packet driver shim interrupt in your mTCP configuration file. Though it should work just fine with that enabled so no configuration changes are required.
* Due to the way my driver is initialized, you can not unload the packet driver once you've connected a NetDrive, even if you disconnect all drives. If you need to be able to unload the packet driver without a reboot then you must use Mike's driver.
Disclaimer
This code has not been extensively tested. I will not accept responsibility for any data corruption or data loss. Make backups before using this driver.
Download
I do plan to release this as open source but for now it's just binaries. The source still needs a lot of work - clean ups, adding more comments and such to make it easier to read and maintain. Meanwhile, if you're really curious, just do what I did - reverse engineer it!
The download contains two versions of the device driver and you can probably guess the differences just by looking at the file name extensions;
NETDRIVE.086 - For use with 8088 and 8086 CPU:s. You can use this version with any CPU, but it requires slightly more memory.
NETDRIVE.186 - For use with everything else, including the NEC V20/V30 CPU:s.
These drivers are the full-featured versions - no defines have been used to reduce memory usage which means they are functionally equivalent to Mike's latest released version (250110).
Feedback
I would love to get all kinds of feedback - bug reports, benchmarks, feature requests and so on.
Thanks!
When I discovered that Mike Brutman had released his first version of NetDrive I became curious to see what the code looked like, how it worked etc, so I loaded the device driver (NETDRIVE.SYS) in IDA Pro to take a quick peek. As I was reading the code I saw plenty of room for improvement in the form of optimizations so I figured it would be a fun project to properly reverse engineer it just to see how much I could reduce the size of the driver.
As time went by, Mike would release updates and I would update my version of the driver to keep it up to date with his changes while continuing work on the optimizations. Eventually, the project became more of a fork than just optimizations because I started adding functionality before Mike. (I wanted the ability to use other packet driver applications while having drives connected with NetDrive.) This is why the packet driver emulation is so different between the two drivers and there are pros and cons to each (more on that below).
Well over a year later, this is the result.
Differences
There are many differences between my driver and Mike's but I'll just mention the major ones;
* My driver can be customized with up to eleven different defines when building it. The overall objective is to reduce memory usage so most of the defines will cut some functionality - for example, the packet driver emulation, the read-only RAMDrive, code for collecting statistics etc.
Here's a table for easy comparison:
Code:
My driver (smallest) (largest) Mike's driver
File size: 4170 bytes 5263 bytes 6768 bytes
Memory usage (1 drive): 4336 bytes 5440 bytes 6144 bytes
* My driver has HLT instructions in the polling loops where the driver is waiting for a response from the server. The idea is to reduce power usage and heat emission. Note that this can in rare cases cause problems (hangs) on some buggy CPU:s such as early revisions of the 486DX4-100 CPU:s. If so, adding NOHALT to the end of the command line in CONFIG.SYS will disable this functionality. (Please let me know if this is required for any of your machines.)
* The packet driver emulation in Mike's driver can only accept one protocol registration at a time. This means that it will only work with applications that uses just one protocol, or, with applications that registers themselves as receivers of all packet types - the mTCP applications all belong to this group. Any application that uses more than one protocol and does not register itself as a receiver of all packet types will not work with Mike's driver.
My driver will accept one registration each for IP and ARP, or one registration for all packet types. Any registration attempts for other protocols will be passed on to the real packet driver (where they will probably fail since NETDRIVE.SYS is already registered for all packet types).
In practice there's very little difference between the drivers in this regard. The mTCP applications seems to work just fine with my driver but I've not been able to get ARACHNE or LINKS to work. Please let me know if you find a packet driver application that works with my driver but not Mike's (or vice versa).
* My driver's packet driver emulation feature hooks the same interrupt as the actual packet driver. In other words, it won't use the packet driver shim interrupt in your mTCP configuration file. Though it should work just fine with that enabled so no configuration changes are required.
* Due to the way my driver is initialized, you can not unload the packet driver once you've connected a NetDrive, even if you disconnect all drives. If you need to be able to unload the packet driver without a reboot then you must use Mike's driver.
Disclaimer
This code has not been extensively tested. I will not accept responsibility for any data corruption or data loss. Make backups before using this driver.
Download
I do plan to release this as open source but for now it's just binaries. The source still needs a lot of work - clean ups, adding more comments and such to make it easier to read and maintain. Meanwhile, if you're really curious, just do what I did - reverse engineer it!
The download contains two versions of the device driver and you can probably guess the differences just by looking at the file name extensions;
NETDRIVE.086 - For use with 8088 and 8086 CPU:s. You can use this version with any CPU, but it requires slightly more memory.
NETDRIVE.186 - For use with everything else, including the NEC V20/V30 CPU:s.
These drivers are the full-featured versions - no defines have been used to reduce memory usage which means they are functionally equivalent to Mike's latest released version (250110).
Feedback
I would love to get all kinds of feedback - bug reports, benchmarks, feature requests and so on.
Thanks!
