[D3DCOMPILER_43] Sync with Wine Staging 3.17. CORE-15127
[reactos.git] / media / doc / winsta and desktops.txt
1 SAWinSta
2 --------
3 I write a GUI appication, and the user may run it in task schedule. Since
4 windows 2000/XP treat schedule task as a service, the schedule service can
5 not be associated with interactive desktop object in the in 2 states
6 1) No user log on
7 2) Log on with another account.
8 I write a test program, and find when the schedule service starts, the
9 station/desktop will be "SAWinSta\Desktop" in both cases
10
11 Is there any way to let schedule service associated with interactive desktop
12 in these 2 cases?
13
14 thanks
15 -------------------------------------------
16
17 Service-0x0-3e7$
18 ----------------
19 By default Win32 services associated with non-visible windows station (for
20 services which run in the local system account it is Service-0x0-3e7$) and they
21 can't (without using special flag MB_SERVICE_NOTIFICATION or
22 MB_DEFAULT_DESKTOP_ONLY in the MessageBox function) interact with user.
23 However, you may configure a service to have GUI capabilities. Just set Type
24 field of the registry service entry equal SERVICE_INTERACTIVE_PROCESS. When
25 this key is specified SCM will connect the service with WinSta0 instead
26 Service-0x0-3e7$ and it will alow to display windows and dialog boxes.
27
28 -------------------------------------------------
29
30 WinSta0
31 -------
32
33 -The one-and-only interactive WinSta.
34 -No other winsta can be visible/active.
35 -Only WinSta0 can receive input.
36 -All other WinSta's are invisible/non-interactive WinStas.
37
38 What good is a invisible WinSta? Its used for running services in thus services cant
39 interact with the user.
40
41 There are limits to what u can do in a invisible WinSta.
42 -Bitblt wont work for instance, since nothing is really displayed in a invisible WinSta (to save resources).
43 No point in using GDI resources for stuff noone can see.
44 -SendInput wont work
45
46
47
48 ---------------------------------------------------
49 MORE INFORMATION
50
51 A Window station can either be interactive or noninteractive. (At the moment on Windows NT 3.51 and 4.0, only "Winsta0" can be an interactive Window station.) Any Desktops created on the interactive Window station will have the ability to become active. An active Desktop encompasses the ability for user objects (such as windows and dialog boxes) created on the Desktop to be visible to the interactively logged-on user (that is, the user who logs on the system via CTRL-ALT-DELETE) and receive user input.
52
53 When the interactively logged-on user launches any processes, these processes are associated with the "default" Desktop in the "Winsta0" Window station. The "default" Desktop is considered the active Desktop. A process on the active Desktop could switch Desktops such that another Desktop becomes the active Desktop such as the "Winlogon" Desktop. Only one Desktop can be the active Desktop at any one time.
54
55 Desktops associated with a noninteractive Window station can create user objects. These objects will never be visible to the interactively logged-on user and will never receive any user input. If you have a noninteractive Service running in the LocalSystem account, any user objects created by the service will not be visible to the interactively logged-on user. In addition, any processes launched by the service will also not be visible.
56 If our desktop has the same name as the active one, we are running on the
57 active (input) desktop. This is true because desktops have exactly one
58 name each, and within a window station, desktop names must be unique
59 ----------------------------------------------------------------
60
61 Process closing window station with CloseWindowStation can't be assigned to the window station
62 it is closing.
63
64
65 The reason is that each session has its own CSRSS, as well as instanced
66 win32k.sys data. So in each session, you basically have a complete copy of
67 Windows that doesn't know about the existance of any other copy. You're not
68 just on a different desktop/windowstation when you're in a different
69 session.
70
71
72 Lawrence, you are wrong. HWNDs are valid throughout the whole
73 windowstation, not only the creating process. That's because they
74 are pointers, but not in your address space...
75
76
77 The CreateDesktop function creates a new desktop on the window station associated with the calling process.
78
79 PROCESS:
80 -every w32 process is associated with a WindowStation
81 -can move between window stations (well, with strict limitations i would guess eg. what if
82 windows have been created and is using the winsta heap? or can multiple winsta heaps be mapped into
83 one process?? )
84
85 THREADS:
86 -can only enumerate windows on its desktop (but u can easely switch to a different desk)
87 -every w32 thread is associated with a Desktop
88 -Threads can switch between desktops, and windows are created on the thread's current desktop
89 (a thread can have windows on multiple desktops? IS THIS REALLY TRUE?)
90
91 DESKTOP:
92 -owns windows
93 -Only one desktop at a time can interact with the user, and that desktop must necessarily
94 be associated with Winsta0
95 -Only one desktop is visible to the user and only one can receives input at any time
96 -contain a logical display surface
97 -contin windows (or a pointer to the desktop window)
98 -contain menus
99 -contain hooks
100 -holds UI objects, such as windows, menus, and hooks
101 -Once a window is created it cannot move between desktops
102
103 SESSION:
104 -session = win32k instance
105 -Every session contains one or more windows stations
106 -A given login session has only one window station with access to user interactions
107 (term server has multiple login sessions)
108 -each logon session is associated with a window station
109
110 WINDOW STATION:
111 -only Winsta0 has access to the display
112 -Only one window station, called Winsta0, can interact with the user display, keyboard, mouse
113 -is a secure object
114 -Only the interactive window station WinSta0, can display
115 output or receive input. Other window stations are used by "services"
116 (but cant u switch winsta?? so a noninteractive winsta becomes active?)
117 -contains a set of global atoms
118 -contains a clipboard
119 -contains a set of desktop objects
120 -contains handle table(s) (handles are valid throughout the whole windowstation, not only the creating process)
121 -contain heaps (pointer(s) to the section heap(s) shared between user32/gdi32/win32k)
122 -A Windows 2000 session will have several windows stations, one assigned to the logon session
123 of the interactive user, and others assigned to the Winlogon process, the secure screen saver
124 process, and any service that runs in a security context other than that of the interactive user.
125
126 The interactive window station assigned to the logon session of the interactive user also contains
127 the keyboard, mouse, and display device. The interactive window station is visible to the user and
128 can receive input from the user. All other window stations are noninteractive, which means that
129 they cannot be made visible to the user, and cannot receive user input.
130
131 WINDOWS
132 -is owned by a desktop
133 -windows are tied to the window station where they started
134 -u cant move windows between desktops either
135
136 The system associates a desktop with a thread when that thread is created
137 The desktop associated with a thread must be on the window station associated with the thread's process.
138 A thread can use the SetThreadDesktop function to change its desktop.
139 The GetThreadDesktop function retrieves a handle to the desktop associated with a specified thread.
140
141 The calling process must have an associated window station, either assigned by the system at process creation time or set by SetProcessWindowStation. A desktop is a secure object contained within a window station object.
142
143
144 There can be several window stations in the system but only one of them can
145 be the interactive window station. That is the only windowstation whose
146 processes can communicate with the user (it has a visible desktop and can
147 receive mouse and keyboard input). A desktop lives inside a windowstation
148 and provides a display to the user. Only one desktop can be the active
149 desktop for a particular windowstation at any time. Furthermore only a
150 desktop that lives inside the interactive windowstation and is the currently
151 active desktop for that windowstation is visible to the user. On your
152 average Windows NT system there are at least 3 desktops inside the
153 interactive windowstation: the 'shell', winlogon and the screensaver. Each
154 process that runs on your system (and hence services as well) run inside a
155 windowstation and each thread in that process runs in the same windowstation
156 but can run in a different desktop.