Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

libcommon/init.c File Reference

Common functions für initialization the WDM and NT4 driver. More...

#include <wdm.h>
#include "cbm_driver.h"
#include "iec.h"

Go to the source code of this file.

Functions

VOID cbm_init_registry (IN PUNICODE_STRING RegistryPath, IN PDEVICE_EXTENSION Pdx)
 Initialize from registry.
NTSTATUS DriverCommonInit (IN PDRIVER_OBJECT Driverobject, IN PUNICODE_STRING RegistryPath)
 Perform driver initialization, common to WDM and NT4 driver.
VOID DriverCommonUninit (VOID)
 Undo what DriverCommonInit() has done.
NTSTATUS AddDeviceCommonInit (IN PDEVICE_OBJECT Fdo, IN PUNICODE_STRING DeviceName, IN PCWSTR ParallelPortName)
 Initialize device object, common to WDM and NT4 driver.


Detailed Description

Common functions für initialization the WDM and NT4 driver.

**************************************************************

Author:
Spiro Trikaliotis
Version:
Id
init.c,v 1.26 2006/03/23 19:20:39 trikalio Exp


Definition in file libcommon/init.c.


Function Documentation

NTSTATUS AddDeviceCommonInit IN PDEVICE_OBJECT  Fdo,
IN PUNICODE_STRING  DeviceName,
IN PCWSTR  ParallelPortName
 

Initialize device object, common to WDM and NT4 driver.

This function initializes the device object, as done in AddDevice() of a WDM driver, or in DriverEntry() for an NT4 driver.

Parameters:
Fdo Pointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver.
DeviceName Pointer to the name of the device.
ParallelPortName Pointer to the name of the parallel port driver which this device will use.
Returns:
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values.
This function performs the following steps:
1. Initialize the Pdx
2. Initialize the Queue inside of the Pdx
3. Initialize the operating mode of the Fdo (Buffered, Direct, Neither)
4. Get the information from the parallel port
5. Start the Worker Thread
6. Log either success or failure

Definition at line 277 of file libcommon/init.c.

References cbm_start_thread(), cbm_startio(), DBG_ERROR, DBG_PREFIX, FUNC_ENTER, LogErrorOnly, LogErrorString, ParPortInit(), and QueueInit().

Referenced by AddDevice().

VOID cbm_init_registry IN PUNICODE_STRING  RegistryPath,
IN PDEVICE_EXTENSION  Pdx
 

Initialize from registry.

This function initializes some driver settings from the appropriate registry keys.

Parameters:
RegistryPath Pointer to a UNICODE_STRING containing the name of the registry path from which to get the information. If this is NULL, this function uses the same registry path that was given the last time this function was called.
Pdx Pointer to the device extension of the device to be updated.
The RegistryPath parameter can be NULL, but this is only allowed on a second or subsequent call.

Pdx can be NULL, too. If it is NULL, no device-specific data is read at all.

If RegistryPath is not NULL, some memory is allocated. This has to be freed by calling DriverCommonUninit().

Definition at line 56 of file libcommon/init.c.

References cbm_lock_parport(), cbm_registry_close(), cbm_registry_open_for_read(), cbm_registry_read_ulong(), cbmiec_global_init(), cbmiec_set_cabletype(), DBG_ASSERT, FUNC_ENTER, FUNC_LEAVE, and MTAG_SERVKEY.

Referenced by AddDevice(), cbm_execute_devicecontrol(), and DriverCommonInit().

NTSTATUS DriverCommonInit IN PDRIVER_OBJECT  Driverobject,
IN PUNICODE_STRING  RegistryPath
 

Perform driver initialization, common to WDM and NT4 driver.

This function is called from the DriverEntry() of either the WDM or the NT4 driver.

Parameters:
Driverobject Pointer to the DRIVER_OBJECT structure given to DriverEntry().
RegistryPath Pointer to a UNICODE_STRING containing the name of the registry path from which to get the information.
Returns:
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values.

Definition at line 191 of file libcommon/init.c.

References cbm_cleanup(), cbm_createopenclose(), cbm_devicecontrol(), cbm_init_registry(), cbm_readwrite(), DriverUnload(), FUNC_ENTER, and PERF_INIT.

Referenced by DriverEntry().

VOID DriverCommonUninit VOID   ) 
 

Undo what DriverCommonInit() has done.

This function is called from the DriverUnload() of either the WDM or the NT4 driver.

This function frees memory allocated by cbm_init_registry().

Definition at line 224 of file libcommon/init.c.

References DBGDO, FUNC_ENTER, FUNC_LEAVE, and PERF_SAVE.

Referenced by DriverUnload().


Generated on Sun Apr 30 18:46:10 2006 for opencbm by  doxygen 1.4.2