Hello Nick,
Thank you for your detailed report.
About your observations with the card reader flashes: it is function FindObjectsInit that will trigger reading out the card data if it hasn't been cached yet.
And as you state that the code is freezing in FindObjects, reading out the card data does not seem to be where the error lays (as also confirmed by the card reader flashes).
The function FindObjects actually just fetches the previously read and parsed card data and returns (up to the requested amount of) objects that matches the search criteria.
This function can be (like all our pkcs11 function) protected by a mutex (wheather or not mutexes are used depends on the parameters of the C_initialize function).
Are you accessing our pkcs11 library in multiple threads, and specifying the usage of mutexes in C_initialize ?
A second place in this function that has blocking potential is a pcsc call to check if the card reader status hasn't been changed.
I've been looking into this a bit deeper and this one is likely causing the issue you observe.
"Each member of each structure in this array must be initialized to zero and then set to specific values as necessary. If this is not done, the function will fail in situations that involve remote card readers."
Not all members were initialized to zero, I'll fix that now and provide you with a new pkcs11.dll for testing if you like?
Wkr,
Frederik