Smart Card reader driver Driver works on XP but crashes on vista

Hi All,

I have a written a contactless smart card reader driver …Which is
written in KMDF …When i install this on WinXp it works with out
any issues perfectly…

But the same thing when tried to install on vista …after building
it for vista longhorn…it crashes…The crash is as given below…

Do any one has any idea what might be the reason…

*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 1, {81d8ee63, 0, 1, 0}

Probably caused by : ntkrpamp.exe ( nt!NtDeviceIoControlFile+0 )

Followup: MachineOwner

nt!RtlpBreakWithStatusInstruction:
81c81760 cc int 3
1: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

APC_INDEX_MISMATCH (1)
This is a kernel internal error. The most common reason to see this
bugcheck is when a filesystem or a driver has a mismatched number of
calls to disable and re-enable APCs. The key data item is the
Thread->KernelApcDisable field. A negative value indicates that a
driver
has disabled APC calls without re-enabling them. A positive value
indicates
that the reverse is true. This check is made on exit from a system
call.
Arguments:
Arg1: 81d8ee63, address of system function (system call)
Arg2: 00000000, Thread->ApcStateIndex << 8 | Previous ApcStateIndex
Arg3: 00000001, Thread->KernelApcDisable
Arg4: 00000000, Previous KernelApcDisable

Debugging Details:

FAULTING_IP:
nt!NtDeviceIoControlFile+0
81d8ee63 8bff mov edi,edi

DEFAULT_BUCKET_ID: VISTA_RC

BUGCHECK_STR: 0x1

PROCESS_NAME: svchost.exe

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 81cd873f to 81c81760

STACK_TEXT:
a1634944 81cd873f 00000003 a163f2d4 00000000 nt!
RtlpBreakWithStatusInstruction
a1634994 81cd91ac 00000003 00000698 00000103 nt!KiBugCheckDebugBreak
+0x1c
a1634d44 81c8ccd7 00000001 81d8ee63 00000000 nt!KeBugCheck2+0x5f4
a1634d44 77770f34 00000001 81d8ee63 00000000 nt!KiServiceExit2+0x16e
02e4f7d4 6d84aa47 00000698 00310028 00000000 ntdll!RtlUsageHeap+0x24c
02e4f88c 77673833 01aeb640 02e4f8d8 7774a9bd scardsvr!MonitorReader
+0x158
02e4f898 7774a9bd 01aeb640 02e41108 00000000 kernel32!
BaseThreadInitThunk+0xe
02e4f8d8 00000000 6d84a8ef 01aeb640 00000000 ntdll!RtlCreateHeap+0x300

STACK_COMMAND: .bugcheck ; kb

FOLLOWUP_IP:
nt!NtDeviceIoControlFile+0
81d8ee63 8bff mov edi,edi

SYMBOL_NAME: nt!NtDeviceIoControlFile+0

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: nt

IMAGE_NAME: ntkrpamp.exe

DEBUG_FLR_IMAGE_TIMESTAMP: 4549ae00

FAILURE_BUCKET_ID: 0x1_nt!NtDeviceIoControlFile+0

BUCKET_ID: 0x1_nt!NtDeviceIoControlFile+0

Followup: MachineOwner

Have you tested your driver with driver verifier on XP? Perhaps it fails under XP as well with DV enabled, esp with IRQL checking. One thing that comes to mind is that you are acquiring a WDFWAITLOCK on a thread and not releasing it on the same thread. The WDFWAITLOCK must be released on the same thread that it was acquired on. Additionally if you install the CHK version of KMDF (which requires a chk build) and turn on KMDF verifier, we will catch this error (this is not caught with KMDF verifier on a fre version of the framework).

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, October 02, 2007 9:46 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Smart Card reader driver Driver works on XP but crashes on vista

Hi All,

I have a written a contactless smart card reader driver …Which is
written in KMDF …When i install this on WinXp it works with out
any issues perfectly…

But the same thing when tried to install on vista …after building
it for vista longhorn…it crashes…The crash is as given below…

Do any one has any idea what might be the reason…

*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 1, {81d8ee63, 0, 1, 0}

Probably caused by : ntkrpamp.exe ( nt!NtDeviceIoControlFile+0 )

Followup: MachineOwner

nt!RtlpBreakWithStatusInstruction:
81c81760 cc int 3
1: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

APC_INDEX_MISMATCH (1)
This is a kernel internal error. The most common reason to see this
bugcheck is when a filesystem or a driver has a mismatched number of
calls to disable and re-enable APCs. The key data item is the
Thread->KernelApcDisable field. A negative value indicates that a
driver
has disabled APC calls without re-enabling them. A positive value
indicates
that the reverse is true. This check is made on exit from a system
call.
Arguments:
Arg1: 81d8ee63, address of system function (system call)
Arg2: 00000000, Thread->ApcStateIndex << 8 | Previous ApcStateIndex
Arg3: 00000001, Thread->KernelApcDisable
Arg4: 00000000, Previous KernelApcDisable

Debugging Details:

FAULTING_IP:
nt!NtDeviceIoControlFile+0
81d8ee63 8bff mov edi,edi

DEFAULT_BUCKET_ID: VISTA_RC

BUGCHECK_STR: 0x1

PROCESS_NAME: svchost.exe

CURRENT_IRQL: 0

LAST_CONTROL_TRANSFER: from 81cd873f to 81c81760

STACK_TEXT:
a1634944 81cd873f 00000003 a163f2d4 00000000 nt!
RtlpBreakWithStatusInstruction
a1634994 81cd91ac 00000003 00000698 00000103 nt!KiBugCheckDebugBreak
+0x1c
a1634d44 81c8ccd7 00000001 81d8ee63 00000000 nt!KeBugCheck2+0x5f4
a1634d44 77770f34 00000001 81d8ee63 00000000 nt!KiServiceExit2+0x16e
02e4f7d4 6d84aa47 00000698 00310028 00000000 ntdll!RtlUsageHeap+0x24c
02e4f88c 77673833 01aeb640 02e4f8d8 7774a9bd scardsvr!MonitorReader
+0x158
02e4f898 7774a9bd 01aeb640 02e41108 00000000 kernel32!
BaseThreadInitThunk+0xe
02e4f8d8 00000000 6d84a8ef 01aeb640 00000000 ntdll!RtlCreateHeap+0x300

STACK_COMMAND: .bugcheck ; kb

FOLLOWUP_IP:
nt!NtDeviceIoControlFile+0
81d8ee63 8bff mov edi,edi

SYMBOL_NAME: nt!NtDeviceIoControlFile+0

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: nt

IMAGE_NAME: ntkrpamp.exe

DEBUG_FLR_IMAGE_TIMESTAMP: 4549ae00

FAILURE_BUCKET_ID: 0x1_nt!NtDeviceIoControlFile+0

BUCKET_ID: 0x1_nt!NtDeviceIoControlFile+0

Followup: MachineOwner


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