Dennis Liu
Dennis Liu

Reputation: 11

Check if a username have permission to folder on windows

In my programs, i want to check whether a username have a permission to a folder on windows. But this username may not the user who current log on user.Did the windows provide the similar API?

Upvotes: 0

Views: 1831

Answers (2)

Dennis Liu
Dennis Liu

Reputation: 11

Thanks Jerry Coffin and Remy Lebeau. I had found the solution. Look at the link http://msdn.microsoft.com/en-us/library/windows/desktop/aa446637(v=vs.85).aspx In the example, you can get the permission of a user via only a username and the permission of a folder. And so i can check whether the username have the permission to folder.

Upvotes: 0

Remy Lebeau
Remy Lebeau

Reputation: 595377

You are looking for AccessCheck():

The AccessCheck function determines whether a security descriptor grants a specified set of access rights to the client identified by an access token.

However, you need an access token for the desired user, such as from LogonUser() or similar function. There is no API function that you can pass a username string to.

Upvotes: 3

Related Questions