How do I detect that my application is running as service or in an interactive session?
I'm writing an application that is able to run as a service or standalone but I want to detect if the application was executed as a service or in a normal user session. I think you can query the process token for membership in the Interactive group. From http://support.microsoft.com/kb/243330 : SID: S-1-5-4 Name: Interactive Description: A group that includes all users that have logged on interactively. Membership is controlled by the operating system. Call GetTokenInformation with TokenGroups to get the groups associated with the account under which the process is running, then iterate over