http://bugs.winehq.org/show_bug.cgi?id=27168
--- Comment #34 from Ilya Konovalov aragaer@gmail.com 2011-09-28 14:10:57 CDT --- (In reply to comment #33)
Out of curiosity, I wrote a brief test for the cert store that a cert created via CertCreateCertificateContext has; see commit 546bfa2c1ce82f80613cce7870d306faf2de653a. It appears as though the cert isn't actually in this store, so somehow the cert contains a reference to the store even though it isn't part of it.
It seems it's not a real store after all. I ran the test several times, created lots of certs in a loop and every time it pointed to the same store. Which seemed weird enough. I tried to duplicate the store - that succeeded. I tried to close the duplicate and that failed with E_UNEXPECTED (8000ffff).
I believe that creation of memstore with intermediate certs is indeed the function of schannel (msdn explicitly mentions the store and intermediate certs in QueryContextAttributes page for schannel).