[FILTER DRIVER][AGAIN][NOOB Level2] Unamed device

Hello,
i’ve got a new question about filters driver.

here’s a part of the code i used with success in some case

(…)

CCHAR ntNameBuffer[64] = “\Device\HEART”;
STRING ntNameString;
UNICODE_STRING uHEARTDeviceName;
RtlInitAnsiString( &ntNameString, ntNameBuffer );
NTSTATUS unicode_status = RtlAnsiStringToUnicodeString( &uHEARTDeviceName, &ntNameString, TRUE );

(…) some debug print messages

status = IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->pHEARTDevice);

(etc…)

So, know i want to so the same with another edvice but when i want to have the name of the device, th DeviceTree toll says (Unamed)

So i really don’t know what to do instead
CCHAR ntNameBuffer[64] = “\Device\HEART”;

and of course instead

status = IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->pHEARTDevice);

In a word how to attach my filter to an unamed device?

Thank’s in advance for your help.

> In a word how to attach my filter to an unamed device?
Will
PDEVICE_OBJECT IoAttachDeviceToDeviceStack(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice
);
help?

-------------- Original message --------------
From: xxxxx@gmail.com

Hello,
i’ve got a new question about filters driver.

here’s a part of the code i used with success in some case

(…)

CCHAR ntNameBuffer[64] = “\Device\HEART”;
STRING ntNameString;
UNICODE_STRING uHEARTDeviceName;
RtlInitAnsiString( &ntNameString, ntNameBuffer );
NTSTATUS unicode_status = RtlAnsiStringToUnicodeString( &uHEARTDeviceName,
&ntNameString, TRUE );

(…) some debug print messages

status =
IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->pHEA
RTDevice);

(etc…)

So, know i want to so the same with another edvice but when i want to have the
name of the device, th DeviceTree toll says (Unamed)

So i really don’t know what to do instead
CCHAR ntNameBuffer[64] = “\Device\HEART”;

and of course instead

status =
IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->pHEA
RTDevice);

In a word how to attach my filter to an unamed device?

Thank’s in advance for your help.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

A pnp device? Does it have symbolic links?

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@comcast.net
Sent: Friday, July 06, 2007 9:28 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] [FILTER DRIVER][AGAIN][NOOB Level2] Unamed device

In a word how to attach my filter to an unamed device?

Will
PDEVICE_OBJECT IoAttachDeviceToDeviceStack(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice
);

help?

-------------- Original message --------------
From: xxxxx@gmail.com

Hello,
i’ve got a new question about filters driver.

here’s a part of the code i used with success in some case

(…)

CCHAR ntNameBuffer[64] = “\Device\HEART”;
STRING ntNameString;
UNICODE_STRING uHEARTDeviceName;
RtlInitAnsiString( &ntNameString, ntNameBuffer );
NTSTATUS unicode_status = RtlAnsiStringToUnicodeString( &uHEARTDeviceName,

&ntNameString, TRUE );

(…) some debug print messages

status =

IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->
pHEA

RTDevice);

(etc…)

So, know i want to so the same with another edvice but when i want t o
have the
name of the device, th DeviceTree toll says (Unamed)

So i really don’t know what to do instead
CCHAR ntNameBuffer[64] = “\Device\HEART”;

and of course instead

status =

IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtension->
pHEA

RTDevice);

In a word how to attach my filter to an unamed device?

Thank’s in advance for your help.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

How to attach to an unnamed device? Well typically the way you do this
is that you are registered as a filter or service for a particular
device stack and you use IoAttachDeviceToDeviceStack (as others have
correctly pointed out). Note that as a filter/service you are attaching
while the stack is being built up vs after the stack has been started
like your code below depends on (since IoAttachDevice sends an open to
the device you want to attach to and opens do not succeed until the
entire stack has been started).

Also, you are pointlessly converting from ansi to Unicode. You can
easily do this

UNICODE_STRING uHEARTDeviceName =
DECLARE_CONST_UNICODE_STRING(L"\Device\Heart");

Or this

UNICODE_STRING uHEARTDeviceName;
RtlInitUnicodeString(&uHEARTDeviceName, L"\Device\Heart");

Furthermore, it is a bit better to declare stack based strings without a
length, this
CCHAR ntNameBuffer[64] = “\Device\HEART”;
Should look like
CCHAR ntNameBuffer = “\Device\HEART”;

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, July 06, 2007 2:39 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] [FILTER DRIVER][AGAIN][NOOB Level2] Unamed device

Hello,
i’ve got a new question about filters driver.

here’s a part of the code i used with success in some case

(…)

CCHAR ntNameBuffer[64] = “\Device\HEART”;
STRING ntNameString;
UNICODE_STRING uHEARTDeviceName;
RtlInitAnsiString( &ntNameString, ntNameBuffer );
NTSTATUS unicode_status = RtlAnsiStringToUnicodeString(
&uHEARTDeviceName, &ntNameString, TRUE );

(…) some debug print messages

status =
IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtensi
on->pHEARTDevice);

(etc…)

So, know i want to so the same with another edvice but when i want to
have the name of the device, th DeviceTree toll says (Unamed)

So i really don’t know what to do instead
CCHAR ntNameBuffer[64] = “\Device\HEART”;

and of course instead

status =
IoAttachDevice(pHEARTDeviceObject,&uHEARTDeviceName,&pHEARTDeviceExtensi
on->pHEARTDevice);

In a word how to attach my filter to an unamed device?

Thank’s in advance for your help.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

xxxxx@comcast.net wrote:

> In a word how to attach my filter to an unamed device?
Will
PDEVICE_OBJECT IoAttachDeviceToDeviceStack(
* *IN PDEVICE_OBJECT /SourceDevice/*,*
* *IN PDEVICE_OBJECT /TargetDevice/
* *);
help?

Sure, if you can locate the device object for your target device.

If you know the plug and play ID of the device you want to filter, why
don’t you just add your driver to the UpperFilters or LowerFilters value
in its Enum registry key? Then the operating system will load your
filter automatically and HAND you the device object for your place in
the stack.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts a écrit :

xxxxx@comcast.net wrote:

>> In a word how to attach my filter to an unamed device?
>>
> Will
> PDEVICE_OBJECT IoAttachDeviceToDeviceStack(
> * *IN PDEVICE_OBJECT /SourceDevice/*,*
> * *IN PDEVICE_OBJECT /TargetDevice/
> * *);
> help?
>

Sure, if you can locate the device object for your target device.

If you know the plug and play ID of the device you want to filter, why
don’t you just add your driver to the UpperFilters or LowerFilters value
in its Enum registry key? Then the operating system will load your
filter automatically and HAND you the device object for your place in
the stack.

Ok thank you very much for the help, and sorry for the lag between your
last answer and mine, but i’m afraid to run out of time.
It’s a crazy race to restore the laboratory to something near of an
operational state here.

And since we are in a critical situation, we’ve got no money to
outsource drivers dev.
But we have to finish some forgotten softwares in the same time (in fact
in share time).

So, i have to give up with drivers until i finish with other stuffes.
May be i’ll ask more later.

Is there any tools you use with succes to make some drivers skelletons?
Some wizzards? What do you think about softice driver studio?

You definitely do not want to use DriverStudio. In addition to no longer being a product, it deeply sucked in the first place. In my opinion, tools that generate skeletons save no real time. If you’re able to use WDF, that might help depending on what you are doing and what you already know.

mm

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Aldric Gilbert
Sent: Sunday, July 22, 2007 15:00
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] [FILTER DRIVER][AGAIN][NOOB Level2] Unamed device

Tim Roberts a ?crit :

xxxxx@comcast.net wrote:

>> In a word how to attach my filter to an unamed device?
>>
> Will
> PDEVICE_OBJECT IoAttachDeviceToDeviceStack(
> * *IN PDEVICE_OBJECT /SourceDevice/*,*
> * *IN PDEVICE_OBJECT /TargetDevice/
> * *);
> help?
>

Sure, if you can locate the device object for your target device.

If you know the plug and play ID of the device you want to filter, why
don’t you just add your driver to the UpperFilters or LowerFilters value
in its Enum registry key? Then the operating system will load your
filter automatically and HAND you the device object for your place in
the stack.

Ok thank you very much for the help, and sorry for the lag between your
last answer and mine, but i’m afraid to run out of time.
It’s a crazy race to restore the laboratory to something near of an
operational state here.

And since we are in a critical situation, we’ve got no money to
outsource drivers dev.
But we have to finish some forgotten softwares in the same time (in fact
in share time).

So, i have to give up with drivers until i finish with other stuffes.
May be i’ll ask more later.

Is there any tools you use with succes to make some drivers skelletons?
Some wizzards? What do you think about softice driver studio?


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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