Forum > Networking and Web Programming

User Domain

(1/2) > >>

Weitentaaal:
Hello,

how should i check for the user's domain name. I tried using GetTokenInformation but can't quite figure it out. I would like to grant a User, in a certain Domain, permission to do specific things.

thanks for any help, i hope i posted this in the right Forum Section.

Khrys:
You could use  GetEnvironmentVariable  to check the value of  USERDOMAIN  on Windows,  but note that (like any other environment variable) it can easily be changed/overwritten by the user.

Weitentaaal:
i asked the Network Admin and he told me that the User's are not able to Edit the Environment Variables. So i should be safe when using GetEnvironmentVariable? Its Windows only currently so that wont be a problem either.

Zvoni:
What about querying LDAP?

https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol


--- Quote ---dn: cn=John Doe,dc=example,dc=com
--- End quote ---

Remy Lebeau:

--- Quote from: Weitentaaal on February 06, 2025, 11:08:24 am ---I tried using GetTokenInformation but can't quite figure it out.

--- End quote ---

What did you try that is not working?

Perhaps you can use GetTokenInformation() to get the user's SID, and then use LookupAccountSid() to get the domain where that SID is found.


--- Quote from: Weitentaaal on February 06, 2025, 11:08:24 am ---i hope i posted this in the right Forum Section.

--- End quote ---

Not really.  This question has nothing to do with network/web programming. The Programming > Operating Systems > Windows forum would probably have been more appropriate.

Navigation

[0] Message Index

[#] Next page

Go to full version