I have a list of usernames. In C++ which way would it be better to check if the profile associated with the username exists or deleted in the local machine? I came across ATL CAccessToken class methods and Win32 APIs with GetTokenInformation etc. Which one would be better on performance perspective too?

有帮助吗?

解决方案

I would expect that performance-wise a single call to gather the entire list of all users would be faster than verifying them individually. You can do that using the NetUserEnum function as described here. This will also get you the status flags so you know if the user account has been disabled, locked out, their password expired, etc.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top