Windows中的桌面管理 Process Connection to a Window Station

A process automatically establishes a connection to a window station and desktop when it first calls a USER32 or GDI32 function (other than the window station and desktop functions). The system determines the window station to which a process connects according to the following rules:

 

进程在调用第一个USER32或GDI32函数时,自动连接到一个Window Station和Desktop。系统按照如下规则决定进程连接到哪个Window Station:

 

  1. If the process has called the SetProcessWindowStation function, it connects to the window station specified in that call.
    如果进程已经调用SetProcessWindowStation 函数,指定了Window Station。
  2. If the process did not call SetProcessWindowStation, it connects to the window station inherited from the parent process.
    如果进程没有调用SetProcessWindowStation  ,进程将继承父进程连接到的Window Station。
  3. If the process did not call SetProcessWindowStation and did not inherit a window station, the system attempts to open for MAXIMUM_ALLOWED access and connect to a window station as follows:

    如果进程未调用SetProcessWindowStation  并且也没有继承Window Station,系统尝试MAXIMUM_ALLOWED访问权限打开并连接到下面的Window Station。

    • If a window station name was specified in the lpDesktop member of the STARTUPINFO structure that was passed to the CreateProcess function when the process was created, the process connects to the specified window station.
      调用CreateProcess  时,为STARTUPINFO  参数中的lpDesktop  属性指定了Window Station名称。
    • Otherwise, if the process is running in the logon session of the interactive user, the process connects to the interactive window station.
      否则,进程的Widnow Station运行在交互用户登录会话的交互Window Station中。
    • If the process is running in a noninteractive logon session, the window station name is formed based on the logon session identifier and an attempt is made to open that window station. If the open operation fails because this window station does not exist, the system tries to create the window station and a default desktop.
      如果进程运行在非交互登录会话中,Windows Station 名称的形成以登录会话标识为基础,并且尝试打开这个Window Station。如果打开操作因为Window Station不存在而失败,系统将尝试创建一个Window Station和一个Default Desktop。

The window station assigned during this connection process cannot be closed by calling the CloseWindowStation function.

 

Window Station 在进程连接的过程中,不能通过调用CloseWindowStation  关闭。

 

When a process is connecting to a window station, the system searches the process's handle table for inherited handles. The system uses the first window station handle it finds. If you want a child process to connect to a particular inherited window station, you must ensure that the only the desired handle is marked inheritable. If a child process inherits multiple window station handles, the results of the window station connection are undefined.

Handles to a window station that the system opens while connecting a process to a window station are not inheritable.

 

 当进程连接到一个Window Station后,系统查询进程句柄表找到继承的句柄。系统使用第一个找到的Window Station。如果子进程想连接到一个指定的继承Window station,必须确认仅继承了想要的那个句柄。如果子进程继承了多个Window Station句柄,则连接未被接受。系统在进程连接时打开的Window Station句柄是不可继承的。

参与评论 您还未登录,请先 登录 后发表或查看评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

东东

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值