Win32k design guideline
From ReactOS
This is work in progress. Please add suggestions.
Contents |
File layout
Suggestion for a new layout by Timo:
- dib
- as it is
- driver
- device.c
- display.c
- driver.c
- loader.c
- misc
- copy.c
- debug.c
- engmisc.c
- err.c
- error.c
- event.c
- gdibatch.c
- gdidbg.c
- math.c
- mem.c
- mouse.c
- perfcnt.c
- print.c
- sort.c
- usrheap.c
- ntuser
- ???
- objects
- bitmap.c
- brush.c
- clipobj.c
- dc.c
- dcutil.c
- dibobj.c
- driverobj.c
- floatobj.c
- gdiobj.c
- icm.c
- lfont.c
- metafile.c
- palette.c
- path.c
- pen.c
- rect.c
- region.c
- rfont.c
- semaphor.c
- stockobj.c
- strobj.c
- surface.c
- window.c
- xform.c
- xlate.c
- painting
- alphablend.c (NtGdiAlphaBlend, NtGdiEngAlphaBlend, EngAlphaBlend, IntEngAlphaBlend)
- arc.c (NtGdiArcInternal, NtGdiAngleArc, IntGdiArcInternal, IntArc)
- bezier.c
- bitblt.c (NtGdiBitBlt, NtGdiEngBitBlt, EngBitBlt, IntEngBitBlt, CallDibBitBlt)
- copybits.c (EngCopyBits)
- ellipse.c (NtGdiEllipse, NtGdiPie)
- fill.c
- floodfill.c
- gradient.c
- lineto.c
- maskblt.c (NtGdiMaskBlt, IntEngMaskBlt, EngMaskBlt)
- paint.c
- patblt.c
- pixel.c
- polyblt.c
- polyfill.c
- polygon.c
- polyline.c
- pos.c
- rectangle.c
- stretchblt.c
- textout.c (NtGdiExtTextOut, IntEngTextOut, EngTextOut)
- transblt.c (NtGdiTransparentBlt, IntEngTransparentBlt, EngTransparentBlt)
GDI object Locking
This is a very important point! If you lock more than one GDI object at a time it must be done in a special order: DCs -> Brushes -> Pens -> Bitmaps -> ... (not finished!) If you lock more than one object of the same type, use GDIOBJ_LockMultipleObjects (yes, I know it's not yet implemented, give me some time to test ;-)) The reason is, if 2 threads lock the same objects in a different order, they might both end up waiting for an object, that was locked by the other thread and none will be able to continue.
Coding style
Function naming
Finally here all those Int... Eng.. Nt* should be explained, since every time a new developer comes, he has questions.
Suggestion for internal naming of XXXOBJ_ functions:
Give them all names like EXXXOBJ_DoSomething with the preceeding E. Those functions will have the extended object as parameter. Prototypes are defined in win32k internal headers. So they can be used internally without typecasting EXXXOBJ* to XXXOBJ*. The def file will take care to redirect the public functions to our private function names.
example: implement ULONG EXFORMOBJ_iGetXform(EXFORMOBJ *pxo, XFORML *pxform); in the def file: XFORMOBJ_iGetXform@8=EXFORMOBJ_iGetXform@8
Indentation
- Should match the kernel's indentation preferably? At least Ged, me (Aleksey) and some other people on IRC supported that idea.
- I support the idea of using the kernel's indentation style (4 spaces) as well :-) - Colin Finck 10:46, 14 June 2008 (UTC)
Recursive function calls
Have a look at the SetWindowPos implementation and start either laughing or whining...
other
just found this on the wiki, old, but ...: win32k.sys

