Symbolic Link

Hi!
I want to build a ndis intermediate driver(Win2K),and I must creat a
symbolic link.

*********Driver****************************************
PDRIVER_OBJECT IMDriverObject;
PDEVICE_OBJECT IMDeviceObject;

NDIS_STRING IMSymbolicName = NDIS_STRING_CONST(“\DosDevices\SFilter”);
NDIS_STRING IMDriverName = NDIS_STRING_CONST( “\Device\SFilter” );

IoCreateDevice(IMDriverObject,
0,
&IMDriverName,
FILE_DEVICE_NETWORK,
0,
FALSE,
&IMDeviceObject);

IMDeviceObject->Flags |= DO_BUFFERED_IO;
IoCreateSymbolicLink( &IMSymbolicName, &IMDriverName );
******************************************************************
what’s wrong about this code?and where should I place it?
It seems there are three places that i can choose: DriverEntry, AddDevice
routine and protocol BindAdapterHandler.
I have make a test in the sample passthru which is shipped with Win2K ddk,
this sample has no AddDevice routine so I add it into DriverEntry and
BindAdapterHandler respectively, but it all failed.
If I add it into DriverEntry, the system cannot find the file specified
when I call CreateFile in the user mode application.
If i add it into BindAdapterHandler, the system crash during the
installation of this sample filter.
Who knows why?
Thanks a lot.

  1. For w2k NDIS driver you should use NdisMRegisterDevice() instead of
    IoCreateDevice() and IoCreateSymbolicLink(). It correctly handles dispatch
    handlers rerouting which might cause you problem (did you something like
    this?).

  2. There is no AddDevice() handler for NDIS IM drivers.

  3. When you create device depends on your needs and your driver design. Both
    DriverEntry() and ProtocolBindAdapter() are suitable. In my driver I do it
    in MiniportInitialize() (called indirectly via
    NdisIMInitializeDeviceInstanceEx() in ProtocolBindAdapter()) and destroy
    devices in the last MiniportHalt() call. There is an advantage of this
    design for PnP drivers: when the last device is disabled, driver destroys
    all additional devices it created and system can unload it which saves
    developer from hundreds reboots.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: xxxxx@necas.nec.co.jp[SMTP:xxxxx@necas.nec.co.jp]
Reply To: NT Developers Interest List
Sent: Wednesday, November 08, 2000 8:29 AM
To: NT Developers Interest List
Subject: [ntdev] Symbolic Link

Hi!
I want to build a ndis intermediate driver(Win2K),and I must creat a
symbolic link.

*********Driver****************************************
PDRIVER_OBJECT IMDriverObject;
PDEVICE_OBJECT IMDeviceObject;

NDIS_STRING IMSymbolicName = NDIS_STRING_CONST(“\DosDevices\SFilter”);
NDIS_STRING IMDriverName = NDIS_STRING_CONST( “\Device\SFilter” );

IoCreateDevice(IMDriverObject,
0,
&IMDriverName,
FILE_DEVICE_NETWORK,
0,
FALSE,
&IMDeviceObject);

IMDeviceObject->Flags |= DO_BUFFERED_IO;
IoCreateSymbolicLink( &IMSymbolicName, &IMDriverName );
******************************************************************
what’s wrong about this code?and where should I place it?
It seems there are three places that i can choose: DriverEntry, AddDevice
routine and protocol BindAdapterHandler.
I have make a test in the sample passthru which is shipped with Win2K ddk,
this sample has no AddDevice routine so I add it into DriverEntry and
BindAdapterHandler respectively, but it all failed.
If I add it into DriverEntry, the system cannot find the file specified
when I call CreateFile in the user mode application.
If i add it into BindAdapterHandler, the system crash during the
installation of this sample filter.
Who knows why?
Thanks a lot.


You are currently subscribed to ntdev as: xxxxx@rkk.cz
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

At first, thank you very much for your help.
I have done as what you told me.I call the method NdisMRegisterDevice() in
the MiniportInitialize() and this time the system crash when I send an Io
control in user model application.The bug check codes is
0x0000007f(0x00000008,0x00000000,0x00000000,0x00000000)and stack backtrace
is
******************Stack BackTrace**************************************
ChildEBP RetAddr Args to Child
8046cc68 8042bcb9 00000003 8046ccb0 00000008
ntoskrnl!RtlpBreakWithStatusInstruction
8046cc98 8042c068 00000003 00000000 00000000
ntoskrnl!KiBugCheckDebugBreak+0x31
8046d020 8046365e 00000000 00000008 00000000 ntoskrnl!KeBugCheckEx+0x37b
8046d020 fcc23da9 00000000 00000008 00000000 ntoskrnl!KiTrap08+0x3e
ed86208c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x9
ed8620a0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86214c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862160 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86220c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862220 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed8622cc fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8622e0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86238c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8623a0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86244c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862460 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86250c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862520 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed8625cc fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8625e0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
***************************************************************************
What can I conclude from this contents?

By the way, I have defined BINARY_COMPATIBLE as 0 in the precomp.h
(#define BINARY_COMPATIBLE 0),does it make ady trouble?

Best regards,

yyang

It seems as recursion during IRP handling. Just take a debugger and trace
your IRP handlers. As far as BINARY_COMPATIBLE 0 I’m not aware of any
problem and also use it.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: xxxxx@necas.nec.co.jp[SMTP:xxxxx@necas.nec.co.jp]
Reply To: NT Developers Interest List
Sent: Thursday, November 09, 2000 1:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Symbolic Link

At first, thank you very much for your help.
I have done as what you told me.I call the method NdisMRegisterDevice() in

the MiniportInitialize() and this time the system crash when I send an Io
control in user model application.The bug check codes is
0x0000007f(0x00000008,0x00000000,0x00000000,0x00000000)and stack backtrace

is
******************Stack BackTrace**************************************
ChildEBP RetAddr Args to Child
8046cc68 8042bcb9 00000003 8046ccb0 00000008
ntoskrnl!RtlpBreakWithStatusInstruction
8046cc98 8042c068 00000003 00000000 00000000
ntoskrnl!KiBugCheckDebugBreak+0x31
8046d020 8046365e 00000000 00000008 00000000 ntoskrnl!KeBugCheckEx+0x37b
8046d020 fcc23da9 00000000 00000008 00000000 ntoskrnl!KiTrap08+0x3e
ed86208c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x9
ed8620a0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86214c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862160 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86220c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862220 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed8622cc fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8622e0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86238c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8623a0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86244c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862460 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed86250c fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed862520 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
ed8625cc fcc241ed 81335b70 80eab568 80eab568
NDIS!ndisDeviceControlIrpHandler+0x62
ed8625e0 fcc23ecf 81335b70 80eab568 81335b70 NDIS!ndisDummyIrpHandler+0x34
**************************************************************************
*
What can I conclude from this contents?

By the way, I have defined BINARY_COMPATIBLE as 0 in the precomp.h
(#define BINARY_COMPATIBLE 0),does it make ady trouble?

Best regards,

yyang


You are currently subscribed to ntdev as: xxxxx@rkk.cz
To unsubscribe send a blank email to $subst(‘Email.Unsub’)