c++ - : LoadUserProfile -vs- RegOpenCurrentUser有什么区别

标签 c++ windows impersonation token roaming-profile

这两个 API 非常相似,但不清楚有什么区别以及何时应该使用它们(除了 LoadUserProfile 被指定用于与我没有使用的 CreateProcessAsUser 一起使用。我只是模拟配置单元访问)。

加载用户配置文件 http://msdn.microsoft.com/en-us/library/bb762281(VS.85).aspx

RegOpenCurrentUser http://msdn.microsoft.com/en-us/library/ms724894(VS.85).aspx

根据服务和注册表文章: http://msdn.microsoft.com/en-us/library/ms685145(VS.85).aspx 我们应该在模拟时使用 RegOpenCurrentUser。

但是如果用户配置文件正在漫游,RegOpenCurrentUser 应该做什么/应该加载它?

据我从这些文档中得知,这两个 API 都为线程正在模拟的用户提供了 HKEY_CURRENT_USER 的句柄。因此,它们都“加载”配置单元,即将其锁定为数据库文件并为注册表 API 提供句柄。

LoadUserProfile 加载用户配置文件的方式似乎与用户登录时加载用户配置文件的方式相同,而 RegOpenCurrentUser 则不然 - 这是否正确?这两个 API 如何挂载配置单元的根本区别(如果有的话)是什么?

IF 发生的事情之间的含义和区别(如果有的话)是什么

  1. 用户登录或注销时这些模拟句柄中的每一个都已在使用中?

  2. 调用每个匹配的关闭函数(RegCloseKey 和 UnloadUserProfile)时,用户是否已经登录?

最佳答案

But what does/should RegOpenCurrentUser do if the user profile is roaming - should it load it?

它不会加载配置文件。以这种方式考虑:如果是这样,您必须在完成 HKEY_CURRENT_USER 的句柄后以某种方式调用 UnloadUserProfile()

It might seem that LoadUserProfile loads the user profile in the same way as the User does when he/she logs on, whereas RegOpenCurrentUser does not - is this correct?

是的。

What is the fundamental difference (if any) in how these two APIs mount the hive?

没有。

What are the implications and differences (if any) between what happens IF A user logs-on or logs-off while each of these impersonated handles is already in use?

他们将获得自己的打开和关闭句柄(使用相同的键)。

A user is already logged-on when each matching close function (RegCloseKey and UnloadUserProfile) is called?

同上。

关于c++ - : LoadUserProfile -vs- RegOpenCurrentUser有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/459248/

相关文章:

c++ - Listwidget 中的右键

windows - Azure 角色包的大小是否有限制?

c++ - 如何终止使用 ShellExecute 启动的程序

asp.net-mvc-2 - Web 应用程序 : Allowing super users to impersonate other users - Is there a design pattern for this?

c# - ASP.NET - 使用模拟但使用 AppPoolIdentity 连接到 SQL Server

c++ - 为什么我的打印功能不起作用?链表

c++ - VS2015 中的计时文字

c++ - Resource.rc 文件中返回多个资源

sql-server - 在SSRS中自动设置用户的订阅

c++ - 在 wxwidgets 中,如何让一个线程在继续之前等待另一个线程完成?