S
Steff
I can get the user name of a process in Windows XP by following code:
GetCurrentProcess();
GetSecurityInfo(handle,SE_KERNEL_OBJECT,OWNER_SECURITY_INFORMATION,&pSidOwner,NULL,NULL,NULL,&pSD);LookupAccountSid(NULL, pSidOwner, lpName,&cchName,lpReferencedDomainName,&cchReferencedDomainName, &peUse);But I failed in Vista when UAC opened:if the user of the process is in administrators group, and it is run asadministrator, the code above return the name (in lpName): "administrators"instead of the real user name.Who can help me?
GetCurrentProcess();
GetSecurityInfo(handle,SE_KERNEL_OBJECT,OWNER_SECURITY_INFORMATION,&pSidOwner,NULL,NULL,NULL,&pSD);LookupAccountSid(NULL, pSidOwner, lpName,&cchName,lpReferencedDomainName,&cchReferencedDomainName, &peUse);But I failed in Vista when UAC opened:if the user of the process is in administrators group, and it is run asadministrator, the code above return the name (in lpName): "administrators"instead of the real user name.Who can help me?