http://bugs.winehq.org/show_bug.cgi?id=27168
--- Comment #26 from Ilya Konovalov aragaer@gmail.com 2011-09-18 12:27:15 CDT --- (In reply to comment #25)
Don't assign to store in a print statement, it's easy to miss.
My bad, was trying to make it all as short as possible and in some places I've shortened it a bit too much.
Also, it would be preferable to assign store using CertDuplicateStore, i.e.:
store = CertDupicateStore(cert->hCertStore);
Otherwise, it's possible that the last remaining store reference is closed when you call CertEnumCertificatesInStore for the last cert in the store, implicitly closing the store and freeing it.
That's the point - once the certificate is freed the associated temporary storage is closed and CertEnumCertificatesInStore returns nothing.