RE: Upper filter driver and Microsoft Usbccid driver problem

Read this

http://msdn.microsoft.com/en-us/library/windows/hardware/ff561214(v=vs.85).aspx

You will need to set the file object policy as well (UmdfFileObjectPolicy) to allow the missing file object

d

Bent from my phone


From: Mark Shnaidermailto:xxxxx
Sent: ?12/?26/?2013 9:13 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE: [ntdev] Upper filter driver and Microsoft Usbccid driver problem

Hello,
In AddDevice I safe TopOfStack:
status = IoCreateDevice(Driver,
sizeof(DEVICE_EXTENSION),
NULL,
FILE_DEVICE_SMARTCARD,
0,
FALSE,
&device
);

if (NT_SUCCESS(status))
{
devExt = (PDEVICE_EXTENSION) device->DeviceExtension;
devExt->TopOfStack = IoAttachDeviceToDeviceStack(device, PDO);
}
The my filter driver properly monitoring Irp to Microsoft Usbccid driver in FilterDispatchDeviceControl:

IoStack = IoGetCurrentIrpStackLocation (Irp);
IoControlCode = IoStack->Parameters.DeviceIoControl.IoControlCode;
switch (IoControlCode)
{
case IOCTL_SMARTCARD_IS_PRESENT:
-----
break;
case IOCTL_SMARTCARD_POWER:
----
break;
case IOCTL_SMARTCARD_TRANSMIT:
----
DeviceExtension->IsStartIoComplete = TRUE;
break;
}

if(DeviceExtension->IsStartIoComplete) {
IoCopyCurrentIrpStackLocationToNext(Irp)
IoSetCompletionRoutine( Irp, ArScFilterIoComplete,
DeviceObject, TRUE, TRUE, TRUE );
}else
IoSkipCurrentIrpStackLocation(Irp);

status = IoCallDriver(((PDEVICE_EXTENSION) DeviceObject->DeviceExtension)->TopOfStack, Irp);

Problem if use our proprietary request (IOCTL_SMARTCARD_PROP) and send requests(IOCTL_SMARTCARD_TRANSMIT) Microsoft Usbccid driver(SCR,OMINKEY readers work OK)

case IOCTL_SMARTCARD_PROP:
------
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = IoBuildDeviceIoControlRequest(
IOCTL_SMARTCARD_TRANSMIT,
DeviceExtension->TopOfStack,
DeviceExtension->ScSendData,
DeviceExtension->ScTransmitLen,
OutBuffer,
SC_BUFFER_SIZE,
FALSE,
&event,
&ioStatus);

if( irp==NULL )
return STATUS_UNSUCCESSFUL;

status = IoCallDriver( DeviceExtension->TopOfStack, irp);
return STATUS_INVALID_DEVICE_REQUEST (0xC0000010L

Thanks for any help
Best regards
Mark

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, December 26, 2013 5:43 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Upper filter driver and Microsoft Usbccid driver problem

Do you have an open handle to the stack and setting the file object properly in the next stack location of the irpnwhen formatting?

d

Bent from my phone
________________________________
From: Mark Shnaidermailto:xxxxx
Sent: ?12/?26/?2013 6:40 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE: [ntdev] Upper filter driver and Microsoft Usbccid driver problem
Hello,
The Precise.inf file contains directive UmdfKernelClientPolic:
[UsbccidActivCard_Install.NT.Wdf]
KmdfService = WINUSB, WinUsb_Install
UmdfService=WUDFUsbccidDriver, WUDFUsbccidDriver_Install
UmdfServiceOrder=WUDFUsbccidDriver
UmdfDispatcher=WinUsb
UmdfKernelModeClientPolicy=AllowKernelModeClients

but IoCallDriver return error.
Best regards
Mark

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, December 24, 2013 20:04
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Upper filter driver and Microsoft Usbccid driver problem

Mark Shnaider wrote:

If use SCR3310 or OMNILEY readers and computer connect to Internet those readers do not use WUDF driver( drivers will be updated) .
For example driver SCR3XX2K.sys signed by Microsoft will be used for SCR 3310 reader.
In this case driver works properly and send sequense of smart card commands to low level diver without any problem.

If SCR3310,OMNIKEY,Precise readers use WUDF driver IoCallDriver return STATUS_INVALID_DEVICE_REQUEST (0xC0000010L).
I was wondering if anyone can help me what is wrong.

As I recently learned the hard way (although it IS documented), you cannot have a kernel driver sitting above a UMDF driver unless the UMDF driver allowed for that in its INF file, by setting UmdfKernelClientPolicy. If the UMDF driver didn’t do that, then your kernel filter is not allowed to send it requests.



Tim Roberts, xxxxx@probo.commailto:xxxxx

Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>