Why aren't console windows themed on Windows XP?

Raymond Chen

Commenter Andrej Budja asks why cmd.exe is not themed in Windows XP. (This question was repeated by Serge Wautier, proving that nobody checks whether their suggestion has already been submitted before adding their own. It was also asked by a commenter who goes by the name “S”, and then repeated again just a few hours later, which proves again that nobody reads the comments either.) Knowledge Base article 306509 explains that this behavior exists because the command prompt window (like all console windows) is run under the ClientServer Runtime System (CSRSS), and CSRSS cannot be themed. But why can’t CSRSS be themed? CSRSS runs as a system service, so any code that runs as part of CSRSS creates potential for mass havoc. The slightest mis-step could crash CSRSS, and with it the entire system. The CSRSS team decided that they didn’t want to take the risk of allowing the theme code to run in their process, so they disabled theming for console windows. (There’s also an architectural reason why CSRSS cannot use the theming services: CSRSS runs as a subsystem, and the user interface theming services assume that they’re running as part of a Win32 program.) In Windows Vista, the window frame is drawn by the desktop window manager, which means that your console windows on Vista get the glassy frame just like other windows. But if you take a closer look, you will see that CSRSS itself doesn’t use themed windows: Notice that the scroll bars retain the classic look.

The window manager giveth and the window manager taketh away, for at the same time console windows gained the glassy frame, they also lost drag and drop. You used to be able to drag a file out of Explorer and drop it onto a command prompt, but if you try that in Windows Vista, nothing happens. This is a consequence of tighter security around the delivery of messages from a process running at lower integrity to one running at a higher integrity level (see UIPI). Since CSRSS is a system process, it runs at very high security level and won’t let any random program (like Explorer) send it messages, such as the ones used to mediate OLE drag and drop. You’ll see the same thing if you log on as a restricted administrator and then kick off an elevated copy of Notepad. You won’t be able to drag a file out of Explorer and drop it onto Notepad, for the same reason.

0 comments

Discussion is closed.

Feedback usabilla icon