cryptomator / cryptomator-win

Cryptomator .exe installer for Windows
GNU General Public License v3.0
21 stars 12 forks source link

Windows Explorer Integration #29

Open kojid0 opened 4 years ago

kojid0 commented 4 years ago

Please add support for windows explorer integration in order to easily access unlocked cryptomator vaults. Dropbox, Boxcryptor, Nextcloud,... have this feature already and I often use it to navigate quickly between folders. cryptomator-issue

overheadhunter commented 4 years ago

Some possible solutions discussed in https://github.com/dokan-dev/dokany/issues/51

infeo commented 4 years ago

Currenty this issues contains two feature request, i suggest to open a seperate one for the drive icon and discuss in this one the deeper integration.

Speaking of, what do you mean with explorer integration? Context menu entry? QuickAccess item? Or maybe something else?

kojid0 commented 4 years ago

Currenty this issues contains two feature request, i suggest to open a seperate one for the drive icon and discuss in this one the deeper integration.

Speaking of, what do you mean with explorer integration? Context menu entry? QuickAccess item? Or maybe something else?

Alright, I've made separate issues. I actually meant some other kind of integration on the left panel of windows explorer (see picture). It is not under QuickAccess but separate. Context menu entry would not make lots of sense, or am I wrong? What could be done with it?

infeo commented 4 years ago

I thought so, but just to be sure. (:

We can use powershell to quickly add and remove an item from the quickaccess:

$o = new-object -com shell.application
$o.Namespace('c:\My Folder').Self.InvokeVerb("pintohome")
kojid0 commented 4 years ago

I thought so, but just to be sure. (:

We can use powershell to quickly add and remove an item from the quickaccess:

$o = new-object -com shell.application
$o.Namespace('c:\My Folder').Self.InvokeVerb("pintohome")

I've rechecked and it's not the same as QuickAccess. As you can see in the picture, Boxcrypor, Dropbox,... are not under "Schnellzugriff" (German for QuickAccess). They have separate integration. You could easily add things to your QuickAccess manually (via context menu) but you cannot add things easily as separate line, e.g. as Boxcryptor, Dropbox are.

infeo commented 4 years ago

I think this feature-request should be setup during the installation.

We can do it similarly to other cloud providers, Microsoft has documented the steps to follow here: https://docs.microsoft.com/en-us/windows/win32/shell/integrate-cloud-storage

lucasschuett commented 3 years ago

I would really love to see this feature with one of the next releases. Maybe as a checkbox in the mount point menu. Up to then I have my personal work around which does not require any privileges since it just works with the current user registry. Also it does not contain any steps which require to run during installation.

After I open a vault I run a unique power shell script for each vault. After I close a vault I run another script. Unfortunately I don't have any clue about java, so it is not possible for me to integrate this into the codebase. The steps itself mainly follow the documentation linked by @infeo.

# Tresor Tresorname
# This is a GUID generated by the powershell command New-Guid. After generating it I check with reg query if it already exists in the registry. For the dynamic use in cryptomator the guid should be derived from the upcomming vault id so it is (at least in a way) unique for each vault.
# 01a727bf-86a9-4ebe-a47f-817f3d2f1e11

$meineguid = "01a727bf-86a9-4ebe-a47f-817f3d2f1e11"
"$meineguid"

# I define two variables so that I can adapt this script fast for each of my vaults. $einhaengepfad have to match with the choosen mount point in the cryptomator gui. In the code base of cryptomator this propably is already a variable to hand it over to dokany.

$tresorname = "Tresor"

$einhaengepfad = "%USERPROFILE%\Cryptomator\Tresor"

# The next commands reproduce the documentation of microsoft.
# Name the extension
reg add "HKCU\Software\Classes\CLSID\{$meineguid}" /ve /t REG_SZ /d "$tresorname" /f

# Icon
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\DefaultIcon" /ve /t REG_SZ /d "C:\Program Files\Cryptomator\Cryptomator.ico" /f

# Make extension visible to Navigation Pane
reg add "HKCU\Software\Classes\CLSID\{$meineguid}" /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0x1 /f

# Sortorder in Navigation Pane
# If different system folders have to same SortOrderIndex windows sort it by alphabet. 0x42 is the standard value for OneDrive. 0x41 is the standard value for Nextcloud. I want to list my vaults above them.
reg add "HKCU\Software\Classes\CLSID\{$meineguid}" /v SortOrderIndex /t REG_DWORD /d 0x40 /f

# Provide shell dll
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\InProcServer32" /ve /t REG_EXPAND_SZ /d "%systemroot%\system32\shell32.dll" /f

# Define the instance
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\Instance" /v CLSID /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" /f

# File system attributes
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\Instance\InitPropertyBag" /v Attributes /t REG_DWORD /d 0x11 /f

# Path to folder
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\Instance\InitPropertyBag" /v TargetFolderPath /t REG_EXPAND_SZ /d "$einhaengepfad" /f

# Shell flags
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\ShellFolder" /v FolderValueFlags /t REG_DWORD /d 0x28 /f

# Shell flags
reg add "HKCU\Software\Classes\CLSID\{$meineguid}\ShellFolder" /v Attributes /t REG_DWORD /d 0xF080004D /f

# Namespace root
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{$meineguid}" /ve /t REG_SZ /d "$tresorname" /f

# Hide from Desktop
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{$meineguid}" /t REG_DWORD /d 0x1 /f

# End

This script ads a system folder for the vault (in this example named Tresor) which refers to $einhaengepunkt. This happens without the need to close and open the explorer.

After closing the vault I run

# Tresor Tresorname
# The GUID have to match the GUID form before.
# 01a727bf-86a9-4ebe-a47f-817f3d2f1e11

$meineguid = "01a727bf-86a9-4ebe-a47f-817f3d2f1e11"
"$meineguid"

# Software class
reg delete "HKCU\Software\Classes\CLSID\{$meineguid}" /f

# Namespace root
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{$meineguid}" /f

# Hide from Desktop
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{$meineguid}" /f

# End

It works fine for me but it would be really nice if Cryptomator does this automatically. This solution is not as @kojid0 suggested but with small changes (mount vaults in %userprofile%/Cryptomator/Vaultname and let %userprofile%/Cryptomator then be a system folder if a vault is open) his or her suggestion can be realised as well.