列出使用智能卡读卡器的进程
我正在编写一个必须处理智能卡读卡器的 Windows 服务。
很多时候,当我尝试连接到插入的智能卡时,SCardConnect()
会失败并显示 SCARD_E_SHARING_VIOLATION
,这基本上意味着:
由于其他未完成的连接,无法访问智能卡。
很公平。
我猜想至少有一个其他进程会同时尝试访问 Smart。但是有没有办法确定它是哪个进程?
I'm writing a Windows service that must handle Smart card readers.
Very often, when I try to connect to an inserted Smart card, SCardConnect()
fails with SCARD_E_SHARING_VIOLATION
which basically means:
The smart card cannot be accessed because of other outstanding connections.
Fair enough.
I guess that a least one other process tries to access the Smart at the same time. But is there a way to determine which process(es) it is ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的地方,我会尝试使用 Process Explorer 来查看该文件如果您访问智能卡读卡器,则由您的应用程序打开的句柄。为此,您应该选择您的进程并按Ctrl-H(菜单“View”/“Low Pane View”/“Handes”)。了解智能卡读卡器的设备名称后,如果收到
SCARD_E_SHARING_VIOLATION
错误,您将能够找到使用该设备的其他进程。您应该只使用 Ctrl-F (菜单“查找”/“查找句柄或 DLL...”)来查找文件句柄。On your place I would try with the Process Explorer to look at the file handles opened by your application if you access to the Smart card readers. To do this you should select your process and press Ctrl-H (menu "View"/"Low Pane View"/"Handes"). After you know the device name of the Smart card readers you will be able to find out other processes which use the device if you receive
SCARD_E_SHARING_VIOLATION
error. You should just use Ctrl-F (menu "Find"/"Find Handle or DLL...") to find file handle.