Example #1
0
        public unsafe void OpenIStorage()
        {
            using (var cleaner = new TestFileCleaner())
            {
                string   path    = cleaner.GetTestPath();
                IStorage storage = (IStorage)ComMethods.CreateStorage(path, InterfaceIds.IID_IStorage);
                Guid     guid    = new Guid();
                storage.SetClass(ref guid);
                storage.Commit(StorageCommit.Default);
                Marshal.ReleaseComObject(storage);
                storage = (IStorage)ComMethods.OpenStorage(path, InterfaceIds.IID_IStorage);
                storage.Should().NotBeNull();

                storage.Stat(out var stats, StatFlag.Default);
                stats.GetAndFreeString().Should().Be(path);
                stats.type.Should().Be(StorageType.Storage);
                stats.clsid.Should().Be(guid);
            }
        }