Arwinss technical

From ReactOS Wiki
Revision as of 06:49, 2 March 2012 by BrentNewland (talk | contribs) (Categories)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Arwinss technical information

The Win32 subsystem consists of quite a lot of different modules. Arwinss reimplements only USER32.DLL/GDI32.DLL, leaving KERNEL32.DLL intact, because it's already implemented correctly (some minor modifications are still required to this and some other modules, see below).

FREETYPE.DLL

Located in dll/3rdparty/freetype. This is unchanged FreeType library, compiled as a DLL with small ReactOS-glue code. It's imported by GDI32.DLL

GDI32.DLL

Located in dll/win32/gdi32. Implements GDI API. Heavily based on unchanged latest Wine's gdi32.dll source code. Changed parts are:

  • font-loading code in freetype.c adapted to work on NT systems instead of relying to Unix specifics.
  • Registry operations (Open/Close keys, RegSetValue, etc) are copied from advapi32 to a regglue.c file to prevent static binding to advapi32.dll (which causes incorrect load order).
  • gdiobj.c, in DllMain() a call to LoadLibraryA("gdi.exe16") is commented out.

USER32.DLL

Located in dll/win32/user32. Implements USER API. Heavily based on unchanged latest Wine's user32.dll source code. Changed parts are:

  • user_main.c: Commented out LoadLibraryA("user.exe16");
  • user_main.c: winstation_init() is changed so that it always opens default window station instead of always creating it.
  • win.c: GetDesktopWindow(): Don't try to start "explorer.exe" if there is no desktop window.

WINENT.DRV

Located in dll/win32/winent.drv. A special so-called user/gdi "driver", which is used by USER32.DLL and GDI32.DLL to abstract all graphics, window managing and user input. WINENT.DRV implements glue code which forwards all calls into the kernelmode Win32 subsystem counter part (win32k.sys), providing additional information where needed and doing some housekeeping. Interface with win32k.sys is done via usual syscalls, however their names, amount of parameters and meaning have nothing in common with real Windows' win32k syscalls.

WINEX11.DRV

Located in dll/win32/winex11.drv. Implements X11 X-windows graphics and user drivers. Will be covered later since it's optional.

WIN32K.SYS

Located in subsystems/win32/win32k. The most important part of the subsystem, and the place where most hacking occurs. Implements kernel mode counter part of the native graphics driver, a Simple Window Manager (SWM) and a kernel mode USER server.

Subdirectories:

  • dib - Device Independent Bitmap code, copied nearly unchanged from ReactOS win32k, rev. 41760.
  • eng - Eng* functions implementation for native video drivers. Most code is taken from ReactOS win32k either unchanged or with improved formatting and comments added. Uncalled/unused code is stubbed.
  • gdi - RosGdi* functions implementations, which make up Arwinss win32k syscall interface.
  • gre - Graphic Engine implementation. Usually, RosGdi* is a wrapper around GRE functions.
  • main - Generic code for Win32 process/thread creation and deletion, CSR interaction, keyboard layout, monitor information.
  • swm - Simple Window Manager. Arwinss relies on a Window Manager which manages top level windows. It's called "Simple" because it implements the minimal needed amount of work: it keeps track of windows, calculates clipping regions (visible regions), invalidates regions when they become visible.
  • wine - Contains USER server, which is based on source code from Wineserver, which implements: Atom support, Window classes management, directory object management, handle management, window hooks support, objects manager, message queues, region objects, user handles, window handling, window stations and desktops handling; and some glue code which is to be cleaned up later.

WIN32CSR.DLL

Located in subsystems/win32/csrss/win32csr. Implements needed parts of the CSR subsystem along with handling user input