When using the code from LSA Functions Privileges and Impersonation
on Windows Server 2008R2 it works fine to add a user to the logon as a service policy. When using this code on Windows Server 2012 it doesn't work. The function 'LsaAddAccountRights' returns an strange number which can't be translated via 'LsaNtStatusToWinError' to a windows error. The return code is something like 1034061105409818720. Every time when I run the same code, it returns a different number. Can someone provide some help because I'm stuck?