BazisLib framework

2.3.0

Introduction

To get an overview of main BazisLib components, see the following pages:

File structure

The BazisLib framework simplifies creation of device drivers (mostly virtual) for Windows & Linux, and some system applications for Win32 and WinCE. Here is an overview of the directory structure:
\BZSCMNCommon (platform-independent) headers & modules. Contain such inline classes as Mutex, and such interfaces as IFile/AIFile.
\BZSDDKLibrary for building Windows DDK/WDK drivers. Detailed documentation on most classes is available inside. You can explore the comments in files or use doxygen to build a pretty HTML documentation.
\BZSLNXLibrary for building Linux drivers. To enable C++ support for Linux kernel modules, you need to patch kernel headers. A set of patches featuring an installing script are available in \BZSLNX\_linuxcpp\. Simply copy them somewhere on your Linux machine and run "install.sh" from root. WARNING! This library is not supported in builds later than 1.0 and the new functionality is not ported. There are totally no hints whether this library will be resumed in the future.
\BZSNETLibrary supporting various network-related services, such as HTTP client, multi-threaded download manager, download manager, etc. Compatible with Win32 and WinCE (Windows Mobile). Win32 build supports SSL via OpenSSL library.
\BZSWINLibrary providing various Win32- and WinCE-related features. Contains Win32 implementation of various cross-platform classes, such as File, Socket, DateTime, etc. Also supports classes simplifying registry access and PnP device enumeration.
\SAMPLESContains simple example projects:
\SAMPLES\Linux\bulkusbSimple BulkUSB driver. Creates character device nodes for all found BulkUSB devices.
\SAMPLES\COMMONVarious platform-independant samples
\SAMPLES\CROSSVarious cross-platform (Windows DDK/Linux kernel) samples:
\SAMPLES\CROSS\ramdiskA simple fixed-size RAM disk
\SAMPLES\CROSS\filediskA very simple "file disk" (virtual disk based on a file)
\SAMPLES\DDK\TestBusA simple bus driver for Windows
\SAMPLES\DDK\DiskFilterA simple disk filter
\SAMPLES\WINDOWS\RegistryA sample application demonstrating inline registry class and registry serializer
\TESTSContains various autotests
\TESTS\FILETESTA set of tests for file/directory subsystem
\TESTS\OBJMGRA test for object manager (reference counter)

Installation

Windows installation

To start using BazisLib framework, first install Microsoft Visual Studio 2008. Previous versions of Visual Studio should also work, but you need to modify version numbers, paths & etc manually in order to get it working.
Starting from version 2.2, BazisLib is distributed with installer capable of downloading and installing all additional dependencies. However, you can use the following guide to do manual installation in case something goes wrong:
1. Download WDK (it is freely available at http://connect.microsoft.com) and install it
2. Set the environment variable WDKPATH to the location where you have installed the WDK. For, example, if you installed it in E:\WINDDK\6000, set WDKPATH=E:\WINDDK\6000. Do not forget to restart Visual Studio after you change the environment variables.
3. Download and unpack STLPort from SourceForge (I used STLPort-5.1.3, however, new versions will probably also work). Patch it using LINUXCPP patch (found in BazisLib\BzsLnx\_linuxcpp, filename: STLport-5.1.3.patch). This patch enables STL support for Linux kernel & Windows DDK. If you don't want to bother with patching, you can download the patched version directly (filename: stlport-5.1.3-patched.zip).
4. Download and unpack WTL from SourceForge or directly from Microsoft website: http://www.microsoft.com/downloads/details.aspx?familyid=e5ba5ba4-6e6b-462a-b24c-61115e846f0c&displaylang=en Add WTL include file path to Visual Studio.
IMPORTANT NOTES ON WTL:
4.1. To add Visual Studio 2008 support for WTL8, you should copy the setup80.js in WTL80\AppWiz directory to setup90.js and replace the string "HKLM\\Software\\Microsoft\\VisualStudio\\8.0" with "HKLM\\Software\\Microsoft\\VisualStudio\\9.0".
4.2. If WTL applications fail to compile for Windows Mobile platform because of lstrlenA and lstrcpynA problems in WTL include files, consider replacing lstrlenA() calls to ::lstrlenA() and lstrcpynA() to strncpy() in the erroneous lines.
5. Download and unpack OpenSSL sources if you want to use it for Windows network apps. 6. Unpack BazisLib and add its path to Visual Studio include paths. If you plan to build Windows Mobile apps, do not forget to add the include directories for the Windows Mobile platform as well as for Win32 one.
7. Create the following environmental variables:
VariableMeaningExample
WDKPATHPath to your WDK installationset WDKPATH=E:\WINDDK\6000
BZSLIB_PATHPath to your BazisLib installationset WDKPATH=E:\PROJECTS\BazisLib
STLPORT_PATHPath to your STLPort installationset WDKPATH=E:\PROJECTS\Imported\STLport-5.1.3
OPENSSL_PATHPath to your OpenSSL sourcesset WDKPATH=E:\PROJECTS\Imported\openssl-0.9.8g
8. Install the BazisLib driver wizard plugin to Visual Studio by launching SUPPORT\DDKWIZ\install.bat. This will significantly simplify creation of new legacy and PnP devices for Windows DDK. The wizard even supports INF file generation.
Now you can start exploring BazisLib. I recommend you to build & examine samples first.

Linux installation

To enable C++ support for Linux kernel modules, you need to patch kernel headers. A set of patches featuring an installing script are available in \BZSLNX\_linuxcpp\. Simply copy them somewhere on your Linux machine and run "install.sh" from root. WARNING! Please note that only release 1.0 has full Linux support. In further versions Linux kernel support is not provided and Linux library is not modified. To build crossplatform apps between Linux and Windows, use the 1.0 release, or port main functionality to Linux by yourself.

String classes

BazisLib has a relatively complex model of string classes providing a significantly higher performance compared to standard STL string class. See this article for more details.

Windows DDK support

The classes providing DDK support reside inside the BazisLib::DDK namespace. You can see the SAMPLES directory to check out some typical use cases and patterns. If you want to read the documentation on DDK class hierarchy, see the BazisLib::DDK namespace page.
Warning! Before developing DDK-based virtual devices, be sure to read the information about Windows Cache bug.

Linux kernel module support

See BazisLib::Linux namespace documentation for details.

Downloading

The latest version of BazisLib framework can always be downloaded at the SourceForge.net project page.