locked
CertOpenSystemStoreA hangs on Windows 7 RRS feed

  • Question

  • Hello,

    I am attempting to make the following call in order to enumerate certificates:

    HCERTSTORE handle = CertOpenSystemStoreA(NULL, "CA");

    This works on Windows 10 and I am able to successfully enumerate the certificates in the store, but on Windows 7 the application hangs at this line.  This is done on application start up, before any UI has loaded, and so the only way to terminate the application is by using task manager.  I've also tried passing "AuthRoot" and "ROOT" as the second parameter.

    I haven't been able to find any similar issue online and am not sure how to proceed, any advice would be much appreciated.

    EDIT:

    I have resolved this issue. The certificate enumeration was being performed in the initialisation of a static global, I modified this to be a singleton which is initialised on first use and this resolved the issue. My guess is that something in the Windows API was not fully initialised when my global was created and this caused the hang. The singleton is initialised later and so does not suffer the same problem. It does however mean that I've had to mutex the retrieval of the singleton as this could now happen on multiple threads.

    Tuesday, March 26, 2019 9:18 AM