Protocol Driver's ProtocolBindAdapater earliest call time (and registry reading)

Q1)
(I saw) in my Protocol driver where createBinding is being called even when DriverEntry failed or before Driverentry returns. I am not sure if this can happen or even logical. But I was doing debug and had bp’s set in Driverentry and while F8 it jumped to ProtocolBindAddapter().

Just want to know if this can happen? Ofcourse I have some initial setup to be completed successfully in DriverEntry() which later is used in ProtocolbindAdapter for it to be successful.

Q2) Also I want to put some reg entries in my protocol driver registry and read them during DriverEntry(). This is how I wanted to create the reg entries

[Install]
AddReg=Inst_Ndi, Reg_Entries

[Reg_Entries]
HKR,DbgFlags,0x10001,0x7
HKR,LogLevel,0x00000,“777”

But I do not see these sample registry entries being written anywhere.
The devicename param is in teh form "\DEVICE{GUID}

The SystemSpecific1 param is in teh form “my_protocol_driver.sys\Parameters\Adapters{GUID}”

For my protocl driver during DriverEntry() the registry_path is “\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\my_protocol_Driver”

The DDK sample NDIS protocol driver, in ProtocolBindAdapater() reads from SystemSpecific1 param.

I do not see these entries being written anywhere. Can you please let me know (how to write these registry entries through INF for my protocol driver) and where I can find those to read them possibly in the DriverEntry() later.

–thanks

A1: It is possible to get a ProtocolBindAdapter call anytime after the call
to NdisRegisterProtocol (and before that call returns). If
NdisRegisterProtocol suceeds and DriverEntry needs to fail, you must call
NdisDeregisterProtocol which will cause (at least in NT5 & later)
ProtocolUnbind to be called for each binding that suceeded.

A2: The INF snippet you supply below is not sufficient to know that is going
on with your INF. What, for instance, is the [Install] section and how does
it get invoked (and when?). However, taking a guess: Perhaps you should
place your registry parameters in an AddReg section called from the service
install referenced in the [Install.Services] section. At least then it can
end up in
HKLM\SYSTEM\CurrentControlSet\Services<your-protocol-driver-service> or a
sub-key.

Did you look, by the way, in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network{4D36E975-E325-1
1CE-BFC1-08002BE10318}<some-guid-assigned-by-netcfg-to-your-protocol> to
see if your settings end up there? Not that it is of any use because you
probably should stick with global settings in the driver SERVICE entry. In
any event, the very fine RegMon or ProcessMonitor tool from MSFT /
SysInternals will tell you where your settings are going…

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Monday, October 08, 2007 7:14 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Protocol Driver’s ProtocolBindAdapater earliest call time
(and registry reading)

Q1)
(I saw) in my Protocol driver where createBinding is being called even when
DriverEntry failed or before Driverentry returns. I am not sure if this can
happen or even logical. But I was doing debug and had bp’s set in
Driverentry and while F8 it jumped to ProtocolBindAddapter().

Just want to know if this can happen? Ofcourse I have some initial setup to
be completed successfully in DriverEntry() which later is used in
ProtocolbindAdapter for it to be successful.

Q2) Also I want to put some reg entries in my protocol driver registry and
read them during DriverEntry(). This is how I wanted to create the reg
entries

[Install]
AddReg=Inst_Ndi, Reg_Entries

[Reg_Entries]
HKR,DbgFlags,0x10001,0x7
HKR,LogLevel,0x00000,“777”

But I do not see these sample registry entries being written anywhere.
The devicename param is in teh form “\DEVICE{GUID}

The SystemSpecific1 param is in teh form
“my_protocol_driver.sys\Parameters\Adapters{GUID}”

For my protocl driver during DriverEntry() the registry_path is
”\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\my_protocol_Driver"

The DDK sample NDIS protocol driver, in ProtocolBindAdapater() reads from
SystemSpecific1 param.

I do not see these entries being written anywhere. Can you please let me
know (how to write these registry entries through INF for my protocol
driver) and where I can find those to read them possibly in the
DriverEntry() later.

–thanks


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

David

Thank you. Q1) reply answers my question!

For Q2) Did Chkinf and I quickly added in [Install.Services], did not show up (have to test it more but). But will run through those tools to find where those entries are going.

Anyways below is the snippet of my protocol driver inf
(just an adaptation of DDK sample Ndis protocol driver inf)
since the inst_Ndi entries are being written to registry, I expected Reg_Entries section should also be invoked, but I do not see those entries being written anywhere.

–thanks


; Copyright (c) 2003, Microsoft Corporation
;-------------------------------------------------------------------------
[version]
Signature = “$Windows NT$”
Class = NetTrans
ClassGUID = {4d36e975-e325-11ce-bfc1-08002be10318}
Provider = %XXX%
LayoutFile = layout.inf

[Manufacturer]
%XXX%=XXX

[XXX]
%XXXPROT_Desc%=Install, MS_NDISPROT

;-------------------------------------------------------------------------
; Installation Section
;-------------------------------------------------------------------------
[Install]
AddReg=Inst_Ndi, Reg_Entries
Characteristics=0x0 ;
CopyFiles=CpyFiles_Sys

[Reg_Entries]
HKR,DbgFlags,0x10001,0x7
HKR,LogLevel,0x00000,“777”

;-------------------------------------------------------------------------
; Ndi installation support
;-------------------------------------------------------------------------
[Inst_Ndi]
HKR,Ndi,Service,“XXXService”
HKR,Ndi,HelpText,%XXXPROT_HelpText%
HKR,Ndi\Interfaces, UpperRange, noupper
HKR,“Ndi\Interfaces”,“LowerRange”,XXXProtX