Skip to content

Commit 4b0fe97

Browse files
committed
Improved
1 parent a9ef2a8 commit 4b0fe97

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Shell.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public unsafe static HRESULT GetPropertyValue<TValue>(this IWindowsStorable stor
4848

4949
public unsafe static bool HasShellAttributes(this IWindowsStorable storable, SFGAO_FLAGS attributes)
5050
{
51-
return storable.ThisPtr->GetAttributes(SFGAO_FLAGS.SFGAO_FOLDER, out var returnedAttributes).Succeeded &&
52-
returnedAttributes == attributes;
51+
return storable.ThisPtr->GetAttributes(attributes, out var dwRetAttributes).Succeeded && dwRetAttributes == attributes;
5352
}
5453

5554
public unsafe static string GetDisplayName(this IWindowsStorable storable, SIGDN options = SIGDN.SIGDN_FILESYSPATH)

src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ public override async Task ExecutePinToSidebarCommand(WidgetCardItem? item)
206206
{
207207
unsafe
208208
{
209-
using ComPtr<IShellItem> pShellItem = default;
210-
hr = pAgileReference.Get()->Resolve(IID.IID_IShellItem, (void**)pShellItem.GetAddressOf());
211-
var windowsFile = new WindowsFile(pShellItem.Get());
209+
IShellItem* pShellItem = null;
210+
hr = pAgileReference.Get()->Resolve(IID.IID_IShellItem, (void**)&pShellItem);
211+
using var windowsFile = new WindowsFile(pShellItem);
212212

213213
// NOTE: "pintohome" is an undocumented verb, which calls an undocumented COM class, windows.storage.dll!CPinToFrequentExecute : public IExecuteCommand, ...
214214
return windowsFile.TryInvokeContextMenuVerb("pintohome");
@@ -242,9 +242,9 @@ public override async Task ExecuteUnpinFromSidebarCommand(WidgetCardItem? item)
242242
{
243243
unsafe
244244
{
245-
using ComPtr<IShellItem> pShellItem = default;
246-
hr = pAgileReference.Get()->Resolve(IID.IID_IShellItem, (void**)pShellItem.GetAddressOf());
247-
var windowsFile = new WindowsFile(pShellItem.Get());
245+
IShellItem* pShellItem = null;
246+
hr = pAgileReference.Get()->Resolve(IID.IID_IShellItem, (void**)&pShellItem);
247+
using var windowsFile = new WindowsFile(pShellItem);
248248

249249
// NOTE: "unpinfromhome" is an undocumented verb, which calls an undocumented COM class, windows.storage.dll!CRemoveFromFrequentPlacesExecute : public IExecuteCommand, ...
250250
// NOTE: "remove" is for some shell folders where the "unpinfromhome" may not work

0 commit comments

Comments
 (0)