0x01 Story
As is known to us all, officially, the default install directory for Adobe Creative Cloud can’t be changed from C:/Program Files/Adobe to users desire directory unless users have install at least one of Adobe Creative Cloud product.
Hence, I am wondering about whether there is another way to install Adobe Creative Cloud component without installing one then changing install directory via Creative Cloud application and finally installing the rest products.
Of course, there is another way. By means of altering the registry.
0x02 Implementation
The Creative Cloud installer will search “ProgramFilesDir”, “ProgramFilesDir (x86)“, “ProgramFilesPath” and “ProgramFilesPath” in “SOFTWARE\Microsoft\Windows\CurrentVersion” in system registry so as to find the Program Files directory, then it will put the newly-installed component in Program Files directory like “C:\Program Files\Adobe”.
On basis of that, it is easy for us to find out a solution to trick the installer into installing Creative Cloud component to user-defined directory.
I bet you have found it that the way I used by altering these registry value to specified directory is quite simple.
1 2 3 4 5 | bool result = true; result = result & RE.SetKey<string>(Path, "ProgramFilesDir", DesiredDir, Microsoft.Win32.RegistryValueKind.String); result = result & RE.SetKey<string>(Path, "ProgramFilesDir (x86)", DesiredDir, Microsoft.Win32.RegistryValueKind.String); result = result & RE.SetKey<string>(Path, "ProgramFilesPath", DesiredDir, Microsoft.Win32.RegistryValueKind.ExpandString); result = result & RE.SetKey<string>(Path, "ProgramW6432Dir", DesiredDir, Microsoft.Win32.RegistryValueKind.String); |
In above code, the Path is the custom directory for installation of Creative Cloud component, the RE is a registry editor class whose code is given as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Win32; namespace CCInstallDirChanger { /// <summary> /// Registry Edit Class /// </summary> public class RegistryEdit { private RegistryKey CurrentKey; public RegistryEdit(RegistryKey KeyMain) { CurrentKey = KeyMain; } /// <summary> /// Create a Subitem with given path /// </summary> /// <param name="Path"></param> /// <returns></returns> public bool CreateItem(string Path) { try { using (RegistryKey Key = CurrentKey.CreateSubKey(Path)) { } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } return true; } /// <summary> /// Set a key with given path, value and value type /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Path"></param> /// <param name="KeyName"></param> /// <param name="KeyValue"></param> /// <param name="ValueKind"></param> /// <returns></returns> public bool SetKey<T>(string Path, string KeyName, T KeyValue, RegistryValueKind ValueKind) { try { using (RegistryKey Key = CurrentKey.OpenSubKey(Path, true)) { Key.SetValue(KeyName, KeyValue, ValueKind); } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } return true; } /// <summary> /// Delete an item with given path /// </summary> /// <param name="Path"></param> /// <returns></returns> public bool DeleteItem(string Path) { try { CurrentKey.DeleteSubKey(Path, true); } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } return true; } /// <summary> /// Delete a value with given Path and Value Name /// </summary> /// <param name="Path"></param> /// <param name="KeyName"></param> /// <returns></returns> public bool DeleteKey(string Path, string KeyName) { try { using (RegistryKey Key = CurrentKey.OpenSubKey(Path, true)) { Key.DeleteValue(KeyName, true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } return true; } /// <summary> /// Get Value of Given ValueName /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Path"></param> /// <param name="KeyName"></param> /// <returns></returns> public T GetKeyValue<T>(string Path, string KeyName) { try { using (RegistryKey Key = CurrentKey.OpenSubKey(Path, true)) { var Val = Key.GetValue(KeyName, null, RegistryValueOptions.DoNotExpandEnvironmentNames); if (Val != null) { T result = (T)Convert.ChangeType(Val, typeof(T)); return result; } throw new KeyNotFoundException("Cannot find the value"); } } catch (Exception ex) { Console.WriteLine(ex.Message); return default(T); } } } } |
0x03 Precompiled executable and source code
Go to https://github.com/Xiderowg/AdobeCCInstallDirectoryChanger for more detail.