Open 20Alexanderxx opened 6 months ago
Which Windows OS are you on?
How are you unregistering the PyDeskband? Is it via the registrar script?
Similar question: if you just restart Windows explorer do all the deskbands persist?
I am using Windows 10 64 bit version
For testing purposes I registered and unregistered manual using the regsvr32.exe. I copied the commands that your script executes and run them in an elevated CMD prompt. But that does not make a difference, because the issue came up when I used it in my final program and when my colleague tested it it cleared her taskbar.
And whenever windows Explorer got restarted, the pinned folder remained there,only went away on unregistering and the obligatory restart afterwards.
So just running regsvr32 to unregister this one takes away all deskbands?
jup exactly. But like I said, it does not make a difference how I run it. My main app uses the python code to unregister but for reproducing the error I used the regsvr32 directly.
To reproduce this error just create a new custom toolbar and then register the Pydeskband and unregister it again. Then you should see the other toolbar disappear
i now tested it some time again and i can say that when i install it and straight up uninstall it again, without activating it, (so it wont sho up in my taskbar) my other toolbar will remain there even after the uninstall and explorer restart: n.p.
When i try to activate it after install...: ... my other toolbar will vanish after uninstallation:
I found a bug where i left the async thread running in the deskband code. I just pushed a fix to fix that (4a9eb06673d5cadbfd3f835761d6274781026c8a). Without that, explorer would crash when I try to disable PyDeskband.
With this fix, I can select/unselect PyDeskband to enable/disable it (via right click on the taskbar, etc: the normal way). Then if I use regsvr32 to uninstall it: restarting explorer has just PyDeskband go away.
I think technically we're supposed to disable the deskband before uninstalling it. Try doing that (with the latest dll updates).
Okay I will try that. For uninstaller purposes, is there a way to programmatically disable the deskband?
There must be.. but I don't know it :/
i now found a way of programatically disabling the Deskband:
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop"
$propertyName = "TaskbarWinXP"
# Deskband bytes to search for - the leading space is important
$deskbandRegex = " 113 158 42 102 102 91 65 76 180 238 48 99 85 132 111 68 \d+ 0 0 0 192 4 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 40 0 0 0 0 0 0 0 1 0 0 0( \d){0,4}"
try {
$value = Get-ItemProperty -Path $regPath -Name $propertyName
$valueString = ($value.$propertyName | ForEach-Object { $_.ToString() }) -join " "
# Add a regular expression to the deskband to match any 4 bytes that can be there because it is in between others
if ($valueString -match $deskbandRegex) {
# Replace the deskband and the 4 bytes that follow it with an empty string
$newValueString = $valueString -replace $deskbandRegex, ""
$newValue = $newValueString.Split(" ") | ForEach-Object { [byte]$_ }
# Decrease the 9th value by one
$newValue[8] -= 1
# Save the new value back to the registry key
Set-ItemProperty -Path $regPath -Name $propertyName -Value $newValue
Write-Output "Deskband removed from $($propertyName)."
} else {
Write-Output "$($propertyName) does not contain the deskband."
}
} catch {
Write-Output "An error occurred: $_"
}
I have tested it on multiple storing locations and all worked. It is important to note, that you also have to decrease the ninth value as i suppose it is the amount of toolbars you have enabled.
I have no idea, what the String for the deskband means, but luckily it does not change so i guess it has something to do with the UUID of pydeskband.
After restarting the explorer, deskband is disaled but none of the other toolbars are so this is a win. you can even run the unregister before restart and it works, because in the system it is already disbaled and thus not lead to crashing the explorer.
I have found the connection between the deskband string and the UUID, but i have no idea what is going on there tbh:
the hex value of the string above would be:
"71 9E 2A 66 66 5B 41 4C B4 EE 30 63 55 84 6F 44 00 00 00 00 C0 04 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 01 00 00 00"
now check the UUID of pydeskband:
662A9E71-5B66-4C41-B4EE-306355846F44
now cross-reference:
str = "71 9E 2A 66 - 66 5B - 41 4C - B4 EE - 30 63 55 84 6F 44 ..."
UUID = "66 2A 9E 71 - 5B 66 - 4C 41 - B4 EE - 30 63 55 84 6F 44"
Hey, i dont knwo if you are reading this, but when i want to unregister the PyDeskband, it removes other folders i have pinned to the taskbar as well. So if i created a custom taskbar and then added the PyDeskband, everything was fine until i tried to unregister it again. then all my pinned folders (custom Deskbands) are gone.
Feel free to ask me for further information. Alexander