Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to get the user name of a process when Vista UAC open?

 
   Windows (Home) -> Security RSS
Next:  Can't open udf on ie7 on vista Ultimate  
Author Message
Steff

External


Since: Apr 29, 2007
Posts: 2



(Msg. 1) Posted: Sun Apr 29, 2007 5:51 pm
Post subject: How to get the user name of a process when Vista UAC open?
Archived from groups: microsoft>public>windows>vista>general, others (more info?)

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?
Back to top
Login to vote
Jon

External


Since: Sep 01, 2005
Posts: 45



(Msg. 2) Posted: Sun Apr 29, 2007 10:01 pm
Post subject: Re: How to get the user name of a process when Vista UAC open? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Steff" <st_10.DeleteThis@hotmail.com> wrote in message
news:u5TIRPkiHHA.4772@TK2MSFTNGP04.phx.gbl...
>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?
>


Sounds like you need to use 'impersonation'

--
Jon
Back to top
Login to vote
Steff

External


Since: Apr 29, 2007
Posts: 2



(Msg. 3) Posted: Mon Apr 30, 2007 12:07 pm
Post subject: Re: How to get the user name of a process when Vista UAC open? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I solved my question: should be use:
BOOL GetTokenInformation(
HANDLE TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass,
LPVOID TokenInformation,
DWORD TokenInformationLength,
PDWORD ReturnLength
);
in stead of GetSecurityInfo()."Jon" <Email_Address.RemoveThis@SomewhereOrOther.com>
??????:uOlsHGqiHHA.5044@TK2MSFTNGP05.phx.gbl...
> "Steff" <st_10.RemoveThis@hotmail.com> wrote in message
> news:u5TIRPkiHHA.4772@TK2MSFTNGP04.phx.gbl...
>>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?
>>
>
>
> Sounds like you need to use 'impersonation'
>
> --
> Jon
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Can't open udf on ie7 on vista Ultimate - Each time I try to open a pdf link on Vista Ultimate using IE or mozilla ,the pc stops and give err msg such as can't open file please update registry. pc is not working untill I kill the ie/mozilla. the only way for me to read those pdfs is to save..

Vista no enabled user in administrators group?? - I was trying to help someone resolve a problem on their newer Dell computer today with Vista Home Premium installed. The user was having problems with Peachtree and up to a short time everything worked fine. The computer still works well as long as th...

Restarting a Windows Service with C# under Vista when User.. - Hello! I need to restart the "Windows Audio Service" (audiosrv) via C#. I'm using the ServiceController Class to do this. It is no problem under XP and no problem under vista if UAC is disabled. But with enabled UAC i'm getting a "access ...

IE7 cannot open web site - Since a recent MS update download, IE7 has been unable to open one web site that I visit regularly. I have tried all the fixes recommended by Windows help with no success. I removed each update one at a time, but that did not resolve the issue. I..

A thought on improving Vista security. - Hello everyone, I have an idea that I think would really help improve Vista security. At the same time, it would make Vista run faster and take up less space, and it would make things more difficult for malicious hackers. Could someone tell me the....
       Windows (Home) -> Security All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
  Windows Forums
 Game Forums
 Linux Forums
 Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact