Esempio n. 1
0
        public unsafe static IEnumerable <PhysicalStoreInformation> EnumeratePhysicalStores(SystemStoreLocation location, string systemStoreName)
        {
            var      info       = new List <PhysicalStoreInformation>();
            GCHandle infoHandle = GCHandle.Alloc(info);

            fixed(char *namePointer = systemStoreName)
            {
                try
                {
                    // To lookup system stores in an alternate location you need to set CERT_SYSTEM_STORE_RELOCATE_FLAG
                    // and pass in the name and alternate location (HKEY) in pvSystemStoreLocationPara.
                    var callBack = new CertEnumPhysicalStoreCallback(PhysicalStoreEnumeratorCallback);
                    Direct.CertEnumPhysicalStore(
                        pvSystemStore: (IntPtr)namePointer,
                        dwFlags: (uint)location,
                        pvArg: GCHandle.ToIntPtr(infoHandle),
                        pfnEnum: callBack);
                }
                finally
                {
                    infoHandle.Free();
                }
            }

            return(info);
        }
 public static extern bool CertEnumPhysicalStore(
     [In, MarshalAs(UnmanagedType.LPWStr)] string pvSystemStore,
     [In] uint dwFlags,
     [In] IntPtr pvArg,
     [In] CertEnumPhysicalStoreCallback pfnEnum);
Esempio n. 3
0
 public static extern bool CertEnumPhysicalStore(
     IntPtr pvSystemStore,
     uint dwFlags,
     IntPtr pvArg,
     CertEnumPhysicalStoreCallback pfnEnum);