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
March 2015
----- 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
18 participants
496 discussions
Start a n
N
ew thread
[tkreuzer] 66893: [WIN32K] Rewrite brush code in C++
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:38:20 2015 New Revision: 66893 URL:
http://svn.reactos.org/svn/reactos?rev=66893&view=rev
Log: [WIN32K] Rewrite brush code in C++ Added: trunk/reactos/win32ss/gdi/ntgdi/baseobj.hpp (with props) trunk/reactos/win32ss/gdi/ntgdi/brush.cpp (with props) trunk/reactos/win32ss/gdi/ntgdi/brush.hpp (with props) Removed: trunk/reactos/win32ss/gdi/ntgdi/brush.c Modified: trunk/reactos/win32ss/CMakeLists.txt trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c trunk/reactos/win32ss/pch.h trunk/reactos/win32ss/user/ntuser/ntuser.c Modified: trunk/reactos/win32ss/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/CMakeLists.txt?rev…
============================================================================== --- trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -1,5 +1,10 @@ set(USE_DIBLIB FALSE) + +if(NOT MSVC) + # HACK: this should be enabled globally! + add_compile_flags_language("-std=c++11" "CXX") +endif() # Give WIN32 subsystem its own project. PROJECT(WIN32SS) @@ -146,7 +151,7 @@ gdi/ntgdi/bezier.c gdi/ntgdi/bitblt.c gdi/ntgdi/bitmaps.c - gdi/ntgdi/brush.c + gdi/ntgdi/brush.cpp gdi/ntgdi/cliprgn.c gdi/ntgdi/coord.c gdi/ntgdi/dcattr.c @@ -227,7 +232,7 @@ endif() add_importlibs(win32k ntoskrnl hal ftfd) -add_pch(win32k pch.h SOURCE) +#add_pch(win32k pch.h SOURCE) add_cd_file(TARGET win32k DESTINATION reactos/system32 FOR all) set_source_files_properties(sys-stubs.S PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/w32ksvc.h) Added: trunk/reactos/win32ss/gdi/ntgdi/baseobj.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/baseobj.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/baseobj.hpp (added) +++ trunk/reactos/win32ss/gdi/ntgdi/baseobj.hpp [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -0,0 +1,109 @@ + +#pragma once + +#define GDIOBJ_POOL_TAG(type) ('00hG' + (((type) & 0x1f) << 24)) + +#define BASEOBJECT CBASEOBJECT + +class BASEOBJECT : private _BASEOBJECT +{ +public: + + enum OWNER + { + POWNED = GDI_OBJ_HMGR_POWNED, + PUBLIC = GDI_OBJ_HMGR_PUBLIC, + NONE = GDI_OBJ_HMGR_NONE + }; + +protected: + + BASEOBJECT( + _In_ GDILOOBJTYPE loobjtype) + { + /* Initialize the object */ + _BASEOBJECT::hHmgr = (HGDIOBJ)(ULONG_PTR)loobjtype; + this->cExclusiveLock = 0; + this->ulShareCount = 1; + this->BaseFlags = 0;//fl & 0xffff; + DBG_INITLOG(&this->slhLog); + DBG_LOGEVENT(&this->slhLog, EVENT_ALLOCATE, 0); + #if DBG_ENABLE_GDIOBJ_BACKTRACES + DbgCaptureStackBackTace(this->apvBackTrace, 1, GDI_OBJECT_STACK_LEVELS); + #endif /* GDI_DEBUG */ + } + + static + BASEOBJECT* + LockExclusive( + HGDIOBJ hobj, + GDIOBJTYPE objtype); + + static + BASEOBJECT* + LockExclusive( + HGDIOBJ hobj, + GDILOOBJTYPE loobjtype); + + static + BASEOBJECT* + LockShared( + HGDIOBJ hobj, + GDILOOBJTYPE loobjtype, + OWNER owner) + { + return 0; + } + + VOID + vSetObjectAttr( + _In_opt_ PVOID pvUserAttr) + { + GDIOBJ_vSetObjectAttr((POBJ)this, pvUserAttr); + } + + +public: + + static + inline + PVOID + pvAllocate( + _In_ GDIOBJTYPE objtype, + _In_ SIZE_T cjSize) + { + return ExAllocatePoolWithTag(PagedPool, cjSize, GDIOBJ_POOL_TAG(objtype)); + } + + VOID + vUnlock( + VOID) + { + if (this->cExclusiveLock > 0) + { + GDIOBJ_vUnlockObject(this); + } + else + { + GDIOBJ_vDereferenceObject(this); + } + } + + inline + HGDIOBJ + hHmgr( + VOID) + { + return _BASEOBJECT::hHmgr; + } + + HGDIOBJ + hInsertObject( + OWNER owner) + { + return GDIOBJ_hInsertObject(this, owner); + } + +}; + + Propchange: trunk/reactos/win32ss/gdi/ntgdi/baseobj.hpp ------------------------------------------------------------------------------ svn:eol-style = native Removed: trunk/reactos/win32ss/gdi/ntgdi/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.c (removed) @@ -1,563 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS win32 subsystem - * PURPOSE: Functions for brushes - * FILE: subsystem/win32/win32k/objects/brush.c - * PROGRAMER: - */ - -#include <win32k.h> - -#define NDEBUG -#include <debug.h> - -static -VOID -BRUSH_vInit( - PBRUSH pbr) -{ - /* Start with kmode brush attribute */ - pbr->pBrushAttr = &pbr->BrushAttr; -} - -static -PBRUSH -BRUSH_AllocBrushWithHandle( - VOID) -{ - PBRUSH pbr; - - pbr = (PBRUSH)GDIOBJ_AllocObjWithHandle(GDILoObjType_LO_BRUSH_TYPE, sizeof(BRUSH)); - if (pbr == NULL) - { - return NULL; - } - - BRUSH_vInit(pbr); - return pbr; -} - -static -BOOL -BRUSH_bAllocBrushAttr(PBRUSH pbr) -{ - PPROCESSINFO ppi; - BRUSH_ATTR *pBrushAttr; - NT_ASSERT(pbr->pBrushAttr == &pbr->BrushAttr); - - ppi = PsGetCurrentProcessWin32Process(); - NT_ASSERT(ppi); - __analysis_assume(ppi); - - pBrushAttr = GdiPoolAllocate(ppi->pPoolBrushAttr); - if (!pBrushAttr) - { - DPRINT1("Could not allocate brush attr\n"); - return FALSE; - } - - /* Copy the content from the kernel mode dc attr */ - pbr->pBrushAttr = pBrushAttr; - *pbr->pBrushAttr = pbr->BrushAttr; - - /* Set the object attribute in the handle table */ - GDIOBJ_vSetObjectAttr(&pbr->BaseObject, pBrushAttr); - - DPRINT("BRUSH_bAllocBrushAttr: pbr=%p, pbr->pdcattr=%p\n", pbr, pbr->pBrushAttr); - return TRUE; -} - -static -VOID -BRUSH_vFreeBrushAttr(PBRUSH pbr) -{ - PPROCESSINFO ppi; - - if (pbr->pBrushAttr == &pbr->BrushAttr) return; - - /* Reset the object attribute in the handle table */ - GDIOBJ_vSetObjectAttr(&pbr->BaseObject, NULL); - - /* Free memory from the process gdi pool */ - ppi = PsGetCurrentProcessWin32Process(); - ASSERT(ppi); - GdiPoolFree(ppi->pPoolBrushAttr, pbr->pBrushAttr); - - /* Reset to kmode brush attribute */ - pbr->pBrushAttr = &pbr->BrushAttr; -} - -BOOL -FASTCALL -IntGdiSetBrushOwner(PBRUSH pbr, ULONG ulOwner) -{ - // FIXME: - if (pbr->flAttrs & BR_IS_GLOBAL) return TRUE; - - if ((ulOwner == GDI_OBJ_HMGR_PUBLIC) || ulOwner == GDI_OBJ_HMGR_NONE) - { - /* Free user mode attribute, if any */ - BRUSH_vFreeBrushAttr(pbr); - - // Deny user access to User Data. - GDIOBJ_vSetObjectAttr(&pbr->BaseObject, NULL); - } - - if (ulOwner == GDI_OBJ_HMGR_POWNED) - { - /* Allocate a user mode attribute */ - BRUSH_bAllocBrushAttr(pbr); - - // Allow user access to User Data. - GDIOBJ_vSetObjectAttr(&pbr->BaseObject, pbr->pBrushAttr); - } - - GDIOBJ_vSetObjectOwner(&pbr->BaseObject, ulOwner); - - return TRUE; -} - -BOOL -FASTCALL -GreSetBrushOwner(HBRUSH hBrush, ULONG ulOwner) -{ - BOOL Ret; - PBRUSH pbrush; - - pbrush = BRUSH_ShareLockBrush(hBrush); - Ret = IntGdiSetBrushOwner(pbrush, ulOwner); - BRUSH_ShareUnlockBrush(pbrush); - return Ret; -} - -VOID -NTAPI -BRUSH_vCleanup(PVOID ObjectBody) -{ - PBRUSH pbrush = (PBRUSH)ObjectBody; - if (pbrush->hbmPattern) - { - GreSetObjectOwner(pbrush->hbmPattern, GDI_OBJ_HMGR_POWNED); - GreDeleteObject(pbrush->hbmPattern); - } - - /* Check if there is a usermode attribute */ - if (pbrush->pBrushAttr != &pbrush->BrushAttr) - { - BRUSH_vFreeBrushAttr(pbrush); - } - - /* Free the kmode styles array of EXTPENS */ - if (pbrush->pStyle) - { - ExFreePool(pbrush->pStyle); - } -} - -VOID -NTAPI -BRUSH_vDeleteObject( - PVOID pvObject) -{ - BRUSH_vCleanup(pvObject); - ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE); -} - - -INT -FASTCALL -BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush) -{ - /* Check if only size is requested */ - if (plogbrush == NULL) return sizeof(LOGBRUSH); - - /* Check if size is ok */ - if (cjSize == 0) return 0; - - /* Set colour */ - plogbrush->lbColor = pbrush->BrushAttr.lbColor; - - /* Default to 0 */ - plogbrush->lbHatch = 0; - - /* Get the type of style */ - if (pbrush->flAttrs & BR_IS_SOLID) - { - plogbrush->lbStyle = BS_SOLID; - } - else if (pbrush->flAttrs & BR_IS_NULL) - { - plogbrush->lbStyle = BS_NULL; // BS_HOLLOW - } - else if (pbrush->flAttrs & BR_IS_HATCH) - { - plogbrush->lbStyle = BS_HATCHED; - plogbrush->lbHatch = pbrush->iHatch; - } - else if (pbrush->flAttrs & BR_IS_DIB) - { - plogbrush->lbStyle = BS_DIBPATTERN; - plogbrush->lbHatch = (ULONG_PTR)pbrush->hbmClient; - } - else if (pbrush->flAttrs & BR_IS_BITMAP) - { - plogbrush->lbStyle = BS_PATTERN; - } - else - { - plogbrush->lbStyle = 0; // ??? - } - - /* FIXME - else if (pbrush->flAttrs & ) - { - plogbrush->lbStyle = BS_INDEXED; - } - else if (pbrush->flAttrs & ) - { - plogbrush->lbStyle = BS_DIBPATTERNPT; - } - */ - - /* FIXME */ - return sizeof(LOGBRUSH); -} - -HBRUSH -APIENTRY -IntGdiCreateDIBBrush( - const BITMAPINFO *BitmapInfo, - UINT uUsage, - UINT BitmapInfoSize, - const VOID* pvClient) -{ - HBRUSH hBrush; - PBRUSH pbrush; - HBITMAP hPattern; - ULONG_PTR DataPtr; - PVOID pvDIBits; - - if (BitmapInfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - DataPtr = (ULONG_PTR)BitmapInfo + DIB_BitmapInfoSize(BitmapInfo, uUsage); - - hPattern = DIB_CreateDIBSection(NULL, BitmapInfo, uUsage, &pvDIBits, NULL, 0, 0); - if (hPattern == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - RtlCopyMemory(pvDIBits, - (PVOID)DataPtr, - DIB_GetDIBImageBytes(BitmapInfo->bmiHeader.biWidth, - BitmapInfo->bmiHeader.biHeight, - BitmapInfo->bmiHeader.biBitCount * BitmapInfo->bmiHeader.biPlanes)); - - pbrush = BRUSH_AllocBrushWithHandle(); - if (pbrush == NULL) - { - GreDeleteObject(hPattern); - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - hBrush = pbrush->BaseObject.hHmgr; - - pbrush->flAttrs |= BR_IS_BITMAP | BR_IS_DIB; - if (uUsage == DIB_PAL_COLORS) - pbrush->flAttrs |= BR_IS_DIBPALCOLORS; - pbrush->hbmPattern = hPattern; - pbrush->hbmClient = (HBITMAP)pvClient; - /* FIXME: Fill in the rest of fields!!! */ - - GreSetObjectOwner(hPattern, GDI_OBJ_HMGR_PUBLIC); - - GDIOBJ_vUnlockObject(&pbrush->BaseObject); - - return hBrush; -} - -HBRUSH -APIENTRY -IntGdiCreateHatchBrush( - INT Style, - COLORREF Color) -{ - HBRUSH hBrush; - PBRUSH pbrush; - - if (Style < 0 || Style >= NB_HATCH_STYLES) - { - return 0; - } - - pbrush = BRUSH_AllocBrushWithHandle(); - if (pbrush == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - hBrush = pbrush->BaseObject.hHmgr; - - pbrush->flAttrs |= BR_IS_HATCH; - pbrush->BrushAttr.lbColor = Color & 0xFFFFFF; - pbrush->iHatch = Style; - - GDIOBJ_vUnlockObject(&pbrush->BaseObject); - - return hBrush; -} - -HBRUSH -APIENTRY -IntGdiCreatePatternBrush( - HBITMAP hBitmap) -{ - HBRUSH hBrush; - PBRUSH pbrush; - HBITMAP hPattern; - - hPattern = BITMAP_CopyBitmap(hBitmap); - if (hPattern == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - - pbrush = BRUSH_AllocBrushWithHandle(); - if (pbrush == NULL) - { - GreDeleteObject(hPattern); - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - hBrush = pbrush->BaseObject.hHmgr; - - pbrush->flAttrs |= BR_IS_BITMAP; - pbrush->hbmPattern = hPattern; - /* FIXME: Fill in the rest of fields!!! */ - - GreSetObjectOwner(hPattern, GDI_OBJ_HMGR_PUBLIC); - - GDIOBJ_vUnlockObject(&pbrush->BaseObject); - - return hBrush; -} - -HBRUSH -APIENTRY -IntGdiCreateSolidBrush( - COLORREF Color) -{ - HBRUSH hBrush; - PBRUSH pbrush; - - pbrush = BRUSH_AllocBrushWithHandle(); - if (pbrush == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - hBrush = pbrush->BaseObject.hHmgr; - - pbrush->flAttrs |= BR_IS_SOLID; - - pbrush->BrushAttr.lbColor = Color & 0x00FFFFFF; - /* FIXME: Fill in the rest of fields!!! */ - - GDIOBJ_vUnlockObject(&pbrush->BaseObject); - - return hBrush; -} - -HBRUSH -APIENTRY -IntGdiCreateNullBrush(VOID) -{ - HBRUSH hBrush; - PBRUSH pbrush; - - pbrush = BRUSH_AllocBrushWithHandle(); - if (pbrush == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - hBrush = pbrush->BaseObject.hHmgr; - - pbrush->flAttrs |= BR_IS_NULL; - GDIOBJ_vUnlockObject(&pbrush->BaseObject); - - return hBrush; -} - -VOID -NTAPI -IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color) -{ - PBRUSH pbrush; - - pbrush = BRUSH_ShareLockBrush(hBrush); - if (pbrush->flAttrs & BR_IS_SOLID) - { - pbrush->BrushAttr.lbColor = Color & 0xFFFFFF; - } - BRUSH_ShareUnlockBrush(pbrush); -} - - -/* PUBLIC FUNCTIONS ***********************************************************/ - -HBRUSH -APIENTRY -NtGdiCreateDIBBrush( - IN PVOID BitmapInfoAndData, - IN FLONG ColorSpec, - IN UINT BitmapInfoSize, - IN BOOL b8X8, - IN BOOL bPen, - IN PVOID PackedDIB) -{ - BITMAPINFO *SafeBitmapInfoAndData; - NTSTATUS Status = STATUS_SUCCESS; - HBRUSH hBrush; - - SafeBitmapInfoAndData = EngAllocMem(FL_ZERO_MEMORY, BitmapInfoSize, TAG_DIB); - if (SafeBitmapInfoAndData == NULL) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - - _SEH2_TRY - { - ProbeForRead(BitmapInfoAndData, BitmapInfoSize, 1); - RtlCopyMemory(SafeBitmapInfoAndData, BitmapInfoAndData, BitmapInfoSize); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - { - EngFreeMem(SafeBitmapInfoAndData); - SetLastNtError(Status); - return 0; - } - - hBrush = IntGdiCreateDIBBrush(SafeBitmapInfoAndData, - ColorSpec, - BitmapInfoSize, - PackedDIB); - - EngFreeMem(SafeBitmapInfoAndData); - - return hBrush; -} - -HBRUSH -APIENTRY -NtGdiCreateHatchBrushInternal( - ULONG Style, - COLORREF Color, - BOOL bPen) -{ - return IntGdiCreateHatchBrush(Style, Color); -} - -HBRUSH -APIENTRY -NtGdiCreatePatternBrushInternal( - HBITMAP hBitmap, - BOOL bPen, - BOOL b8x8) -{ - return IntGdiCreatePatternBrush(hBitmap); -} - -HBRUSH -APIENTRY -NtGdiCreateSolidBrush(COLORREF Color, - IN OPTIONAL HBRUSH hbr) -{ - return IntGdiCreateSolidBrush(Color); -} - -HBITMAP -APIENTRY -NtGdiGetObjectBitmapHandle( - _In_ HBRUSH hbr, - _Out_ UINT *piUsage) -{ - HBITMAP hbmPattern; - PBRUSH pbr; - - /* Lock the brush */ - pbr = BRUSH_ShareLockBrush(hbr); - if (pbr == NULL) - { - DPRINT1("Could not lock brush\n"); - return NULL; - } - - /* Get the pattern bitmap handle */ - hbmPattern = pbr->hbmPattern; - - _SEH2_TRY - { - ProbeForWrite(piUsage, sizeof(*piUsage), sizeof(*piUsage)); - - /* Set usage according to flags */ - if (pbr->flAttrs & BR_IS_DIBPALCOLORS) - *piUsage = DIB_PAL_COLORS; - else - *piUsage = DIB_RGB_COLORS; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - DPRINT1("Got exception!\n"); - hbmPattern = NULL; - } - _SEH2_END; - - /* Unlock the brush */ - BRUSH_ShareUnlockBrush(pbr); - - /* Return the pattern bitmap handle */ - return hbmPattern; -} - -/* - * @unimplemented - */ -HBRUSH -APIENTRY -NtGdiSetBrushAttributes( - IN HBRUSH hbm, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return NULL; -} - - -/* - * @unimplemented - */ -HBRUSH -APIENTRY -NtGdiClearBrushAttributes( - IN HBRUSH hbr, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return NULL; -} - - -/* EOF */ Added: trunk/reactos/win32ss/gdi/ntgdi/brush.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.cp…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.cpp (added) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.cpp [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -0,0 +1,550 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS win32 subsystem + * PURPOSE: BRUSH class implementation + * PROGRAMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) + * + * REFERENCES:
http://support.microsoft.com/kb/kbview/108497
+ */ + +#include "brush.hpp" + +DBG_DEFAULT_CHANNEL(GdiBrush); + +BRUSH::BRUSH( + _In_ FLONG flAttrs, + _In_ COLORREF crColor, + _In_ ULONG iHatch, + _In_opt_ HBITMAP hbmPattern, + _In_opt_ PVOID pvClient, + _In_ GDILOOBJTYPE loobjtype = GDILoObjType_LO_BRUSH_TYPE) + : BASEOBJECT(loobjtype) +{ + static ULONG ulGlobalBrushUnique = 0; + + /* Get a unique value */ + this->ulBrushUnique = InterlockedIncrementUL(&ulGlobalBrushUnique); + + /* Start with kmode brush attribute */ + this->pBrushAttr = &this->BrushAttr; + + /* Set parameters */ + this->flAttrs = flAttrs; + this->iHatch = iHatch; + this->hbmPattern = hbmPattern; + this->hbmClient = (HBITMAP)pvClient; + this->pBrushAttr->lbColor = crColor; + + /* Initialize the other fields */ + this->ptOrigin.x = 0; + this->ptOrigin.y = 0; + this->bCacheGrabbed = FALSE; + this->crBack = 0; + this->crFore = 0; + this->ulPalTime = 0; + this->ulSurfTime = 0; + this->pvRBrush = NULL; + this->hdev = NULL; +} + +BRUSH::~BRUSH( + VOID) +{ + /* Check if we have a user mode brush attribute */ + if (this->pBrushAttr != &this->BrushAttr) + { + /* Free memory to the process GDI pool */ + GdiPoolFree(GetBrushAttrPool(), this->pBrushAttr); + } + + /* Delete the pattern bitmap */ + if (this->hbmPattern != NULL) + { + GreSetBitmapOwner(this->hbmPattern, BASEOBJECT::OWNER::POWNED); + GreDeleteObject(this->hbmPattern); + } +} + +VOID +BRUSH::vDeleteObject( + _In_ PVOID pvObject) +{ + PBRUSH pbr = static_cast<PBRUSH>(pvObject); + NT_ASSERT((GDI_HANDLE_GET_TYPE(pbr->hHmgr()) == GDILoObjType_LO_BRUSH_TYPE) || + (GDI_HANDLE_GET_TYPE(pbr->hHmgr()) == GDILoObjType_LO_PEN_TYPE) || + (GDI_HANDLE_GET_TYPE(pbr->hHmgr()) == GDILoObjType_LO_EXTPEN_TYPE)); + delete pbr; +} + +BOOL +BRUSH::bAllocateBrushAttr( + VOID) +{ + PBRUSH_ATTR pBrushAttr; + NT_ASSERT(this->pBrushAttr == &this->BrushAttr); + + /* Allocate a brush attribute from the pool */ + pBrushAttr = static_cast<PBRUSH_ATTR>(GdiPoolAllocate(GetBrushAttrPool())); + if (pBrushAttr == NULL) + { + ERR("Could not allocate brush attr\n"); + return FALSE; + } + + /* Copy the content from the kernel mode brush attribute */ + this->pBrushAttr = pBrushAttr; + *this->pBrushAttr = this->BrushAttr; + + /* Set the object attribute in the handle table */ + vSetObjectAttr(pBrushAttr); + + return TRUE; +} + +VOID +BRUSH::vSetSolidColor( + _In_ COLORREF crColor) +{ + NT_ASSERT(this->flAttrs & BR_IS_SOLID); + + /* Set new color and reset the pal times */ + this->pBrushAttr->lbColor = crColor & 0xFFFFFF; + this->ulPalTime = -1; + this->ulSurfTime = -1; +} + +HBITMAP +BRUSH::hbmGetBitmapHandle( + _Out_ PUINT puUsage) const +{ + /* Return the color usage based on flags */ + *puUsage = (this->flAttrs & BR_IS_DIBPALCOLORS) ? DIB_PAL_COLORS : + (this->flAttrs & BR_IS_DIBPALINDICES) ? DIB_PAL_INDICES : + DIB_RGB_COLORS; + + return this->hbmPattern; +} + +UINT +BRUSH::cjGetObject( + _In_ UINT cjSize, + _Out_bytecap_(cjSize) PLOGBRUSH plb) const +{ + /* Check if only size is requested */ + if (plb == NULL) + return sizeof(LOGBRUSH); + + /* Check if size is ok */ + if (cjSize == 0) + return 0; + + /* Set color */ + plb->lbColor = this->BrushAttr.lbColor; + + /* Set style and hatch based on the attribute flags */ + if (this->flAttrs & BR_IS_SOLID) + { + plb->lbStyle = BS_SOLID; + plb->lbHatch = 0; + } + else if (this->flAttrs & BR_IS_HATCH) + { + plb->lbStyle = BS_HATCHED; + plb->lbHatch = this->iHatch; + } + else if (this->flAttrs & BR_IS_DIB) + { + plb->lbStyle = BS_DIBPATTERN; + plb->lbHatch = (ULONG_PTR)this->hbmClient; + } + else if (this->flAttrs & BR_IS_BITMAP) + { + plb->lbStyle = BS_PATTERN; + plb->lbHatch = (ULONG_PTR)this->hbmClient; + } + else if (this->flAttrs & BR_IS_NULL) + { + plb->lbStyle = BS_NULL; + plb->lbHatch = 0; + } + else + { + NT_ASSERT(FALSE); + } + + return sizeof(LOGBRUSH); +} + +static +HBRUSH +CreateBrushInternal( + _In_ ULONG flAttrs, + _In_ COLORREF crColor, + _In_ ULONG iHatch, + _In_opt_ HBITMAP hbmPattern, + _In_opt_ PVOID pvClient) +{ + BASEOBJECT::OWNER owner; + PBRUSH pbr; + HBRUSH hbr; + + NT_ASSERT(((flAttrs & BR_IS_BITMAP) == 0) || (hbmPattern != NULL)); + + /* Create the brush (brush takes ownership of the bitmap) */ + pbr = new BRUSH(flAttrs, crColor, iHatch, hbmPattern, pvClient); + if (pbr == NULL) + { + ERR("Failed to allocate a brush\n"); + GreSetBitmapOwner(hbmPattern, BASEOBJECT::OWNER::POWNED); + GreDeleteObject(hbmPattern); + return NULL; + } + + /* Check if this is a global brush */ + if (!(flAttrs & BR_IS_GLOBAL)) + { + /* Not a global brush, so allocate a user mode brush attribute */ + if (!pbr->bAllocateBrushAttr()) + { + ERR("Failed to allocate brush attribute\n"); + delete pbr; + return NULL; + } + } + + /* Set the owner, either public or process owned */ + owner = (flAttrs & BR_IS_GLOBAL) ? BASEOBJECT::OWNER::PUBLIC : + BASEOBJECT::OWNER::POWNED; + + /* Insert the object into the GDI handle table */ + hbr = static_cast<HBRUSH>(pbr->hInsertObject(owner)); + if (hbr == NULL) + { + ERR("Failed to insert brush\n"); + delete pbr; + return NULL; + } + + /* Unlock the brush */ + pbr->vUnlock(); + + return hbr; +} + + +/* C interface ***************************************************************/ + +extern "C" { + +VOID +NTAPI +BRUSH_vDeleteObject( + PVOID pvObject) +{ + BRUSH::vDeleteObject(pvObject); +} + +INT +FASTCALL +BRUSH_GetObject( + PBRUSH pbr, + INT cjBuffer, + LPLOGBRUSH plbBuffer) +{ + return pbr->cjGetObject(cjBuffer, plbBuffer); +} + +HBRUSH +NTAPI +IntGdiCreateNullBrush( + VOID) +{ + /* Call the internal function */ + return CreateBrushInternal(BR_IS_NULL | BR_IS_GLOBAL, 0, 0, NULL, NULL); +} + +HBRUSH +APIENTRY +IntGdiCreateSolidBrush( + COLORREF crColor) +{ + /* Call the internal function */ + return CreateBrushInternal(BR_IS_SOLID | BR_IS_GLOBAL, + crColor, + 0, + NULL, + NULL); +} + +HBRUSH +NTAPI +IntGdiCreatePatternBrush( + HBITMAP hbmPattern) +{ + NT_ASSERT(hbmPattern != NULL); + GreSetBitmapOwner(hbmPattern, BASEOBJECT::OWNER::PUBLIC); + return CreateBrushInternal(BR_IS_BITMAP | BR_IS_GLOBAL, + 0, + 0, + hbmPattern, + NULL); +} + +VOID +NTAPI +IntGdiSetSolidBrushColor( + _In_ HBRUSH hbr, + _In_ COLORREF crColor) +{ + PBRUSH pbr; + + /* Lock the brush */ + pbr = BRUSH::LockAny(hbr); + if (pbr == NULL) + { + ERR("Failed to lock brush %p\n", hbr); + return; + } + + /* Call the member function */ + pbr->vSetSolidColor(crColor); + + /* Unlock the brush */ + pbr->vUnlock(); +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiCreateSolidBrush( + _In_ COLORREF crColor, + _In_opt_ HBRUSH hbr) +{ + if (hbr != NULL) + { + WARN("hbr is not supported, ignoring\n"); + } + + /* Call the internal function */ + return CreateBrushInternal(BR_IS_SOLID, crColor, 0, NULL, NULL); +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiCreateHatchBrushInternal( + _In_ ULONG iHatch, + _In_ COLORREF crColor, + _In_ BOOL bPen) +{ + FLONG flAttr; + + if (bPen) + { + WARN("bPen is not supported, ignoring\n"); + } + + /* Check what kind if hatch style this is */ + if (iHatch < HS_DDI_MAX) + { + flAttr = BR_IS_HATCH; + } + else if (iHatch < HS_API_MAX) + { + flAttr = BR_IS_SOLID; + } + else + { + ERR("Invalid iHatch: %lu\n", iHatch); + return NULL; + } + + /* Call the internal function */ + return CreateBrushInternal(flAttr, crColor, iHatch, NULL, NULL); +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiCreatePatternBrushInternal( + _In_ HBITMAP hbmClient, + _In_ BOOL bPen, + _In_ BOOL b8X8) +{ + HBITMAP hbmPattern; + + if (b8X8) + { + WARN("b8X8 is not supported, ignoring\n"); + } + + if (bPen) + { + WARN("bPen is not supported, ignoring\n"); + } + + /* Copy the bitmap */ + hbmPattern = BITMAP_CopyBitmap(hbmClient); + if (hbmPattern == NULL) + { + ERR("Failed to copy the bitmap %p\n", hbmPattern); + return NULL; + } + + /* Call the internal function (will delete hbmPattern on failure) */ + return CreateBrushInternal(BR_IS_BITMAP, 0, 0, hbmPattern, hbmClient); +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiCreateDIBBrush( + _In_reads_bytes_(cj) PVOID pv, + _In_ FLONG uUsage, + _In_ UINT cj, + _In_ BOOL b8X8, + _In_ BOOL bPen, + _In_ PVOID pvClient) +{ + PVOID pvPackedDIB; + FLONG flAttrs; + HBITMAP hbm; + HBRUSH hbr = NULL; + + if (b8X8) + { + WARN("b8X8 is not supported, ignoring\n"); + } + + if (bPen) + { + WARN("bPen is not supported, ignoring\n"); + } + + if (uUsage > DIB_PAL_INDICES) + { + ERR("Invalid uUsage value: %lu\n", uUsage); + EngSetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Allocate a buffer for the packed DIB */ + pvPackedDIB = ExAllocatePoolWithTag(PagedPool, cj, GDITAG_TEMP); + if (pvPackedDIB == NULL) + { + ERR("Failed to allocate temp buffer of %u bytes\n", cj); + return NULL; + } + + /* Probe and copy the packed DIB */ + _SEH2_TRY + { + ProbeForRead(pv, cj, 1); + RtlCopyMemory(pvPackedDIB, pv, cj); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("Got exception, pv = %p, cj = %lu\n", pv, cj); + goto cleanup; + } + _SEH2_END; + + flAttrs = BR_IS_BITMAP | BR_IS_DIB; + + /* Check what kind of color table we have */ + if (uUsage == DIB_PAL_COLORS) + { + /* Remember it and use DIB_PAL_BRUSHHACK to create a "special" palette */ + flAttrs |= BR_IS_DIBPALCOLORS; + uUsage = DIB_PAL_BRUSHHACK; + } + else if (uUsage == DIB_PAL_INDICES) + { + /* No color table, bitmap contains device palette indices */ + flAttrs |= BR_IS_DIBPALINDICES; + + /* FIXME: This makes tests pass, but needs investigation. */ + flAttrs |= BR_IS_NULL; + } + + /* Create a bitmap from the DIB */ + hbm = GreCreateDIBitmapFromPackedDIB(pvPackedDIB, cj, uUsage); + if (hbm == NULL) + { + ERR("Failed to create bitmap from DIB\n"); + goto cleanup; + } + + /* Call the internal function (will delete hbm on failure) */ + hbr = CreateBrushInternal(flAttrs, 0, 0, hbm, pvClient); + +cleanup: + + ExFreePoolWithTag(pvPackedDIB, GDITAG_TEMP); + + return hbr; +} + +__kernel_entry +HBITMAP +APIENTRY +NtGdiGetObjectBitmapHandle( + _In_ HBRUSH hbr, + _Out_ UINT *piUsage) +{ + PBRUSH pbr; + HBITMAP hbm; + UINT uUsage; + + /* Lock the brush */ + pbr = BRUSH::LockForRead(hbr); + if (pbr == NULL) + { + ERR("Failed to lock brush %p\n", hbr); + return NULL; + } + + /* Call the member function */ + hbm = pbr->hbmGetBitmapHandle(&uUsage); + + /* Unlock the brush */ + pbr->vUnlock(); + + _SEH2_TRY + { + ProbeForWrite(piUsage, sizeof(*piUsage), 1); + *piUsage = uUsage; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("Got exception! piUsage = %p\n", piUsage); + hbm = NULL; + } + _SEH2_END; + + return hbm; +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiSetBrushAttributes( + _In_ HBRUSH hbr, + _In_ DWORD dwFlags) +{ + __debugbreak(); + return NULL; +} + +__kernel_entry +HBRUSH +APIENTRY +NtGdiClearBrushAttributes( + _In_ HBRUSH hbr, + _In_ DWORD dwFlags) +{ + __debugbreak(); + return NULL; +} + +} /* extern "C" */ Propchange: trunk/reactos/win32ss/gdi/ntgdi/brush.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/win32ss/gdi/ntgdi/brush.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.hp…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.hpp (added) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.hpp [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -0,0 +1,121 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS win32 subsystem + * PURPOSE: BRUSH class definition + * PROGRAMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) + */ + +#pragma once + +#include <win32k.h> +#include "baseobj.hpp" + +__prefast_operator_new_null + +class BRUSH : public BASEOBJECT, protected _BRUSHBODY +{ + +public: + _Analysis_mode_(_Analysis_operator_new_null_) + + inline + void* + __cdecl + operator new( + _In_ size_t cjSize) throw() + { + return ExAllocatePoolWithTag(PagedPool, cjSize, GDITAG_HMGR_BRUSH_TYPE); + //return BASEOBJECT::pvAllocate(GDIObjType_BRUSH_TYPE, cjSize); + } + + inline + void + operator delete( + void *pvObject) + { + /// HACK! better would be to extract the exact object type's tag + ExFreePool(pvObject); + //ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE); + //BASEOBJECT::pvFree(GDIObjType_BRUSH_TYPE, cjSize); + } + + BRUSH( + _In_ FLONG flAttrs, + _In_ COLORREF crColor, + _In_ ULONG iHatch, + _In_opt_ HBITMAP hbmPattern, + _In_opt_ PVOID pvClient, + _In_ GDILOOBJTYPE objtype); + + ~BRUSH( + VOID); + + static + VOID + vDeleteObject( + _In_ PVOID pvObject); + + BOOL + bAllocateBrushAttr( + VOID); + + _Check_return_ + _Ret_opt_bytecount_(sizeof(BRUSH)) + static + inline + PBRUSH + LockForRead( + _In_ HBRUSH hbr) + { + return static_cast<PBRUSH>( + BASEOBJECT::LockShared(hbr, + GDILoObjType_LO_BRUSH_TYPE, + BASEOBJECT::OWNER::PUBLIC)); + } + + _Check_return_ + _Ret_opt_bytecount_(sizeof(BRUSH)) + static + inline + PBRUSH + LockForWrite( + _In_ HBRUSH hbr) + { + return static_cast<PBRUSH>( + BASEOBJECT::LockShared(hbr, + GDILoObjType_LO_BRUSH_TYPE, + BASEOBJECT::OWNER::POWNED)); + } + + _Check_return_ + _Ret_opt_bytecap_(sizeof(BRUSH)) + static + inline + PBRUSH + LockAny( + _In_ HBRUSH hbr) + { + return static_cast<PBRUSH>( + BASEOBJECT::LockShared(hbr, + GDILoObjType_LO_BRUSH_TYPE, + BASEOBJECT::OWNER::NONE)); + } + + UINT + cjGetObject( + _In_ UINT cjBuffer, + _Out_bytecap_(cjBuffer) PLOGBRUSH plbBuffer) const; + + HBITMAP + hbmGetBitmapHandle( + _Out_ PUINT puUsage) const; + + VOID + vSetSolidColor( + _In_ COLORREF crColor); +}; + +/* HACK! */ +extern "C" +PGDI_POOL +GetBrushAttrPool(VOID); Propchange: trunk/reactos/win32ss/gdi/ntgdi/brush.hpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -28,6 +28,19 @@ * this is the only way it can ever be exclusively locked. It prevents the * object from being locked by another thread. A shared lock will simply fail, * while an exclusive lock will succeed after the object was unlocked. + * + * Ownership: + * + * Owner: POWNED PUBLIC NONE spec + * --------------------------------------------------- + * LockForRead + + - PUBLIC + * LockForWrite + - - POWNED + * LockAny + + + NONE + * NtGdiDeleteObjectApp + - - PUBLIC + * GreDeleteObject + + + NONE + * GreSetOwner(POWNED) - - + - + * GreSetOwner(PUBLIC) + - + - + * GreSetOwner(NONE) + - - - * */ @@ -1590,5 +1603,16 @@ return TRUE; } +/// HACK! +PGDI_POOL +GetBrushAttrPool(VOID) +{ + PPROCESSINFO ppi; + + ppi = PsGetCurrentProcessWin32Process(); + NT_ASSERT(ppi != NULL); + + return ppi->pPoolBrushAttr; +} /* EOF */ Modified: trunk/reactos/win32ss/pch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/pch.h?rev=66893&r1…
============================================================================== --- trunk/reactos/win32ss/pch.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/pch.h [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -66,6 +66,10 @@ /* SEH support with PSEH */ #include <pseh/pseh2.h> +#ifdef __cplusplus +extern "C" { +#endif + /* Public Win32K headers */ #include <include/ntgdityp.h> #include <ntgdi.h> @@ -91,4 +95,8 @@ /* Internal Win32K header */ #include "win32kp.h" +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __W32K_H */ Modified: trunk/reactos/win32ss/user/ntuser/ntuser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntuser…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/ntuser.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/ntuser.c [iso-8859-1] Wed Mar 25 22:38:20 2015 @@ -144,9 +144,14 @@ if (gpsi->hbrGray == NULL) { hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA); + if (hPattern55AABitmap == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + //NT_VERIFY(GreSetBitmapOwner(hPattern55AABitmap, GDI_OBJ_HMGR_PUBLIC)); gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap); GreDeleteObject(hPattern55AABitmap); - GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC); + if (gpsi->hbrGray == NULL) + return STATUS_INSUFFICIENT_RESOURCES; } return STATUS_SUCCESS;
9 years, 9 months
1
0
0
0
[tkreuzer] 66892: [WIN32K] Handle DIB_PAL_INDICES in DIB_BitmapInfoSize
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:37:16 2015 New Revision: 66892 URL:
http://svn.reactos.org/svn/reactos?rev=66892&view=rev
Log: [WIN32K] Handle DIB_PAL_INDICES in DIB_BitmapInfoSize Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Wed Mar 25 22:37:16 2015 @@ -1916,13 +1916,17 @@ INT FASTCALL DIB_BitmapInfoSize(const BITMAPINFO * info, WORD coloruse) { unsigned int colors, size, masks = 0; + unsigned int colorsize; + + colorsize = (coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : + (coloruse == DIB_PAL_INDICES) ? 0 : + sizeof(WORD); if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) { const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info; colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0; - return sizeof(BITMAPCOREHEADER) + colors * - ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD)); + return sizeof(BITMAPCOREHEADER) + colors * colorsize; } else /* Assume BITMAPINFOHEADER */ { @@ -1932,7 +1936,7 @@ colors = 1 << info->bmiHeader.biBitCount; if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3; size = max( info->bmiHeader.biSize, sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) ); - return size + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD)); + return size + colors * colorsize; } }
9 years, 9 months
1
0
0
0
[tkreuzer] 66891: [WIN32K] - Make brush structure definition C++ compatible - Add delete callback for GDI objects and use if for brushes. - Make IntGdiSetSolidBrushColor NTAPI instead of FASTCALL
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:32:48 2015 New Revision: 66891 URL:
http://svn.reactos.org/svn/reactos?rev=66891&view=rev
Log: [WIN32K] - Make brush structure definition C++ compatible - Add delete callback for GDI objects and use if for brushes. - Make IntGdiSetSolidBrushColor NTAPI instead of FASTCALL Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c trunk/reactos/win32ss/gdi/ntgdi/brush.h trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] Wed Mar 25 22:32:48 2015 @@ -154,6 +154,16 @@ } } +VOID +NTAPI +BRUSH_vDeleteObject( + PVOID pvObject) +{ + BRUSH_vCleanup(pvObject); + ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE); +} + + INT FASTCALL BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush) @@ -385,7 +395,7 @@ } VOID -FASTCALL +NTAPI IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color) { PBRUSH pbrush; Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Wed Mar 25 22:32:48 2015 @@ -11,12 +11,8 @@ * DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON * A MAILING LIST FIRST. */ -typedef struct _BRUSH -{ - /* Header for all gdi objects in the handle table. - Do not (re)move this. */ - BASEOBJECT BaseObject; - +typedef struct _BRUSHBODY +{ ULONG iHatch; // This is not the brush style, but the hatch style! HBITMAP hbmPattern; HBITMAP hbmClient; @@ -34,6 +30,8 @@ PVOID pvRBrush; HDEV hdev; //DWORD unk054; + + /* The following members are for PENs only */ LONG lWidth; FLOAT eWidth; ULONG ulPenStyle; @@ -47,7 +45,21 @@ //DWORD unk078; // 0x078 DWORD unk07c; // 0x07c LIST_ENTRY ListHead; // 0x080 +} BRUSHBODY; + +#ifndef __cplusplus +typedef struct _BRUSH +{ + /* Header for all gdi objects in the handle table. + Do not (re)move this. */ + BASEOBJECT BaseObject; + + BRUSHBODY; } BRUSH, *PBRUSH; +#else +class BRUSH; +typedef class BRUSH *PBRUSH; +#endif typedef struct _EBRUSHOBJ { @@ -68,7 +80,7 @@ struct _PALETTE * ppalDC; struct _PALETTE * ppalDIB; // DWORD dwUnknown44; - BRUSH * pbrush; + PBRUSH pbrush; FLONG flattrs; DWORD ulUnique; // DWORD dwUnknown54; @@ -109,8 +121,8 @@ VOID NTAPI -BRUSH_vCleanup( - PVOID ObjectBody); +BRUSH_vDeleteObject( + PVOID pvObject); extern HSURF gahsurfHatch[HS_DDI_MAX]; @@ -188,5 +200,8 @@ HBRUSH APIENTRY IntGdiCreateNullBrush(VOID); -VOID FASTCALL -IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color); +VOID +NTAPI +IntGdiSetSolidBrushColor( + _In_ HBRUSH hbr, + _In_ COLORREF crColor); Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Wed Mar 25 22:32:48 2015 @@ -159,7 +159,7 @@ NULL, /* 0d GDIObjType_PFT_TYPE, unused */ GDIOBJ_vCleanup, /* 0e GDIObjType_ICMCXF_TYPE */ NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */ - BRUSH_vCleanup, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */ + NULL, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */ NULL, /* 11 GDIObjType_UMPD_TYPE, unused */ NULL, /* 12 GDIObjType_UNUSED4_TYPE */ NULL, /* 13 GDIObjType_SPACE_TYPE, unused */ @@ -177,6 +177,44 @@ NULL, /* 1f reserved entry */ }; +static const +GDIOBJDELETEPROC +apfnDelete[] = +{ + NULL, /* 00 GDIObjType_DEF_TYPE */ + NULL, /* 01 GDIObjType_DC_TYPE */ + NULL, /* 02 GDIObjType_UNUSED1_TYPE */ + NULL, /* 03 GDIObjType_UNUSED2_TYPE */ + NULL, /* 04 GDIObjType_RGN_TYPE */ + NULL, /* 05 GDIObjType_SURF_TYPE */ + NULL, /* 06 GDIObjType_CLIENTOBJ_TYPE */ + NULL, /* 07 GDIObjType_PATH_TYPE */ + NULL, /* 08 GDIObjType_PAL_TYPE */ + NULL, /* 09 GDIObjType_ICMLCS_TYPE */ + NULL, /* 0a GDIObjType_LFONT_TYPE */ + NULL, /* 0b GDIObjType_RFONT_TYPE, unused */ + NULL, /* 0c GDIObjType_PFE_TYPE, unused */ + NULL, /* 0d GDIObjType_PFT_TYPE, unused */ + NULL, /* 0e GDIObjType_ICMCXF_TYPE */ + NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */ + BRUSH_vDeleteObject, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */ + NULL, /* 11 GDIObjType_UMPD_TYPE, unused */ + NULL, /* 12 GDIObjType_UNUSED4_TYPE */ + NULL, /* 13 GDIObjType_SPACE_TYPE, unused */ + NULL, /* 14 GDIObjType_UNUSED5_TYPE */ + NULL, /* 15 GDIObjType_META_TYPE, unused */ + NULL, /* 16 GDIObjType_EFSTATE_TYPE, unused */ + NULL, /* 17 GDIObjType_BMFD_TYPE, unused */ + NULL, /* 18 GDIObjType_VTFD_TYPE, unused */ + NULL, /* 19 GDIObjType_TTFD_TYPE, unused */ + NULL, /* 1a GDIObjType_RC_TYPE, unused */ + NULL, /* 1b GDIObjType_TEMP_TYPE, unused */ + NULL, /* 1c GDIObjType_DRVOBJ_TYPE */ + NULL, /* 1d GDIObjType_DCIOBJ_TYPE, unused */ + NULL, /* 1e GDIObjType_SPOOL_TYPE, unused */ + NULL, /* 1f reserved entry */ +}; + /* INTERNAL FUNCTIONS ********************************************************/ static @@ -547,18 +585,27 @@ /* Get the object type */ objt = ((ULONG_PTR)pobj->hHmgr >> 16) & 0x1f; - /* Call the cleanup procedure */ - ASSERT(apfnCleanup[objt]); - apfnCleanup[objt](pobj); - - /* Check if the object is allocated from a lookaside list */ - if (pobj->BaseFlags & BASEFLAG_LOOKASIDE) - { - ExFreeToPagedLookasideList(&gpaLookasideList[objt], pobj); + /* Check if we have a delete procedure (for C++ based objects) */ + if (apfnDelete[objt] != NULL) + { + /* Invoke the delete procedure */ + apfnDelete[objt](pobj); } else { - ExFreePoolWithTag(pobj, GDIOBJ_POOL_TAG(objt)); + /* Call the cleanup procedure */ + NT_ASSERT(apfnCleanup[objt]); + apfnCleanup[objt](pobj); + + /* Check if the object is allocated from a lookaside list */ + if (pobj->BaseFlags & BASEFLAG_LOOKASIDE) + { + ExFreeToPagedLookasideList(&gpaLookasideList[objt], pobj); + } + else + { + ExFreePoolWithTag(pobj, GDIOBJ_POOL_TAG(objt)); + } } } Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h [iso-8859-1] Wed Mar 25 22:32:48 2015 @@ -31,6 +31,7 @@ typedef PVOID PGDIOBJ; typedef VOID (NTAPI *GDICLEANUPPROC)(PVOID ObjectBody); +typedef VOID (NTAPI *GDIOBJDELETEPROC)(PVOID ObjectBody); /* Every GDI Object must have this standard type of header. * It's for thread locking. */
9 years, 9 months
1
0
0
0
[tkreuzer] 66890: [WIN32K] - Add InterlockedIn/DecrementUL - Define NULL to nullptr for C++ code - Reorder includes a bit. First GDI then USER. Don't include most USER headers for C++ for now.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:32:35 2015 New Revision: 66890 URL:
http://svn.reactos.org/svn/reactos?rev=66890&view=rev
Log: [WIN32K] - Add InterlockedIn/DecrementUL - Define NULL to nullptr for C++ code - Reorder includes a bit. First GDI then USER. Don't include most USER headers for C++ for now. Modified: trunk/reactos/win32ss/pch.h trunk/reactos/win32ss/user/ntuser/win32.h trunk/reactos/win32ss/win32k.h trunk/reactos/win32ss/win32kp.h Modified: trunk/reactos/win32ss/pch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/pch.h?rev=66890&r1…
============================================================================== --- trunk/reactos/win32ss/pch.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/pch.h [iso-8859-1] Wed Mar 25 22:32:35 2015 @@ -67,13 +67,16 @@ #include <pseh/pseh2.h> /* Public Win32K headers */ -#include <include/callback.h> +#include <include/ntgdityp.h> +#include <ntgdi.h> +#include <include/ntgdihdl.h> +#include <include/ntgdibad.h> + +#ifndef __cplusplus #include <include/ntusrtyp.h> #include <include/ntuser.h> -#include <include/ntgdityp.h> -#include <include/ntgdibad.h> -#include <include/ntgdihdl.h> -#include <ntgdi.h> +#include <include/callback.h> +#endif // __cplusplus /* Undocumented user definitions */ #include <undocuser.h> @@ -82,6 +85,9 @@ #include <ft2build.h> #include FT_FREETYPE_H +#define InterlockedIncrementUL(Value) InterlockedIncrement((PLONG)Value) +#define InterlockedDecrementUL(Value) InterlockedDecrement((PLONG)Value) + /* Internal Win32K header */ #include "win32kp.h" Modified: trunk/reactos/win32ss/user/ntuser/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/win32.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] Wed Mar 25 22:32:35 2015 @@ -49,7 +49,7 @@ extern BOOL ClientPfnInit; extern HINSTANCE hModClient; extern HANDLE hModuleWin; // This Win32k Instance. -extern PCLS SystemClassList; +extern struct _CLS *SystemClassList; extern BOOL RegisteredSysClasses; typedef struct tagMENUSTATE MENUSTATE, *PMENUSTATE; @@ -77,17 +77,22 @@ PVOID pUMPDObj; } W32THREAD, *PW32THREAD; +#ifdef __cplusplus +typedef struct _THREADINFO : _W32THREAD +{ +#else typedef struct _THREADINFO { W32THREAD; +#endif PTL ptl; PPROCESSINFO ppi; struct _USER_MESSAGE_QUEUE* MessageQueue; struct tagKL* KeyboardLayout; - PCLIENTTHREADINFO pcti; + struct _CLIENTTHREADINFO * pcti; struct _DESKTOP* rpdesk; - PDESKTOPINFO pDeskInfo; - PCLIENTINFO pClientInfo; + struct _DESKTOPINFO * pDeskInfo; + struct _CLIENTINFO * pClientInfo; FLONG TIF_flags; PUNICODE_STRING pstrAppName; /* Messages that are currently dispatched to other threads */ @@ -112,7 +117,7 @@ struct _USER_MESSAGE_QUEUE* pqAttach; PTHREADINFO ptiSibling; ULONG fsHooks; - PHOOK sphkCurrent; + struct tagHOOK * sphkCurrent; LPARAM lParamHkCurrent; WPARAM wParamHkCurrent; struct tagSBTRACK* pSBTrack; @@ -130,6 +135,7 @@ WCHAR wchInjected; UINT cWindows; UINT cVisWindows; +#ifndef __cplusplus /// FIXME! LIST_ENTRY aphkStart[NB_HOOKS]; CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL. @@ -151,7 +157,7 @@ #if DBG USHORT acExclusiveLockCount[GDIObjTypeTotal + 1]; #endif - +#endif // __cplusplus } THREADINFO; #include <poppack.h> @@ -234,14 +240,19 @@ #define CLIBS 32 +#ifdef __cplusplus +typedef struct _PROCESSINFO : _W32PROCESS +{ +#else typedef struct _PROCESSINFO { W32PROCESS; +#endif PTHREADINFO ptiList; PTHREADINFO ptiMainThread; struct _DESKTOP* rpdeskStartup; - PCLS pclsPrivateList; - PCLS pclsPublicList; + struct _CLS *pclsPrivateList; + struct _CLS *pclsPublicList; PPROCESSINFO ppiNext; INT cThreads; HDESK hdeskStartup; @@ -276,8 +287,10 @@ #if DBG BYTE DbgChannelLevel[DbgChCount]; +#ifndef __cplusplus DWORD DbgHandleCount[TYPE_CTYPES]; -#endif +#endif // __cplusplus +#endif // DBG } PROCESSINFO; #if DBG Modified: trunk/reactos/win32ss/win32k.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/win32k.h?rev=66890…
============================================================================== --- trunk/reactos/win32ss/win32k.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/win32k.h [iso-8859-1] Wed Mar 25 22:32:35 2015 @@ -3,3 +3,8 @@ /* Headers that shouldn't be precompiled due to GCC bugs */ /* Probe and capture */ #include <reactos/probe.h> + +#ifdef __cplusplus +#undef NULL +#define NULL nullptr +#endif Modified: trunk/reactos/win32ss/win32kp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/win32kp.h?rev=6689…
============================================================================== --- trunk/reactos/win32ss/win32kp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/win32kp.h [iso-8859-1] Wed Mar 25 22:32:35 2015 @@ -27,18 +27,10 @@ #define DBG_ENABLE_EVENT_LOGGING 0 #define DBG_ENABLE_SERVICE_HOOKS 0 -/* CSRSS Interface */ -#include "user/ntuser/csr.h" - -/* Misc headers */ -#include "user/ntuser/win32kdebug.h" -#include "user/ntuser/mmcopy.h" -#include "user/ntuser/tags.h" +/* Internal NtGdi Headers */ +typedef struct _DC *PDC; #include "gdi/ntgdi/rect.h" #include "gdi/ntgdi/misc.h" - -/* Internal NtGdi Headers */ -typedef struct _DC *PDC; #include "gdi/ntgdi/gdiobj.h" #include "gdi/ntgdi/palette.h" #include "gdi/eng/surface.h" @@ -74,7 +66,10 @@ #include "reactx/ntddraw/intddraw.h" /* Internal NtUser Headers */ +#include "user/ntuser/win32kdebug.h" #include "user/ntuser/win32.h" +#include "user/ntuser/tags.h" +#ifndef __cplusplus #include "user/ntuser/usrheap.h" #include "user/ntuser/object.h" #include "user/ntuser/ntuser.h" @@ -106,5 +101,11 @@ #include "user/ntuser/scroll.h" #include "user/ntuser/winpos.h" #include "user/ntuser/callback.h" +#include "user/ntuser/mmcopy.h" + +/* CSRSS Interface */ +#include "user/ntuser/csr.h" + +#endif // __cplusplus #include "gdi/ntgdi/gdidebug.h"
9 years, 9 months
1
0
0
0
[tkreuzer] 66889: [WIN32K] Make internal GDI headers C++ compatible, get rid of USER dependencies
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:32:22 2015 New Revision: 66889 URL:
http://svn.reactos.org/svn/reactos?rev=66889&view=rev
Log: [WIN32K] Make internal GDI headers C++ compatible, get rid of USER dependencies Modified: trunk/reactos/win32ss/gdi/eng/driverobj.h trunk/reactos/win32ss/gdi/eng/eng.h trunk/reactos/win32ss/gdi/eng/engobjects.h trunk/reactos/win32ss/gdi/eng/mapping.h trunk/reactos/win32ss/gdi/ntgdi/dc.h trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h trunk/reactos/win32ss/gdi/ntgdi/palette.h Modified: trunk/reactos/win32ss/gdi/eng/driverobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/driverobj.…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/driverobj.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/driverobj.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -22,5 +22,5 @@ PEDRIVEROBJ DRIVEROBJ_TryLockObject(HDRVOBJ hdo) { - return GDIOBJ_TryLockObject(hdo, GDIObjType_DRVOBJ_TYPE); + return (PEDRIVEROBJ)GDIOBJ_TryLockObject(hdo, GDIObjType_DRVOBJ_TYPE); } Modified: trunk/reactos/win32ss/gdi/eng/eng.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/eng.h?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -32,8 +32,8 @@ VOID FASTCALL IntEngWindowChanged( - _In_ PWND Window, - _In_ FLONG flChanged); + _In_ struct _WND *Window, + _In_ FLONG flChanged); ULONGLONG APIENTRY Modified: trunk/reactos/win32ss/gdi/eng/engobjects.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engobjects…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engobjects.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -40,9 +40,14 @@ ---------------------------------------------------------------------------*/ /* EXtended CLip and Window Region Object */ +#ifdef __cplusplus +typedef struct _XCLIPOBJ : _WNDOBJ +{ +#else typedef struct _XCLIPOBJ { WNDOBJ; +#endif PVOID pClipRgn; /* prgnRao_ or (prgnVis_ if (prgnRao_ == z)) */ RECTL rclClipRgn; PVOID pscanClipRgn; /* Ptr to regions rect buffer based on iDirection. */ Modified: trunk/reactos/win32ss/gdi/eng/mapping.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mapping.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mapping.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -16,9 +16,14 @@ PVOID pSection; } FILEVIEW, *PFILEVIEW; +#ifdef __cplusplus +typedef struct _FONTFILEVIEW : FILEVIEW +{ +#else typedef struct _FONTFILEVIEW { FILEVIEW; +#endif DWORD reserved[2]; PWSTR pwszPath; SIZE_T ulRegionSize; Modified: trunk/reactos/win32ss/gdi/ntgdi/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dc.h?rev…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -220,7 +220,7 @@ { PDC pdc; - pdc = GDIOBJ_LockObject(hdc, GDIObjType_DC_TYPE); + pdc = (PDC)GDIOBJ_LockObject(hdc, GDIObjType_DC_TYPE); if (pdc) { ASSERT((GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_DC_TYPE) || Modified: trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdidebug…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdidebug.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -125,6 +125,7 @@ #define ID_Win32PreServiceHook 'WSH0' #define ID_Win32PostServiceHook 'WSH1' +#ifndef __cplusplus FORCEINLINE void GdiDbgAssertNoLocks(char * pszFile, ULONG nLine) { @@ -139,6 +140,7 @@ ASSERT(FALSE); } } +#endif // __cplusplus #endif Modified: trunk/reactos/win32ss/gdi/ntgdi/palette.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/palette.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/palette.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/palette.h [iso-8859-1] Wed Mar 25 22:32:22 2015 @@ -1,4 +1,8 @@ #pragma once + +#ifdef _MSC_VER +#pragma warning(disable:4200) // zero-sized array in struct/union +#endif // _MSC_VER // Palette mode flags enum _PALFLAGS
9 years, 9 months
1
0
0
0
[tkreuzer] 66888: [WIN32SS/INCLUDE] - Add ntwin32.h, move declaration of PTHREADINFO, PPROCESSINFO and W32CLIENTINFO there - Avoid language extensions that are not C++ compatible - Avoid dependenen...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:32:06 2015 New Revision: 66888 URL:
http://svn.reactos.org/svn/reactos?rev=66888&view=rev
Log: [WIN32SS/INCLUDE] - Add ntwin32.h, move declaration of PTHREADINFO, PPROCESSINFO and W32CLIENTINFO there - Avoid language extensions that are not C++ compatible - Avoid dependenence to PTHREADINFO/PPROCESSINFO in ntuser.h and use incomplete types instead - Move duplicate definition of PATRECT from ntusrtyp.h to user32.h private header Modified: trunk/reactos/win32ss/include/ntgdityp.h trunk/reactos/win32ss/include/ntuser.h trunk/reactos/win32ss/include/ntusrtyp.h trunk/reactos/win32ss/user/user32/include/user32.h Modified: trunk/reactos/win32ss/include/ntgdityp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntgdityp.h…
============================================================================== --- trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] Wed Mar 25 22:32:06 2015 @@ -10,6 +10,8 @@ #ifndef _NTGDITYP_ #define _NTGDITYP_ + +#include "ntwin32.h" /* ENUMERATIONS **************************************************************/ @@ -436,9 +438,7 @@ DWORD dwCFCount; } CFONT, *PCFONT; -// -// GDI Batch structures. -// +/* GDI Batch structures. */ typedef struct _GDIBATCHHDR { SHORT Size; @@ -464,24 +464,13 @@ ULONG ulBrushClr; } GDIBSPATBLT, *PGDIBSPATBLT; -#ifndef _NTUSRTYP_ +/* FIXME: this should go to some "public" GDI32 header */ typedef struct _PATRECT { RECT r; HBRUSH hBrush; } PATRECT, * PPATRECT; -#endif -#ifndef __WIN32K_NTUSER_H -typedef struct _W32CLIENTINFO -{ - ULONG CI_flags; - ULONG cSpins; - ULONG ulWindowsVersion; - ULONG ulAppCompatFlags; - ULONG ulAppCompatFlags2; - ULONG W32ClientInfo[57]; -} W32CLIENTINFO, *PW32CLIENTINFO; -#endif + typedef struct _GDIBSPPATBLT { GDIBATCHHDR gbHdr; @@ -539,26 +528,20 @@ { GDIBATCHHDR gbHdr; int fnMode; - RECTL; + RECTL rcl; } GDIBSEXTSELCLPRGN, *PGDIBSEXTSELCLPRGN; -// -// Use with GdiBCSelObj, GdiBCDelObj and GdiBCDelRgn. + +/* Use with GdiBCSelObj, GdiBCDelObj and GdiBCDelRgn. */ typedef struct _GDIBSOBJECT { GDIBATCHHDR gbHdr; HGDIOBJ hgdiobj; } GDIBSOBJECT, *PGDIBSOBJECT; -// -// Declarations missing in ddk/winddi.h -// +/* Declaration missing in ddk/winddi.h */ typedef VOID (APIENTRY *PFN_DrvMovePanning)(LONG, LONG, FLONG); -//typedef BOOL (APIENTRY *PFN_DrvOffset)(SURFOBJ*, LONG, LONG, FLONG); - - -// -// Most of these are defined in ddk/winddi.h -// + +/* Most of these are defined in ddk/winddi.h */ typedef struct _DRIVER_FUNCTIONS { PFN_DrvEnablePDEV EnablePDEV; Modified: trunk/reactos/win32ss/include/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
============================================================================== --- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Wed Mar 25 22:32:06 2015 @@ -1,8 +1,8 @@ #ifndef __WIN32K_NTUSER_H #define __WIN32K_NTUSER_H -typedef struct _PROCESSINFO *PPROCESSINFO; -typedef struct _THREADINFO *PTHREADINFO; +struct _PROCESSINFO; +struct _THREADINFO; struct _DESKTOP; struct _WND; struct tagPOPUPMENU; @@ -21,8 +21,8 @@ union { PVOID pi; - PTHREADINFO pti; /* pointer to Win32ThreadInfo */ - PPROCESSINFO ppi; /* pointer to W32ProcessInfo */ + struct _THREADINFO *pti; /* pointer to Win32ThreadInfo */ + struct _PROCESSINFO *ppi; /* pointer to W32ProcessInfo */ }; unsigned char type; /* object type (0 if free) */ unsigned char flags; @@ -141,7 +141,7 @@ HWND hShellWindow; struct _WND *spwndShell; - PPROCESSINFO ppiShellProcess; + struct _PROCESSINFO *ppiShellProcess; union { @@ -178,7 +178,7 @@ typedef struct _THROBJHEAD { HEAD; - PTHREADINFO pti; + struct _THREADINFO *pti; } THROBJHEAD, *PTHROBJHEAD; typedef struct _THRDESKHEAD @@ -200,7 +200,7 @@ { HEAD; ULONG hTaskWow; - PPROCESSINFO ppi; + struct _PROCESSINFO *ppi; } PROCMARKHEAD, *PPROCMARKHEAD; #define UserHMGetHandle(obj) ((obj)->head.h) @@ -218,7 +218,7 @@ ULONG_PTR offPfn; ULONG flags; /* Some internal flags */ INT ihmod; - PTHREADINFO ptiHooked; + struct _THREADINFO *ptiHooked; struct _DESKTOP *rpdesk; /* ReactOS */ LIST_ENTRY Chain; /* Hook chain entry */ @@ -309,7 +309,7 @@ LPDWORD lpdwRegisteredClasses; ULONG Win32ClientInfo3[26]; /* It's just a pointer reference not to be used w the structure in user space. */ - PPROCESSINFO ppi; + struct _PROCESSINFO *ppi; } CLIENTINFO, *PCLIENTINFO; /* Make sure it fits into the TEB */ @@ -1032,8 +1032,8 @@ LUID luid; } BROADCASTPARM, *PBROADCASTPARM; -PTHREADINFO GetW32ThreadInfo(VOID); -PPROCESSINFO GetW32ProcessInfo(VOID); +struct _THREADINFO *GetW32ThreadInfo(VOID); +struct _PROCESSINFO *GetW32ProcessInfo(VOID); typedef struct _WNDMSG { Modified: trunk/reactos/win32ss/include/ntusrtyp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntusrtyp.h…
============================================================================== --- trunk/reactos/win32ss/include/ntusrtyp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntusrtyp.h [iso-8859-1] Wed Mar 25 22:32:06 2015 @@ -11,15 +11,11 @@ #ifndef _NTUSRTYP_ #define _NTUSRTYP_ +#include <ntwin32.h> + /* ENUMERATIONS **************************************************************/ /* TYPES *********************************************************************/ - -typedef struct _PATRECT -{ - RECT r; - HBRUSH hBrush; -} PATRECT, * PPATRECT; /* Bitfields for UserpreferencesMask SPI_ values (with defaults) */ /* See also
http://technet.microsoft.com/nl-nl/library/cc957204(en-us).aspx
*/ @@ -88,7 +84,7 @@ typedef struct { union - { + { ICONRESDIR icon; CURSORRESDIR cursor; } ResInfo; Modified: trunk/reactos/win32ss/user/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/includ…
============================================================================== --- trunk/reactos/win32ss/user/user32/include/user32.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/include/user32.h [iso-8859-1] Wed Mar 25 22:32:06 2015 @@ -61,4 +61,11 @@ /* User macros */ #include "user_x.h" +/* FIXME: this should be in a "public" GDI32 header */ +typedef struct _PATRECT +{ + RECT r; + HBRUSH hBrush; +} PATRECT, * PPATRECT; + #endif /* _USER32_PCH_ */
9 years, 9 months
1
0
0
0
[tkreuzer] 66887: [WIN32K/INCLUDE] Add ntwin32.h
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:30:28 2015 New Revision: 66887 URL:
http://svn.reactos.org/svn/reactos?rev=66887&view=rev
Log: [WIN32K/INCLUDE] Add ntwin32.h Added: trunk/reactos/win32ss/include/ntwin32.h (with props) Added: trunk/reactos/win32ss/include/ntwin32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntwin32.h?…
============================================================================== --- trunk/reactos/win32ss/include/ntwin32.h (added) +++ trunk/reactos/win32ss/include/ntwin32.h [iso-8859-1] Wed Mar 25 22:30:28 2015 @@ -0,0 +1,16 @@ + +#pragma once + +/* These are opaque for user mode */ +typedef struct _PROCESSINFO *PPROCESSINFO; +typedef struct _THREADINFO *PTHREADINFO; + +typedef struct _W32CLIENTINFO +{ + ULONG CI_flags; + ULONG cSpins; + ULONG ulWindowsVersion; + ULONG ulAppCompatFlags; + ULONG ulAppCompatFlags2; + ULONG W32ClientInfo[57]; +} W32CLIENTINFO, *PW32CLIENTINFO; Propchange: trunk/reactos/win32ss/include/ntwin32.h ------------------------------------------------------------------------------ svn:eol-style = native
9 years, 9 months
1
0
0
0
[tkreuzer] 66886: [INCLUDE] - intsafe.h: Fix some constants to be C++ compatible - sal.h: Implement _Analysis_mode_, __prefast_operator_new_null and __prefast_operator_new_throws annotations - Make...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:27:44 2015 New Revision: 66886 URL:
http://svn.reactos.org/svn/reactos?rev=66886&view=rev
Log: [INCLUDE] - intsafe.h: Fix some constants to be C++ compatible - sal.h: Implement _Analysis_mode_, __prefast_operator_new_null and __prefast_operator_new_throws annotations - Make probe.h (mostly) C++ compatible Modified: trunk/reactos/include/ndk/no_sal2.h trunk/reactos/include/psdk/driverspecs.h trunk/reactos/include/psdk/intsafe.h trunk/reactos/include/psdk/sal.h trunk/reactos/include/reactos/probe.h Modified: trunk/reactos/include/ndk/no_sal2.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/no_sal2.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/no_sal2.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/no_sal2.h [iso-8859-1] Wed Mar 25 22:27:44 2015 @@ -5,6 +5,7 @@ /* From sal.h */ #define _Always_(annos) +#define _Analysis_mode_(mode) #define _Analysis_noreturn_ #define _Analysis_assume_(expr) __analysis_assume(expr) #define _At_(target, annos) @@ -664,6 +665,8 @@ #define _Kernel_requires_resource_not_held_(kind) #define _Kernel_acquires_resource_(kind) #define _Landmark_(name) +#define __prefast_operator_new_null +#define __prefast_operator_new_throws /* concurrencysal.h */ #define _Benign_race_begin_ __pragma(warning(push)) Modified: trunk/reactos/include/psdk/driverspecs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/driverspecs.h…
============================================================================== --- trunk/reactos/include/psdk/driverspecs.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/driverspecs.h [iso-8859-1] Wed Mar 25 22:27:44 2015 @@ -135,8 +135,14 @@ #define __internal_kernel_driver #define __kernel_code #define __kernel_driver -#define __prefast_operator_new_null -#define __prefast_operator_new_throws +#define __prefast_operator_new_null \ + void* __cdecl operator new(size_t size) throw(); \ + void* __cdecl operator new[](size_t size) throw(); \ + _Analysis_mode_(_Analysis_operator_new_null_) +#define __prefast_operator_new_throws \ + void* __cdecl operator new(size_t size) throw(std::bad_alloc); \ + void* __cdecl operator new[](size_t size) throw(std::bad_alloc); \ + _Analysis_mode_(_Analysis_operator_new_throw_) #define __user_code #define __user_driver #define ___drv_unit_internal_kernel_driver Modified: trunk/reactos/include/psdk/intsafe.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intsafe.h?rev…
============================================================================== --- trunk/reactos/include/psdk/intsafe.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/intsafe.h [iso-8859-1] Wed Mar 25 22:27:44 2015 @@ -147,12 +147,12 @@ #define INT8_MAX ((signed char)127) #define UINT8_MAX ((unsigned char)0xffU) -#define BYTE_MAX 0xff -#define SHORT_MAX 32767 +#define BYTE_MAX ((unsigned char)0xff) +#define SHORT_MAX ((short)32767) #define INT16_MAX ((short)32767) -#define USHORT_MAX 0xffff -#define UINT16_MAX ((unsigned short)0xffffU) -#define WORD_MAX 0xffff +#define USHORT_MAX ((unsigned short)0xffff) +#define UINT16_MAX ((unsigned short)0xffff) +#define WORD_MAX ((unsigned short)0xffff) #define INT_MAX 2147483647 #define INT32_MAX 2147483647 #define UINT_MAX 0xffffffff @@ -196,15 +196,15 @@ /* Error values */ #define INT8_ERROR ((signed char)(-1)) #define UINT8_ERROR ((unsigned char)0xff) -#define BYTE_ERROR 0xff -#define SHORT_ERROR (-1) +#define BYTE_ERROR ((unsigned char)0xff) +#define SHORT_ERROR ((short)(-1)) #define INT16_ERROR ((short)(-1)) -#define USHORT_ERROR 0xffff -#define UINT16_ERROR ((unsigned short)0xffffU) -#define WORD_ERROR 0xffff +#define USHORT_ERROR ((unsigned short)0xffff) +#define UINT16_ERROR ((unsigned short)0xffff) +#define WORD_ERROR ((unsigned short)0xffff) #define INT_ERROR (-1) #define INT32_ERROR (-1) -#define UINT_ERROR 0xffffffff +#define UINT_ERROR 0xffffffffU #define UINT32_ERROR 0xffffffffU #define LONG_ERROR (-1L) #define ULONG_ERROR 0xffffffffUL @@ -228,25 +228,25 @@ #define _SIZE_T_ERROR 0xffffffffffffffffULL #else /* _WIN64 */ #define INT_PTR_ERROR (-1) -#define UINT_PTR_ERROR 0xffffffff +#define UINT_PTR_ERROR 0xffffffffU #define LONG_PTR_ERROR (-1L) #define ULONG_PTR_ERROR 0xffffffffUL #define DWORD_PTR_ERROR 0xffffffffUL #define PTRDIFF_T_ERROR (-1) -#define SIZE_T_ERROR 0xffffffff +#define SIZE_T_ERROR 0xffffffffU #define SSIZE_T_ERROR (-1L) #define _SIZE_T_ERROR 0xffffffffUL #endif /* _WIN64 */ /* special definitons (the CHAR ones should not be defined here!) */ #define _INTSAFE_CHAR CHAR -#define _INTSAFE_CHAR_ERROR 0xff +#define _INTSAFE_CHAR_ERROR ((signed char)(-1)) #ifdef _CHAR_UNSIGNED - #define _INTSAFE_CHAR_MIN 0 - #define _INTSAFE_CHAR_MAX 0xff + #define _INTSAFE_CHAR_MIN ((unsigned char)0) + #define _INTSAFE_CHAR_MAX ((unsigned char)0xff) #else - #define _INTSAFE_CHAR_MIN (-128) - #define _INTSAFE_CHAR_MAX 127 + #define _INTSAFE_CHAR_MIN ((signed char)(-128)) + #define _INTSAFE_CHAR_MAX ((signed char)127) #endif /* _CHAR_UNSIGNED */ #define size_t_ERROR SIZE_T_ERROR Modified: trunk/reactos/include/psdk/sal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sal.h?rev=668…
============================================================================== --- trunk/reactos/include/psdk/sal.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/sal.h [iso-8859-1] Wed Mar 25 22:27:44 2015 @@ -53,9 +53,12 @@ #error broken #endif // ] -#pragma warning(disable:6320) /* disable warning about SEH filter */ -#pragma warning(disable:28247) /* duplicated model file annotations */ +#pragma warning(disable:6320) /* Disable warning about SEH filter */ +#pragma warning(disable:28247) /* Duplicated model file annotations */ #pragma warning(disable:28251) /* Inconsistent annotation */ +#ifndef _M_IX86 // [ +#pragma warning(disable:28110 28111 28161 28162) /* Floating point save */ +#endif // ] /******************************************************************************/ //#include "codeanalysis\sourceannotations.h" @@ -420,6 +423,9 @@ #define _At_buffer_(target, iter, bound, annos) [SAL_at_buffer(p1=_SA_SPECSTRIZE(target), p2=_SA_SPECSTRIZE(iter), p3=_SA_SPECSTRIZE(bound))] [SAL_begin] annos [SAL_end] #define _On_failure_(annos) [SAL_context(p1="SAL_failed")] _Group_(_Post_ _Group_(annos)) #define _Always_(annos) _Group_(annos) _On_failure_(annos) + +#define _Analysis_mode_impl_(mode) _SAL2_NAME(_Analysis_mode_impl) _Group_([SAL_annotes(Name="SAL_analysisMode", p1=_SA_SPECSTRIZE(mode))]) +#define _Analysis_mode_(mode) typedef _Analysis_mode_impl_(mode) int __prefast_analysis_mode_flag__COUNTER__; #define _Analysis_noreturn_ _SAL2_NAME(_Analysis_noreturn_) [SAL_annotes(Name="SAL_terminates")] #define _Analysis_assume_(expr) __assume(expr) @@ -1099,6 +1105,7 @@ #define __inner_exceptthat #define __inner_typefix(ctype) #define _Always_(annos) +#define _Analysis_mode_(mode) #define _Analysis_noreturn_ #define _Analysis_assume_(expr) ((void)0) #define __analysis_assume(expr) ((void)0) Modified: trunk/reactos/include/reactos/probe.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/probe.h?re…
============================================================================== --- trunk/reactos/include/reactos/probe.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/probe.h [iso-8859-1] Wed Mar 25 22:27:44 2015 @@ -12,7 +12,7 @@ static const ULARGE_INTEGER __emptyULargeInteger = {{0, 0}}; static const IO_STATUS_BLOCK __emptyIoStatusBlock = {{0}, 0}; -#if defined(_WIN32K_) +#if defined(_WIN32K_) && !defined(__cplusplus) static const LARGE_STRING __emptyLargeString = {0, 0, 0, NULL}; #endif @@ -152,7 +152,12 @@ { _SEH2_TRY { +#ifdef __cplusplus + ProbeForRead(UnsafeSrc, sizeof(*UnsafeSrc), 1); + RtlCopyMemory(Dest, UnsafeSrc, sizeof(*UnsafeSrc)); +#else *Dest = ProbeForReadUnicodeString(UnsafeSrc); +#endif if(Dest->Buffer != NULL) { if (Dest->Length != 0) @@ -162,7 +167,7 @@ sizeof(WCHAR)); /* Allocate space for the buffer */ - Buffer = ExAllocatePoolWithTag(PagedPool, + Buffer = (PWCHAR)ExAllocatePoolWithTag(PagedPool, Dest->Length + sizeof(WCHAR), 'RTSU'); if (Buffer == NULL)
9 years, 9 months
1
0
0
0
[tkreuzer] 66885: [WIN32K] Implement GreCreateDIBitmapFromPackedDIB
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:27:16 2015 New Revision: 66885 URL:
http://svn.reactos.org/svn/reactos?rev=66885&view=rev
Log: [WIN32K] Implement GreCreateDIBitmapFromPackedDIB Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h trunk/reactos/win32ss/gdi/ntgdi/dibobj.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dib.h?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dib.h [iso-8859-1] Wed Mar 25 22:27:16 2015 @@ -26,4 +26,11 @@ UINT MaxBits, UINT MaxInfo); +HBITMAP +NTAPI +GreCreateDIBitmapFromPackedDIB( + _In_reads_(cjPackedDIB )PVOID pvPackedDIB, + _In_ UINT cjPackedDIB, + _In_ ULONG uUsage); + #define DIB_PAL_BRUSHHACK 3 Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Wed Mar 25 22:27:16 2015 @@ -1539,6 +1539,56 @@ return Bmp; } +HBITMAP +NTAPI +GreCreateDIBitmapFromPackedDIB( + _In_reads_(cjPackedDIB )PVOID pvPackedDIB, + _In_ UINT cjPackedDIB, + _In_ ULONG uUsage) +{ + PBITMAPINFO pbmi; + PBYTE pjBits; + UINT cjInfo, cjBits; + HBITMAP hbm; + + /* We only support BITMAPINFOHEADER, make sure the size is ok */ + if (cjPackedDIB < sizeof(BITMAPINFOHEADER)) + { + return NULL; + } + + /* The packed DIB starts with the BITMAPINFOHEADER */ + pbmi = pvPackedDIB; + + if (cjPackedDIB < pbmi->bmiHeader.biSize) + { + return NULL; + } + + /* Calculate the info size and make sure the packed DIB is large enough */ + cjInfo = DIB_BitmapInfoSize(pbmi, uUsage); + if (cjPackedDIB <= cjInfo) + { + return NULL; + } + + /* The bitmap bits start after the header */ + pjBits = (PBYTE)pvPackedDIB + cjInfo; + cjBits = cjPackedDIB - cjInfo; + + hbm = GreCreateDIBitmapInternal(NULL, + pbmi->bmiHeader.biWidth, + abs(pbmi->bmiHeader.biHeight), + CBM_INIT | CBM_CREATDIB, + pjBits, + pbmi, + uUsage, + 0, + cjBits, + NULL); + + return hbm; +} HBITMAP APIENTRY
9 years, 9 months
1
0
0
0
[tkreuzer] 66884: [WIN32K] Add definition for DIB_PAL_INDICES and fix typo in the related brush flag (BR_IS_DIBPALINDICES). See http://support.microsoft.com/kb/kbview/108497
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Mar 25 22:27:05 2015 New Revision: 66884 URL:
http://svn.reactos.org/svn/reactos?rev=66884&view=rev
Log: [WIN32K] Add definition for DIB_PAL_INDICES and fix typo in the related brush flag (BR_IS_DIBPALINDICES). See
http://support.microsoft.com/kb/kbview/108497
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h trunk/reactos/win32ss/include/ntgdityp.h Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Wed Mar 25 22:27:05 2015 @@ -90,7 +90,7 @@ #define BR_IS_PEN 0x00000400 /* Pen */ #define BR_IS_OLDSTYLEPEN 0x00000800 /* Geometric pen */ #define BR_IS_DIBPALCOLORS 0x00001000 -#define BR_IS_DIBPALINDICE 0x00002000 +#define BR_IS_DIBPALINDICES 0x00002000 #define BR_IS_DEFAULTSTYLE 0x00004000 #define BR_IS_MASKING 0x00008000 /* Pattern bitmap is used as transparent mask (?) */ #define BR_IS_INSIDEFRAME 0x00010000 Modified: trunk/reactos/win32ss/include/ntgdityp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntgdityp.h…
============================================================================== --- trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] Wed Mar 25 22:27:05 2015 @@ -223,8 +223,12 @@ #define METARGN 2 // GetMetaRgn #define APIRGN 3 -/* Undocumented flag for fdwInit in CreateDIBitmap */ +/* New flag for fdwInit in CreateDIBitmap. See
support.microsoft.com/kb/kbview/108497*/
#define CBM_CREATDIB 2 + +/* New color use parameter. See
support.microsoft.com/kb/kbview/108497
*/ +#define DIB_PAL_INDICES 2 + /* TYPES *********************************************************************/
9 years, 9 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
50
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
Results per page:
10
25
50
100
200