In a saucepan combine the sugar, cornstarch, salt, egg yolks and whisk the mixture until combined. Whisk in the milk, bring the liquid to a boil over moderate heat. Continue to simmer and whisk until thickened-about 1 minute. Pour the mixture into a bowl and whisk in the melted chocolate and vanilla. Divide the pudding among 4 stemmed glasses and garnish with the whipped cream and chocolate shavings. Serve garnished or accompanied by cookies.