For the sunroof you can use a standard water resistant Silicone Grease.
Liqui Moly has a fantastic Grease specifically for door hinges, sunroofs and even to get rid of rattles on the dashboard.
Dont use WD40... It will disintegrate the remaining grease and then evaporate leaving you with no grease.
Mike