大家好,我正在写一个python脚本来访问windows的winscard.dll。
lib = cdll.LoadLibrary('winscard.dll')
hSC = c_long(0)
lRetval = lib.SCardEstablishContext(0,None,None,pointer(hSC))上面返回一个值错误,如下所示
Traceback (most recent call last):
File "C:\Documents and Settings\sbritto\Desktop\OpenSSL\python\test.py",
line 17, in <module>
lRetval = lib.SCardEstablishContext(0,None,None,pointer(hSC))
ValueError: Procedure called with not enough arguments (16 bytes missing) or
wrong calling convention这种情况下的值error表示参数是错误的。但我不知道还需要输入什么才能让它工作,我尝试了几种输入组合。
谢谢你们所有人。
发布于 2013-03-18 22:00:14
您对DLL使用了错误的调用约定:
lib = ctypes.WinDLL("winscard")
handle = ctypes.c_voidp()
lib.SCardEstablishConnection(0, None, None, ctypes.pointer(handle))
# returns 0, all is good
handle
# c_void_p(some address), handle got created附注:请确保Smart Card服务已启动。否则,您会得到一个隐含的错误代码。
https://stackoverflow.com/questions/14151919
复制相似问题