;these functions were written if you don't use SetShellVarContext all and ;if you want to remove ALL created shortcurts (in Start Menu/Programs) ;in and from any user session ;feel free to modify if you want to extend to desktop and Start Menu etc. ;(you will have to write two functions for each) ;(c) 2002 Wyz ;Put !define NAME "your software name here" somewhere in your .nsi file Function GetStartMenuUserInfo ;called when user choose to put shortcuts Push $1 Push $2 Push $3 ;to have the full path of the user's Start Menu/Programs StrCpy $1 "$SMPROGRAMS" ;or $DESKTOP or $STARTMENU etc. StrCpy $2 "" loop: ;I use the registry as I still put links there to make the uninstall available from control panel's Add/Remove ReadRegStr $3 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" \ "StartMenuProgramsPath$2" StrCmp $3 "" go ;if the string doesn't exist then it is good StrCmp $3 $1 end ;if the user has already created shortcuts in this session, no need to process IntOp $2 $2 + 1 Goto loop go: ;it's time to write in the registry the info the uninstall will read WriteRegStr HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" \ "StartMenuProgramsPath$2" \ "$1" end: Pop $3 Pop $2 Pop $1 FunctionEnd -------- Function un.RemoveStartMenuItems ;called in uninstall section Push $1 Push $2 StrCpy $1 "" loop: ;Need to read the string written by the installation ReadRegStr $2 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" \ "StartMenuProgramsPath$1" StrCmp $2 "" end ;finish when there is no more string Delete "$2\${NAME}\*.*" ;deletion of all the files in the Start Menu/Programs's item RMDir "$2\${NAME}" /r ;deletion of the Start Menu/Programs's item DeleteRegValue HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" \ "StartMenuProgramsPath$1" ;possible to remove the info (no more usefull) IntOp $1 $1 + 1 Goto loop end: Pop $2 Pop $1 FunctionEnd