Skip to content

Commit 5591b5a

Browse files
author
dahall
committed
Fixed bug #530 in declaration of IPropertyStoreFactory.GetPropertyStore.
1 parent cbef155 commit 5591b5a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

PInvoke/Ole/PropSys/PropSys.Interfaces.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ public interface IPropertyStoreFactory
15021502
/// </remarks>
15031503
// https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-ipropertystorefactory-getpropertystore HRESULT
15041504
// GetPropertyStore( GETPROPERTYSTOREFLAGS flags, IUnknown *pUnkFactory, REFIID riid, void **ppv );
1505-
void GetPropertyStore(GETPROPERTYSTOREFLAGS flags, [Optional, MarshalAs(UnmanagedType.IUnknown)] ICreateObject? pUnkFactory, in Guid riid, out IPropertyStore ppv);
1505+
void GetPropertyStore(GETPROPERTYSTOREFLAGS flags, [Optional] ICreateObject? pUnkFactory, in Guid riid, out IPropertyStore ppv);
15061506

15071507
/// <summary>
15081508
/// <para>

UnitTests/PInvoke/Shell32/IShellFolderTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using NUnit.Framework;
2+
using System.Linq;
23
using Vanara.Collections;
4+
using static Vanara.PInvoke.PropSys;
35
using static Vanara.PInvoke.Shell32;
46

57
namespace Vanara.PInvoke.Tests;
@@ -47,4 +49,20 @@ public void EnumSearchesTest()
4749
}
4850

4951
}
52+
53+
[Test]
54+
public void Issue530Test()
55+
{
56+
var pFolder = (IShellFolder2)new MyDocuments();
57+
var item = pFolder.EnumObjects().FirstOrDefault();
58+
Assert.That(item, Is.Not.Null);
59+
60+
IPropertyStoreFactory? propertyStoreFactoryForChild = null;
61+
Assert.That(() => propertyStoreFactoryForChild = pFolder.BindToObject<IPropertyStoreFactory>(item!), Throws.Nothing);
62+
Assert.That(propertyStoreFactoryForChild, Is.Not.Null);
63+
64+
IPropertyStore? propertyStoreForChild = null;
65+
Assert.That(() => propertyStoreFactoryForChild!.GetPropertyStore(GETPROPERTYSTOREFLAGS.GPS_DEFAULT, null, typeof(IPropertyStore).GUID, out propertyStoreForChild), Throws.Nothing);
66+
Assert.That(propertyStoreForChild, Is.Not.Null);
67+
}
5068
}

0 commit comments

Comments
 (0)