Reputation: 101
i am currently working on a demo deployment where custom toolbars for users are a requirement.
Normally you create those toolbars as the user directly with right click to the taskbar and than toolbars and create new. Not like the pinned items which many people suggest creating by a other value and folder.
As i did some research it turns out it's not easy to do this in a script or program (i am working mostly with C# and PowerShell). I already found out that the REG-Binary key under:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop
holds the info i want to rewrite but i am unable to decode this value or create a new value for new mappings. I also did try the export import stuff which is very troublesome because the values are somewhat influenced by username (of cause it is in the user context) and the machine name the settings are created at.
Has anybody worked with those values before and can give an insight of how microsoft is encoding them? It seems to be something like a old savestate in a game where according to the bytes changed diffrent states are active. These are the inner parts i could so far figure out myself.
I would love to build a tool to de and encode the settings in the TaskbarWinXP key and make it open source we all can profit from this.
Upvotes: 4
Views: 2925
Reputation: 1706
It is not easy to decode it, there is some magic there. And if you change the computer name inside the reg it will not work, because in the reg it is coded the size of the computer name. but there is a solution.
as you said, first create the toolbar put it in the position you want, then save the reg :
reg export HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop taskbar_toolbar_Backup.reg
and if you want to save the position of the taskbar too (left dock, bottom ...etc) ,then save this too:
REM change StuckRects2 to StuckRects3 if you are in win10
reg export HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2 taskbar_position.reg
now the important part, you will of course copy the reg to another computer but it have to be the same OS (xp to xp , win 7 to win 7 ...etc) create the folder needed then run both REGs, but it will not work because explorer will reset the registry again. the solution I found is to close the explorer first then run the reg then run again explorer and voila , it works, windows will accept the computer name of the other PC, and will update it automatically in next login, so do not worry about.
@echo off
REM mkdir path\to\folder
taskkill /f /im explorer.exe
reg import Taskbar-Toolbars-Backup.reg"
reg import taskbar_position.reg
start explorer.exe
that is all.
now if the folder path will be fix then you are good to go, but if you want to change it pragmatically in other PC's then here is how:
I could not find any solution so I made this workaround: first I create a shortcut of any folder to a permanent fixed path, for example I will save the shortcut to system32 or the home folder. then we begin this guide from the beginning, but instead of using the folder you want to convert to toolbar we will put the shortcut that we have created now inside the taskbar(it will work as if it was a folder and show it s content as a folder would do). now you can save the backup of the reg value and copy the reg to other pc and continue with steps as I explained before.
as you see the toolbar now point to a shortcut, so can use the same reg in any computer and you have to edit only the shortcut not the reg. creating and editing the shortcut is easy and there is a lot of guides and tools to do it pragmatically, so I will not explain it.
of course now you have to prepare a reg for every OS , one for xp , one for win 7 , another for win8.1 and one for win10 , and from now you can use those reg's anywhere and you have to change only the shortcut
one more thing; what happens if you save the shortcut in D:\ and now you want to change it to C:\for example ? you can edit the reg easily for this, you have to change only two letters (a hex), you can look in the regedit
to see the binary as decimal , then find the position of the letter , now in the reg file change those two letters to mydrive
, and from now you can change the reg pragmatically easily by replacing mydrive
with the hex of your wanted drive.and of course you have to respect the same path saved in the reg, fr example if you saved the shortcut in the reg as d:\path\to\folder
then you can change D
drive to C
drive but use the same folder structure :\path\to\folder
, so it become c:\path\to\folder
I think with this there is no need to decrypt the binary inside that reg which no one did until now (while the other reg StuckRects2
they decrypted it; but this one no one I know did it yet)
Upvotes: 5