Example #1
0
        public static IEnumerable <string> EnumerateSystemStoreLocations()
        {
            var      info   = new List <string>();
            GCHandle handle = GCHandle.Alloc(info);

            try
            {
                var callBack = new CertEnumSystemStoreLocationCallback(SystemStoreLocationCallback);
                Direct.CertEnumSystemStoreLocation(
                    dwFlags: 0,
                    pvArg: GCHandle.ToIntPtr(handle),
                    pfnEnum: callBack);
            }
            finally
            {
                handle.Free();
            }

            return(info);
        }