B.8.1.1  DriverEntry Routine

When a Windows NT driver is loaded, its DriverEntry routine is called. For each Windows NT driver containing a STREAMS stack, its DriverEntry routine must:

1.Register each STREAMS component contained in the driver.

2.Call the init routine, if any, of each STREAMS component in the driver.

STREAMS stacks that implement NetBIOS providers require more work, as described in Section B.8.4.

Example: DriverEntry Routine for tcpip.sys from Windows NT 3.1

#include <ntddk.h>

#include <stream.h>

 

extern struct streamtab arpinfo;

extern struct streamtab tcpinfo;

 

extern int arpinit(void);

extern int tcpinit(void);

 

NTSTATUS

DriverEntry(

        IN PDRIVER_OBJECT driver,

        IN PUNICODE_STRING device

)

{

    NTSTATUS status;

 

    status = StrmRegisterModule(driver, &arpinfo, NULL);

 

    if (status != STATUS_SUCCESS) {

        return(status);

    }

    

    status = StrmRegisterDriver(driver, &tcpinfo, NULL, NULL);

 

    if (status != STATUS_SUCCESS) {

        return(status);

    }

    

    arpinit();

    tcpinit();

 

    return(STATUS_SUCCESS);

}