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

后端 未结 3 1183
广开言路
广开言路 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:44

    Before going the undocumented route like flokra suggests, I would try NetUserEnum() or NetQueryDisplayInformation()

    If you want to go into undocumented land, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList has a (incomplete) list of accounts (It's missing special accounts like ASPNET, HelpAssistant and SUPPORT_xxxx) It also has the path to the profile folder, which is a lot safer than using %ALLUSERSPROFILE%\..\ but why use it when there is GetProfilesDirectory()

提交回复
热议问题