User forums > Help
Windows Codeblocks uninstall - Associations left over after uninstall
AndrewCot:
On Windows when you uninstall Code::Blocks via the Windows uninstall process there are file associations left in the registry due to the code in the src\associations.cpp (Associations::DoSetAssociation function) that are not removed on an uninstall... This is not very good IMHO.
You can use the following process to see the registry entries that have NOT been removed, assuming you have ccleaner (ccleaner slim is my preferred version)
1) Run ccleaner and clean the registry until no more registry entries can be cleaned.
2) Uninstall Code::Blocks
3) Rename/backup the Code::Blocks APPDATA directory (%APPDATA%\CodeBlocks)
4) Delete the Code::Blocks APPDATA directory (rmdir /q /s %APPDATA%\CodeBlocks)
5) Install Code::Blocks "codeblocks-20.03-setup.exe"
6) Run Code::Blocks and associate C/C++ to C::B
7) Exit Code::Blocks
5) Uninstall Code::Blocks
6) Run ccleaner and scan for registry entry issues. You should see a bunch of entries left over from C::B:
Should the NSIS script detect these registry entries and remove them or is there a better way of doing this?
oBFusCATed:
--- Quote from: AndrewCot on July 24, 2021, 12:09:19 pm ---Should the NSIS script detect these registry entries and remove them or is there a better way of doing this?
--- End quote ---
Windows is multiuser system. How are we supposed to do this in this environment?
AndrewCot:
--- Quote ---Windows is multiuser system. How are we supposed to do this in this environment?
--- End quote ---
If I knew this then I would not have asked.
cacb:
If the installer establishes the associations, instead of Code::Blocks itself (or maybe in addition to), then an uninstall will remove and tidy up the associations.
AndrewCot:
The NSIS script below removes some HKCU\SOFTWARE\Classes sub entries, but not the entries listed below,
Not Removed Associations:
HKCU\SOFTWARE\Classes\.cbp
HKCU\SOFTWARE\Classes\.cc
HKCU\SOFTWARE\Classes\.tcc
HKCU\SOFTWARE\Classes\.workspace
HKCU\SOFTWARE\Classes\CodeBlocks.cpp
HKCU\SOFTWARE\Classes\CodeBlocks.hpp
HKCU\SOFTWARE\Classes\CodeBlocks.tpp
NSIS Script snippet that includes NSIS special build logging:
--- Code: --- # Start Unregister CodeBlocks associated files - see FileAssocation.cpp
# or check out the registry "Computer\HKEY_CURRENT_USER\SOFTWARE\Classes\CodeBlocks.*" entries.
${If} ${RunningX64}
LogText "SetRegView 64"
SetRegView 64
StrCpy $0 0 ; Registry key index
; Length of "CodeBlocks" = 10
enumunkey64:
EnumRegKey $1 HKCU "SOFTWARE\Classes" $0
;LogText "Read HKCU\SOFTWARE\Classes\$1"
IntOp $0 $0 + 1
StrCmp $1 "" done64
StrCpy $2 $1 10 0
; LogText "Read 0 = $0 , 1 = $1 , 2 = $2"
StrCmp $2 "CodeBlocks" 0 enumunkey64
StrLen $3 $1
IntOp $3 $3 - 10 ; Includes .
StrCpy $4 $1 $3 10 ; Includes .
LogText "L2755 1 = $1 , 2 = $2 , 3 = $3 , 4 = $4"
StrCmp $4 "" enumunkey64
ReadRegStr $5 HKCU "SOFTWARE\Classes\$4" ""
LogText "L2758 1 = $1 , 2 = $2 , 5 = $5"
StrCmp $5 $1 0 DelCodeBlocksEntry64 ; If no file extension classes found then goto DelCodeBlocksEntry
StrCmp $5 $2 0 DelCodeBlocksEntry64 ; If file extension classes is not for codeblocks entry goto DelCodeBlocksEntry
LogText "TBA L2761 Found : 'SOFTWARE\Classes\$1'"
LogText "ReadRegStr 'SOFTWARE\Classes\$4' returned $5"
LogText "DeleteRegValue HKCU 'SOFTWARE\Classes\$4' ''"
DeleteRegValue HKCU "SOFTWARE\Classes\$4" "" ; Delete default as it is codeblocks
LogText "DeleteRegKey /IfEmpty HKCU 'SOFTWARE\Classes\$4'"
DeleteRegKey /IfEmpty HKCU "SOFTWARE\Classes\$4"
DelCodeBlocksEntry64:
DeleteRegKey HKCU "SOFTWARE\Classes\$1"
Goto enumunkey64
done64:
# Finish Unregister CodeBlocks associated files - see FileAssocation.cpp
SetRegView 32
LogText "SetRegView 32"
${EndIf}
StrCpy $0 0 ; Registry key index
; Length of "CodeBlocks" = 10
enumunkey:
EnumRegKey $1 HKCU "SOFTWARE\Classes" $0
;LogText "Read HKCU\SOFTWARE\Classes\$1"
IntOp $0 $0 + 1
StrCmp $1 "" done
StrCpy $2 $1 10 0
;LogText "Read 0 = $0 , 1 = $1 , 2 = $2"
StrCmp $2 "CodeBlocks" 0 enumunkey
StrLen $3 $1
IntOp $3 $3 - 10 ; Includes .
StrCpy $4 $1 $3 10 ; Includes .
LogText "L2791 1 = $1 , 2 = $2 , 3 = $3 , 4 = $4"
StrCmp $4 "" enumunkey
ReadRegStr $5 HKCU "SOFTWARE\Classes\$4" ""
LogText "L2794 1 = $1 , 2 = $2 , 5 = $5"
StrCmp $5 $1 0 DelCodeBlocksEntry ; If no file extension classes found then goto DelCodeBlocksEntry
StrCmp $5 $2 0 DelCodeBlocksEntry ; If file extension classes is not for codeblocks entry goto DelCodeBlocksEntry
LogText "TBA L2797 Found : 'SOFTWARE\Classes\$1'"
LogText "ReadRegStr 'SOFTWARE\Classes\$4' returned $5"
LogText "DeleteRegValue HKCU 'SOFTWARE\Classes\$4' ''"
DeleteRegValue HKCU "SOFTWARE\Classes\$4" "" ; Delete default as it is codeblocks
LogText "DeleteRegKey HKCU 'SOFTWARE\Classes\$4'"
DeleteRegKey HKCU "SOFTWARE\Classes\$4"
DelCodeBlocksEntry:
DeleteRegKey HKCU "SOFTWARE\Classes\$1"
Goto enumunkey
--- End code ---
I have used the MS Process Monitor to see if there is any differences between the HKCU\SOFTWARE\Classes\CodeBlocks.tpp and HKCU\SOFTWARE\Classes\CodeBlocks.cbp access when running Code::Block for the first time when I associate CB with the C/C++ files and I could not see any differences, but I must have missed something as the CodeBlocks.cbp is removed and the CodeBlocks.tpp is not....
Navigation
[0] Message Index
[#] Next page
Go to full version