From ReactOS Wiki
Revision as of 04:54, 8 April 2012 by BrentNewland (talk | contribs)
Jump to: navigation, search


See Arwinss page for the alternative win32 subsystem implementation effort.

See also Win32k_design_guideline

Kernel-mode subsystem server (Win32K)

See also User-mode subsystem server

The Graphics Device Interface Provides functionality for outputting graphical content to monitors, printers and other output devices. It resides in gdi.exe on 16-bit Windows, and gdi32.dll on 32-bit Windows in user-mode. Kernel-mode GDI support is provided by win32k.sys which communicates directly with the graphics driver.


  • Win32k: Initial implementation of regions and clipping
  • Win32k: Object cleanup on process deletion Eugene Ingerman
  • Win32k: Initial window painting code, bitmap loading David Welch
  • Win32k: Callbacks and messaging improvements David Welch
  • Win32k: Mouse messaging David Welch
  • Win32k: DIB Fixes Jason Filby


  • Win32k: Rewrote gdi (Engxxx) objects,
  • Made GDI object locking exclusive,
  • Added functions for locking multiple objects,
  • Color translation now works properly,
  • Implemented several DC functions (Eugene Ingerman)
  • Win32k: Initial scrollbar code (Jason Filby)









  • Handle correctly bottom-up surfaces in the VGA driver. (Filip Navara)
  • Stop processing if exact match is found in ClosestColorMatch. (Filip Navara)
  • Fixed locking in NtGdiGetBitmapBits. (Filip Navara)
  • Removed IntCopyBitmap and replaced it's usage by BITMAPOBJ_CopyBitmap. (Filip Navara)
  • Fixed setting of SURFOBJ->pvBits and SURFOBJ->pvScan0 in EngCreateBitmap for bottom-up surfaces. (Filip Navara)
  • Call IntEngBitBlt instead of EngBitBlt from EngCopyBits. (Filip Navara)
  • Correctly set the SURFOBJ->hsurf field. (Filip Navara)
  • Support for bottom-up mouse cursors in the Eng* cursor emulation routines. (Filip Navara)
  • Fix locking in error cases of NtGdiRestoreDC (get Primitives demo to start). (Filip Navara)
  • Fix BitmapFormat to return 0 for unknown bit depth. (Filip Navara)
  • New implementation of NtGdiGetDIBits. (Filip Navara)
  • Fixed buffer handling and coordinate translation in IntGdiPolyline. (Filip Navara)
  • Allocate memory from paged pool in EngAllocMem. (Filip Navara)
  • Support resursive locking of the GDI objects. (Filip Navara)
  • Call EngMovePointer instead of DrvMovePointer if driver DrvSetPointerShape returned SPS_DECLINE. (Filip Navara)
  • Don't continue execution if there is no exception handler. (Filip Navara)
  • Send the cursor to display driver in top-down format. (Filip Navara)
  • Guard against out of bounds access to KeyboardLayout->pusVSCtoVK in W32kKeyProcessMessage. (Filip Navara)
  • Fixed SetKeyState to correctly index the keyboard state table. (Filip Navara)
  • Use absolute value of the color difference when calculating color match rating. (Filip Navara)
  • Handle allocation failure in IntCreateBitmap. (Filip Navara)
  • Don't allow creating surface with BitmapFormat == 0 (Invalid) in IntCreateSurface. (Filip Navara)
  • Fixed ExcludeClipRgn for case when DC contained no clipping region before the call to this function. (Filip Navara)
  • Don't create XLATEOBJ for BitBlt and StretchBlt operations that don't use source DC. (Filip Navara)
  • Honor the "Extended" bit in SetKeyState. (Filip Navara)
  • Display window icon only if there is any. (Filip Navara)
  • DrawIcon should return TRUE if it succeeds. (Filip Navara)
  • Handle UnsafeRect == NULL case in NtUserGetUpdateRect. (Filip Navara)
  • Implementation of [NtGdi]GetTextFace[W] and [NtGdi]GetFontData[W]. (Filip Navara)
  • Fixed locking in NtGdiGetCharWidth32. This caused problems with AbiWord reported by Jason Filby. (Filip Navara)
  • Add IntEngCreateSrcMonoXlate. (Filip Navara)
  • Get rid of compiler warnings in Win32k. (Filip Navara)
  • Handle indexed palettes in IntEngCreateSrcMonoXlate. (Filip Navara)
  • Fix WS_CAPTION style handling. (Filip Navara)
  • Maintain higher internal precision during font rendering. (Filip Navara)
  • Honour bitmap->bitmap_left while rendering. (Filip Navara)
  • Correctly handle ClipCursor(NULL) case. (Filip Navara)
  • Implemented NtUserEnumDisplaySettings/IntEnumDisplaySettings (Gregor Anich)
  • Only accept matching palette (Gé van Geldorp)
  • FindWindow() should search the threads desktop, not the active one. (Gé van Geldorp)
  • Implement NtUserBuildNamesList() (Gé van Geldorp)
  • If SendMessageTimeout() times out, GetLastError() should return 0 (Gé van Geldorp)
  • Simplified assigning of DDI functions (Thomas Weidenmueller)
  • Fixed graphics (gui) checks (Thomas Weidenmueller)
  • Added support to paint and change desktop wallpapers (Thomas Weidenmueller)



  • Implement NtGdiDdGetDriverInfo and NtGdiDdWaitForVerticalBlank for directx. Untested yet. (Magnus Olsen)


(Magnus Olsen)

  • Implemented NtGdiDdCanCreateSurface and NtGdiDdBlt for DirectX™ (untested)
  • Expanded StretchBitBlt to all bit-per-pixel (BPP) settings (not yet fully implemented; use the code as a reference)
  • partially implemented fullscreen in changedisplay setting—I can play winquake™ in fullscreen now :)
  • Implemented NtGdiGetSystemPaletteUse and NtGdiSetSystemPaletteUse (this code has been taken from Wine)
  • Fixed winquake color glitch bug—the text is now white instead of black (Magnus Olsen)
  • Implemented NtGdiAnimatePalette (partly ripped from Wine; does not animate 100% of the palette) (Hervé Poussineau)
  • Speed-optimized the bitblt (Magnus Olsen, Gregor Anich), Alex Ionescu), Gé van Geldorp) (see svn log)
  • Repaired GDI to handle debugging functionality (Filip Navara)
  • Implemented NtGdiUnrealizedObject (James Tabor)
  • Implemented WH_KEYBOARD_LL hook (Gé van Geldorp)



  • Implemented code for tile and stretch wallpapers. (Brandon Turner)
  • Fixed a bug so the wallpaper gets written to registry and stays on reboot. (Brandon Turner)
  • Implement the saving of wallpaper styles in WinSta and the registry. (Brandon Turner)
  • Broaden the truetype lock to clear up text artifacts (Art Yerkes)
  • Fix display of menus in Firefox (Gé van Geldorp)
  • Make Firefox menus actually work (Gé van Geldorp)
  • Pass correct masks when creating bitfield palettes (Gé van Geldorp)
  • Fix a bitmap upside-down problem (Gé van Geldorp)
  • Implement IntEngAlphaBlend, NtGdiAlphaBlend functions, 8, 16, 24 and 32 bpp DIB AlphaBlend functions. (Gregor Anich)
  • Implement GetMenuBarInfo (James Tabor)


  • Fix BSOD in IntPrepareDriver (bug 1321) (Hervé Poussineau)
  • Fix EnumDisplayDevicesA when it convert the struct DISPLAY_DEVICE to unicode it use ansi side of it. and that why it did fail. (Magnus Olsen)
  • Fix BSOD in NtGdiDdCreateDirectDrawObject, it is not correct fix, it is a work around, the HDC can be NULL. it prevent some bsod for my new test apps for directx (Magnus Olsen)
  • Fix a problem with NtGdiDdDeleteDirectDrawObject, it attempted to lock object 0x8d1f9ad8 that is deleted! problem. (Magnus Olsen)
  • Fix BSOD in DD_Cleanup thanks Thomas W, Implement second check for DrvGetDrawInfo (Magnus Olsen)
  • NtGdiDdQueryDirectDrawObject do not setup wrong callback to struct members. Check for some NULL parama that can not be NULL. (Magnus Olsen)
  • part of bug 252 : checking for null and correct memmroy leak patch by j_anderw commited by (Magnus Olsen)
  • update NtUserGetMouseMovePointsEx prototype to msdn (Magnus Olsen)
  • DIB_CreateDIBSection fix do not zero out memmory if it is a null pointer it got from ExAllocatePoolWithTag (Magnus Olsen)
  • DIB_MapPaletteColors do not try write to NULL pointer if ExAllocatePoolWithTag do return a NULLL pointer. (Magnus Olsen)
  • EngSetPointerShape did not check for NULL pointer when it alloc memmory. (Magnus Olsen)
  • DRIVER_RegisterDriver did not check for NULL pointer when it alloc memory. (Magnus Olsen)
  • IntRegisterClass did not check for NULL pointer when it alloc memory. (Magnus Olsen)
  • Fix memory leak in NtUserMonitorFromRect when it return in one case. (Magnus Olsen)
  • some case from win32k can call to RtlClearAllBits with NULL pointer. and check for null pointer after RtlClearAllBits. This take care of those case for moment. (Magnus Olsen)
  • InitTimerImpl did not check for NULL pointer when it alloc memory. (Magnus Olsen)
  • NtGdiCreatePalette did not check for NULL pointer when it alloc memory. (Magnus Olsen)
  • Fix a mouse bug for hide the cursor. It is working now with my test code for ShowCursor and NtShowCursor. The code for it is not finish. and it also working now hide the mouse with EngMovePointer(SurfObj,-1,-1,NULL); and that did not work before. (Magnus Olsen)
  • Implement ShowCursor, it is a issue with quake when you moving the mouse, the mousepointer will show, when you stand still with the mouse it will not show the mousepointer. (Magnus Olsen)
  • solv the issue with mouse poiter is hide, do not show the mousepointer when you are moving the mouse. tested in winquake (Magnus Olsen)
  • ShowCursor, gott a internal count to show the mouse or not, and return that value. as msdn descripe. (Magnus Olsen)
  • Fixing a small bug for hide mouse. Save the current surface under the mouse. But do not blt the mouse pointer. It takes care of small glitch I have seen in winquake. (Magnus Olsen)
  • fix some bugs wih org with strechblt. (Magnus Olsen)
  • Correct Streachblt in windows mode, it take accunt org and offset now. (Magnus Olsen)
  • Thanks GvG for helping put to gather a new math formula that make alot of calc not needed any longer. and correct fourmla for rounding fault. I did not think of it when I rewrote the streachblt. it feal strechblt is bit fasfer agains the old one. (Magnus Olsen)
  • check return value of RtlDeleteAtomFromAtomTable (Johannes Anderwald)
  • simply, optimize, bugfix UserRegisterClass (Johannes Anderwald)
  • allow de-registration for system classes (Johannes Anderwald)
  • set ERROR_CLASS_DOES_NOT_EXIST in case of errors (Johannes Anderwald)
  • fix UserGetClassLongPtr && UserSetClassLongPtr (Johannes Anderwald, Thomas Weidenmueller)
  • fix Bug 1376, patch from SuperTrax at gmx dot de (owner of supertrax dot de, lookup Mark Hipp)if a Window was showed normaly, GetWindowPlacement never returned a showCmd. commited by (Magnus Olsen)
  • Bug 252 commiting file desktop.c from bug 252 , the patch is from (j_anderw at sbox dot tugraz dot at) it make our win32k lile more stable commited by (Magnus Olsen)
  • Bug 1391 : patch from (Thomas Weidenmueller) for Some Ansi vs. Unicode fixes for window classes commited by (Magnus Olsen)
  • Bug 1393 : Patch from (Thomas Weidenmueller) Fix moving class objects between desktop heaps and the shared heaps commited by (Magnus Olsen)
  • fix 16 to 16 soyrce dest why the hell does th 16bitmap surface calls into this (Magnus Olsen)
  • Fix the xlate bug in 24dib correct fix more buttom showing right in firefox now (Magnus Olsen)
  • fast cleanup in dib/dib24bpp.c, Fixing a crash bug in dib32bpp.c (typo from me), xlate XO_TABLE can resive 0xffff or 0xffff or 0xffffff or 0xffffffff as color code for table, but the table is only 256 but in color&FF, That will stop firefox crash and translate the color right. (Magnus Olsen)
  • Bug : 1452  : patch from w3seek, some xlate obj fixes for indexed palettes, should fix a hack introduced in r21292 commited by (Magnus Olsen)
  • Win32k Header Rewrite (Alex Ionescu)
  • Fix flaw in win32k hardware message queue which used KMUTEX instead of KMUTANT, thus double*disabling Kernel APCs during the parsing of the queue, which would result in actually deliving hardware message callbacks with Kernel APCs disabled when going to user*mode. This was detected when my new user*mode callback rewrite added checks for this situation, and it originally caused a bugcheck. Since the message queue code is now fixed, the bugcheck has been re*enabled, hopefully no other such violations will be detected.(Alex Ionescu)
  • Clear Tcb*>Win32Thread during win32 cleanup. (Alex Ionescu)
  • Allow TLS usage for 1088 TLS slots, fixes part of Bug 191. Patch by Filip Navara ( Ionescu)
  • Remove NtGdiDeleteDC and refernces to it as it is not a real win32 API. (Brandon Turner)
  • Remove NtGdiCheckColorsInGamut and refernces to it as it is not a real win32 API. (Brandon Turner)
  • Replace NtGdiCreatePatternBrush and NtGdiCreateHatchBrush with NtGdiCreatePatternBrushInteral and NtGdiCreateHatchBrushInteral. (Brandon Turner)
  • Implement CreateHatchBrush, CreatePatternBrush (Brandon Turner)
  • Rename NtGdiGetTextExtentPoint to NtGdiGetTextExtent and correct the declaration. (Brandon Turner)
  • Implemented PS_DOT, PS_DASH and PS_INSIDEFRAME in IntGdiCreatePenIndirect (Christoph von Wittich)
  • Fixed LoadCursorIconImage - this made Thunderbird working (Christoph von Wittich)
  • Fix BSOD when executing gdi32_winetest bitmap (Saveliy Tretiakov)


  • Fix BSOD in IntPrepareDriver (Bug #1321) (Hervé Poussineau)
  • New keyboard driver and layout structure implemented (James Tabor)
  • Have IntSystemParametersInfo send WM_SETTINGCHANGE when needed (Timo Kreuzer)
  • Patch from (Timo Kreuzer) for Bug #843: Removed focus from windows, workaround
  • NtUserSetFocus accepts Null window (Timo Kreuzer)
  • Same StretchBlt code for 8, 16, 32 bpp DIBs. It does not use putpixel anymore for 8bpp and 32bpp. Minor cleanups (Magnus Olsen)
  • Last part of the new strectsblt. Remove all mul and div from the loop (speed increase). (Magnus Olsen)
  • Commit FreeType cache glyth patch by Royce Mitchell. Modified by tinus to work with trunk, final fixes made by Timo Kreuzer. Text output receives speed increase from this fix. See Bug #511 for more details. (Magnus Olsen)
  • Implemented NtUserDrawCaption, NtGdiGetPath, NtGdiPathToRegion, NtGdiFlattenPath, NtGdiCloseFigure, NtGdiStrokePath, NtGdiStrokeAndFillPath, NtGdiPolyDraw (Saveliy Tretiakov)
  • Remove hack from Aleksey in changedisplay(), which hard coded the display number. With this patch we are now extract the display number from the desktop and use it. (Johannes Anderwald) and (Magnus Olsen)
  • Patch from Thomas Weidenmueller for Bug #1507: This patch fixes more issues with NtUserFindWindowEx. (one example of bugs have been fixed with this patch is the tray icon)
  • Fix strechblt dib16 and dib32, can be compiled with -O2 (gcc). See Bug #1520 for details (Magnus Olsen)
  • Patch from Thomas Weidenmueller: Patch to fix a couple of argument probing bugs in NtQuerySymbolicLinkObject and NtCreateSymbolicLinkObject
  • Fix two failures from wine gdi32 test. When HDC is NULL to NtGdiCreateDIBitmap we to need create a hdc and delete the hdc when we are done. (Magnus Olsen)
  • Implement SPI_GETFLATMENU and SPI_SETFLATMENU , not fully tested (Magnus Olsen)
  • Implement SPI_GETWHEELSCROLLLINES and SPI_GETWHEELSCROLLCHARS. Further additions to Win32k may be necessary to fully implement the two (Magnus Olsen)
  • Clean up NtGdiDdCreateDirectDrawObject and test. Fix create hdc when it is NULL (Magnus Olsen)
  • Rewrote NtGdiDdQueryDirectDrawObject. gdientry2 now working more or less. Create surface not yet fully implemented. A few more steps before dx hal working out of the box from win32k and gdi32. Thanks to DrFred for helping debugging between ddraw.dll and gdi32.dll with his sniffer apps, Alex for GdiEntry2, W3seek, Filip, GvG for helping me understand how our win32k works and some other info. It is now possible to load a graphic driver directx hal support in ROS. But I do not know how well it works yet (Magnus Olsen)
  • Added alpha blend support for 32bpp icons with alpha channels (Ged Murphy)
  • Improve compatibility in IntCallWndProcA/W, at least mIRC.exe works with this change (Aleksey Bragin)
  • Improve classes, fix bugs IntMapDesktopView() function (Aleksey Bragin)
  • Audit NCI interface, fixing a few wrong entries (Aleksey Bragin)


  • New clipboard implementation by Pablo Borobia (merged to trunk by Saveliy Tretiakov)
  • Make ntuser locks use eresource instead of mutex. Fix corresponding FIXME in class.c (Saveliy Tretiakov)
  • Add multiple keyboard layout support. Implemented NtUserLoadKeyboardLayoutEx, NtUserActivateKeyboardLayout, NtUserGetKeyboardLayoutList, NtUserGetKeyboardLayoutName. (Saveliy Tretiakov)
  • Send WM_INPUTLANGCHANGE to thread's focus windows when keyboard layout is changed. (Saveliy Tretiakov)
  • NtUserLoadKeyboardLayoutEx: Support KLF_REORDER and KLF_ACTIVATE. (Saveliy Tretiakov)
  • NtUserActivateKeyboardLayout: Support HKL_NEXT, HKL_PREV, KLF_REORDER. (Saveliy Tretiakov)
  • Add KLF_SHIFTLOCK and KLF_RESET (Saveliy Tretiakov)
  • Implement EngUnloadImage() (Saveliy Tretiakov)
  • Implement NtUserUnloadKeyboardLayout() (Saveliy Tretiakov)
  • dont double free memory (Johannes Anderwald)
  • remove MenuItem from MenuItemList on request (Johannes Anderwald)
  • Fix return call of GetObject under certain conditions (Ged Murphy)
  • Implement SPI_GET/SETMINIMIZEDMETRICS and SPI_SETNONCLIENTMETRICS in IntSystemParametersInfo (Timo Kreuzer, bug 1668)
  • NtUserBuildHwndList: non-recursive implementation, also processing child windows (Timo Kreuzer)
  • IntSetSysColors: update SysColor brushes and pens and broadcast WM_SYCOLORCHANGE (Timo Kreuzer)
  • NtGdiMoveToEx: copy old cursor pos back to caller instead of copying from caller (Timo Kreuzer)
  • NtGdiGetObjectW: fail if buffer != 0 and count == 0, don't write beyond buffer size (Timo Kreuzer)
  • NtGdiGetObjectW: use SEH only once (Timo Kreuzer)
  • Implement EXTPEN support (Timo Kreuzer)
  • NtGdiGetObjectW: add support for EXTPEN and PALETTE, fix BITMAP and BRUSH (Timo Kreuzer)
  • IntGdiAddFontResource: Add the filename to the font entry (Timo Kreuzer)
  • Partly implement NtGdiGetFontResourceInfoInternalW (Timo Kreuzer)
  • Handle FW_DONTCARE in GetFontScore (Timo Kreuzer)
  • NtGdiPaintRgn: fix a region leak, unlock a bitmap (Timo Kreuzer)
  • IntGetNCUpdateRegion: fix region leak (Timo Kreuzer)
  • co_UserRedrawWindow: Don't use a region after it was deleted (Timo Kreuzer)
  • Fix broken IntValidateParent function (Timo Kreuzer)
  • co_WinPosSetWindowPos: Validate parent windows if a region is bitcopied (Timo Kreuzer)
  • co_WinPosSetWindowPos: fix window drawing (Timo Kreuzer, bugs #902, #735)
  • Set default screensaver timeout to 10 minutes (Aleksey Bragin)
  • Bug fixes for NtGdiDdCreateDirectDrawObject, NtGdiDdCanCreateSurface, NtGdiDdGetScanLine and NtGdiDdWaitForVerticalBlank for various minor bugs, so that they work similar to the Windows NT4/2000/XP/2003 functions in most cases (Magnus Olsen)
  • Bug fixes for NtGdiDdCreateSurface, it can create one surface now, but it contains many bugs (Magnus Olsen)
  • Rewrite NtGdiDdBlt, it can now operate on a surface, but it might contain bugs (Magnus Olsen)
  • Revert revision 21677, this change is not needed, I confirm VMware's own graphics driver does not release the DX interface in windows XP/2003 or higher.
    I removed this, so the VMware driver gets a DX interface, this enables Windows XP graphics driver again. Unfortunately, there are no DX hardware accelerations from VMware any longer. (Magnus Olsen)
  • Remove a Windows 95/98/Me behaviour in NtGdiDdQueryDirectDrawObject, also tested under Windows 2000 to see if this behaviour really existed or not.
    puvmList and puNumHeaps should be ignored by Windows NT when they are passed down. After I fix the last part, this API is 99.9% compatible with Windows 2000 and higher. (Magnus Olsen)
  • Implement NtUserDrawCaptionTemp (Christoph von Wittich)
  • Handle DIB_PAL_COLORS in NtGdiStretchDIBits (Christoph von Wittich)
  • Add SEH to fix the crash in win32k after user-mode callback (Dmitry Gorbachev, bug #2212)
  • Add almost all SPI messages that can be sent to win32k. Some are stubs and will not work yet, but win32k will accept them (Yaroslav Ponomarenko)
  • Partly support swapping the mouse buttons with SPI (Yaroslav Ponomarenko)
  • Implement pointers MouseSpeed, CursorAccelerationInfo.FirstThreshold, CursorAccelerationInfo.SecondThreshold, CursorAccelerationInfo.Acceleration, MouseHoverTime, MouseHoverWidth, MouseHoverHeight for SPI_SETMOUSEHOVERTIME, SPI_SETMOUSEHOVERWIDTH, SPI_SETMOUSEHOVERHEIGHT, SPI_SETMOUSE, SPI_SETMOUSESPEED. (Yaroslav Ponomarenko)
  • Rewrite NtUserScrollDC, fixing a scrolling bug and optimizing for speed (bug #2237) (Timo Kreuzer)
  • Fix gdi object reuse counter storage (Timo Kreuzer)
  • Several compatibility changes for win32k syscall api (Timo Kreuzer)
  • NtGdiGetRandomRgn: small compatibility fixes (Timo Kreuzer)
  • NtGdiGetSetBitmapBits: add SEH protection (Timo Kreuzer)
  • Simplify VIS_ComputeVisibleRegion (Timo Kreuzer)