Building the Client Driver


The exact procedure for building the client driver is dependant on the driver type (standard kernel mode, NDIS, etc). Most drivers are created with the BUILD.EXE utility included with the Windows DDK. BUILD.EXE processes a user supplied SOURCES file that identifies the driver source files and build options. See the Windows NT DDK documentation for details on building drivers.

The client driver must link to the API driver import library to access the functions exported by the API driver. Each client source file that calls the API functions should include the API header file MGHDLC.H.

Add the API driver import library (MGHDLCD.LIB) to TARGETLIBS in the SOURCES file. The example below shows TARGETLIBS in a SOURCES file for a Windows NT 4 NDIS miniport driver. As usual for this type of driver, the NDIS.LIB import library is included in addition to the API import library. $(APILIBPATH) should be set to the path containing the API import library.

TARGETLIBS=$(BASEDIR)\lib\*\$(DDKBUILDENV)\ndis.lib \ $(APILIBPATH)\mghdlcd.lib

After building the client driver, the API imports can be verified using the DUMPBIN.EXE utility provided with the Windows DDK:

dumpbin /imports clientdriver.sys

The output should contain references to all HDLC API functions called by the client driver:

Microsoft (R) COFF Binary File Dumper Version 5.10.7303
Copyright (C) Microsoft Corp 1992-1997. All rights reserved.

Dump of file clientdriver.sys

File Type: EXECUTABLE IMAGE

  Section contains the following imports:

MGHDLC.SYS
                  1A   DiMgslSetTraceLevel
                  10   DiMgslGetTraceEvent
                   1   DiMgslClose
                  13   DiMgslOpen
                  18   DiMgslSetParams
                  16   DiMgslResetTraceBuffers
                  1B   DiMgslTransmit
                  17   DiMgslSetIdleMode
                   D   DiMgslEnableTransmitter
                  14   DiMgslPutTraceEvent
                  15   DiMgslReceive
                   C   DiMgslEnableReceiver
                   0   DiMgslCancelTransmit
                   F   DiMgslGetSerialSignals
                  19   DiMgslSetSerialSignals
                  12   DiMgslMonitorEvents

The dumpbin.exe output will also contain imports from other Windows components such as ntoskrnl.exe, HAL.dll, and NDIS.SYS.


Previous Contents Next