LookupAccountName does not seem to work correctly....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am trying to get the user account information using the function
LookupAccountName supplying it the user name. This API return the user SID if
the user exists.
Now, each SID has a user SID_NAME_USE which indicates the type of the user
e.g. SidTypeUser, SidTypeDomain, SidTypeComputer etc.

If I try this function for a normal user, it returns me the SID with correct
SID_NAME_USE as SidTypeUser.
However if I try this function for a computer account, this function returns
me the SID but with an incorrect SID_NAME_USE as SidTypeUser instead of the
expected SidTypeComputer.

Is it the expected behaviour? Am I missing something? Or should I use
another API which could give me correct user account type?

I would be highly grateful if anybody could help me in this regards.
Thanks,
Tushar
 
Tushar,

I don't know what you are looking for, however getting the most simple way
the username in Net is environment.username.

There are more methods by the way without using an API.

Cor
 
Thanks a lot for the reply Cor - much appreciated.
I basically want to identify the user account type on a domain controller
given the account name and its RID. The account then can be of a normal user
or of a computer in that domain etc.
I looked into Net API's, however I am not currently using Net API library
and using those will require me to include the Net API library only for using
a single function. Is there any other way than using Net APIs? Also any
comment on the odd(?) behavior of the LookupAccountName API?

Thanks again,
Tushar.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top