Howto enable Smart Card debug tracing

Hi I have done a checked build of the PSCR sample from WDK 6001. This uses the SmartcardDebug API for tracing. I dont see any output in DebugView.

  1. How do I enable the SmartcardDebug tracing?
  2. What tool can I use to view the output?

Thanks

Ditta

WinDbg is one, though you may also need to install the checked build of the
HAL and kernel …

Look for “Debugging Tools for Windows” …


The personal opinion of
Gary G. Little

wrote in message news:xxxxx@ntdev…
> Hi I have done a checked build of the PSCR sample from WDK 6001. This uses
> the SmartcardDebug API for tracing. I dont see any output in DebugView.
>
> 1) How do I enable the SmartcardDebug tracing?
> 2) What tool can I use to view the output?
>
> Thanks
>
> Ditta
>
>

Thanks for your response Gary, I dont see any output under SoftICE either.

However I do get output from some KdPrint() statements I have added to the code.

From my reading, it seems SmartcardDebug() are subsititued where KdPrint() would be typically used. I am thinking there is either a registry setting or a tool that “turns on” the SmartcardDebug tracing.

Quick look to older WDK sources shows SmartcardDebug() makes the decision according to SmartcardGetDebugLevel() return value. Google and docs don’t reveal anything more than one would guess from the call name. However, there is SmartcardSetDebugLevel() fuction available. I’d try to call it on the beginning with the appropriate level.

As for capturing, DebugView is the best tool available. I guess you don’t use Vista as SI doesn’t work there but anyway, there is a new capture option in the latest DebugView version which has to be checked to see all DbgPrints. Including all the stupid unwanted messages from OS drivers :-/

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@hotmail.com[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, October 23, 2007 6:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Howto enable Smart Card debug tracing

Thanks for your response Gary, I dont see any output under SoftICE either.

However I do get output from some KdPrint() statements I have added to the code.

From my reading, it seems SmartcardDebug() are subsititued where KdPrint() would be typically used. I am thinking there is either a registry setting or a tool that “turns on” the SmartcardDebug tracing.


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

This is certainly not the most elegant solution, but problems like this
are way just irritating - just change the definition of SmartCardDebug()
to lose the conditional. While nice in concept, I have never really
found the general “LEVEL” idea to be granular enough to be useful in
practice, especially in something that you didn’t write yourself.

mm

Michal Vodicka wrote:

Quick look to older WDK sources shows SmartcardDebug() makes the decision according to SmartcardGetDebugLevel() return value. Google and docs don’t reveal anything more than one would guess from the call name. However, there is SmartcardSetDebugLevel() fuction available. I’d try to call it on the beginning with the appropriate level.

As for capturing, DebugView is the best tool available. I guess you don’t use Vista as SI doesn’t work there but anyway, there is a new capture option in the latest DebugView version which has to be checked to see all DbgPrints. Including all the stupid unwanted messages from OS drivers :-/

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@hotmail.com[SMTP:xxxxx@hotmail.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Tuesday, October 23, 2007 6:28 PM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Howto enable Smart Card debug tracing
>
> Thanks for your response Gary, I dont see any output under SoftICE either.
>
> However I do get output from some KdPrint() statements I have added to the code.
>
> From my reading, it seems SmartcardDebug() are subsititued where KdPrint() would be typically used. I am thinking there is either a registry setting or a tool that “turns on” the SmartcardDebug tracing.
>
>
> —
> 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
>

Thanks all for your replies.

Ok as suggested, I placed the SmartcardSetDebugLevel(DEBUG_ALL) at the top of the DriverEntry routine - and that enables the tracing. However I would have thought there will be a setting or a utility that is external to the driver that will allow me to set the tracing level. That would seem the logical way to go about it?

Ditta

Quick look to older WDK sources shows SmartcardDebug() makes the decision
according to SmartcardGetDebugLevel() return value. Google and docs don’t reveal
anything more than one would guess from the call name. However, there is
SmartcardSetDebugLevel() fuction available. I’d try to call it on the beginning
with the appropriate level.

Most things in the NT kernel are logical but the problem is documentation. It is incomplete and the selection of documented parts is far from logical. Maybe it is implemented the way you think but nobody bothered to document it. The information value of the docs for these two functions is near to zero.

If you’re really interested about it, I’d recommend to disassemble the Get function to see if the default debug level is read from the registry for example and from where. Sounds as strange recomendation? Welcome to NT kernel world :wink:

BTW, there is a next logical possibility. The decision how to set debug level and where to get it can be left purely on your driver and the library only provides simple infrastructure allowing to use it. However, such design should be documented.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of xxxxx@hotmail.com[SMTP:xxxxx@hotmail.com]
Reply To: Windows System Software Devs Interest List
Sent: Wednesday, October 24, 2007 6:03 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Howto enable Smart Card debug tracing

Thanks all for your replies.

Ok as suggested, I placed the SmartcardSetDebugLevel(DEBUG_ALL) at the top of the DriverEntry routine - and that enables the tracing. However I would have thought there will be a setting or a utility that is external to the driver that will allow me to set the tracing level. That would seem the logical way to go about it?

Ditta

>Quick look to older WDK sources shows SmartcardDebug() makes the decision
according to SmartcardGetDebugLevel() return value. Google and docs don’t reveal
anything more than one would guess from the call name. However, there is
SmartcardSetDebugLevel() fuction available. I’d try to call it on the beginning
with the appropriate level.


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