User:Lone Rifle/GDI Function Implementation Guidelines

From ReactOS Wiki
Jump to: navigation, search

GDI Function Call Order

GDI functions have implementation in both user space and kernel space. The DLL GDI32.DLL exports the GDI functions in the Win32 API to programs running in user space. The real guts of the implementation is in kernel space. The portion of the kernel that does the work associated with a particular GDI call is WIN32K.SYS. This section of the document is dedicated to describing the naming conventions and call order of generic GDI functions calls.

Given a GDI function XXX exported by GDI32.DLL, the following diagram describes how the ReactOs kernel implements XXX.


GDI_call_flow.png


First, XXX is passed into the WIN32K.SYS entry point, NtGdiXXX. This function converts the parameters passed from user space into parameters understood by the kernel. It also locks resources used to implement XXX. After this is done, NtGdiXXX calls IntEngXXX to do the work. IntEngXXX first checks to see if the driver hooks the function XXX, and if it does, IntEngXXX calls DrvXXX to complete the call. If the driver does not hook XXX, then IntEngXXX calls the generic implementation of XXX, EngXXX to complete the call.

Notes

  • Drivers may not implement XXX for all surfaces, and may call EngXXX to complete the XXX call.
  • All(I need to verify this) EngXXX calls are documented in the Windows DDK. These functions are part of the API used by driver implementers.
  • If a kernel function needs to call into XXX, it should call IntEngXXX to take advantage of optimizations provided by the driver, and to avoid multiply locking resources.