ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
605 discussions
Start a n
N
ew thread
[fireball] 42320: - Switch arwinss win32k to the GDI object manager from trunk. gdiobj.c is cleaned up from functions which aren't used in arwinss, and the user<->kernel handle mapping still remains. The only supported object types now are DC, SURFACE and PALETTE. (see arwinss issue nr. 14). - Kernelmode GDI handles leak now very significantly. To be investigated.
by fireball@svn.reactos.org
Author: fireball Date: Sat Aug 1 00:08:01 2009 New Revision: 42320 URL:
http://svn.reactos.org/svn/reactos?rev=42320&view=rev
Log: - Switch arwinss win32k to the GDI object manager from trunk. gdiobj.c is cleaned up from functions which aren't used in arwinss, and the user<->kernel handle mapping still remains. The only supported object types now are DC, SURFACE and PALETTE. (see arwinss issue nr. 14). - Kernelmode GDI handles leak now very significantly. To be investigated. Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/gdidbg.c - copied, changed from r42309, trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c - copied, changed from r42309, trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engpal.c branches/arwinss/reactos/subsystems/win32/win32k/eng/engsurf.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/enum.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h branches/arwinss/reactos/subsystems/win32/win32k/include/gdiobj.h branches/arwinss/reactos/subsystems/win32/win32k/include/palobj.h branches/arwinss/reactos/subsystems/win32/win32k/include/surfobj.h branches/arwinss/reactos/subsystems/win32/win32k/include/tags.h branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h branches/arwinss/reactos/subsystems/win32/win32k/main/init.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engpal.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/eng/engpal.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/eng/engpal.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -24,18 +24,27 @@ IN FLONG flGreen, IN FLONG flBlue) { - HPALETTE Palette; + HPALETTE Palette; - Palette = PALETTE_AllocPalette(iMode, cColors, pulColors, flRed, flGreen, flBlue); + Palette = PALETTE_AllocPalette(iMode, cColors, pulColors, flRed, flGreen, flBlue); - return Palette; + /* Make it global */ + GDIOBJ_SetOwnership(Palette, NULL); + + return Palette; } BOOL APIENTRY EngDeletePalette(IN HPALETTE hpal) { + /* Get ownership */ + GDIOBJ_SetOwnership(hpal, PsGetCurrentProcess()); + + /* Free palette by handle */ PALETTE_FreePaletteByHandle(hpal); + + /* Report success */ return TRUE; } Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engsurf.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/eng/engsurf.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/eng/engsurf.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -30,6 +30,9 @@ /* Call the internal routine */ hNewBitmap = GreCreateBitmap(Size, Width, Format, Flags, Bits); + /* Make it global */ + GDIOBJ_SetOwnership(hNewBitmap, NULL); + return hNewBitmap; } @@ -240,6 +243,9 @@ APIENTRY EngDeleteSurface(IN HSURF hSurf) { + /* Get ownership */ + GDIOBJ_SetOwnership(hSurf, PsGetCurrentProcess()); + /* Delete this bitmap */ GreDeleteBitmap((HGDIOBJ)hSurf); @@ -255,7 +261,7 @@ DPRINT("EngLockSurface(%x)\n", hSurf); /* Get a pointer to the surface */ - Surface = GDI_GetObjPtr(hSurf, (SHORT)GDI_OBJECT_TYPE_BITMAP); + Surface = SURFACE_ShareLock(hSurf); /* Return pointer to SURFOBJ object */ return &Surface->SurfObj; @@ -263,12 +269,13 @@ VOID APIENTRY -EngUnlockSurface(IN SURFOBJ* Surface) -{ - DPRINT("EngUnlockSurface(%p)\n", Surface); +EngUnlockSurface(IN SURFOBJ* pSurfObj) +{ + SURFACE *pSurface = CONTAINING_RECORD(pSurfObj, SURFACE, SurfObj); + DPRINT("EngUnlockSurface(%p)\n", pSurface); /* Release the surface */ - GDI_ReleaseObj(0); + SURFACE_ShareUnlock(pSurface); } BOOL @@ -282,7 +289,7 @@ DPRINT("EngAssociateSurface(%x %x)\n", hSurf, hDev); /* Get a pointer to the surface */ - pSurface = GDI_GetObjPtr(hSurf, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pSurface = SURFACE_Lock(hSurf); /* Associate it */ pSurface->SurfObj.hdev = hDev; @@ -294,7 +301,7 @@ DPRINT1("flHooks: 0x%x\n", flHooks); /* Release the pointer */ - GDI_ReleaseObj(hSurf); + SURFACE_Unlock(pSurface); /* Indicate success */ return TRUE; Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -32,15 +32,15 @@ DPRINT("BitBlt %x -> %x\n", physDevSrc, physDevDst); /* Get a pointer to the DCs */ - pSrc = GDI_GetObjPtr(physDevSrc, (SHORT)GDI_OBJECT_TYPE_DC); - pDst = GDI_GetObjPtr(physDevDst, (SHORT)GDI_OBJECT_TYPE_DC); + pSrc = DC_Lock(physDevSrc); + pDst = DC_Lock(physDevDst); /* Call the internal helper */ bRes = GreBitBlt(pDst, xDst, yDst, width, height, pSrc, xSrc, ySrc, rop); /* Release DC objects */ - GDI_ReleaseObj(physDevDst); - GDI_ReleaseObj(physDevSrc); + DC_Unlock(pDst); + DC_Unlock(pSrc); /* Return status */ return bRes; @@ -81,13 +81,13 @@ if (bmBits) { /* Get the object pointer */ - pSurface = GDI_GetObjPtr(hBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pSurface = SURFACE_Lock(hBitmap); /* Copy bits */ GreSetBitmapBits(pSurface, pSurface->SurfObj.cjBits, bmBits); /* Release the surface */ - GDI_ReleaseObj(hBitmap); + SURFACE_Unlock(pSurface); } /* Map handles */ @@ -143,11 +143,8 @@ return 0; } - psurf = GDI_GetObjPtr(hKernel, (SHORT)GDI_OBJECT_TYPE_BITMAP); - if (!psurf) - { - return 0; - } + psurf = SURFACE_Lock(hKernel); + if (!psurf) return 0; bmSize = BITMAP_GetWidthBytes(psurf->SurfObj.sizlBitmap.cx, BitsPerFormat(psurf->SurfObj.iBitmapFormat)) * @@ -156,7 +153,7 @@ /* If the bits vector is null, the function should return the read size */ if (buffer == NULL) { - GDI_ReleaseObj(psurf); + SURFACE_Unlock(psurf); return bmSize; } @@ -167,7 +164,7 @@ ret = GreGetBitmapBits(psurf, Bytes, buffer); /* Release bitmap pointer */ - GDI_ReleaseObj(psurf); + SURFACE_Unlock(psurf); return ret; } @@ -191,13 +188,13 @@ PDC pDst; /* Get a pointer to the DCs */ - pDst = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDst = DC_Lock(physDev); /* Call the internal helper */ bRet = GrePatBlt(pDst, left, top, width, height, rop, pDst->pLineBrush); /* Release DC objects */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDst); /* Return status */ return bRet; @@ -223,7 +220,7 @@ HGDIOBJ hBitmap = GDI_MapUserHandle(hUserBitmap); /* Get a pointer to the DCs */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); DPRINT("RosGdiSetDIBits for bitmap %x (user handle %x), StartScan %d, ScanLines %d\n", hBitmap, hUserBitmap, StartScan, ScanLines); @@ -238,7 +235,7 @@ ColorUse); /* Release DC objects */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Return amount of lines set */ return ScanLines; @@ -268,11 +265,10 @@ } /* Get a pointer to the DCs */ - pDcDest = GDI_GetObjPtr(physDevDst, (SHORT)GDI_OBJECT_TYPE_DC); + pDcDest = DC_Lock(physDevDst); if (physDevSrc) - pDcSrc = GDI_GetObjPtr(physDevSrc, (SHORT)GDI_OBJECT_TYPE_DC); - + pDcSrc = DC_Lock(physDevSrc); bRet = GreStretchBltMask( pDcDest, @@ -290,8 +286,8 @@ NULL); /* Release DC objects */ - GDI_ReleaseObj(physDevDst); - if (physDevSrc) GDI_ReleaseObj(physDevSrc); + DC_Unlock(pDcDest); + if (pDcSrc) DC_Unlock(pDcSrc); /* Return result */ return bRet; Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -85,12 +85,11 @@ return STATUS_UNSUCCESSFUL; /* Allocate storage for DC structure */ - pNewDC = ExAllocatePool(PagedPool, sizeof(DC)); + pNewDC = (PDC)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_DC); if (!pNewDC) return FALSE; - RtlZeroMemory(pNewDC, sizeof(DC)); - - /* Allocate a handle for it */ - hNewDC = alloc_gdi_handle(&pNewDC->BaseObject, (SHORT)GDI_OBJECT_TYPE_DC); + + /* Save a handle to it */ + hNewDC = pNewDC->BaseObject.hHmgr; /* Set physical device pointer */ pNewDC->pPDevice = (PVOID)&PrimarySurface; @@ -121,7 +120,7 @@ DPRINT("Creating a memory DC %x\n", hNewDC); slSize.cx = 1; slSize.cy = 1; hStockBitmap = GreCreateBitmap(slSize, 1, 1, 0, NULL); - pNewDC->pBitmap = GDI_GetObjPtr(hStockBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pNewDC->pBitmap = SURFACE_ShareLock(hStockBitmap); /* Set DC rectangles */ pNewDC->rcDcRect.left = 0; pNewDC->rcDcRect.top = 0; @@ -131,7 +130,7 @@ else { DPRINT("Creating a display DC %x\n", hNewDC); - pNewDC->pBitmap = GDI_GetObjPtr(PrimarySurface.pSurface, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pNewDC->pBitmap = SURFACE_ShareLock(PrimarySurface.pSurface); /* Set DC rectangles */ pNewDC->rcVport.left = 0; @@ -145,23 +144,27 @@ /* Give handle to the caller */ *pdev = hNewDC; + /* Unlock the DC */ + DC_Unlock(pNewDC); + /* Indicate success */ return TRUE; } BOOL APIENTRY RosGdiDeleteDC( HDC physDev ) { - PDC pDC; + PDC pDC = DC_Lock(physDev); + DPRINT("RosGdiDeleteDC(%x)\n", physDev); - /* Free the handle */ - pDC = free_gdi_handle((HGDIOBJ)physDev); - /* Release the surface */ - GDI_ReleaseObj(pDC->pBitmap); - - /* Free its storage */ - ExFreePool(pDC); + SURFACE_ShareUnlock(pDC->pBitmap); + + /* Unlock DC */ + DC_Unlock(pDC); + + /* Free DC */ + GDIOBJ_FreeObjByHandle(physDev, GDI_OBJECT_TYPE_DC); /* Indicate success */ return TRUE; @@ -199,8 +202,8 @@ DPRINT("Selecting %x bitmap to hdc %x\n", hBmpKern, physDev); /* Get a pointer to the DC and the bitmap*/ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); - pSurface = GDI_GetObjPtr(hBmpKern, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pDC = DC_Lock(physDev); + pSurface = SURFACE_ShareLock(hBmpKern); /* Select it */ pDC->pBitmap = pSurface; @@ -213,7 +216,7 @@ pDC->rcDcRect = pDC->rcVport; /* Release the DC object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); } VOID APIENTRY RosGdiSelectBrush( HDC physDev, LOGBRUSH *pLogBrush ) @@ -223,7 +226,7 @@ PSURFACE pSurface; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); DPRINT("RosGdiSelectBrush(): dc %x, brush style %x, brush color %x\n", physDev, pLogBrush->lbStyle, pLogBrush->lbColor); @@ -261,7 +264,7 @@ DPRINT1("Trying to select an unknown bitmap %x to the DC %x!\n", pLogBrush->lbHatch, physDev); break; } - pSurface = GDI_GetObjPtr(hBmpKern, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pSurface = SURFACE_Lock(hBmpKern); pDC->pFillBrush = GreCreatePatternBrush(pSurface); break; @@ -271,7 +274,7 @@ } /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); } HFONT APIENTRY RosGdiSelectFont( HDC physDev, HFONT hfont, HANDLE gdiFont ) @@ -285,7 +288,7 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); DPRINT("RosGdiSelectPen(): dc %x, pen style %x, pen color %x\n", physDev, pLogPen->lopnStyle, pLogPen->lopnColor); @@ -293,7 +296,7 @@ { DPRINT1("Ext pens aren't supported yet!"); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); return; } @@ -314,7 +317,7 @@ TRUE); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); } COLORREF APIENTRY RosGdiSetBkColor( HDC physDev, COLORREF color ) @@ -322,13 +325,13 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Set the color */ pDC->crBackgroundClr = color; /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Return the color set */ return color; @@ -357,7 +360,7 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Delete old clipping region */ if (pDC->CombinedClip) @@ -370,7 +373,7 @@ physDev, rcBounds->left, rcBounds->bottom, rcBounds->right, rcBounds->top); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); } BOOL APIENTRY RosGdiSetDeviceGammaRamp(HDC physDev, LPVOID ramp) @@ -398,13 +401,13 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Set the color */ pDC->crForegroundClr = color; /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Return the color set */ return color; @@ -415,7 +418,7 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Set DC rectangle */ if (rcDcRect) @@ -438,7 +441,7 @@ } /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); } /* EOF */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/enum.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/enum.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/enum.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -50,13 +50,13 @@ INT iCaps; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Get device caps from the DC */ iCaps = GreGetDeviceCaps(pDC, cap); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Return result */ return iCaps; Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -55,13 +55,13 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Call GRE routine */ GreTextOut(pDC, x, y, flags, lprect, wstr, count, lpDx, formatEntry); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); return TRUE; } @@ -76,7 +76,7 @@ DPRINT("LineTo: (%d,%d)-(%d,%d)\n", x1, y1, x2, y2); /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); scrRect.left = scrRect.top = 0; scrRect.right = 800; @@ -105,7 +105,7 @@ IntEngDeleteClipRegion(pClipObj); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); return TRUE; } @@ -138,7 +138,7 @@ ULONG i; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Capture the points buffer */ _SEH2_TRY @@ -161,7 +161,7 @@ if (!NT_SUCCESS(Status)) { /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Free the buffer if it was allocated */ if (pPoints != pStackBuf) ExFreePool(pPoints); @@ -181,7 +181,7 @@ GrePolygon(pDC, pPoints, count); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); /* Free the buffer if it was allocated */ if (pPoints != pStackBuf) ExFreePool(pPoints); @@ -195,13 +195,13 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Draw the polyline */ GrePolyline(pDC, pt, count); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); return TRUE; } @@ -223,13 +223,13 @@ PDC pDC; /* Get a pointer to the DC */ - pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); + pDC = DC_Lock(physDev); /* Draw the rectangle */ GreRectangle(pDC, rc->left, rc->top, rc->right, rc->bottom); /* Release the object */ - GDI_ReleaseObj(physDev); + DC_Unlock(pDC); return TRUE; } Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -427,7 +427,7 @@ INT DIBWidth; // Check parameters - if (!(bitmap = GDI_GetObjPtr(hBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP))) + if (!(bitmap = SURFACE_Lock(hBitmap))) { return 0; } @@ -454,7 +454,7 @@ (PVOID) Bits); if (0 == SourceBitmap) { - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); return 0; } @@ -463,7 +463,7 @@ if (NULL == SourceSurf) { EngDeleteSurface((HSURF)SourceBitmap); - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); return 0; } @@ -484,7 +484,7 @@ { EngUnlockSurface(SourceSurf); EngDeleteSurface((HSURF)SourceBitmap); - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); SetLastWin32Error(ERROR_INVALID_HANDLE); return 0; } @@ -497,7 +497,7 @@ { EngUnlockSurface(SourceSurf); EngDeleteSurface((HSURF)SourceBitmap); - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); return 0; } @@ -509,7 +509,7 @@ PALETTE_FreePaletteByHandle(DIB_Palette); EngUnlockSurface(SourceSurf); EngDeleteSurface((HSURF)SourceBitmap); - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); return 0; } @@ -538,7 +538,7 @@ EngUnlockSurface(SourceSurf); EngDeleteSurface((HSURF)SourceBitmap); - GDI_ReleaseObj(bitmap); + SURFACE_Unlock(bitmap); return result; } Copied: branches/arwinss/reactos/subsystems/win32/win32k/gre/gdidbg.c (from r42309, trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c) URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/gdidbg.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -212,11 +212,11 @@ r = 0; DPRINT1("Used entry invalid KernelData\n"); } - if (((POBJ)(pEntry->KernelData))->hHmgr != Handle) + if (((PBASEOBJECT)(pEntry->KernelData))->hHmgr != Handle) { r = 0; DPRINT1("Used entry %ld, has invalid hHmg %p (expected: %p)\n", - i, ((POBJ)(pEntry->KernelData))->hHmgr, Handle); + i, ((PBASEOBJECT)(pEntry->KernelData))->hHmgr, Handle); } nUsed++; } @@ -269,7 +269,7 @@ ULONG FASTCALL -GDIOBJ_IncrementShareCount(POBJ Object) +GDIOBJ_IncrementShareCount(PBASEOBJECT Object) { INT cLocks = InterlockedIncrement((PLONG)&Object->ulShareCount); GDIDBG_CAPTURESHARELOCKER(Object->hHmgr); Copied: branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c (from r42309, trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c) URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/gdiobj.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS win32 kernel mode subsystem * LICENSE: GPL - See COPYING in the top level directory - * FILE: subsystems/win32/win32k/objects/gdiobj.c + * FILE: subsystems/win32/win32k/gre/gdiobj.c * PURPOSE: General GDI object manipulation routines * PROGRAMMERS: ... */ @@ -10,7 +10,7 @@ //#define GDI_DEBUG -#include <w32k.h> +#include <win32k.h> #define NDEBUG #include <debug.h> @@ -31,7 +31,7 @@ #include "gdidbg.c" /* static */ /* FIXME: -fno-unit-at-a-time breaks this */ -BOOL INTERNAL_CALL GDI_CleanupDummy(PVOID ObjectBody); +BOOL APIENTRY GDI_CleanupDummy(PVOID ObjectBody); /** GLOBALS *******************************************************************/ @@ -41,42 +41,42 @@ ULONG_PTR ulBodySize; ULONG Tag; GDICLEANUPPROC CleanupProc; -} OBJ_TYPE_INFO, *POBJ_TYPE_INFO; +} OBJ_TYPE_INFO, *PBASEOBJECT_TYPE_INFO; static const OBJ_TYPE_INFO ObjTypeInfo[BASE_OBJTYPE_COUNT] = { {0, 0, 0, NULL}, /* 00 reserved entry */ - {1, sizeof(DC), TAG_DC, DC_Cleanup}, /* 01 DC */ - {1, 0, 0, NULL}, /* 02 UNUSED1 */ - {1, 0, 0, NULL}, /* 03 UNUSED2 */ - {1, sizeof(ROSRGNDATA), TAG_REGION, REGION_Cleanup}, /* 04 RGN */ - {1, sizeof(SURFACE), TAG_SURFACE, SURFACE_Cleanup}, /* 05 SURFACE */ - {1, sizeof(CLIENTOBJ), TAG_CLIENTOBJ, GDI_CleanupDummy}, /* 06 CLIENTOBJ: METADC,... */ - {1, sizeof(PATH), TAG_PATH, GDI_CleanupDummy}, /* 07 PATH */ - {1, sizeof(PALETTE), TAG_PALETTE, PALETTE_Cleanup}, /* 08 PAL */ - {1, sizeof(COLORSPACE), TAG_ICMLCS, GDI_CleanupDummy}, /* 09 ICMLCS, */ - {1, sizeof(TEXTOBJ), TAG_LFONT, GDI_CleanupDummy}, /* 0a LFONT */ - {0, 0, TAG_RFONT, NULL}, /* 0b RFONT, unused */ - {0, 0, TAG_PFE, NULL}, /* 0c PFE, unused */ - {0, 0, TAG_PFT, NULL}, /* 0d PFT, unused */ - {0, sizeof(GDICLRXFORM), TAG_ICMCXF, GDI_CleanupDummy}, /* 0e ICMCXF, */ - {0, 0, TAG_SPRITE, NULL}, /* 0f SPRITE, unused */ - {1, sizeof(BRUSH), TAG_BRUSH, BRUSH_Cleanup}, /* 10 BRUSH, PEN, EXTPEN */ - {0, 0, TAG_UMPD, NULL}, /* 11 UMPD, unused */ + {0, sizeof(DC), TAG_DC, GDI_CleanupDummy}, /* 01 DC */ + {0, 0, 0, NULL}, /* 02 reserved entry */ + {0, 0, 0, NULL}, /* 03 reserved entry */ + {0, 0, 0, NULL}, /* 04 reserved entry */ + {0, sizeof(SURFACE), TAG_SURFOBJ, GDI_CleanupDummy}, /* 05 SURFACE */ + {0, 0, 0, NULL}, /* 06 reserved entry */ + {0, 0, 0, NULL}, /* 07 reserved entry */ + {0, sizeof(PALETTE), TAG_PALETTE, GDI_CleanupDummy}, /* 08 PAL */ + {0, 0, 0, NULL}, /* 09 ICMLCS, */ + {0, 0, 0, NULL}, /* 0a LFONT */ + {0, 0, 0, NULL}, /* 0b RFONT, unused */ + {0, 0, 0, NULL}, /* 0c PFE, unused */ + {0, 0, 0, NULL}, /* 0d PFT, unused */ + {0, 0, 0, NULL}, /* 0e ICMCXF, */ + {0, 0, 0, NULL}, /* 0f SPRITE, unused */ + {0, 0, 0, NULL}, /* 10 BRUSH, PEN, EXTPEN */ + {0, 0, 0, NULL}, /* 11 UMPD, unused */ {0, 0, 0, NULL}, /* 12 UNUSED4 */ - {0, 0, TAG_SPACE, NULL}, /* 13 SPACE, unused */ + {0, 0, 0, NULL}, /* 13 SPACE, unused */ {0, 0, 0, NULL}, /* 14 UNUSED5 */ - {0, 0, TAG_META, NULL}, /* 15 META, unused */ - {0, 0, TAG_EFSTATE, NULL}, /* 16 EFSTATE, unused */ - {0, 0, TAG_BMFD, NULL}, /* 17 BMFD, unused */ - {0, 0, TAG_VTFD, NULL}, /* 18 VTFD, unused */ - {0, 0, TAG_TTFD, NULL}, /* 19 TTFD, unused */ - {0, 0, TAG_RC, NULL}, /* 1a RC, unused */ - {0, 0, TAG_TEMP, NULL}, /* 1b TEMP, unused */ - {0, sizeof(EDRIVEROBJ), TAG_DRVOBJ, DRIVEROBJ_Cleanup},/* 1c DRVOBJ */ - {0, 0, TAG_DCIOBJ, NULL}, /* 1d DCIOBJ, unused */ - {0, 0, TAG_SPOOL, NULL}, /* 1e SPOOL, unused */ + {0, 0, 0, NULL}, /* 15 META, unused */ + {0, 0, 0, NULL}, /* 16 EFSTATE, unused */ + {0, 0, 0, NULL}, /* 17 BMFD, unused */ + {0, 0, 0, NULL}, /* 18 VTFD, unused */ + {0, 0, 0, NULL}, /* 19 TTFD, unused */ + {0, 0, 0, NULL}, /* 1a RC, unused */ + {0, 0, 0, NULL}, /* 1b TEMP, unused */ + {0, 0, 0, NULL}, /* 1c DRVOBJ */ + {0, 0, 0, NULL}, /* 1d DCIOBJ, unused */ + {0, 0, 0, NULL}, /* 1e SPOOL, unused */ {0, 0, 0, NULL}, /* 1f reserved entry */ }; @@ -88,7 +88,7 @@ * Dummy GDI Cleanup Callback */ /* static */ /* FIXME: -fno-unit-at-a-time breaks this */ -BOOL INTERNAL_CALL +BOOL APIENTRY GDI_CleanupDummy(PVOID ObjectBody) { return TRUE; @@ -98,7 +98,7 @@ * Allocate GDI object table. * \param Size - number of entries in the object table. */ -PGDI_HANDLE_TABLE INTERNAL_CALL +PGDI_HANDLE_TABLE APIENTRY GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject) { PGDI_HANDLE_TABLE HandleTable = NULL; @@ -288,7 +288,7 @@ BOOL -INTERNAL_CALL +APIENTRY GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType) { PGDI_TABLE_ENTRY Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hObj); @@ -304,10 +304,10 @@ return FALSE; } -POBJ INTERNAL_CALL +PBASEOBJECT APIENTRY GDIOBJ_AllocObj(UCHAR BaseType) { - POBJ pObject; + PBASEOBJECT PBASEOBJECTect; ASSERT((BaseType & ~GDIObjTypeTotal) == 0); // BaseType &= GDI_HANDLE_BASETYPE_MASK; @@ -317,21 +317,21 @@ PPAGED_LOOKASIDE_LIST LookasideList; LookasideList = GdiHandleTable->LookasideLists + BaseType; - pObject = ExAllocateFromPagedLookasideList(LookasideList); + PBASEOBJECTect = ExAllocateFromPagedLookasideList(LookasideList); } else { - pObject = ExAllocatePoolWithTag(PagedPool, + PBASEOBJECTect = ExAllocatePoolWithTag(PagedPool, ObjTypeInfo[BaseType].ulBodySize, ObjTypeInfo[BaseType].Tag); } - if (pObject) - { - RtlZeroMemory(pObject, ObjTypeInfo[BaseType].ulBodySize); - } - - return pObject; + if (PBASEOBJECTect) + { + RtlZeroMemory(PBASEOBJECTect, ObjTypeInfo[BaseType].ulBodySize); + } + + return PBASEOBJECTect; } @@ -342,11 +342,11 @@ * * \return Pointer to the allocated object, which is locked. */ -POBJ INTERNAL_CALL +PBASEOBJECT APIENTRY GDIOBJ_AllocObjWithHandle(ULONG ObjectType) { PPROCESSINFO W32Process; - POBJ newObject = NULL; + PBASEOBJECT newObject = NULL; HANDLE CurrentProcessId, LockedProcessId; UCHAR TypeIndex; @@ -453,22 +453,22 @@ } -VOID INTERNAL_CALL -GDIOBJ_FreeObj(POBJ pObject, UCHAR BaseType) +VOID APIENTRY +GDIOBJ_FreeObj(PBASEOBJECT PBASEOBJECTect, UCHAR BaseType) { /* Object must not have a handle! */ - ASSERT(pObject->hHmgr == NULL); + ASSERT(PBASEOBJECTect->hHmgr == NULL); if (ObjTypeInfo[BaseType].bUseLookaside) { PPAGED_LOOKASIDE_LIST LookasideList; LookasideList = GdiHandleTable->LookasideLists + BaseType; - ExFreeToPagedLookasideList(LookasideList, pObject); + ExFreeToPagedLookasideList(LookasideList, PBASEOBJECTect); } else { - ExFreePool(pObject); + ExFreePool(PBASEOBJECTect); } } @@ -484,7 +484,7 @@ * * \bug This function should return VOID and kill the object no matter what... */ -BOOL INTERNAL_CALL +BOOL APIENTRY GDIOBJ_FreeObjByHandle(HGDIOBJ hObj, DWORD ExpectedType) { PGDI_TABLE_ENTRY Entry; @@ -493,8 +493,6 @@ BOOL Silent; GDIDBG_INITLOOPTRACE(); - - DPRINT("GDIOBJ_FreeObj: hObj: 0x%08x\n", hObj); if (GDI_HANDLE_IS_STOCKOBJ(hObj)) { @@ -535,7 +533,7 @@ ((Entry->Type << GDI_ENTRY_UPPER_SHIFT) == HandleUpper) && ((Entry->Type & GDI_ENTRY_BASETYPE_MASK) == (HandleUpper & GDI_ENTRY_BASETYPE_MASK)) ) { - POBJ Object; + PBASEOBJECT Object; Object = Entry->KernelData; @@ -587,7 +585,6 @@ /* * The object is currently locked by another thread, so freeing is forbidden! */ - DPRINT1("Object->cExclusiveLock = %d\n", Object->cExclusiveLock); GDIDBG_TRACECALLER(); GDIDBG_TRACELOCKER(GDI_HANDLE_GET_INDEX(hObj)); (void)InterlockedExchangePointer((PVOID*)&Entry->ProcessId, PrevProcId); @@ -654,29 +651,6 @@ } } - -/*! - * Delete GDI object - * \param hObject object handle - * \return if the function fails the returned value is FALSE. -*/ -BOOL -FASTCALL -GreDeleteObject(HGDIOBJ hObject) -{ - DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject); - if (!IsObjectDead(hObject)) - { - return NULL != hObject - ? GDIOBJ_FreeObjByHandle(hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; - } - else - { - DPRINT1("Attempt DeleteObject 0x%x currently being destroyed!!!\n",hObject); - return TRUE; // return true and move on. - } -} - VOID FASTCALL IntDeleteHandlesForProcess(struct _EPROCESS *Process, ULONG ObjectType) @@ -736,7 +710,7 @@ * Internal function. Called when the process is destroyed to free the remaining GDI handles. * \param Process - PID of the process that will be destroyed. */ -BOOL INTERNAL_CALL +BOOL APIENTRY GDI_CleanupForProcess(struct _EPROCESS *Process) { PEPROCESS CurrentProcess; @@ -787,13 +761,13 @@ * * \todo Get rid of the ExpectedType parameter! */ -PGDIOBJ INTERNAL_CALL +PVOID APIENTRY GDIOBJ_LockObj(HGDIOBJ hObj, DWORD ExpectedType) { ULONG HandleIndex; PGDI_TABLE_ENTRY Entry; HANDLE ProcessId, HandleProcessId, LockedProcessId, PrevProcId; - POBJ Object = NULL; + PBASEOBJECT Object = NULL; ULONG HandleType, HandleUpper; HandleIndex = GDI_HANDLE_GET_INDEX(hObj); @@ -877,7 +851,6 @@ { /* Unlock the handle table entry. */ (void)InterlockedExchangePointer((PVOID*)&Entry->ProcessId, PrevProcId); - DelayExecution(); continue; } @@ -914,6 +887,20 @@ return Object; } +/*! + * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked. + * You should unlock the object + * as soon as you don't need to have access to it's data. + + * \param Object Object pointer (as returned by GDIOBJ_LockObj). + */ +ULONG FASTCALL +GDIOBJ_UnlockObjByPtr(PBASEOBJECT Object) +{ + INT cLocks = InterlockedDecrement((PLONG)&Object->cExclusiveLock); + ASSERT(cLocks >= 0); + return cLocks; +} /*! * Return pointer to the object by handle (and allow sharing of the handle @@ -926,13 +913,13 @@ * * \todo Get rid of the ExpectedType parameter! */ -PGDIOBJ INTERNAL_CALL +PVOID APIENTRY GDIOBJ_ShareLockObj(HGDIOBJ hObj, DWORD ExpectedType) { ULONG HandleIndex; PGDI_TABLE_ENTRY Entry; HANDLE ProcessId, HandleProcessId, LockedProcessId, PrevProcId; - POBJ Object = NULL; + PBASEOBJECT Object = NULL; ULONG_PTR HandleType, HandleUpper; HandleIndex = GDI_HANDLE_GET_INDEX(hObj); @@ -995,7 +982,7 @@ if ( (Entry->KernelData != NULL) && (HandleUpper == (Entry->Type << GDI_ENTRY_UPPER_SHIFT)) ) { - Object = (POBJ)Entry->KernelData; + Object = (PBASEOBJECT)Entry->KernelData; GDIDBG_CAPTURESHARELOCKER(HandleIndex); #ifdef GDI_DEBUG3 @@ -1038,7 +1025,7 @@ return Object; } -BOOL INTERNAL_CALL +BOOL APIENTRY GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle) { PGDI_TABLE_ENTRY Entry; @@ -1062,140 +1049,7 @@ return FALSE; } -BOOL INTERNAL_CALL -GDIOBJ_ConvertToStockObj(HGDIOBJ *phObj) -{ - /* - * FIXME !!!!! THIS FUNCTION NEEDS TO BE FIXED - IT IS NOT SAFE WHEN OTHER THREADS - * MIGHT ATTEMPT TO LOCK THE OBJECT DURING THIS CALL!!! - */ - PGDI_TABLE_ENTRY Entry; - HANDLE ProcessId, LockedProcessId, PrevProcId; - PTHREADINFO Thread; - HGDIOBJ hObj; - - GDIDBG_INITLOOPTRACE(); - - ASSERT(phObj); - hObj = *phObj; - - DPRINT("GDIOBJ_ConvertToStockObj: hObj: 0x%08x\n", hObj); - - Thread = (PTHREADINFO)PsGetCurrentThreadWin32Thread(); - - if (!GDI_HANDLE_IS_STOCKOBJ(hObj)) - { - ProcessId = PsGetCurrentProcessId(); - LockedProcessId = (HANDLE)((ULONG_PTR)ProcessId | 0x1); - - Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hObj); - -LockHandle: - /* lock the object, we must not convert stock objects, so don't check!!! */ - PrevProcId = InterlockedCompareExchangePointer((PVOID*)&Entry->ProcessId, LockedProcessId, ProcessId); - if (PrevProcId == ProcessId) - { - LONG NewType, PrevType, OldType; - - /* we're locking an object that belongs to our process. First calculate - the new object type including the stock object flag and then try to - exchange it.*/ - /* On Windows the higher 16 bit of the type field don't contain the - full type from the handle, but the base type. - (type = BRSUH, PEN, EXTPEN, basetype = BRUSH) */ - OldType = ((ULONG)hObj & GDI_HANDLE_BASETYPE_MASK) | ((ULONG)hObj >> GDI_ENTRY_UPPER_SHIFT); - /* We are currently not using bits 24..31 (flags) of the type field, but for compatibility - we copy them as we can't get them from the handle */ - OldType |= Entry->Type & GDI_ENTRY_FLAGS_MASK; - - /* As the object should be a stock object, set it's flag, but only in the lower 16 bits */ - NewType = OldType | GDI_ENTRY_STOCK_MASK; - - /* Try to exchange the type field - but only if the old (previous type) matches! */ - PrevType = InterlockedCompareExchange(&Entry->Type, NewType, OldType); - if (PrevType == OldType && Entry->KernelData != NULL) - { - PTHREADINFO PrevThread; - POBJ Object; - - /* We successfully set the stock object flag. - KernelData should never be NULL here!!! */ - ASSERT(Entry->KernelData); - - Object = Entry->KernelData; - - PrevThread = Object->Tid; - if (Object->cExclusiveLock == 0 || PrevThread == Thread) - { - /* dereference the process' object counter */ - if (PrevProcId != GDI_GLOBAL_PROCESS) - { - PEPROCESS OldProcess; - PPROCESSINFO W32Process; - NTSTATUS Status; - - /* FIXME */ - Status = PsLookupProcessByProcessId((HANDLE)((ULONG_PTR)PrevProcId & ~0x1), &OldProcess); - if (NT_SUCCESS(Status)) - { - W32Process = (PPROCESSINFO)OldProcess->Win32Process; - if (W32Process != NULL) - { - InterlockedDecrement(&W32Process->GDIHandleCount); - } - ObDereferenceObject(OldProcess); - } - } - - hObj = (HGDIOBJ)((ULONG)(hObj) | GDI_HANDLE_STOCK_MASK); - *phObj = hObj; - Object->hHmgr = hObj; - - /* remove the process id lock and make it global */ - (void)InterlockedExchangePointer((PVOID*)&Entry->ProcessId, GDI_GLOBAL_PROCESS); - - /* we're done, successfully converted the object */ - return TRUE; - } - else - { - GDIDBG_TRACELOOP(hObj, PrevThread, Thread); - - /* WTF?! The object is already locked by a different thread! - Release the lock, wait a bit and try again! - FIXME - we should give up after some time unless we want to wait forever! */ - (void)InterlockedExchangePointer((PVOID*)&Entry->ProcessId, PrevProcId); - - DelayExecution(); - goto LockHandle; - } - } - else - { - DPRINT1("Attempted to convert object 0x%x that is deleted! Should never get here!!!\n", hObj); - DPRINT1("OldType = 0x%x, Entry->Type = 0x%x, NewType = 0x%x, Entry->KernelData = 0x%x\n", OldType, Entry->Type, NewType, Entry->KernelData); - } - } - else if (PrevProcId == LockedProcessId) - { - GDIDBG_TRACELOOP(hObj, PrevProcId, ProcessId); - - /* the object is currently locked, wait some time and try again. - FIXME - we shouldn't loop forever! Give up after some time! */ - DelayExecution(); - /* try again */ - goto LockHandle; - } - else - { - DPRINT1("Attempted to convert invalid handle: 0x%x\n", hObj); - } - } - - return FALSE; -} - -BOOL INTERNAL_CALL +BOOL APIENTRY GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS NewOwner) { PGDI_TABLE_ENTRY Entry; @@ -1225,7 +1079,7 @@ if ((Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0) { - POBJ Object = Entry->KernelData; + PBASEOBJECT Object = Entry->KernelData; PrevThread = Object->Tid; if (Object->cExclusiveLock == 0 || PrevThread == Thread) @@ -1324,7 +1178,7 @@ return Ret; } -BOOL INTERNAL_CALL +BOOL APIENTRY GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo) { PGDI_TABLE_ENTRY FromEntry; @@ -1351,7 +1205,7 @@ if (FromPrevProcId == FromProcessId) { PTHREADINFO PrevThread; - POBJ Object; + PBASEOBJECT Object; if ((FromEntry->Type & GDI_ENTRY_BASETYPE_MASK) != 0) { @@ -1431,7 +1285,7 @@ return Ret; } -PVOID INTERNAL_CALL +PVOID APIENTRY GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process) { PVOID MappedView = NULL; @@ -1461,328 +1315,114 @@ return MappedView; } -/** PUBLIC FUNCTIONS **********************************************************/ - -/* - Since Brush/Pen and Region objects are sharable,,, we can just use - UserHeapAlloc to allocate the small attribute objects. - - Example Allocating: - - // Save Kernel Space Pointer - (PBRUSH)->pBrushAttr = IntGdiAllocObjAttr(GDIObjType_BRUSH_TYPE); - - // Kernel Space to User Space Pointer - (PGDI_TABLE_ENTRY)->UserData = pBrushAttr; - // Gdi will adjust for heap delta. - - Example Freeing: - - (PGDI_TABLE_ENTRY)->UserData = NULL; // Zero the user ptr. - UserHeapFree((PBRUSH)->pBrushAttr); // Free from kernel ptr. - (PBRUSH)->pBrushAttr = NULL; - - Notes: - Testing with DC_ATTR works but has drawing difficulties. - Base on observation, (Over looking the obvious) we need to supply heap delta - to user space gdi. Now, with testing, looks all normal. - - */ -PVOID -FASTCALL -IntGdiAllocObjAttr(GDIOBJTYPE Type) -{ - PVOID pMemAttr = NULL; - - switch( Type ) - { - case GDIObjType_DC_TYPE: - pMemAttr = UserHeapAlloc(sizeof(DC_ATTR)); - if (pMemAttr) RtlZeroMemory(pMemAttr, sizeof(DC_ATTR)); - break; - case GDIObjType_RGN_TYPE: - pMemAttr = UserHeapAlloc(sizeof(RGN_ATTR)); - if (pMemAttr) RtlZeroMemory(pMemAttr, sizeof(RGN_ATTR)); - break; - case GDIObjType_BRUSH_TYPE: - pMemAttr = UserHeapAlloc(sizeof(BRUSH_ATTR)); - if (pMemAttr) RtlZeroMemory(pMemAttr, sizeof(BRUSH_ATTR)); - break; - default: - break; - } - return pMemAttr; -} - - -BOOL -FASTCALL -IntGdiSetBrushOwner(PBRUSH pbr, DWORD OwnerMask) -{ - HBRUSH hBR; - PEPROCESS Owner = NULL; - PGDI_TABLE_ENTRY pEntry = NULL; - - if (!pbr) return FALSE; - - hBR = pbr->BaseObject.hHmgr; - - if (!hBR || (GDI_HANDLE_GET_TYPE(hBR) != GDI_OBJECT_TYPE_BRUSH)) - return FALSE; - else - { - INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hBR); - pEntry = &GdiHandleTable->Entries[Index]; - } - - if (pbr->flAttrs & GDIBRUSH_IS_GLOBAL) - { - GDIOBJ_ShareUnlockObjByPtr((POBJ)pbr); - return TRUE; - } - - if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE) - { - // Set this Brush to inaccessible mode and to an Owner of NONE. -// if (OwnerMask == GDI_OBJ_HMGR_NONE) Owner = OwnerMask; - - if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, Owner)) - return FALSE; - - // Deny user access to User Data. - pEntry->UserData = NULL; // This hBR is inaccessible! - } - - if (OwnerMask == GDI_OBJ_HMGR_POWNED) - { - if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, PsGetCurrentProcess() )) - return FALSE; - - // Allow user access to User Data. - pEntry->UserData = pbr->pBrushAttr; - } - return TRUE; -} - - -BOOL -FASTCALL -IntGdiSetDCOwnerEx( HDC hDC, DWORD OwnerMask, BOOL NoSetBrush) -{ - PDC pDC; - BOOL Ret = FALSE; - - if (!hDC || (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)) return FALSE; - - if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE) - { - pDC = DC_LockDc ( hDC ); - MmCopyFromCaller(&pDC->dcattr, pDC->pdcattr, sizeof(DC_ATTR)); - DC_UnlockDc( pDC ); - - DC_FreeDcAttr( hDC ); // Free the dcattr! - - if (!DC_SetOwnership( hDC, NULL )) // This hDC is inaccessible! - return Ret; - } - - if (OwnerMask == GDI_OBJ_HMGR_POWNED) - { - pDC = DC_LockDc ( hDC ); - ASSERT(pDC->pdcattr == &pDC->dcattr); - DC_UnlockDc( pDC ); - - if (!DC_SetOwnership( hDC, PsGetCurrentProcess() )) return Ret; - - DC_AllocateDcAttr( hDC ); // Allocate new dcattr - - DCU_SynchDcAttrtoUser( hDC ); // Copy data from dc to dcattr - } - - if ((OwnerMask != GDI_OBJ_HMGR_NONE) && !NoSetBrush) - { - pDC = DC_LockDc ( hDC ); - if (IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrFill, OwnerMask)) - IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrLine, OwnerMask); - DC_UnlockDc( pDC ); - } - return TRUE; -} - -INT -FASTCALL -GreGetObjectOwner(HGDIOBJ Handle, GDIOBJTYPE ObjType) -{ - INT Ret = GDI_OBJ_HMGR_RESTRICTED; - - if ( GDI_HANDLE_GET_INDEX(Handle) < GDI_HANDLE_COUNT ) - { - PGDI_TABLE_ENTRY pEntry = &GdiHandleTable->Entries[GDI_HANDLE_GET_INDEX(Handle)]; - - if (pEntry->ObjectType == ObjType) - { - if (pEntry->FullUnique == (GDI_HANDLE_GET_UPPER(Handle) >> GDI_ENTRY_UPPER_SHIFT)) - Ret = pEntry->ProcessId & ~1; - } - } - return Ret; -} - - -W32KAPI -HANDLE -APIENTRY -NtGdiCreateClientObj( - IN ULONG ulType -) -{ - POBJ pObject; - HANDLE handle; - - /* Mask out everything that would change the type in a wrong manner */ - ulType &= (GDI_HANDLE_TYPE_MASK & ~GDI_HANDLE_BASETYPE_MASK); - - /* Allocate a new object */ - pObject = GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_CLIOBJ | ulType); - if (!pObject) - { - return NULL; - } - - /* get the handle */ - handle = pObject->hHmgr; - - /* Unlock it */ - GDIOBJ_UnlockObjByPtr(pObject); - - return handle; -} - -W32KAPI -BOOL -APIENTRY -NtGdiDeleteClientObj( - IN HANDLE h -) -{ - /* We first need to get the real type from the handle */ - ULONG type = GDI_HANDLE_GET_TYPE(h); - - /* Check if it's really a CLIENTOBJ */ - if ((type & GDI_HANDLE_BASETYPE_MASK) != GDILoObjType_LO_CLIENTOBJ_TYPE) - { - /* FIXME: SetLastError? */ - return FALSE; - } - return GDIOBJ_FreeObjByHandle(h, type); -} - -INT -FASTCALL -IntGdiGetObject(IN HANDLE Handle, - IN INT cbCount, - IN LPVOID lpBuffer) -{ - PVOID pGdiObject; - INT Result = 0; - DWORD dwObjectType; - - pGdiObject = GDIOBJ_LockObj(Handle, GDI_OBJECT_TYPE_DONTCARE); - if (!pGdiObject) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - dwObjectType = GDIOBJ_GetObjectType(Handle); - switch (dwObjectType) - { - case GDI_OBJECT_TYPE_PEN: - case GDI_OBJECT_TYPE_EXTPEN: - Result = PEN_GetObject((PBRUSH) pGdiObject, cbCount, (PLOGPEN) lpBuffer); // IntGdiCreatePenIndirect - break; - - case GDI_OBJECT_TYPE_BRUSH: - Result = BRUSH_GetObject((PBRUSH ) pGdiObject, cbCount, (LPLOGBRUSH)lpBuffer); - break; - - case GDI_OBJECT_TYPE_BITMAP: - Result = BITMAP_GetObject((SURFACE *) pGdiObject, cbCount, lpBuffer); - break; - case GDI_OBJECT_TYPE_FONT: - Result = FontGetObject((PTEXTOBJ) pGdiObject, cbCount, lpBuffer); -#if 0 - // Fix the LOGFONT structure for the stock fonts - if (FIRST_STOCK_HANDLE <= Handle && Handle <= LAST_STOCK_HANDLE) - { - FixStockFontSizeW(Handle, cbCount, lpBuffer); - } -#endif - break; - - case GDI_OBJECT_TYPE_PALETTE: - Result = PALETTE_GetObject((PPALETTE) pGdiObject, cbCount, lpBuffer); - break; - - default: - DPRINT1("GDI object type 0x%08x not implemented\n", dwObjectType); - break; - } - - GDIOBJ_UnlockObjByPtr(pGdiObject); - - return Result; -} - - - -W32KAPI -INT -APIENTRY -NtGdiExtGetObjectW(IN HANDLE hGdiObj, - IN INT cbCount, - OUT LPVOID lpBuffer) -{ - INT iRetCount = 0; - INT cbCopyCount; - union - { - BITMAP bitmap; - DIBSECTION dibsection; - LOGPEN logpen; - LOGBRUSH logbrush; - LOGFONTW logfontw; - EXTLOGFONTW extlogfontw; - ENUMLOGFONTEXDVW enumlogfontexdvw; - } Object; - - // Normalize to the largest supported object size - cbCount = min((UINT)cbCount, sizeof(Object)); - - // Now do the actual call - iRetCount = IntGdiGetObject(hGdiObj, cbCount, lpBuffer ? &Object : NULL); - cbCopyCount = min((UINT)cbCount, (UINT)iRetCount); - - // Make sure we have a buffer and a copy size - if ((cbCopyCount) && (lpBuffer)) - { - // Enter SEH for buffer transfer - _SEH2_TRY - { - // Probe the buffer and copy it - ProbeForWrite(lpBuffer, cbCopyCount, sizeof(WORD)); - RtlCopyMemory(lpBuffer, &Object, cbCopyCount); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - // Clear the return value. - // Do *NOT* set last error here! - iRetCount = 0; - } - _SEH2_END; - } - // Return the count - return iRetCount; +/* Usermode -> kernelmode handle mapping */ +LIST_ENTRY HandleMapping; +KSPIN_LOCK HandleMappingLock; + +typedef struct _HMAPPING +{ + HGDIOBJ hUser; + HGDIOBJ hKernel; + HANDLE hProcessId; + LIST_ENTRY Entry; +} HMAPPING, *PHMAPPING; + +VOID NTAPI +GDI_InitHandleMapping() +{ + /* Initialize handles list and a spinlock */ + InitializeListHead(&HandleMapping); + KeInitializeSpinLock(&HandleMappingLock); +} + +VOID NTAPI +GDI_AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser) +{ + HGDIOBJ hExisting; + PHMAPPING pMapping = ExAllocatePool(NonPagedPool, sizeof(HMAPPING)); + if (!pMapping) return; + + /* Set mapping */ + pMapping->hUser = hUser; + pMapping->hKernel = hKernel; + pMapping->hProcessId = PsGetCurrentProcessId(); + + /* Debug check: see if we already have this mapping */ + hExisting = GDI_MapUserHandle(hUser); + if (hExisting) + DPRINT1("Trying to map already existing mapping %x -> %x to %x!\n", hUser, hExisting, hKernel); + + /* Add it to the list */ + ExInterlockedInsertHeadList(&HandleMapping, &pMapping->Entry, &HandleMappingLock); +} + +HGDIOBJ NTAPI +GDI_MapUserHandle(HGDIOBJ hUser) +{ + KIRQL OldIrql; + PLIST_ENTRY Current; + PHMAPPING Mapping; + HGDIOBJ Found = 0; + HANDLE hProcessId = PsGetCurrentProcessId(); + + /* Acquire the lock and check if the list is empty */ + KeAcquireSpinLock(&HandleMappingLock, &OldIrql); + + /* Traverse the list to find our mapping */ + Current = HandleMapping.Flink; + while(Current != &HandleMapping) + { + Mapping = CONTAINING_RECORD(Current, HMAPPING, Entry); + + /* Check if it's our entry */ + if (Mapping->hUser == hUser && Mapping->hProcessId == hProcessId) + { + /* Found it, save it and break out of the loop */ + Found = Mapping->hKernel; + break; + } + + /* Advance to the next pair */ + Current = Current->Flink; + } + + /* Release the lock and return the entry */ + KeReleaseSpinLock(&HandleMappingLock, OldIrql); + return Found; +} + +VOID NTAPI +GDI_RemoveHandleMapping(HGDIOBJ hUser) +{ + KIRQL OldIrql; + PLIST_ENTRY Current; + PHMAPPING Mapping; + HANDLE hProcessId = PsGetCurrentProcessId(); + + /* Acquire the lock and check if the list is empty */ + KeAcquireSpinLock(&HandleMappingLock, &OldIrql); + + /* Traverse the list to find our mapping */ + Current = HandleMapping.Flink; + while(Current != &HandleMapping) + { + Mapping = CONTAINING_RECORD(Current, HMAPPING, Entry); + + /* Check if it's our entry */ + if (Mapping->hUser == hUser && Mapping->hProcessId == hProcessId) + { + /* Remove and free it */ + RemoveEntryList(Current); + ExFreePool(Mapping); + break; + } + + /* Advance to the next pair */ + Current = Current->Flink; + } + + /* Release the lock and return the entry */ + KeReleaseSpinLock(&HandleMappingLock, OldIrql); } /* EOF */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -28,13 +28,10 @@ HPALETTE NewPalette; PPALETTE PalGDI; - PalGDI = ExAllocatePool(PagedPool, sizeof(PALETTE)); - if (!PalGDI) - { - return NULL; - } - - NewPalette = alloc_gdi_handle(&PalGDI->BaseObject, (SHORT)GDI_OBJECT_TYPE_PALETTE); + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) return NULL; + + NewPalette = PalGDI->BaseObject.hHmgr; PalGDI->Self = NewPalette; PalGDI->Mode = Mode; @@ -61,21 +58,9 @@ PalGDI->BlueMask = Blue; } + PALETTE_UnlockPalette(PalGDI); + return NewPalette; -} - -VOID -FASTCALL -PALETTE_FreePaletteByHandle(HGDIOBJ hPalette) -{ - PPALETTE pPal; - DPRINT("RosGdiDeleteDC(%x)\n", hPalette); - - /* Free the handle */ - pPal = free_gdi_handle(hPalette); - - /* Free its storage */ - ExFreePool(pPal); } HPALETTE @@ -87,13 +72,10 @@ PPALETTE PalGDI; UINT i; - PalGDI = ExAllocatePool(PagedPool, sizeof(PALETTE)); - if (!PalGDI) - { - return NULL; - } - - NewPalette = alloc_gdi_handle(&PalGDI->BaseObject, (SHORT)GDI_OBJECT_TYPE_PALETTE); + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) return NULL; + + NewPalette = PalGDI->BaseObject.hHmgr; PalGDI->Self = NewPalette; PalGDI->Mode = PAL_INDEXED; @@ -117,6 +99,8 @@ } PalGDI->NumColors = NumColors; + + PALETTE_UnlockPalette(PalGDI); return NewPalette; } Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -136,44 +136,43 @@ return 0; /* Allocate storage for surface object */ - pSurface = EngAllocMem(FL_ZERO_MEMORY, sizeof(SURFACE), TAG_SURFOBJ); - if (!pSurface) return NULL; - - /* Create a handle for it */ - hSurface = alloc_gdi_handle(&pSurface->BaseObject, (SHORT)GDI_OBJECT_TYPE_BITMAP); + pSurface = (PSURFACE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP); + if (!pSurface) return 0; + + /* Save a handle to it */ + hSurface = pSurface->BaseObject.hHmgr; /* Check the format */ if (Format == BMF_4RLE || Format == BMF_8RLE) { DPRINT1("Bitmaps with format 0x%x aren't supported yet!\n", Format); + + /* Cleanup and exit */ + GDIOBJ_FreeObjByHandle(hSurface, GDI_OBJECT_TYPE_BITMAP); + return 0; + } + + /* Initialize SURFOBJ */ + pSurfObj = &pSurface->SurfObj; + + pSurfObj->hsurf = (HSURF)hSurface; + pSurfObj->sizlBitmap = Size; + pSurfObj->iType = STYPE_BITMAP; + pSurfObj->fjBitmap = Flags & (BMF_TOPDOWN | BMF_NOZEROINIT); + + pSurfObj->lDelta = abs(Width); + pSurfObj->cjBits = pSurfObj->lDelta * Size.cy; + +#if 0 + if (!Bits) + { + DPRINT1("Bitmaps without Bits aren't supported yet!\n"); /* Cleanup and exit */ free_gdi_handle(hSurface); ExFreePool(pSurface); return 0; } - - /* Initialize SURFOBJ */ - pSurfObj = &pSurface->SurfObj; - - pSurfObj->hsurf = (HSURF)hSurface; - pSurfObj->sizlBitmap = Size; - pSurfObj->iType = STYPE_BITMAP; - pSurfObj->fjBitmap = Flags & (BMF_TOPDOWN | BMF_NOZEROINIT); - - pSurfObj->lDelta = abs(Width); - pSurfObj->cjBits = pSurfObj->lDelta * Size.cy; - -#if 0 - if (!Bits) - { - DPRINT1("Bitmaps without Bits aren't supported yet!\n"); - - /* Cleanup and exit */ - free_gdi_handle(hSurface); - ExFreePool(pSurface); - return 0; - } #endif if (!Bits) { @@ -184,8 +183,7 @@ if (!pSurfObj->pvBits) { /* Cleanup and exit */ - free_gdi_handle(hSurface); - ExFreePool(pSurface); + GDIOBJ_FreeObjByHandle(hSurface, GDI_OBJECT_TYPE_BITMAP); return 0; } } @@ -206,6 +204,9 @@ /* Set the format */ pSurfObj->iBitmapFormat = Format; + /* Unlock the surface */ + SURFACE_Unlock(pSurface); + /* Return handle to it */ return hSurface; } @@ -213,13 +214,7 @@ VOID FASTCALL GreDeleteBitmap(HGDIOBJ hBitmap) { - PSURFACE pSurf; - - /* Free the handle */ - pSurf = free_gdi_handle(hBitmap); - - /* Free its storage */ - EngFreeMem(pSurf); + GDIOBJ_FreeObjByHandle(hBitmap, GDI_OBJECT_TYPE_BITMAP); } LONG FASTCALL Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -3,7 +3,7 @@ typedef struct _DC { - GDIOBJHDR BaseObject; + BASEOBJECT BaseObject; PPDEVOBJ pPDevice; @@ -29,107 +29,11 @@ MATRIX mxWorldToPage; } DC, *PDC; +#define DC_Lock(hDC) \ + ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)) +#define DC_Unlock(pDC) \ + GDIOBJ_UnlockObjByPtr ((PBASEOBJECT)pDC) + INT APIENTRY GreGetDeviceCaps(PDC pDC, INT cap); -/* NOTE! Following structures are direct copies from gdi_private.h */ -typedef enum tagGdiPathState -{ - PATH_Null, - PATH_Open, - PATH_Closed -} GdiPathState; - -typedef struct tagGdiPath -{ - GdiPathState state; - POINT *pPoints; - BYTE *pFlags; - int numEntriesUsed, numEntriesAllocated; - BOOL newStroke; -} GdiPath; - -typedef struct tagGdiFont GdiFont; - -struct saved_visrgn -{ - struct saved_visrgn *next; - HRGN hrgn; -}; - -typedef struct tagUSERDC -{ - GDIOBJHDR header; - HDC hSelf; /* Handle to this DC */ - const struct tagDC_FUNCS *funcs; /* DC function table */ - PVOID physDev; /* Physical device (driver-specific) */ - DWORD thread; /* thread owning the DC */ - LONG refcount; /* thread refcount */ - LONG dirty; /* dirty flag */ - INT saveLevel; - HDC saved_dc; - DWORD_PTR dwHookData; - PVOID hookProc; /* the original SEGPTR ... */ - PVOID hookThunk; /* ... and the thunk to call it */ - - INT wndOrgX; /* Window origin */ - INT wndOrgY; - INT wndExtX; /* Window extent */ - INT wndExtY; - INT vportOrgX; /* Viewport origin */ - INT vportOrgY; - INT vportExtX; /* Viewport extent */ - INT vportExtY; - FLOAT miterLimit; - - int flags; - DWORD layout; - HRGN hClipRgn; /* Clip region (may be 0) */ - HRGN hMetaRgn; /* Meta region (may be 0) */ - HRGN hMetaClipRgn; /* Intersection of meta and clip regions (may be 0) */ - HRGN hVisRgn; /* Visible region (must never be 0) */ - HPEN hPen; - HBRUSH hBrush; - HFONT hFont; - HBITMAP hBitmap; - HANDLE hDevice; - HPALETTE hPalette; - - GdiFont *gdiFont; - GdiPath path; - - UINT font_code_page; - WORD ROPmode; - WORD polyFillMode; - WORD stretchBltMode; - WORD relAbsMode; - WORD backgroundMode; - COLORREF backgroundColor; - COLORREF textColor; - COLORREF dcBrushColor; - COLORREF dcPenColor; - short brushOrgX; - short brushOrgY; - - WORD textAlign; /* Text alignment from SetTextAlign() */ - INT charExtra; /* Spacing from SetTextCharacterExtra() */ - INT breakExtra; /* breakTotalExtra / breakCount */ - INT breakRem; /* breakTotalExtra % breakCount */ - INT MapMode; - INT GraphicsMode; /* Graphics mode */ - ABORTPROC pAbortProc; /* AbortProc for Printing */ -#ifndef __REACTOS__ - ABORTPROC16 pAbortProc16; #endif - INT CursPosX; /* Current position */ - INT CursPosY; - INT ArcDirection; - XFORM xformWorld2Wnd; /* World-to-window transformation */ - XFORM xformWorld2Vport; /* World-to-viewport transformation */ - XFORM xformVport2World; /* Inverse of the above transformation */ - BOOL vport2WorldValid; /* Is xformVport2World valid? */ - RECT BoundsRect; /* Current bounding rect */ - - struct saved_visrgn *saved_visrgn; -} USERDC; - -#endif Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gdiobj.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -1,15 +1,40 @@ #ifndef __WIN32K_GDIOBJ_H #define __WIN32K_GDIOBJ_H +typedef struct _GDI_HANDLE_TABLE +{ +/* The table must be located at the beginning of this structure so it can be + * properly mapped! + */ +////////////////////////////////////////////////////////////////////////////// + GDI_TABLE_ENTRY Entries[GDI_HANDLE_COUNT]; + DEVCAPS DevCaps; // Device Capabilities. + FLONG flDeviceUniq; // Device settings uniqueness. + PVOID pvLangPack; // Language Pack. + CFONT cfPublic[GDI_CFONT_MAX]; // Public Fonts. + DWORD dwCFCount; +////////////////////////////////////////////////////////////////////////////// + PPAGED_LOOKASIDE_LIST LookasideLists; -typedef struct tagGDIOBJHDR + ULONG FirstFree; + ULONG FirstUnused; + +} GDI_HANDLE_TABLE, *PGDI_HANDLE_TABLE; + +extern PGDI_HANDLE_TABLE GdiHandleTable; + +typedef struct _BASEOBJECT { - SHORT type; /* object type (one of the OBJ_* constants) */ - SHORT system : 1; /* system object flag */ - SHORT deleted : 1; /* whether DeleteObject has been called on this object */ - LONG selcount; /* number of times the object is selected in a DC */ -} GDIOBJHDR; + HGDIOBJ hHmgr; + ULONG ulShareCount; + USHORT cExclusiveLock; + USHORT BaseFlags; + PTHREADINFO Tid; +} BASEOBJECT, *PBASEOBJECT; +typedef BOOL (APIENTRY *GDICLEANUPPROC)(PVOID ObjectBody); + +#if 0 extern BOOLEAN GDIOBJ_Init(void); extern HGDIOBJ alloc_gdi_handle( GDIOBJHDR *obj, SHORT type); extern void *free_gdi_handle( HGDIOBJ handle ); @@ -17,6 +42,48 @@ extern void GDI_ReleaseObj( HGDIOBJ ); extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ); extern BOOL GDI_dec_ref_count( HGDIOBJ handle ); +#endif + +enum BASEFLAGS +{ + BASEFLAG_LOOKASIDE = 0x80, + + /* ReactOS specific: */ + BASEFLAG_READY_TO_DIE = 0x1000 +}; + +PGDI_HANDLE_TABLE APIENTRY GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject); +PVOID APIENTRY GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process); + +BOOL APIENTRY GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle); +BOOL APIENTRY GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner); +BOOL APIENTRY GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo); +BOOL APIENTRY GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj); +BOOL APIENTRY GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType); +PBASEOBJECT APIENTRY GDIOBJ_AllocObj(UCHAR ObjectType); +PBASEOBJECT APIENTRY GDIOBJ_AllocObjWithHandle(ULONG ObjectType); +VOID APIENTRY GDIOBJ_FreeObj (PBASEOBJECT pObj, UCHAR ObjectType); +BOOL APIENTRY GDIOBJ_FreeObjByHandle (HGDIOBJ hObj, DWORD ObjectType); +PVOID APIENTRY GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType); +ULONG FASTCALL GDIOBJ_UnlockObjByPtr(PBASEOBJECT Object); + +PVOID APIENTRY GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType); + +/* Inlines */ +ULONG +FORCEINLINE +GDIOBJ_ShareUnlockObjByPtr(PBASEOBJECT Object) +{ + HGDIOBJ hobj = Object->hHmgr; + USHORT flags = Object->BaseFlags; + INT cLocks = InterlockedDecrement((PLONG)&Object->ulShareCount); + ASSERT(cLocks >= 0); + if ((flags & BASEFLAG_READY_TO_DIE) && (cLocks == 0)) + { + GDIOBJ_FreeObjByHandle(hobj, GDI_OBJECT_TYPE_DONTCARE); + } + return cLocks; +} /* Handle mapping */ VOID NTAPI GDI_InitHandleMapping(); Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/palobj.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/palobj.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/palobj.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -3,7 +3,7 @@ typedef struct _PALETTE { - GDIOBJHDR BaseObject; + BASEOBJECT BaseObject; PALOBJ PalObj; //XLATEOBJ *logicalToSystem; @@ -24,9 +24,6 @@ ULONG Green, ULONG Blue); -VOID FASTCALL -PALETTE_FreePaletteByHandle(HGDIOBJ hPalette); - HPALETTE FASTCALL PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, CONST RGBQUAD *Colors); @@ -37,8 +34,15 @@ HPALETTE NTAPI BuildDIBPalette(CONST BITMAPINFO *bmi, PINT paletteType); -#define PALETTE_LockPalette(hPalette) ((PPALETTE)GDI_GetObjPtr(hPalette, (SHORT)GDI_OBJECT_TYPE_PALETTE)) -#define PALETTE_UnlockPalette(pPalette) GDI_ReleaseObj((HANDLE)pPalette) +VOID +FORCEINLINE +PALETTE_FreePaletteByHandle(HGDIOBJ hPalette) +{ + GDIOBJ_FreeObjByHandle(hPalette, GDI_OBJECT_TYPE_PALETTE); +} + +#define PALETTE_LockPalette(hPalette) ((PPALETTE)GDIOBJ_LockObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)) +#define PALETTE_UnlockPalette(pPalette) GDIOBJ_UnlockObjByPtr((PBASEOBJECT)pPalette) #endif Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/surfobj.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/surfobj.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/surfobj.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -4,7 +4,7 @@ typedef struct _SURFACE { - GDIOBJHDR BaseObject; + BASEOBJECT BaseObject; SURFOBJ SurfObj; FLONG flHooks; @@ -33,6 +33,14 @@ #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions +#define SURFACE_Lock(hBMObj) \ + ((PSURFACE) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)) +#define SURFACE_ShareLock(hBMObj) \ + ((PSURFACE) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)) +#define SURFACE_Unlock(pBMObj) \ + GDIOBJ_UnlockObjByPtr ((PBASEOBJECT)pBMObj) +#define SURFACE_ShareUnlock(pBMObj) \ + GDIOBJ_ShareUnlockObjByPtr ((PBASEOBJECT)pBMObj) #define SURFACE_LockBitmapBits(x) #define SURFACE_UnlockBitmapBits(x) Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/tags.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/tags.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/tags.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -5,9 +5,11 @@ #define TAG_CLIP TAG('C', 'L', 'I', 'P') /* clipping */ #define TAG_CLIPOBJ TAG('C', 'L', 'P', 'O') /* clip object */ #define TAG_COLORMAP TAG('C', 'O', 'L', 'M') /* color map */ +#define TAG_DC TAG('D', 'C', ' ', ' ') /* DC */ #define TAG_DFSM TAG('D', 'f', 's', 'm') /* Eng event allocation */ #define TAG_DIB TAG('D', 'I', 'B', ' ') /* dib */ #define TAG_DRIVER TAG('G', 'D', 'R', 'V') /* video drivers */ +#define TAG_GDIHNDTBLE TAG('G', 'D', 'I', 'H') /* gdi handle table */ #define TAG_GSEM TAG('G', 's', 'e', 'm') /* Gdi Semaphore */ #define TAG_SURFOBJ TAG('S', 'R', 'F', 'O') /* surface object */ #define TAG_PALETTE TAG('G', 'l', 'a', '8') Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -22,6 +22,7 @@ struct msg_queue *queue; /* main message queue */ obj_handle_t winstation; /* main handle to process window station */ obj_handle_t desktop; /* handle to desktop to use for new threads */ + LONG GDIHandleCount; /* kernelmode GDI handles count */ } PROCESSINFO; #include <pshpack1.h> Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/init.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] Sat Aug 1 00:08:01 2009 @@ -26,6 +26,8 @@ HANDLE GlobalUserHeap = NULL; PSECTION_OBJECT GlobalUserHeapSection = NULL; +PGDI_HANDLE_TABLE GdiHandleTable = NULL; +PSECTION_OBJECT GdiTableSection = NULL; /* PRIVATE FUNCTIONS *********************************************************/ @@ -333,7 +335,15 @@ init_directories(); /* Initialize GDI objects implementation */ - if (!GDIOBJ_Init()) return STATUS_UNSUCCESSFUL; + GdiHandleTable = GDIOBJ_iAllocHandleTable(&GdiTableSection); + if (GdiHandleTable == NULL) + { + DPRINT1("Failed to initialize the GDI handle table.\n"); + return STATUS_UNSUCCESSFUL; + } + + /* Initialize handle-mapping */ + GDI_InitHandleMapping(); /* Init video driver implementation */ InitDcImpl();
15 years, 4 months
1
0
0
0
[fireball] 42319: - Merge: gschneider * r42318 reactos/subsystems/win32/win32k/eng/mouse.c: Fix a typo in EngMovePointer.
by fireball@svn.reactos.org
Author: fireball Date: Fri Jul 31 22:13:27 2009 New Revision: 42319 URL:
http://svn.reactos.org/svn/reactos?rev=42319&view=rev
Log: - Merge: gschneider * r42318 reactos/subsystems/win32/win32k/eng/mouse.c: Fix a typo in EngMovePointer. Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engpoint.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engpoint.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/eng/engpoint.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/eng/engpoint.c [iso-8859-1] Fri Jul 31 22:13:27 2009 @@ -399,7 +399,7 @@ if (prcl != NULL) { prcl->left = x - pgp->HotSpot.x; - prcl->top = y - pgp->HotSpot.x; + prcl->top = y - pgp->HotSpot.y; prcl->right = prcl->left + pgp->Size.cx; prcl->bottom = prcl->top + pgp->Size.cy; }
15 years, 4 months
1
0
0
0
[gschneider] 42318: Fix a typo in EngMovePointer
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Jul 31 21:55:16 2009 New Revision: 42318 URL:
http://svn.reactos.org/svn/reactos?rev=42318&view=rev
Log: Fix a typo in EngMovePointer Modified: trunk/reactos/subsystems/win32/win32k/eng/mouse.c Modified: trunk/reactos/subsystems/win32/win32k/eng/mouse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] Fri Jul 31 21:55:16 2009 @@ -513,7 +513,7 @@ if (prcl != NULL) { prcl->left = x - pgp->HotSpot.x; - prcl->top = y - pgp->HotSpot.x; + prcl->top = y - pgp->HotSpot.y; prcl->right = prcl->left + pgp->Size.cx; prcl->bottom = prcl->top + pgp->Size.cy; }
15 years, 4 months
1
0
0
0
[sginsberg] 42317: - ...mised this one
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Jul 31 20:40:19 2009 New Revision: 42317 URL:
http://svn.reactos.org/svn/reactos?rev=42317&view=rev
Log: - ...mised this one Modified: trunk/reactos/dll/win32/gdi32/objects/coord.c Modified: trunk/reactos/dll/win32/gdi32/objects/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/co…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/coord.c [iso-8859-1] Fri Jul 31 20:40:19 2009 @@ -14,8 +14,8 @@ __asm__ __volatile__ ("fistpl %0" : "=m" (out) : "t" (in) : "st"); #else #define FLOAT_TO_INT(in,out) \ - __asm fld in \ - __asm fistp out + __asm fld in; \ + __asm fistp out; #endif LONG
15 years, 4 months
1
0
0
0
[gschneider] 42316: Remove leftover debug print
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Jul 31 20:32:33 2009 New Revision: 42316 URL:
http://svn.reactos.org/svn/reactos?rev=42316&view=rev
Log: Remove leftover debug print Modified: trunk/reactos/dll/win32/user32/windows/icon.c Modified: trunk/reactos/dll/win32/user32/windows/icon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] Fri Jul 31 20:32:33 2009 @@ -110,7 +110,6 @@ } else { - FIXME("loading %d bpp color cursor\n", IconImage->icHeader.biBitCount); IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT, ImageData, (BITMAPINFO*)IconImage, DIB_RGB_COLORS);
15 years, 4 months
1
0
0
0
[sginsberg] 42315: - Fix gdi32 build due to missing "; "
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Jul 31 20:30:37 2009 New Revision: 42315 URL:
http://svn.reactos.org/svn/reactos?rev=42315&view=rev
Log: - Fix gdi32 build due to missing ";" Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Fri Jul 31 20:30:37 2009 @@ -1539,7 +1539,7 @@ { PDC_ATTR pDc_Attr; HGDIOBJ hOldObj = NULL; - UINT uType + UINT uType; // PTEB pTeb; if(!GdiGetHandleUserData(hDC, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
15 years, 4 months
1
0
0
0
[sginsberg] 42314: - delayimp.h: Use FORCEINLINE instead of static __inline__ - winbase.h: Make winbase.h usable by MSVC - winuser.h: Add missing const specifiers to GetTabbedTextExtentA/W, TabbedTextOutA/W, ToAscii/Ex and ToUnicode/Ex - Make gdi32, user32, beepmidi and csrss drmk build in msvc - Fix most msvc issues in win32k -- a few remain - Make ntoskrnl compile with /W1 again
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Jul 31 20:21:24 2009 New Revision: 42314 URL:
http://svn.reactos.org/svn/reactos?rev=42314&view=rev
Log: - delayimp.h: Use FORCEINLINE instead of static __inline__ - winbase.h: Make winbase.h usable by MSVC - winuser.h: Add missing const specifiers to GetTabbedTextExtentA/W, TabbedTextOutA/W, ToAscii/Ex and ToUnicode/Ex - Make gdi32, user32, beepmidi and csrss drmk build in msvc - Fix most msvc issues in win32k -- a few remain - Make ntoskrnl compile with /W1 again Modified: trunk/reactos/dll/win32/beepmidi/beepmidi.c trunk/reactos/dll/win32/gdi32/misc/wingl.c trunk/reactos/dll/win32/gdi32/objects/dc.c trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/windows/menu.c trunk/reactos/drivers/wdm/audio/drm/drmk/stubs.cpp trunk/reactos/include/psdk/delayimp.h trunk/reactos/include/psdk/winbase.h trunk/reactos/include/psdk/winuser.h trunk/reactos/ntoskrnl/mm/ARM3/expool.c trunk/reactos/ntoskrnl/mm/pool.c trunk/reactos/subsystems/win32/csrss/api/handle.c trunk/reactos/subsystems/win32/csrss/api/wapi.c trunk/reactos/subsystems/win32/win32k/eng/engbrush.c trunk/reactos/subsystems/win32/win32k/eng/engmisc.c trunk/reactos/subsystems/win32/win32k/eng/mem.c trunk/reactos/subsystems/win32/win32k/ldr/loader.c trunk/reactos/subsystems/win32/win32k/ntuser/menu.c trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c trunk/reactos/subsystems/win32/win32k/objects/coord.c trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/drawing.c trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/path.c trunk/reactos/subsystems/win32/win32k/objects/region.c Modified: trunk/reactos/dll/win32/beepmidi/beepmidi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/beepmidi/beepmid…
============================================================================== --- trunk/reactos/dll/win32/beepmidi/beepmidi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/beepmidi/beepmidi.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -142,11 +142,13 @@ while ( ( node != NULL ) && ( arp_notes <= POLYPHONY ) ) { - DPRINT("playing..\n"); BEEP_SET_PARAMETERS beep_data; DWORD actually_playing = 0; double frequency = node->note; + + DPRINT("playing..\n"); + frequency = frequency / 12; frequency = pow(2, frequency); frequency = 8.1758 * frequency; @@ -481,9 +483,9 @@ { HANDLE heap = GetProcessHeap(); + NoteNode* node; + DPRINT("PlayNote\n"); - - NoteNode* node; if ( velocity == 0 ) { @@ -757,8 +759,8 @@ Exported function that receives messages from WINMM (the MME API.) */ +MMRESULT FAR PASCAL -MMRESULT modMessage( UINT device_id, UINT message, @@ -839,7 +841,8 @@ Driver entrypoint. */ -FAR PASCAL LONG +LONG +FAR PASCAL DriverProc( DWORD driver_id, HDRVR driver_handle, Modified: trunk/reactos/dll/win32/gdi32/misc/wingl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/wingl…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/wingl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/wingl.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -28,11 +28,11 @@ -typedef int WINAPI (*CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *); -typedef BOOL WINAPI (*SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *); -typedef BOOL WINAPI (*SWAPBUFFERS) (HDC hdc); -typedef int WINAPI (*DESCRIBEPIXELFMT) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); -typedef int WINAPI (*GETPIXELFMT) (HDC); +typedef int (WINAPI *CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *); +typedef BOOL (WINAPI *SETPIXELFMT) (HDC, int, CONST PIXELFORMATDESCRIPTOR *); +typedef BOOL (WINAPI *SWAPBUFFERS) (HDC hdc); +typedef int (WINAPI *DESCRIBEPIXELFMT) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); +typedef int (WINAPI *GETPIXELFMT) (HDC); static CHOOSEPIXELFMT glChoosePixelFormat = NULL; Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -1539,6 +1539,7 @@ { PDC_ATTR pDc_Attr; HGDIOBJ hOldObj = NULL; + UINT uType // PTEB pTeb; if(!GdiGetHandleUserData(hDC, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr)) @@ -1553,7 +1554,7 @@ return NULL; } - UINT uType = GDI_HANDLE_GET_TYPE(hGdiObj); + uType = GDI_HANDLE_GET_TYPE(hGdiObj); switch (uType) { Modified: trunk/reactos/dll/win32/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -61,9 +61,11 @@ static __inline PVOID DesktopPtrToUser(PVOID Ptr) { + PCLIENTINFO pci; + PDESKTOPINFO pdi; GetW32ThreadInfo(); - PCLIENTINFO pci = GetWin32ClientInfo(); - PDESKTOPINFO pdi = pci->pDeskInfo; + pci = GetWin32ClientInfo(); + pdi = pci->pDeskInfo; ASSERT(Ptr != NULL); ASSERT(pdi != NULL); Modified: trunk/reactos/dll/win32/user32/windows/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -1234,9 +1234,10 @@ { HMENU hmenu = LoadMenuW(User32Instance, L"SYSMENU"); LRESULT Result = (LRESULT)hmenu; + MENUINFO menuinfo = {0}; + MENUITEMINFOW info = {0}; // removing space for checkboxes from menu - MENUINFO menuinfo = {0}; menuinfo.cbSize = sizeof(menuinfo); menuinfo.fMask = MIM_STYLE; GetMenuInfo(hmenu, &menuinfo); @@ -1244,7 +1245,6 @@ SetMenuInfo(hmenu, &menuinfo); // adding bitmaps to menu items - MENUITEMINFOW info = {0}; info.cbSize = sizeof(info); info.fMask |= MIIM_BITMAP; info.hbmpItem = HBMMENU_POPUP_MINIMIZE; Modified: trunk/reactos/drivers/wdm/audio/drm/drmk/stubs.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drm/drmk…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drm/drmk/stubs.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drm/drmk/stubs.cpp [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -24,7 +24,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmAddContentHandlers( IN ULONG ContentId, IN PVOID *paHandlers, @@ -41,7 +42,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmCreateContentMixed( IN PULONG paContentId, IN ULONG cContentId, @@ -57,7 +59,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmDestroyContent( IN ULONG ContentId) { @@ -72,7 +75,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmForwardContentToDeviceObject( IN ULONG ContentId, IN PVOID Reserved, @@ -90,7 +94,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmForwardContentToFileObject( IN ULONG ContentId, IN PFILE_OBJECT FileObject) @@ -106,7 +111,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmForwardContentToInterface( IN ULONG ContentId, IN PUNKNOWN pUnknown, @@ -122,7 +128,8 @@ /* * @unimplemented */ -NTAPI NTSTATUS +NTSTATUS +NTAPI DrmGetContentRights( IN ULONG ContentId, OUT PDRMRIGHTS DrmRights) @@ -130,4 +137,3 @@ UNIMPLEMENTED; return STATUS_UNSUCCESSFUL; } - Modified: trunk/reactos/include/psdk/delayimp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/delayimp.h?re…
============================================================================== --- trunk/reactos/include/psdk/delayimp.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/delayimp.h [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -65,7 +65,7 @@ typedef FARPROC (WINAPI *PfnDliHook)(unsigned, PDelayLoadInfo); -static __inline__ +FORCEINLINE unsigned IndexFromPImgThunkData(PCImgThunkData pData, PCImgThunkData pBase) { @@ -74,7 +74,7 @@ extern const IMAGE_DOS_HEADER __ImageBase; -static __inline__ +FORCEINLINE PVOID PFromRva(RVA rva) { Modified: trunk/reactos/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winbase.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winbase.h [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -1872,6 +1872,15 @@ VOID WINAPI InitializeSListHead(PSLIST_HEADER); USHORT WINAPI QueryDepthSList(PSLIST_HEADER); +#ifdef _MSC_VER + +// +// Intrinsics are a mess -- *sigh* +// +long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand); +#pragma intrinsic(_InterlockedCompareExchange) +#endif + #if !defined(InterlockedAnd) #define InterlockedAnd InterlockedAnd_Inline FORCEINLINE Modified: trunk/reactos/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winuser.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winuser.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winuser.h [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -4090,8 +4090,8 @@ #define GetSysModalWindow() (NULL) HMENU WINAPI GetSystemMenu(HWND,BOOL); int WINAPI GetSystemMetrics(int); -DWORD WINAPI GetTabbedTextExtentA(HDC,LPCSTR,int,int,LPINT); -DWORD WINAPI GetTabbedTextExtentW(HDC,LPCWSTR,int,int,LPINT); +DWORD WINAPI GetTabbedTextExtentA(HDC,LPCSTR,int,int,CONST LPINT); +DWORD WINAPI GetTabbedTextExtentW(HDC,LPCWSTR,int,int,CONST LPINT); LONG WINAPI GetWindowLongA(HWND,int); LONG WINAPI GetWindowLongW(HWND,int); #ifdef _WIN64 @@ -4411,13 +4411,13 @@ #endif /* (_WIN32_WINNT >= 0x0500) */ BOOL WINAPI SystemParametersInfoA(UINT,UINT,PVOID,UINT); BOOL WINAPI SystemParametersInfoW(UINT,UINT,PVOID,UINT); -LONG WINAPI TabbedTextOutA(HDC,int,int,LPCSTR,int,int,LPINT,int); -LONG WINAPI TabbedTextOutW(HDC,int,int,LPCWSTR,int,int,LPINT,int); +LONG WINAPI TabbedTextOutA(HDC,int,int,LPCSTR,int,int,CONST LPINT,int); +LONG WINAPI TabbedTextOutW(HDC,int,int,LPCWSTR,int,int,CONST LPINT,int); WORD WINAPI TileWindows(HWND,UINT,LPCRECT,UINT,const HWND *); -int WINAPI ToAscii(UINT,UINT,PBYTE,LPWORD,UINT); -int WINAPI ToAsciiEx(UINT,UINT,PBYTE,LPWORD,UINT,HKL); -int WINAPI ToUnicode(UINT,UINT,PBYTE,LPWSTR,int,UINT); -int WINAPI ToUnicodeEx(UINT,UINT,PBYTE,LPWSTR,int,UINT,HKL); +int WINAPI ToAscii(UINT,UINT,CONST PBYTE,LPWORD,UINT); +int WINAPI ToAsciiEx(UINT,UINT,CONST PBYTE,LPWORD,UINT,HKL); +int WINAPI ToUnicode(UINT,UINT,CONST PBYTE,LPWSTR,int,UINT); +int WINAPI ToUnicodeEx(UINT,UINT,CONST PBYTE,LPWSTR,int,UINT,HKL); BOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT); BOOL WINAPI TrackPopupMenu(HMENU,UINT,int,int,int,HWND,LPCRECT); BOOL WINAPI TrackPopupMenuEx(HMENU,UINT,int,int,HWND,LPTPMPARAMS); Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -379,7 +379,11 @@ // // Quickly deal with big page allocations // - if (PAGE_ALIGN(P) == P) return (VOID)MiFreePoolPages(P); + if (PAGE_ALIGN(P) == P) + { + (VOID)MiFreePoolPages(P); + return; + } // // Get the entry for this pool allocation @@ -497,7 +501,8 @@ // In this case, release the nonpaged pool lock, and free the page // KeReleaseQueuedSpinLock(LockQueueNonPagedPoolLock, OldIrql); - return (VOID)MiFreePoolPages(Entry); + (VOID)MiFreePoolPages(Entry); + return; } // Modified: trunk/reactos/ntoskrnl/mm/pool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pool.c?rev=423…
============================================================================== --- trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -291,7 +291,7 @@ #endif ExFreePagedPool(Block); } - else if (Block) return ExFreeArmPoolWithTag(Block, Tag); + else if (Block) ExFreeArmPoolWithTag(Block, Tag); else { /* Warn only for NULL pointers */ Modified: trunk/reactos/subsystems/win32/csrss/api/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/api…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/api/handle.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/api/handle.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -180,7 +180,7 @@ RtlCopyMemory(Block, ProcessData->HandleTable, ProcessData->HandleTableSize * sizeof(CSRSS_HANDLE)); - Block = _InterlockedExchangePointer((volatile void*)&ProcessData->HandleTable, Block); + Block = _InterlockedExchangePointer((void* volatile)&ProcessData->HandleTable, Block); RtlFreeHeap( CsrssApiHeap, 0, Block ); ProcessData->HandleTableSize += 64; } Modified: trunk/reactos/subsystems/win32/csrss/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/api…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/api/wapi.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/api/wapi.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -123,7 +123,7 @@ IN HANDLE hApiListenPort) { NTSTATUS Status; - HANDLE ServerPort = (HANDLE) 0; + HANDLE ServerPort = NULL, ServerThread = NULL; PCSRSS_PROCESS_DATA ProcessData = NULL; REMOTE_PORT_VIEW LpcRead; LpcRead.Length = sizeof(LpcRead); @@ -167,7 +167,6 @@ return Status; } - HANDLE ServerThread = (HANDLE) 0; Status = RtlCreateUserThread(NtCurrentProcess(), NULL, FALSE, Modified: trunk/reactos/subsystems/win32/win32k/eng/engbrush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -156,7 +156,9 @@ } /* Copy the bits to the new format bitmap */ - rclDest = (RECTL){0, 0, psoPattern->sizlBitmap.cx, psoPattern->sizlBitmap.cy}; + rclDest.left = rclDest.top = 0; + rclDest.right = psoPattern->sizlBitmap.cx; + rclDest.bottom = psoPattern->sizlBitmap.cy; EngCopyBits(psoRealize, psoPattern, NULL, pxlo, &rclDest, &ptlSrc); /* Unlock the bitmap again */ Modified: trunk/reactos/subsystems/win32/win32k/eng/engmisc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -250,7 +250,7 @@ OUT PUSHORT AnsiCodePage) { /* Forward to kernel */ - return RtlGetDefaultCodePage(AnsiCodePage, OemCodePage); + RtlGetDefaultCodePage(AnsiCodePage, OemCodePage); } /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/eng/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -175,7 +175,7 @@ VOID APIENTRY EngUnsecureMem(HANDLE Mem) { - return MmUnsecureVirtualMemory((PVOID) Mem); + MmUnsecureVirtualMemory((PVOID) Mem); } /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ldr/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ld…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ldr/loader.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ldr/loader.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -228,8 +228,9 @@ DPRINT1("ZwSetSystemInformation failed with Status 0x%lx\n", Status); } else { + PDRIVERS DriverInfo; hImageHandle = (HANDLE)GdiDriverInfo.ImageAddress; - PDRIVERS DriverInfo = ExAllocatePool(PagedPool, sizeof(DRIVERS)); + DriverInfo = ExAllocatePool(PagedPool, sizeof(DRIVERS)); DriverInfo->DriverName.MaximumLength = GdiDriverInfo.DriverName.MaximumLength; DriverInfo->DriverName.Length = GdiDriverInfo.DriverName.Length; DriverInfo->DriverName.Buffer = ExAllocatePool(PagedPool, GdiDriverInfo.DriverName.MaximumLength); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -292,6 +292,7 @@ NULL); if(NT_SUCCESS(Status)) { + BOOL ret; if (Menu->MenuInfo.Wnd) { Window = UserGetWindowObject(Menu->MenuInfo.Wnd); @@ -301,7 +302,7 @@ } } // UserDereferenceObject(Menu); - BOOL ret = UserDeleteObject(Menu->MenuInfo.Self, otMenu); + ret = UserDeleteObject(Menu->MenuInfo.Self, otMenu); ObDereferenceObject(WindowStation); return ret; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -872,9 +872,10 @@ DPRINT("NtUserProcessConnect\n"); if (pUserConnect && ( Size == sizeof(USERCONNECT) )) { + PPROCESSINFO W32Process; UserEnterShared(); GetW32ThreadInfo(); - PPROCESSINFO W32Process = PsGetCurrentProcessWin32Process(); + W32Process = PsGetCurrentProcessWin32Process(); _SEH2_TRY { pUserConnect->siClient.psi = gpsi; Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -127,8 +127,8 @@ CONST LPXFORM lpXForm, DWORD Mode) { + XFORM xformWorld2Wnd; ASSERT(pDc); - XFORM xformWorld2Wnd; switch (Mode) { Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -658,7 +658,8 @@ pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_; pdcattrNew->iCS_CP = pdcattrOld->iCS_CP; - pdcNew->erclWindow = (RECTL){0, 0, 1, 1}; + pdcNew->erclWindow.left = pdcNew->erclWindow.top = 0; + pdcNew->erclWindow.right = pdcNew->erclWindow.bottom = 1; DC_UnlockDc(pdcNew); DC_UnlockDc(pdcOld); Modified: trunk/reactos/subsystems/win32/win32k/objects/drawing.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/drawing.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/drawing.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -713,8 +713,9 @@ } static +POINT FASTCALL -POINT app_boundary_point(Rect r, int angle) +app_boundary_point(Rect r, int angle) { int cx, cy; double tangent; Modified: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -25,14 +25,17 @@ if (!(Device->flFlags & PDEV_DRIVER_PUNTED_CALL) && (Surface->dhsurf)) { if (Device->DriverFunctions.SynchronizeSurface) - return Device->DriverFunctions.SynchronizeSurface(Surface, Rect, fl); + { + Device->DriverFunctions.SynchronizeSurface(Surface, Rect, fl); + } else { if (Device->DriverFunctions.Synchronize) - return Device->DriverFunctions.Synchronize(Surface->dhpdev, Rect); + { + Device->DriverFunctions.Synchronize(Surface->dhpdev, Rect); + } } } - return; } VOID Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -349,6 +349,9 @@ POBJ newObject = NULL; HANDLE CurrentProcessId, LockedProcessId; UCHAR TypeIndex; + UINT Index; + PGDI_TABLE_ENTRY Entry; + LONG TypeInfo; GDIDBG_INITLOOPTRACE(); @@ -372,10 +375,6 @@ DPRINT1("Not enough memory to allocate gdi object!\n"); return NULL; } - - UINT Index; - PGDI_TABLE_ENTRY Entry; - LONG TypeInfo; CurrentProcessId = PsGetCurrentProcessId(); LockedProcessId = (HANDLE)((ULONG_PTR)CurrentProcessId | 0x1); Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -64,8 +64,9 @@ FASTCALL PATH_Delete(HPATH hPath) { + PPATH pPath; if (!hPath) return FALSE; - PPATH pPath = PATH_LockPath( hPath ); + pPath = PATH_LockPath( hPath ); if (!pPath) return FALSE; PATH_DestroyGdiPath( pPath ); PATH_UnlockPath( pPath ); Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Fri Jul 31 20:21:24 2009 @@ -2081,7 +2081,7 @@ REGION_Delete(PROSRGNDATA pRgn) { if ( pRgn == prgnDefault) return; - return REGION_FreeRgn(pRgn); + REGION_FreeRgn(pRgn); }
15 years, 4 months
1
0
0
0
[gschneider] 42313: - Use system wide caret width and height if one of those parameters is zero - Ref: http://msdn.microsoft.com/en-us/library/ms648399(VS.85).aspx - Allows to show the caret in riched20a components (Wordpad f.e.) See issue #1559 for more details.
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Jul 31 19:11:21 2009 New Revision: 42313 URL:
http://svn.reactos.org/svn/reactos?rev=42313&view=rev
Log: - Use system wide caret width and height if one of those parameters is zero - Ref:
http://msdn.microsoft.com/en-us/library/ms648399(VS.85).aspx
- Allows to show the caret in riched20a components (Wordpad f.e.) See issue #1559 for more details. Modified: trunk/reactos/subsystems/win32/win32k/ntuser/caret.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/caret.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] Fri Jul 31 19:11:21 2009 @@ -355,6 +355,14 @@ } else { + if (nWidth == 0) + { + nWidth = UserGetSystemMetrics(SM_CXBORDER); + } + if (nHeight == 0) + { + nHeight = UserGetSystemMetrics(SM_CYBORDER); + } ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0; ThreadQueue->CaretInfo->Size.cx = nWidth; ThreadQueue->CaretInfo->Size.cy = nHeight;
15 years, 4 months
1
0
0
0
[dgorbachev] 42312: Fix _M_X86 -> _M_IX86.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Fri Jul 31 18:32:22 2009 New Revision: 42312 URL:
http://svn.reactos.org/svn/reactos?rev=42312&view=rev
Log: Fix _M_X86 -> _M_IX86. Modified: trunk/reactos/ntoskrnl/ex/shutdown.c Modified: trunk/reactos/ntoskrnl/ex/shutdown.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/shutdown.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ex/shutdown.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/shutdown.c [iso-8859-1] Fri Jul 31 18:32:22 2009 @@ -28,7 +28,7 @@ while (TRUE) { KeRaiseIrql(SYNCH_LEVEL, &OldIrql); -#if defined(_M_X86) +#if defined(_M_IX86) Ke386HaltProcessor(); #else HalProcessorIdle();
15 years, 4 months
1
0
0
0
[gschneider] 42311: - Implement Floodfill: iterative four neighbors version - Details for this algorithm are described in the comments - Nice with the paint clone since the bucket fill tool works now
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Jul 31 17:41:09 2009 New Revision: 42311 URL:
http://svn.reactos.org/svn/reactos?rev=42311&view=rev
Log: - Implement Floodfill: iterative four neighbors version - Details for this algorithm are described in the comments - Nice with the paint clone since the bucket fill tool works now Added: trunk/reactos/subsystems/win32/win32k/dib/floodfill.c (with props) Modified: trunk/reactos/subsystems/win32/win32k/dib/dib.h trunk/reactos/subsystems/win32/win32k/objects/fillshap.c trunk/reactos/subsystems/win32/win32k/win32k.rbuild Modified: trunk/reactos/subsystems/win32/win32k/dib/dib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib.h [iso-8859-1] Fri Jul 31 17:41:09 2009 @@ -133,6 +133,7 @@ BOOLEAN DIB_32BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*); BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,XLATEOBJ*,ROP4); +BOOLEAN DIB_XXBPP_FloodFill(SURFOBJ*, BRUSHOBJ*, RECTL*, POINTL*, XLATEOBJ*, COLORREF, UINT); extern unsigned char notmask[2]; extern unsigned char altnotmask[2]; Added: trunk/reactos/subsystems/win32/win32k/dib/floodfill.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/floodfill.c (added) +++ trunk/reactos/subsystems/win32/win32k/dib/floodfill.c [iso-8859-1] Fri Jul 31 17:41:09 2009 @@ -1,0 +1,168 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS win32 subsystem + * PURPOSE: Flood filling support + * FILE: subsystems/win32/win32k/dib/floodfill.c + * PROGRAMMER: Gregor Schneider, <grschneider AT gmail DOT com> + */ + +#include <w32k.h> + +#define NDEBUG +#include <debug.h> + +/* +* This floodfill algorithm is an iterative four neighbors version. It works with an internal stack like data structure. +* The stack is kept in an array, sized for the worst case scenario of having to add all pixels of the surface. +* This avoids having to allocate and free memory blocks all the time. The stack grows from the end of the array towards the start. +* All pixels are checked before being added, against belonging to the fill rule (FLOODFILLBORDER or FLOODFILLSURFACE) +* and the position in respect to the clip region. This guarantees all pixels lying on the stack belong to the filled surface. +* Further optimisations of the algorithm are possible. +*/ + +/* Floodfil helper structures and functions */ +typedef struct _floodItem +{ + ULONG x; + ULONG y; +} FLOODITEM; + +static ULONG floodLen = 0; +static FLOODITEM *floodStart = NULL, *floodData = NULL; + +static __inline BOOL initFlood(RECTL *DstRect) +{ + ULONG width = DstRect->right - DstRect->left; + ULONG height = DstRect->bottom - DstRect->top; + floodData = ExAllocatePoolWithTag(NonPagedPool, width * height * sizeof(FLOODITEM), TAG_DIB); + if (floodData == NULL) + { + return FALSE; + } + floodStart = (FLOODITEM*)((PBYTE)floodData + (width * height * sizeof(FLOODITEM))); + return TRUE; +} +static __inline VOID finalizeFlood() +{ + ExFreePoolWithTag(floodData, TAG_DIB); +} +static __inline VOID addItemFlood(ULONG x, + ULONG y, + SURFOBJ *DstSurf, + RECTL *DstRect, + XLATEOBJ* ColorTranslation, + COLORREF Color, + BOOL isSurf) +{ + if (x >= DstRect->left && x <= DstRect->right && + y >= DstRect->top && y <= DstRect->bottom) + { + if (isSurf == TRUE && XLATEOBJ_iXlate(ColorTranslation, + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y)) != Color) + { + return; + } + else if (isSurf == FALSE && XLATEOBJ_iXlate(ColorTranslation, + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y)) == Color) + { + return; + } + floodStart--; + floodStart->x = x; + floodStart->y = y; + floodLen++; + } +} +static __inline VOID removeItemFlood() +{ + floodStart++; + floodLen--; +} +static __inline BOOL isEmptyFlood() +{ + if (floodLen == 0) + { + return TRUE; + } + return FALSE; +} + +BOOLEAN DIB_XXBPP_FloodFill(SURFOBJ *DstSurf, + BRUSHOBJ *Brush, + RECTL *DstRect, + POINTL *Origin, + XLATEOBJ *ColorTranslation, + COLORREF Color, + UINT FillType) +{ + ULONG x, y; + ULONG BrushColor; + + BrushColor = Brush->iSolidColor; + x = Origin->x; + y = Origin->y; + + if (FillType == FLOODFILLBORDER) + { + /* Check if the start pixel has the border color */ + if (XLATEOBJ_iXlate(ColorTranslation, + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y)) == Color) + { + return FALSE; + } + + if (initFlood(DstRect) == FALSE) + { + return FALSE; + } + addItemFlood(x, y, DstSurf, DstRect, ColorTranslation, Color, FALSE); + while (!isEmptyFlood()) + { + x = floodStart->x; + y = floodStart->y; + removeItemFlood(); + + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor); + addItemFlood(x, y + 1, DstSurf, DstRect, ColorTranslation, Color, FALSE); + addItemFlood(x, y - 1, DstSurf, DstRect, ColorTranslation, Color, FALSE); + addItemFlood(x + 1, y, DstSurf, DstRect, ColorTranslation, Color, FALSE); + addItemFlood(x - 1, y, DstSurf, DstRect, ColorTranslation, Color, FALSE); + } + finalizeFlood(); + } + else if (FillType == FLOODFILLSURFACE) + { + /* Check if the start pixel has the surface color */ + if (XLATEOBJ_iXlate(ColorTranslation, + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y)) != Color) + { + return FALSE; + } + + if (initFlood(DstRect) == FALSE) + { + return FALSE; + } + addItemFlood(x, y, DstSurf, DstRect, ColorTranslation, Color, TRUE); + while (!isEmptyFlood()) + { + x = floodStart->x; + y = floodStart->y; + removeItemFlood(); + + DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor); + addItemFlood(x, y + 1, DstSurf, DstRect, ColorTranslation, Color, TRUE); + addItemFlood(x, y - 1, DstSurf, DstRect, ColorTranslation, Color, TRUE); + addItemFlood(x + 1, y, DstSurf, DstRect, ColorTranslation, Color, TRUE); + addItemFlood(x - 1, y, DstSurf, DstRect, ColorTranslation, Color, TRUE); + + } + finalizeFlood(); + } + else + { + DPRINT1("Unsupported FloodFill type!\n"); + return FALSE; + } + return TRUE; +} Propchange: trunk/reactos/subsystems/win32/win32k/dib/floodfill.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Fri Jul 31 17:41:09 2009 @@ -1072,12 +1072,11 @@ PDC dc; PDC_ATTR pdcattr; SURFACE *psurf = NULL; - PBRUSH pbrFill = NULL; + HPALETTE Pal = 0; + XLATEOBJ *XlateObj = NULL; BOOL Ret = FALSE; RECTL DestRect; POINTL Pt; - - DPRINT1("FIXME: NtGdiExtFloodFill is UNIMPLEMENTED\n"); dc = DC_LockDc(hDC); if (!dc) @@ -1110,17 +1109,21 @@ else goto cleanup; - pbrFill = dc->dclevel.pbrFill; - if (!pbrFill) + psurf = dc->dclevel.pSurface; + if (!psurf) { Ret = FALSE; goto cleanup; } - psurf = dc->dclevel.pSurface; - if (!psurf) - { - Ret = FALSE; - goto cleanup; + + Pal = dc->dclevel.pSurface->hDIBPalette; + if (!Pal) Pal = pPrimarySurface->DevInfo.hpalDefault; + XlateObj = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, 0, NULL, Pal); + + if (XlateObj != NULL) + { + Ret = DIB_XXBPP_FloodFill(&psurf->SurfObj, &dc->eboFill.BrushObject, &DestRect, &Pt, XlateObj, Color, FillType); + EngDeleteXlate(XlateObj); } cleanup: Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/wi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Fri Jul 31 17:41:09 2009 @@ -31,6 +31,7 @@ <file>dib32bpp.c</file> <file>dibXXbpp.c</file> <file>dib.c</file> + <file>floodfill.c</file> <if property="ARCH" value="i386"> <directory name="i386">
15 years, 4 months
1
0
0
0
← Newer
1
2
3
4
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200