For my purpose I didn't need user environment
I put up the sample code because I struggled on it for a while. Essentially the sample is a translation of Gary Nebbet's sample. You do need to have the SeTcbPrivilege (Act as part of the operation system) and enable it. This corresponds with
MSDN documentation. The purpose of Gary's example was (as I recall) to show the danger of this privilege.
I see LsaLogonUser as an easy (and Vista compatible way) of launching something on the user's desktop from a service (In general services run under the SYSTEM account which has SeTcpPrivilege). Because you obtain the user's LogonSid you need not worry about setting
ACL's on the user's desktop etc. Other purposes could be to acquire admin permissions to the launched application.