I am on WinXP SP1 fully updated. This script works and will register the mmx and mpo extensions but it will not give the file its associated icon. This is the current script. The blue text is where along the script this section is currently located. The crimson text is the only changes I've made. I also numbered this to make help a little easier. Thanks 🙂
01. !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
02. Section ;Register mmx Extension
03. ; back up old value of .mmx
04. ReadRegStr $1 HKCR ".mmx" ""
05. StrCmp $1 "" NoBackup
06. StrCmp $1 "OptionsFile" NoBackup
07. WriteRegStr HKCR ".nsi" "backup_val" $1
08. NoBackup:
09. WriteRegStr HKCR ".mmx" "" "OptionsFile"
10. ReadRegStr $0 HKCR "Mark Master File" ""
11. StrCmp $0 "" 0 skipOPTAssoc
12. WriteRegStr HKCR "OptionsFile" "" "Mark Master File"
13. WriteRegStr HKCR "OptionsFile\shell" "" "open"
14. WriteRegStr HKCR "OptionsFile\DefaultIcon" "" $INSTDIR\mmx.exe,1
15. skipOPTAssoc:
16. WriteRegStr HKCR "OptionsFile\shell\open\command" "" '$INSTDIR\mmx.exe "%1"'
17. WriteRegStr HKCR "OptionsFile\shell\edit" "" "Edit Mark Master File"
18. WriteRegStr HKCR "OptionsFile\shell\edit\command" "" '$INSTDIR\mmx.exe "%1"'
19. SectionEnd
20. Function un.onUninstSuccess
The above code will register the mmx extension but fails in giving the associated files the executable icon.
The below code is what I have for uninstall. To be honest I do not think it is uninstalling any registry entries. I'll explain later.
01. Section Uninstall
02. ;start of restore script
03. ReadRegStr $1 HKCR ".mmx" ""
04. StrCmp $1 "OptionsFile" 0 NoOwn ; only do this if we own it
05. ReadRegStr $1 HKCR ".mmx" "backup_val"
06. StrCmp $1 "" 0 RestoreBackup ; if backup == "" then delete the whole key
07. DeleteRegKey HKCR ".mmx"
08. Goto NoOwn
09. RestoreBackup:
10. WriteRegStr HKCR ".mmx" "" $1
11. DeleteRegValue HKCR ".mmx" "backup_val"
12. NoOwn:
13. ;rest of script
14. ...
I checked my registry with regedit before a test install and I noticed I had no registry entries to my program. After install I checked again but didn't see any. Once I launched an associated file the registry entries kicked in. When I decided to uninstall the application and check the registry again, it seemed some entries were left behind.
These are just a few entries left behind which were never in the system to begin with.
[HKEY_CLASSES_ROOT\Applications\mmx.exe]
[HKEY_CLASSES_ROOT\Applications\mmx.exe\shell]
@="open"
[HKEY_CLASSES_ROOT\Applications\mmx.exe\shell\edit]
@="Edit Mark Master File"
[HKEY_CLASSES_ROOT\Applications\mmx.exe\shell\edit\command]
@="C:\\mmx\\mmx.exe \"%1\""
[HKEY_CLASSES_ROOT\Applications\mmx.exe\shell\open]
[HKEY_CLASSES_ROOT\Applications\mmx.exe\shell\open\command]
@="C:\\mmx\\mmx.exe \"%1\""
I am really trying but build after build I do not know what left to do in order to get the icon to map and the uninstall to fully uninstall the registry entries. I would appreciate backing up an original and replacing it but I am doing this without original registry entries.
How do I map the icons and fully uninstall the reg entries?
Thanks in advance 🙂