Wrong stack location?

Hello,

I wanted to install my filter driver other a serial over bluetooth port. The driver simply forwards all incoming requests (I hope so). For this I manually installed it through “Update Driver” menu. All seemed to happen properly, the port is named as specified in my .inf and the filter driver is shown under upper device filters, but I have doubts if the communication is going through it. I wanted to test it with simply sending back every write request, but Hyperterminal receives nothing. For installing I used the Class and GUID of PORTS. I don’t know exactly if this is the right device setup class, because I’ve read that the driver for this serial other bluetooth port is bthmodem and that it is providing a serial interface at it’s upper edge. Can I reach this driver with PORTS and the corresponding GUID or do I have to install it in another way? I thought if my filter driver is listed under device upper filters of the port it would load and work properly, or am I wrong?

Thanks and in advance
Hannes

After you have created your wdfdevice in your adddevice routine, run !wdfkd.wdfdevice (your wdfdevice). This will give you your PDEVICE_OBJECT in the self field. Pass this value to !devstack (your pdevobj) and send the output of this command. Hopefully the instance path starts with bthenum…

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@device.de
Sent: Friday, November 28, 2008 1:11 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Wrong stack location?

Hello,

I wanted to install my filter driver other a serial over bluetooth port. The driver simply forwards all incoming requests (I hope so). For this I manually installed it through “Update Driver” menu. All seemed to happen properly, the port is named as specified in my .inf and the filter driver is shown under upper device filters, but I have doubts if the communication is going through it. I wanted to test it with simply sending back every write request, but Hyperterminal receives nothing. For installing I used the Class and GUID of PORTS. I don’t know exactly if this is the right device setup class, because I’ve read that the driver for this serial other bluetooth port is bthmodem and that it is providing a serial interface at it’s upper edge. Can I reach this driver with PORTS and the corresponding GUID or do I have to install it in another way? I thought if my filter driver is listed under device upper filters of the port it would load and work properly, or am I wrong?

Thanks and in advance
Hannes


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

Could you please explain this for a unexperienced driver writer? :slight_smile:
This is my first driver and I don’t exactly know how I should do this.
In the registry I saw that the instance path of the device does start
with bthenum.

Thank you very much
Hannes

Are you using a kernel debugger to debug your driver? !wdfkd is a WinDbg/KD command.

Hi,

As a beginner to beginner - I can help you to start with this. What you need is to “debug” your driver with Kernel Debugger, WinDbg in that case. For that, you need additional PC to run the WinDbg on. Here are step-by-step instructions of how to do that. Assumptions:

  • PC on which you installed your driver (debugged PC) is WinXP x86.
  • Both PCs are connected through a serial cable.
  1. Install WinDbg on another PC (available for free from Microsoft at http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx)

  2. Connect the PC with WinDbg to the debugged PC with a serial cable. Run WinDbg, choose File->Kernel debug. Now the WinDbg waits for the debugged computer to connect.

  3. On the debugged PC Perform: Start -> Run -> msconfig. Choose BOOT.INI tab, ‘Advanced Options’, check ‘Debug’, choose the COM port to which the cable is connected to in ‘/DEBUGPORT’ combo, and chose 115200 for ‘/BAUDRATE’. Save the changes, and reboot the PC.

That’s it, you have your PC connected to WinDbg. Now, when your driver is loaded, you can press ‘Break’ on the debugger, and from here follow Doron’s instructions.

Good Luck,
S.

Hi,

I followed you instructions and set up WinDbg. I saw, that
WdfDeviceCreate had failed.

Extract from WinDbg:

COM Port Filter
Built Dec 1 2008 16:42:40
WdfDeviceCreate failed with status code 0xc0000004

Unfortunately I can’t say why this had happened, because of my
inexperience in writing drivers. Is this possible with a wrong .inf or
might the failure be directly in the driver code? To exclude all doubts
I attach my inf.

[Version]
Signature = “$WINDOWS NT$”
Class = PORTS
ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318}
Provider = %MSFT%
DriverVer=11/26/2008,6.0.6001.18000

[DestinationDirs]
DefaultDestDir = 12

;*****************************************
; BthCom Device Filter Install Section
;*****************************************

[Manufacturer]
%StdMfg%=Standard,NTx86

; For Win2K
[Standard]
; DisplayName Section DeviceId
; ----------- ------- --------
%BthCom.DeviceDesc%=BthCom, BTHENUM{00001101-0000-1000-8000-00805f9b34fb}

; For XP and later
[Standard.NTx86]
%BthCom.DeviceDesc%=BthCom, BTHENUM{00001101-0000-1000-8000-00805f9b34fb}

[BthCom.NT]
CopyFiles=BthCom.NT.Copy

[BthCom.NT.Copy]
bthcom.sys

[BthCom.NT.HW]
AddReg = BthCom.NT.HW.AddReg

[BthCom.NT.HW.AddReg]
HKR,“UpperFilters”,0x00010000,“BthCom”

;*****************************************
; BthCom Device Filter Service Section
;*****************************************

[BthCom.NT.Services]
;Do not specify SPSVCINST_ASSOCSERVICE on filter drivers.
AddService = BthCom, filter_Service_Inst

[filter_Service_Inst]
DisplayName = %filter.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\bthcom.sys

;*************************
; Source file information
;*************************

[SourceDisksNames]
1 = %DiskId1%,“”

[SourceDisksFiles]
bthcom.sys = 1,

;
;— BthCom Coinstaller installation ------
;
[DestinationDirs]
BthCom_CoInstaller_CopyFiles = 11

[BthCom.NT.CoInstallers]
AddReg = BthCom_CoInstaller_AddReg
CopyFiles = BthCom_CoInstaller_CopyFiles

[BthCom_CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01007.dll,WdfCoInstaller”

[BthCom_CoInstaller_CopyFiles]
WdfCoInstaller01007.dll

[SourceDisksFiles]
WdfCoInstaller01007.dll=1 ; make sure the number matches with
SourceDisksNames

[BthCom.NT.Wdf]
KmdfService = BthCom, BthCom_wdfsect

[BthCom_wdfsect]
KmdfLibraryVersion = 1.7

[Strings]
SPSVCINST_ASSOCSERVICE = 0x00000002
MSFT = “***”
StdMfg = “(Standard system devices)”
ClassName = “PORTS”
DiskId1 = “COM Filter Installation Disk #1
BthCom.DeviceDesc = “***”
filter.SvcDesc = “BTHCOM”

> WdfDeviceCreate failed with status code 0xc0000004

That’s STATUS_INFO_LENGTH_MISMATCH, you’ve probably messed up your
parameters to the create call somehow (not initialized something with the
appropriate _INIT macro would be my guess).

Two things to do:

  1. Dump the IFR, it should tell you what the framework doesn’t like

http://www.osronline.com/article.cfm?article=496

http://www.microsoft.com/whdc/Driver/tips/KMDF_IfrLog.mspx

  1. Enable KMDF verifier.

See the wdfverifier.exe tool in the latest WDK.

-scott


Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Hannes Finck” wrote in message news:xxxxx@ntdev…
> Hi,
>
> I followed you instructions and set up WinDbg. I saw, that WdfDeviceCreate
> had failed.
>
> Extract from WinDbg:
>
> COM Port Filter
> Built Dec 1 2008 16:42:40
> WdfDeviceCreate failed with status code 0xc0000004
>
> Unfortunately I can’t say why this had happened, because of my
> inexperience in writing drivers. Is this possible with a wrong .inf or
> might the failure be directly in the driver code? To exclude all doubts I
> attach my inf.
>
>
> [Version]
> Signature = “$WINDOWS NT$”
> Class = PORTS
> ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318}
> Provider = %MSFT%
> DriverVer=11/26/2008,6.0.6001.18000
>
> [DestinationDirs]
> DefaultDestDir = 12
>
>
> ;
> ; BthCom Device Filter Install Section
> ;

>
> [Manufacturer]
> %StdMfg%=Standard,NTx86
>
> ; For Win2K
> [Standard]
> ; DisplayName Section DeviceId
> ; ----------- ------- --------
> %BthCom.DeviceDesc%=BthCom, BTHENUM{00001101-0000-1000-8000-00805f9b34fb}
>
> ; For XP and later
> [Standard.NTx86]
> %BthCom.DeviceDesc%=BthCom, BTHENUM{00001101-0000-1000-8000-00805f9b34fb}
>
>
> [BthCom.NT]
> CopyFiles=BthCom.NT.Copy
>
> [BthCom.NT.Copy]
> bthcom.sys
>
> [BthCom.NT.HW]
> AddReg = BthCom.NT.HW.AddReg
>
>
> [BthCom.NT.HW.AddReg]
> HKR,“UpperFilters”,0x00010000,“BthCom”
>
> ;
> ; BthCom Device Filter Service Section
> ;

>
> [BthCom.NT.Services]
> ;Do not specify SPSVCINST_ASSOCSERVICE on filter drivers.
> AddService = BthCom, filter_Service_Inst
>
>
> [filter_Service_Inst]
> DisplayName = %filter.SvcDesc%
> ServiceType = 1 ; SERVICE_KERNEL_DRIVER
> StartType = 3 ; SERVICE_DEMAND_START
> ErrorControl = 1 ; SERVICE_ERROR_NORMAL
> ServiceBinary = %12%\bthcom.sys
>
>
> ;
> ; Source file information
> ;

>
>
> [SourceDisksNames]
> 1 = %DiskId1%,“”
>
> [SourceDisksFiles]
> bthcom.sys = 1,
>
>
> ;
> ;— BthCom Coinstaller installation ------
> ;
> [DestinationDirs]
> BthCom_CoInstaller_CopyFiles = 11
>
> [BthCom.NT.CoInstallers]
> AddReg = BthCom_CoInstaller_AddReg
> CopyFiles = BthCom_CoInstaller_CopyFiles
>
> [BthCom_CoInstaller_AddReg]
> HKR,CoInstallers32,0x00010000, “WdfCoInstaller01007.dll,WdfCoInstaller”
>
> [BthCom_CoInstaller_CopyFiles]
> WdfCoInstaller01007.dll
>
> [SourceDisksFiles]
> WdfCoInstaller01007.dll=1 ; make sure the number matches with
> SourceDisksNames
>
> [BthCom.NT.Wdf]
> KmdfService = BthCom, BthCom_wdfsect
>
> [BthCom_wdfsect]
> KmdfLibraryVersion = 1.7
>
>
> [Strings]
> SPSVCINST_ASSOCSERVICE = 0x00000002
> MSFT = “"
> StdMfg = “(Standard system devices)”
> ClassName = “PORTS”
> DiskId1 = “COM Filter Installation Disk #1
> BthCom.DeviceDesc = "

> filter.SvcDesc = “BTHCOM”
>

Thank you,

your were right. I forgot do initialize the device attributes. Let’s see
what happens next :wink:

Regards
Hannes

Scott Noone schrieb:

> WdfDeviceCreate failed with status code 0xc0000004

That’s STATUS_INFO_LENGTH_MISMATCH, you’ve probably messed up your
parameters to the create call somehow (not initialized something with the
appropriate _INIT macro would be my guess).

Two things to do:

  1. Dump the IFR, it should tell you what the framework doesn’t like

http://www.osronline.com/article.cfm?article=496

http://www.microsoft.com/whdc/Driver/tips/KMDF_IfrLog.mspx

  1. Enable KMDF verifier.

See the wdfverifier.exe tool in the latest WDK.

-scott