Thanks for your comments Juan. Actually, the upcoming implementation checks the used function pointer at each call and returns an error if not assigned. Also in it, winscard always succeed to load even if pcsc-lite is not running. FYI, my first winscard patch contains an advanced stage of the whole implementation. Concerning the BOOL return value, it's here for "historical" reasons. I'll remove it.
Mounir IDRASSI IDRIX - Cryptography and IT Security Experts http://wwww.idrix.fr
+BOOL InitializePCSCLite(void)
You don't use the return value:
@@ -42,9 +43,11 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { DisableThreadLibraryCalls(hinstDLL); WINSCARD_hModule = hinstDLL;
InitializePCSCLite(); break; }
I suspect it's safer not to fail loading winscard if PCSC-Lite isn't available. Instead, the functions such as SCardListCards should probably return empty lists. But knowing to do so relies on knowing that PCSC-Lite couldn't be initialized, so the return value shouldn't be thrown away. Or, remove the return value, and have every function check the function pointers it needs.
--Juan