public static ICollection <string> GetStoreNames(StoreLocation location)
        {
            var callback = new CertEnumSystemStoreCallBackProto(CertEnumSystemStoreCallBack);
            var names    = new List <string>();
            CertificateSystemStoreLocation locationFlags;

            switch (location)
            {
            case StoreLocation.CurrentUser:
                locationFlags = CertificateSystemStoreLocation.CurrentUser;
                break;

            case StoreLocation.LocalMachine:
                locationFlags = CertificateSystemStoreLocation.LocalMachine;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(location), location, null);
            }

            lock (StoreNamesSyncLock)
            {
                EnumeratedStoreNames.Clear();
                CertEnumSystemStore(locationFlags, IntPtr.Zero, IntPtr.Zero, callback);
                names.AddRange(EnumeratedStoreNames);
            }

            return(names);
        }
 bool CertEnumSystemStore(CertificateSystemStoreLocation dwFlags, IntPtr notUsed1, IntPtr notUsed2,
                          CertEnumSystemStoreCallBackProto fn);
示例#3
0
 internal static extern bool CertEnumSystemStore(CertStoreFlags Flags, IntPtr notUsed1, IntPtr notUsed2, CertEnumSystemStoreCallBackProto fn);
示例#4
0
 internal static extern bool CertEnumSystemStore(CertStoreFlags Flags, IntPtr notUsed1, IntPtr notUsed2, CertEnumSystemStoreCallBackProto fn);
示例#5
0
 bool CertEnumSystemStore(CertStoreFlags Flags,
                          IntPtr notUsed1,
                          IntPtr notUsed2,
                          CertEnumSystemStoreCallBackProto fn);