Skip to content

Commit 7740d0e

Browse files
committed
Update GetItemsAsync
1 parent b82fccd commit 7740d0e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Files.App.Storage/Storables/WindowsStorage/WindowsFolder.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,19 @@ public unsafe WindowsFolder(Guid folderId)
3232
(void**)ThisPtr.GetAddressOf());
3333
}
3434

35-
public IAsyncEnumerable<IStorableChild> GetItemsAsync(StorableType type = StorableType.All, CancellationToken cancellationToken = default)
35+
public unsafe IAsyncEnumerable<IStorableChild> GetItemsAsync(StorableType type = StorableType.All, CancellationToken cancellationToken = default)
3636
{
37+
using ComPtr<IEnumShellItems> pEnumShellItems = default;
38+
Guid IID_IEnumShellItems = typeof(IEnumShellItems).GUID;
39+
var BHID_EnumItems = PInvoke.BHID_EnumItems;
40+
HRESULT hr = ThisPtr.Get()->BindToHandler(null, &BHID_EnumItems, &IID_IEnumShellItems, (void**)pEnumShellItems.GetAddressOf());
41+
42+
using ComPtr<IShellItem> pShellItem = default;
43+
while (pEnumShellItems.Get()->Next(1, pShellItem.GetAddressOf()).Succeeded)
44+
{
45+
// instantiate and return here.
46+
}
47+
3748
throw new NotImplementedException();
3849
}
3950

0 commit comments

Comments
 (0)