Skip to content

Commit 0a8c58e

Browse files
committed
v6.4.21218.0
1 parent 546d51d commit 0a8c58e

File tree

14 files changed

+38
-49
lines changed

14 files changed

+38
-49
lines changed

Common/Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Platforms>AnyCPU;x64</Platforms>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21210.0" />
14-
<PackageReference Include="ITHit.FileSystem" Version="6.4.21210.0" />
13+
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21218.0" />
14+
<PackageReference Include="ITHit.FileSystem" Version="6.4.21218.0" />
1515
</ItemGroup>
1616
</Project>

Windows/Common/Core/Common.Windows.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="6.4.21210.0" />
24-
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21210.0" />
23+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="6.4.21218.0" />
24+
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21218.0" />
2525
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2626
</ItemGroup>
2727
</Project>

Windows/Common/Core/Registrar.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Registrar
2323
protected readonly string SyncRootId;
2424
protected readonly string UserFileSystemRootPath;
2525
protected readonly ILog Log;
26-
private readonly IEnumerable<(string Name, Guid Guid)> shellExtensionHandlers;
26+
private readonly IEnumerable<(string Name, Guid Guid, bool AlwaysRegister)> shellExtensionHandlers;
2727

2828
/// <summary>
2929
/// Creates instance of this class.
@@ -37,7 +37,7 @@ public class Registrar
3737
/// List of shell extension handlers. Use it only for applications without application or package identity.
3838
/// For applications with identity this list is ignored.
3939
/// </param>
40-
public Registrar(string syncRootId, string userFileSystemRootPath, ILog log, IEnumerable<(string Name, Guid Guid)> shellExtensionHandlers = null)
40+
public Registrar(string syncRootId, string userFileSystemRootPath, ILog log, IEnumerable<(string Name, Guid Guid, bool AlwaysRegister)> shellExtensionHandlers = null)
4141
{
4242
this.SyncRootId = syncRootId;
4343
this.UserFileSystemRootPath = userFileSystemRootPath;
@@ -71,16 +71,8 @@ public async Task RegisterSyncRootAsync(string displayName, string iconPath, str
7171

7272
if (shellExtensionHandlers != null)
7373
{
74-
// Register thumbnails handler, custom states handler, etc,
75-
// but only if this app has no identity. Otherwise manifest will do this automatically.
76-
if (!PackageRegistrar.IsRunningWithIdentity())
77-
{
78-
RegisterShellExtensions(shellExtensionsComServerExePath);
79-
}
80-
//else
81-
//{
82-
// Log.Debug("\nThis app has identity. Shell extensions list is ignored. Shell extensions must be installed via sparse package manifest or app packaged app manifest.");
83-
//}
74+
// Register thumbnails handler, custom states handler, etc.
75+
RegisterShellExtensions(shellExtensionsComServerExePath);
8476
}
8577
}
8678

@@ -166,13 +158,18 @@ public virtual async Task UnregisterAsync(EngineWindows engine, bool fullUnregis
166158
/// </remarks>
167159
private void RegisterShellExtensions(string shellExtensionsComServerExePath = null)
168160
{
161+
bool isRunningWithIdentity = PackageRegistrar.IsRunningWithIdentity();
169162
foreach (var handler in shellExtensionHandlers)
170163
{
171164
if (!ShellExtensionRegistrar.IsHandlerRegistered(handler.Guid))
172165
{
173-
Log.Info($"\nRegistering shell extension {handler.Name} with CLSID {handler.Guid:B}...\n");
174-
175-
ShellExtensionRegistrar.RegisterHandler(SyncRootId, handler.Name, handler.Guid, shellExtensionsComServerExePath);
166+
// Register handlers only if this app has no identity. Otherwise manifest will do this automatically.
167+
// Unlike other handlers, CopyHook requires registration regardless of identity.
168+
if (!isRunningWithIdentity || handler.AlwaysRegister)
169+
{
170+
Log.Info($"\nRegistering shell extension {handler.Name} with CLSID {handler.Guid:B}...\n");
171+
ShellExtensionRegistrar.RegisterHandler(SyncRootId, handler.Name, handler.Guid, shellExtensionsComServerExePath);
172+
}
176173
}
177174
}
178175
}

Windows/Common/VirtualDrive/Common.Windows.VirtualDrive.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Compile Remove="IVirtualFolder.cs" />
1414
</ItemGroup>
1515
<ItemGroup>
16-
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21210.0" />
16+
<PackageReference Include="ITHit.FileSystem.Windows" Version="6.4.21218.0" />
1717
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1818
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
1919
</ItemGroup>

Windows/Common/VirtualDrive/SparsePackageRegistrar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public SparsePackageRegistrar(
3535
string syncRootId,
3636
string userFileSystemRootPath,
3737
ILog log,
38-
IEnumerable<(string Name, Guid Guid)> shellExtensionHandlers = null)
38+
IEnumerable<(string Name, Guid Guid, bool AlwaysRegister)> shellExtensionHandlers = null)
3939
: base(syncRootId, userFileSystemRootPath, log, shellExtensionHandlers)
4040
{
4141

Windows/VirtualDrive/VirtualDrive.ShellExtension/VirtualDrive.ShellExtension.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
2020
</ItemGroup>
2121
<ItemGroup>
22-
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="6.4.21210.0" />
22+
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="6.4.21218.0" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<None Update="log4net.config">

Windows/VirtualDrive/VirtualDrive/Program.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ private static async Task RunEngine()
139139
// Register sync root and create app folders.
140140
await registrar.RegisterSyncRootAsync(Settings.ProductName, Path.Combine(Settings.IconsFolderPath, "Drive.ico"), Settings.ShellExtensionsComServerExePath);
141141

142-
// Register hook that allows limiting folder operations in GetFolderOperationControlAsync() method.
143-
ShellExtension.ShellExtensions.RegisterCopyHook(SyncRootId);
144-
145142
using (Engine = new VirtualEngine(
146143
Settings.UserFileSystemLicense,
147144
Settings.UserFileSystemRootPath,

Windows/VirtualDrive/VirtualDrive/ShellExtension/ShellExtensions.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace VirtualDrive.ShellExtension
88
{
9+
/// <inheritdoc cref="IFolderWindows"/>
910
/// <summary>
1011
/// Shell extension handlers registration and startup functionality.
1112
/// </summary>
@@ -21,13 +22,13 @@ internal static class ShellExtensions
2122
/// Note that on Windows 11 your context menu will be shown under the "Show more options"
2223
/// menu if your app runs without identity.
2324
/// </remarks>
24-
internal static readonly List<(string Name, Guid Guid)> Handlers = new List<(string, Guid)>
25+
internal static readonly List<(string Name, Guid Guid, bool AlwaysRegister)> Handlers = new List<(string, Guid, bool)>
2526
{
26-
("ThumbnailProvider", typeof(ThumbnailProviderIntegrated).GUID),
27-
("MenuVerbHandler_0", typeof(ContextMenuVerbIntegrated).GUID),
28-
("CustomStateHandler", typeof(CustomStateProviderIntegrated).GUID),
29-
("CopyHook", typeof(StorageProviderCopyHookIntegrated).GUID),
30-
//("UriHandler", typeof(ShellExtension.UriSourceIntegrated).GUID)
27+
("ThumbnailProvider", typeof(ThumbnailProviderIntegrated).GUID, false),
28+
("MenuVerbHandler_0", typeof(ContextMenuVerbIntegrated).GUID, false),
29+
("CustomStateHandler", typeof(CustomStateProviderIntegrated).GUID, false),
30+
("CopyHook", typeof(StorageProviderCopyHookIntegrated).GUID, true),
31+
//("UriHandler", typeof(ShellExtension.UriSourceIntegrated).GUID, false)
3132
};
3233

3334
/// <summary>
@@ -55,10 +56,5 @@ internal static LocalServer StartComServer(bool shellExtensionsComServerRpcEnabl
5556

5657
return server;
5758
}
58-
59-
public static void RegisterCopyHook(string syncRootId)
60-
{
61-
ShellExtensionRegistrar.RegisterHandler(syncRootId, "CopyHook", typeof(StorageProviderCopyHookIntegrated).GUID);
62-
}
6359
}
6460
}

Windows/VirtualDrive/VirtualDrive/ShellExtension/StorageProviderCopyHookIntegrated.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace VirtualDrive.ShellExtension
77
{
8+
89
/// <summary>
910
/// Determines whether the Shell will allow to move, copy, delete, rename, hydrate and dehydrate a folder.
1011
/// Runs in one process with Engine.
@@ -18,4 +19,5 @@ public StorageProviderCopyHookIntegrated() : base(Program.Engine)
1819
{
1920
}
2021
}
22+
2123
}

Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This is an advanced project with ETags support, Microsoft Office documents editi
4040
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
4141
</ItemGroup>
4242
<ItemGroup>
43-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="6.4.21210.0" />
43+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="6.4.21218.0" />
4444
<ProjectReference Include="..\..\..\Common\Common.csproj" />
4545
<ProjectReference Include="..\..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
4646
</ItemGroup>

0 commit comments

Comments
 (0)