-1

All info states that this is the main shell of Windows 3.x versions and up of Windows OSes.

My question is, how does this program have access to the entire GUI and screen/framebuffer data to draw and change stuff on it, and why can't other programs do what it does, like start menu and other stuff that normal programs seemingly can't touch?

For example, checking the program in a hex editor shows that it's a normal 32-bit PE executable format common with all Windows executables; however, all programs can not touch the screen data where the start-menu, taskbar, etc. is.

I heard it's possible to replace it, but then so is it possible for a normal user-level program to alter it? If not, why, and why can simply replacing it with another program work?

More specific details:

How does explorer.exe touch portions of screen memory that normal programs cannot? For example, I write an SDL/C++ app that wraps the Windows API. The WinAPI has no control over the start menu, etc., and neither do any other libraries that I'm aware of. How does explorer.exe alter screen memory from these regions that other programs cannot?

14
  • Thats 3 questions at least. There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.
    – DavidPostill
    Oct 16, 2014 at 19:58
  • Start with en.wikibooks.org/wiki/Windows_Programming
    – DavidPostill
    Oct 16, 2014 at 20:01
  • Very detailed stuff in that link, @DavidPostill. Does it explain why explorer.exe can access screen memory in regions where, say, cmd.exe cannot? Oct 16, 2014 at 20:02
  • 1
    Nope; I don't remember. I likely provided more than that simple statement though; but my comment does not exist so I can't check!
    – Ramhound
    Oct 16, 2014 at 20:21
  • 2
    I cannot delete questions so I actually didn't!
    – Ramhound
    Oct 16, 2014 at 20:31

1 Answer 1

3

how does this program have access to the entire GUI and screen/framebuffer data to draw and change stuff on it.

It uses calls to the API to control the graphic subsystem, which uses drivers to control the video adapter hardware.

and why can't other programs do what it does

They can, and do. Explorer.exe does no graphics generation.

like start menu and other stuff that normal programs seemingly can't touch?

The start menu and task bar ARE explorer.exe.

I heard it's possible to replace it,

You heard correctly, it is replaceable.

but then so is it possible for a normal user-level program to alter it?

No, because you can't change the shell unless you have administrator access to edit the registry. Then, once an EXE has been setup as the shell and run automatically by Windows, it's now running under a system-level context, not a user context.

How does explorer.exe touch portions of screen memory that normal programs cannot?

It doesn't. At best it can protect it's own memory spaces form being changed by other programs, and the OS provides that protection for the most part anyway. Any program can touch any area of the screen. Accessing "screen memory" directly isn't going to happen in Windows, due to hardware abstraction. Unless you're talking about a driver, which you're not.

The WinAPI has no control over the start menu, etc., and neither do any other libraries that I'm aware of. How does explorer.exe alter screen memory from these regions that other programs cannot?

Again, Explerer.exe IS the Start Menu, "etc.". Explorer uses the WinAPI to display its windows and controls (the Start Menu and Task Bar are just windows with controls).

Try this experiment: Open up Task Manager, and kill all copies of Explorer.exe you see. When you kill the last one, you'll notice you start menu and task bar disappear.

Yet other programs ARE STILL RUNNING and STILL VISIBLE, even without Explorer.exe running. You can even use Task Manager to lunch NEW programs; and they'll launch, and be visible, with windows and buttons and all. :)

This CodeProject post may help get you started, and help you wrap your head around modifying the Explorer elements (Start button in this case), from a programming point of view: Hiding the Taskbar and Startmenu (start orb) in Windows Vista and Windows 7

1
  • Of course it's possible to change some behavior with both the start menu and the look, feel, and some behavior with "folders" but some things are also not possible at the same time
    – Ramhound
    Oct 16, 2014 at 20:34

Not the answer you're looking for? Browse other questions tagged .