!macro createDesktopShortcut
  CreateShortCut "$DESKTOP\Farm Control Server.lnk" "$INSTDIR\bin\farmcontrol-server.exe"
!macroend

!macro createStartMenuShortcut
  CreateDirectory "$SMPROGRAMS\Farm Control Server"
  CreateShortCut "$SMPROGRAMS\Farm Control Server\Farm Control Server.lnk" "$INSTDIR\bin\farmcontrol-server.exe"
!macroend

!macro removeDesktopShortcut
  Delete "$DESKTOP\Farm Control Server.lnk"
!macroend

!macro removeStartMenuShortcut
  Delete "$SMPROGRAMS\Farm Control Server\Farm Control Server.lnk"
  RMDir "$SMPROGRAMS\Farm Control Server"
!macroend

!macro customInstall
  DetailPrint "Register farmcontrolserver URI Handler"
  DeleteRegKey HKCR "farmcontrolserver"
  WriteRegStr HKCR "farmcontrolserver" "" "URL:farmcontrolserver"
  WriteRegStr HKCR "farmcontrolserver" "URL Protocol" ""
  WriteRegStr HKCR "farmcontrolserver\DefaultIcon" "" "$INSTDIR\bin\farmcontrol-server.exe"
  WriteRegStr HKCR "farmcontrolserver\shell" "" ""
  WriteRegStr HKCR "farmcontrolserver\shell\Open" "" ""
  WriteRegStr HKCR "farmcontrolserver\shell\Open\command" "" '"$INSTDIR\bin\farmcontrol-server.exe" "%1"'
!macroend

!macro customUnInstall
  !insertmacro removeDesktopShortcut
  !insertmacro removeStartMenuShortcut
  DeleteRegKey HKCR "farmcontrolserver"
!macroend
