Hi,
I’m currently developping a kernel mode driver in which I would like to
be notified when
NICs are added to or deleted from an adapter. So, I’m using the
TdiRegisterPnPHandlers function like this
TDI_CLIENT_INTERFACE_INFO
TdiInfos;
HANDLE
TdiHandle;
PUNICODE_STRING
ClientName;
NTSTATUS
status;
memset(&TdiInfos, 0,
sizeof
(TDI_CLIENT_INTERFACE_INFO));
TdiInfos.MajorTdiVersion = 2;
TdiInfos.MinorTdiVersion = 0;
TdiInfos.AddAddressHandlerV2 = MyClientPnPAddNetAddress;
TdiInfos.BindingHandler = MyClientPnPBindingChange;
TdiInfos.DelAddressHandlerV2 = MyClientPnPDelNetAddress;
TdiInfos.PnPPowerHandler = MyClientPnPPowerChange;
TdiInfos.ClientName = GetMyClientName();
TdiInitialize();
status =
TdiRegisterPnPHandlers(&TdiInfos,
sizeof
(TDI_CLIENT_INTERFACE_INFO),
&TdiHandle);
if
(!NT_SUCCESS(status))
{
DbgPrint(“Error while trying to register Tdi handlers : %X\n”,
status);
}
else
{
DbgPrint(“Successfully register Tdi handlers\n”);
}
The registration of the handlers is successful and I’m notified for the
ip address add or delete but my
ClientPnPBindingChange function is only called with
TDI_PNP_OP_PROVIDERREADY or
TDI_PNP_OP_NETREADY opcodes. I never receive any TDI_PNP_OP_ADD or
TDI_PNP_OP_DEL
opcode.
The DDK documentation indicates this on the ClientName field in the
TDI_CLIENT_INTERFACE_INFO :
" ClientName set to the address of a buffered Unicode string
specifying the client’s named key in the
registry HKLM\System\CCS\Services tree"
So I filled the string with the name of the service of my Driver but I’m
not sure if it’s the right thing to do.
And my driver is not a TDI transport driver nor a TDI client, just a
kernel driver which need to be notified.
Does anybody know why I don’t receive the TDI_PNP_OP_ADD and
TDI_PNP_OP_DEL opcodes ?
Thanks,
JB
–
Jean-Baptiste Lernout
Hi,
I’m currently developping a kernel mode driver in which I would like to be notified when
NICs are added to or deleted from an adapter. So, I’m using the TdiRegisterPnPHandlers function like this
TDI_CLIENT_INTERFACE_INFO TdiInfos;
HANDLE TdiHandle;
PUNICODE_STRING ClientName;
NTSTATUS status;
memset(&TdiInfos, 0, sizeof(TDI_CLIENT_INTERFACE_INFO));
TdiInfos.MajorTdiVersion = 2;
TdiInfos.MinorTdiVersion = 0;
TdiInfos.AddAddressHandlerV2 = MyClientPnPAddNetAddress;
TdiInfos.BindingHandler = MyClientPnPBindingChange;
TdiInfos.DelAddressHandlerV2 = MyClientPnPDelNetAddress;
TdiInfos.PnPPowerHandler = MyClientPnPPowerChange;
TdiInfos.ClientName = GetMyClientName();
TdiInitialize();
status = TdiRegisterPnPHandlers(&TdiInfos, sizeof(TDI_CLIENT_INTERFACE_INFO), &TdiHandle);
if (!NT_SUCCESS(status))
{
DbgPrint(“Error while trying to register Tdi handlers : %X\n”, status);
}
else
{
DbgPrint(“Successfully register Tdi handlers\n”);
}
The registration of the handlers is successful and I’m notified for the ip address add or delete but my
ClientPnPBindingChange function is only called with TDI_PNP_OP_PROVIDERREADY or
TDI_PNP_OP_NETREADY opcodes. I never receive any TDI_PNP_OP_ADD or TDI_PNP_OP_DEL
opcode.
The DDK documentation indicates this on the ClientName field in the TDI_CLIENT_INTERFACE_INFO :
“ClientName set to the address of a buffered Unicode string specifying the client’s named key in the
registry HKLM\System\CCS\Services tree”
So I filled the string with the name of the service of my Driver but I’m not sure if it’s the right thing to do.
And my driver is not a TDI transport driver nor a TDI client, just a kernel driver which need to be notified.
Does anybody know why I don’t receive the TDI_PNP_OP_ADD and TDI_PNP_OP_DEL opcodes ?
Thanks,
JB
Jean-Baptiste Lernout
Note: TdiRegisterPnPHandlers are required for you to properly say goodbye
to the other end during machine shutdown. Otherwise, it is possible that the
NIC will be shut down before your device and your FIN sent as a result of your
own MJ_POWER sequence will go to the la-la land.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “Jean-Baptiste Lernout”
To: “Windows System Software Devs Interest List”
Sent: Thursday, January 26, 2006 4:48 PM
Subject: [ntdev] TdiRegisterPnPHandlers and ClientPnPBindingChange
> Hi,
>
> I’m currently developping a kernel mode driver in which I would like to be
notified when
> NICs are added to or deleted from an adapter. So, I’m using the
TdiRegisterPnPHandlers function like this
>
>
> TDI_CLIENT_INTERFACE_INFO TdiInfos;
> HANDLE TdiHandle;
> PUNICODE_STRING ClientName;
> NTSTATUS status;
>
> memset(&TdiInfos, 0, sizeof (TDI_CLIENT_INTERFACE_INFO));
> TdiInfos.MajorTdiVersion = 2;
> TdiInfos.MinorTdiVersion = 0;
> TdiInfos.AddAddressHandlerV2 = MyClientPnPAddNetAddress;
> TdiInfos.BindingHandler = MyClientPnPBindingChange;
> TdiInfos.DelAddressHandlerV2 = MyClientPnPDelNetAddress;
> TdiInfos.PnPPowerHandler = MyClientPnPPowerChange;
>
> TdiInfos.ClientName = GetMyClientName();
>
> TdiInitialize();
>
> status = TdiRegisterPnPHandlers(&TdiInfos, sizeof
(TDI_CLIENT_INTERFACE_INFO), &TdiHandle);
> if (!NT_SUCCESS(status))
> {
> DbgPrint(“Error while trying to register Tdi handlers :
%X\n”, status);
> }
> else
> {
> DbgPrint(“Successfully register Tdi handlers\n”);
> }
>
> The registration of the handlers is successful and I’m notified for the ip
address add or delete but my
> ClientPnPBindingChange function is only called with TDI_PNP_OP_PROVIDERREADY
or
> TDI_PNP_OP_NETREADY opcodes. I never receive any TDI_PNP_OP_ADD or
TDI_PNP_OP_DEL
> opcode.
>
> The DDK documentation indicates this on the ClientName field in the
TDI_CLIENT_INTERFACE_INFO :
> “ClientName set to the address of a buffered Unicode string specifying the
client’s named key in the
> registry HKLM\System\CCS\Services tree”
>
> So I filled the string with the name of the service of my Driver but I’m not
sure if it’s the right thing to do.
> And my driver is not a TDI transport driver nor a TDI client, just a kernel
driver which need to be notified.
>
> Does anybody know why I don’t receive the TDI_PNP_OP_ADD and TDI_PNP_OP_DEL
opcodes ?
>
> Thanks,
>
> JB
> –
> Jean-Baptiste Lernout
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
Ok, but it doesn’t anwer to my question. The DDK documentation of
TdiRegisterPnPHandlers says that :
“On return from a successful call to TdiRegisterPnPHandlers, the
ClientPnPBindingChange and ClientPnPAddNetAddress routines have been called
one or more times with all the system-setup-time information currently
available to TDI about transports and their already registered network
addresses”
So after the registration of my callbacks, I should be notified of the
bindings and it’s not the case.
JB
Jean-Baptiste Lernout
“Maxim S. Shatskih” a écrit dans le message de
news: xxxxx@ntdev…
> Note: TdiRegisterPnPHandlers are required for you to properly say
> goodbye
> to the other end during machine shutdown. Otherwise, it is possible that
> the
> NIC will be shut down before your device and your FIN sent as a result of
> your
> own MJ_POWER sequence will go to the la-la land.
>