Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Beginning of my virtual smart card reader driver development Win 10.

minhptaminhpta Member Posts: 15
edited October 2019 in NTDEV

Hello guys,
I've just started developing Window driver and my first task is develop a virtual smart card reader driver.
I've read several related threads including

But I still not get my virtual reader visible to user applications.
I've tried to built and install an smart card reader driver sample is Windows-driver-samples/smartcrd to my target Windows 10 host but the OS cannot load it like bellow picture.

I've tried to create a new KDMF project and use the same source code from the sample(because I think the sample project's configuration is out of date) but the problem is same.
I think the driver depend on smart card library(smclib.sys), and may be it is the cause of the OS cannot load the driver.

I know in this forum many of you guys can make your own smart card reader driver work.
Can you help me find out the issue here or give me a sample source code of virtual smart card reader driver that is able to run on Windows 10.

My IDE: Visual Studio 2019
My OS: Window 10 pro, 1903, build 18362.30

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,403

    smclib.sys is part of the operating system. It's always available.

    Are you running a 64-bit or a 32-bit system? Did you build the driver to match that? They must match.

    Did you sign your driver? How? If you self-signed, is your system in "test" mode?

    How, exactly, did you install your driver? I'm guessing you don't actually have a PCMCIA SCM-488C card reader. Did you change the INF to make it virtual?

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • minhptaminhpta Member Posts: 15
    edited October 2019

    Are you running a 64-bit or a 32-bit system? Did you build the driver to match that? They must match.

    My target system is Window 10 pro, 1903, build 18362.30, 64 bit system. And my Window Driver Kit is 10.0.18362.1, it is match with os version 1903.
    I got it from https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk.
    I have also installed some other sample driver successfully. So, I think this is not a cause of problem.

    Did you sign your driver? How? If you self-signed, is your system in "test" mode?

    My target system is in test mode and I've installed the driver via deploy feature of Visual Studio or use 'devcon install ...' but the phenomenon is the same.

    How, exactly, did you install your driver? I'm guessing you don't actually have a PCMCIA SCM-488C card reader. Did you change the INF to make it virtual?

    For manual install, I used 'devcon install pscr.inf PCMCIA\PSCR-Smart_Card_Reader-488C'.
    Yes, I don't have PCMCIA SCM-488C card reader. I also don't know that I need to change INF to make my driver virtual.

    Post edited by minhpta on
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,403

    And my Window Driver Kit is 10.0.18362.1, it is match with os version 1903.

    That's not what I asked. It doesn't matter whether your WDK version matches your Windows version. What I asked is if you built your driver as 64-bit. It's common error to build a 32-bit driver and try to install it on a 64-bit system.

    For manual install, I used 'devcon install pscr.inf PCMCIA\PSCR-Smart_Card_Reader-488C'.

    What led you to do that? You shouldn't be installing drivers without understanding what's going on. What that does is create a FAKE device called PCMCIA\PSCR-Smart_Card_Reader-488C, and loads your driver for that fake device. The problem is that your fake device will not be connected to any hardware, so you won't get any PCMCIA resources, which that driver expects. You need to do some work in that sample to turn it into a virtual driver with no hardware connection, and you need to change the INF file to create a hardware ID that doesn't look like a real device.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • minhptaminhpta Member Posts: 15
    edited October 2019

    @Tim_Roberts said:

    And my Window Driver Kit is 10.0.18362.1, it is match with os version 1903.

    That's not what I asked. It doesn't matter whether your WDK version matches your Windows version. What I asked is if you built your driver as 64-bit. It's common error to build a 32-bit driver and try to install it on a 64-bit system.

    Yes, I missed that in my descriptions but I just want to describe my situation in details and my system and my driver are the same 64-bit platform.

    I am trying to make a new driver, write the code line by line and now my virtual smart card reader can be loaded and my driver's routines can be traveled by the system.
    I think, it is good starting point to do further steps.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,403

    Yes, I agree, but you have to do some work in that sample first. You have to remove everything that talks to hardware, and you need to change the INF file to use a hardware ID that doesn't mimic an actual hardware bus. You could use a hardware ID like SW/virtual-smart-card, or even use a GUID like SW/{12345678-1234-1234...}.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA