Getting a list of user profiles on a computer in C++ Win32

后端 未结 3 1187
广开言路
广开言路 2020-12-03 23:34

What is the best way to enumerate all of the user profiles on a computer?

I know how to get the currently logged in user profile, and I know how to get the \"all use

3条回答
  •  误落风尘
    2020-12-03 23:50

    You could read in the contents of the directory one level above %ALLUSERSPROFILE%.

    Then you would have the names of all accounts that are (or were, if not deleted completely) on the system. To verify that an account still exists, I would use LsaLookupNames2. This function retrieves the SIDs that belong to account-names (deleted account == no SID).

提交回复
热议问题