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
May 2012
----- 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
12 participants
227 discussions
Start a n
N
ew thread
[tkreuzer] 56461: Fix a mistake
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue May 1 12:15:15 2012 New Revision: 56461 URL:
http://svn.reactos.org/svn/reactos?rev=56461&view=rev
Log: Fix a mistake Modified: trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c Modified: trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitmaps.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] Tue May 1 12:15:15 2012 @@ -143,7 +143,7 @@ IN OPTIONAL LPBYTE pUnsafeBits) { HBITMAP hbmp; - ULONG cRealBpp, cjWidthBytes, iFormat, fjBitmap; + ULONG cRealBpp, cjWidthBytes, iFormat; ULONGLONG cjSize; PSURFACE psurf; @@ -170,7 +170,7 @@ nWidth, nHeight, iFormat, - fjBitmap, + 0, 0, NULL); if (!psurf)
12 years, 7 months
1
0
0
0
[tkreuzer] 56460: [WIN32K] Rewrite SURFACE_AllocSurface(), which now does the part of the former SURFACE_bSetBitmapBits() as well. This is to allocate the bits for a bitmap directly with the SURFAC...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue May 1 12:14:10 2012 New Revision: 56460 URL:
http://svn.reactos.org/svn/reactos?rev=56460&view=rev
Log: [WIN32K] Rewrite SURFACE_AllocSurface(), which now does the part of the former SURFACE_bSetBitmapBits() as well. This is to allocate the bits for a bitmap directly with the SURFACE object in one allocation. Also don't use kernel mode sections anymore by default, but paged pool memory. Modified: trunk/reactos/win32ss/gdi/eng/surface.c trunk/reactos/win32ss/gdi/eng/surface.h trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c Modified: trunk/reactos/win32ss/gdi/eng/surface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] Tue May 1 12:14:10 2012 @@ -15,7 +15,7 @@ #define NDEBUG #include <debug.h> -ULONG giUniqueSurface = 0; +LONG giUniqueSurface = 0; UCHAR gajBitsPerFormat[11] = @@ -34,7 +34,9 @@ }; -ULONG FASTCALL BitmapFormat(ULONG cBits, ULONG iCompression) +ULONG +FASTCALL +BitmapFormat(ULONG cBits, ULONG iCompression) { switch (iCompression) { @@ -107,15 +109,10 @@ ASSERT(FALSE); } } - else if (psurf->SurfObj.fjBitmap & BMF_RLE_HACK) - { - /* HACK: Free RLE decompressed bits */ - EngFreeMem(pvBits); - } - else - { - /* There should be nothing to free */ - ASSERT(psurf->SurfObj.fjBitmap & BMF_DONT_FREE); + else if (psurf->SurfObj.fjBitmap & BMF_POOLALLOC) + { + /* Free a pool allocation */ + ExFreePool(pvBits); } } @@ -132,126 +129,162 @@ PSURFACE NTAPI SURFACE_AllocSurface( - IN USHORT iType, - IN ULONG cx, - IN ULONG cy, - IN ULONG iFormat) -{ + _In_ USHORT iType, + _In_ ULONG cx, + _In_ ULONG cy, + _In_ ULONG iFormat, + _In_ ULONG fjBitmap, + _In_opt_ ULONG cjWidth, + _In_opt_ PVOID pvBits) +{ + ULONG cBitsPixel, cjBits, cjObject; PSURFACE psurf; SURFOBJ *pso; + PVOID pvSection; + + ASSERT(!pvBits || (iType == STYPE_BITMAP)); + ASSERT(pvBits || !(fjBitmap & BMF_DONT_FREE)); + ASSERT(!pvBits || !(fjBitmap & BMF_SINGLEALLOC)); /* Verify format */ - if (iFormat < BMF_1BPP || iFormat > BMF_PNG) + if ((iFormat < BMF_1BPP) || (iFormat > BMF_PNG)) { DPRINT1("Invalid bitmap format: %ld\n", iFormat); return NULL; } + /* Get bits per pixel from the format */ + cBitsPixel = gajBitsPerFormat[iFormat]; + + /* Are bits and a width in bytes given? */ + if (pvBits && cjWidth) + { + /* Align the width (Windows compatibility, drivers expect that) */ + cjWidth = WIDTH_BYTES_ALIGN32((cjWidth << 3) / cBitsPixel, cBitsPixel); + } + else + { + /* Calculate width from the bitmap width in pixels */ + cjWidth = WIDTH_BYTES_ALIGN32(cx, cBitsPixel); + } + + /* Calculate the bitmap size in bytes */ + cjBits = cjWidth * cy; + + /* Check if we need an extra large object */ + if ((iType == STYPE_BITMAP) && (pvBits == NULL) && + !(fjBitmap & BMF_USERMEM) && !(fjBitmap & BMF_KMSECTION)) + { + /* Allocate an object large enough to hold the bits */ + cjObject = sizeof(SURFACE) + cjBits; + } + else + { + /* Otherwise just allocate the SURFACE structure */ + cjObject = sizeof(SURFACE); + } + + /* Check for arithmetic overflow */ + if ((cjBits < cjWidth) || (cjObject < sizeof(SURFACE))) + { + /* Fail! */ + return NULL; + } + /* Allocate a SURFACE object */ - psurf = (PSURFACE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP, sizeof(SURFACE)); - - if (psurf) - { - /* Initialize the basic fields */ - pso = &psurf->SurfObj; - pso->hsurf = psurf->BaseObject.hHmgr; - pso->sizlBitmap.cx = cx; - pso->sizlBitmap.cy = cy; - pso->iBitmapFormat = iFormat; - pso->iType = iType; - pso->iUniq = InterlockedIncrement((PLONG)&giUniqueSurface); - - /* Assign a default palette and increment its reference count */ - psurf->ppal = appalSurfaceDefault[iFormat]; - GDIOBJ_vReferenceObjectByPointer(&psurf->ppal->BaseObject); - } - - return psurf; -} - -BOOL -NTAPI -SURFACE_bSetBitmapBits( - IN PSURFACE psurf, - IN ULONG fjBitmap, - IN ULONG ulWidth, - IN PVOID pvBits OPTIONAL) -{ - SURFOBJ *pso = &psurf->SurfObj; - PVOID pvSection; - UCHAR cBitsPixel; - - /* Only bitmaps can have bits */ - ASSERT(psurf->SurfObj.iType == STYPE_BITMAP); - - /* Get bits per pixel from the format */ - cBitsPixel = gajBitsPerFormat[pso->iBitmapFormat]; - - /* Is a width in bytes given? */ - if (ulWidth) - { - /* Align the width (Windows compatibility, drivers expect that) */ - ulWidth = WIDTH_BYTES_ALIGN32((ulWidth << 3) / cBitsPixel, cBitsPixel); - } - else - { - /* Calculate width from the bitmap width in pixels */ - ulWidth = WIDTH_BYTES_ALIGN32(pso->sizlBitmap.cx, cBitsPixel); - } - - /* Calculate the bitmap size in bytes */ - pso->cjBits = ulWidth * pso->sizlBitmap.cy; - - /* Did the caller provide bits? */ - if (pvBits) - { - /* Yes, so let him free it */ - fjBitmap |= BMF_DONT_FREE; - } - else if (pso->cjBits) - { - /* We must allocate memory, check what kind */ - if (fjBitmap & BMF_USERMEM) + psurf = (PSURFACE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP, cjObject); + if (!psurf) + { + return NULL; + } + + /* Initialize the basic fields */ + pso = &psurf->SurfObj; + pso->hsurf = psurf->BaseObject.hHmgr; + pso->sizlBitmap.cx = cx; + pso->sizlBitmap.cy = cy; + pso->iBitmapFormat = iFormat; + pso->iType = iType; + pso->fjBitmap = (USHORT)fjBitmap; + pso->iUniq = InterlockedIncrement(&giUniqueSurface); + pso->cjBits = cjBits; + + /* Check if we need a bitmap buffer */ + if (iType == STYPE_BITMAP) + { + /* Check if we got one or if we need to allocate one */ + if (pvBits != NULL) + { + /* Use the caller provided buffer */ + pso->pvBits = pvBits; + } + else if (fjBitmap & BMF_USERMEM) { /* User mode memory was requested */ - pvBits = EngAllocUserMem(pso->cjBits, 0); + pso->pvBits = EngAllocUserMem(cjBits, 0); + + /* Check for failure */ + if (!pso->pvBits) + { + GDIOBJ_vDeleteObject(&psurf->BaseObject); + return NULL; + } + } + else if (fjBitmap & BMF_KMSECTION) + { + /* Use a kernel mode section */ + pso->pvBits = EngAllocSectionMem(&pvSection, + (fjBitmap & BMF_NOZEROINIT) ? + 0 : FL_ZERO_MEMORY, + cjBits, TAG_DIB); + + /* Check for failure */ + if (!pso->pvBits) + { + GDIOBJ_vDeleteObject(&psurf->BaseObject); + return NULL; + } + + /* Free the section already, but keep the mapping */ + EngFreeSectionMem(pvSection, NULL); } else { - /* Use a kernel mode section */ - fjBitmap |= BMF_KMSECTION; - pvBits = EngAllocSectionMem(&pvSection, - (fjBitmap & BMF_NOZEROINIT) ? - 0 : FL_ZERO_MEMORY, - pso->cjBits, TAG_DIB); - - /* Free the section already, but keep the mapping */ - if (pvBits) EngFreeSectionMem(pvSection, NULL); - } - - /* Check for failure */ - if (!pvBits) return FALSE; - } - - /* Set pvBits, pvScan0 and lDelta */ - pso->pvBits = pvBits; + /* Buffer is after the object */ + pso->pvBits = psurf + 1; + + /* Zero the buffer, except requested otherwise */ + if (!(fjBitmap & BMF_NOZEROINIT)) + { + RtlZeroMemory(pso->pvBits, cjBits); + } + } + } + else + { + /* There are no bitmap bits */ + pso->pvBits = NULL; + } + + /* Set pvScan0 and lDelta */ if (fjBitmap & BMF_TOPDOWN) { /* Topdown is the normal way */ pso->pvScan0 = pso->pvBits; - pso->lDelta = ulWidth; + pso->lDelta = cjWidth; } else { /* Inversed bitmap (bottom up) */ - pso->pvScan0 = (PVOID)((ULONG_PTR)pso->pvBits + pso->cjBits - ulWidth); - pso->lDelta = -(LONG)ulWidth; - } - - pso->fjBitmap = (USHORT)fjBitmap; - - /* Success */ - return TRUE; + pso->pvScan0 = ((PCHAR)pso->pvBits + pso->cjBits - cjWidth); + pso->lDelta = -(LONG)cjWidth; + } + + /* Assign a default palette and increment its reference count */ + psurf->ppal = appalSurfaceDefault[iFormat]; + GDIOBJ_vReferenceObjectByPointer(&psurf->ppal->BaseObject); + + return psurf; } HBITMAP @@ -267,7 +300,13 @@ HBITMAP hbmp; /* Allocate a surface */ - psurf = SURFACE_AllocSurface(STYPE_BITMAP, sizl.cx, sizl.cy, iFormat); + psurf = SURFACE_AllocSurface(STYPE_BITMAP, + sizl.cx, + sizl.cy, + iFormat, + fl, + lWidth, + pvBits); if (!psurf) { DPRINT1("SURFACE_AllocSurface failed.\n"); @@ -276,15 +315,6 @@ /* Get the handle for the bitmap */ hbmp = (HBITMAP)psurf->SurfObj.hsurf; - - /* Set the bitmap bits */ - if (!SURFACE_bSetBitmapBits(psurf, fl, lWidth, pvBits)) - { - /* Bail out if that failed */ - DPRINT1("SURFACE_bSetBitmapBits failed.\n"); - GDIOBJ_vDeleteObject(&psurf->BaseObject); - return NULL; - } /* Set public ownership */ GDIOBJ_vSetObjectOwner(&psurf->BaseObject, GDI_OBJ_HMGR_PUBLIC); @@ -308,10 +338,17 @@ HBITMAP hbmp; /* Allocate a surface */ - psurf = SURFACE_AllocSurface(STYPE_DEVBITMAP, sizl.cx, sizl.cy, iFormat); + psurf = SURFACE_AllocSurface(STYPE_DEVBITMAP, + sizl.cx, + sizl.cy, + iFormat, + 0, + 0, + NULL); if (!psurf) { - return 0; + DPRINT1("SURFACE_AllocSurface failed.\n"); + return NULL; } /* Set the device handle */ @@ -339,10 +376,17 @@ HSURF hsurf; /* Allocate a surface */ - psurf = SURFACE_AllocSurface(STYPE_DEVICE, sizl.cx, sizl.cy, iFormat); + psurf = SURFACE_AllocSurface(STYPE_DEVICE, + sizl.cx, + sizl.cy, + iFormat, + 0, + 0, + NULL); if (!psurf) { - return 0; + DPRINT1("SURFACE_AllocSurface failed.\n"); + return NULL; } /* Set the device handle */ Modified: trunk/reactos/win32ss/gdi/eng/surface.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] Tue May 1 12:14:10 2012 @@ -83,7 +83,8 @@ #define BMF_DONT_FREE 0x100 #define BMF_RLE_HACK 0x200 - +#define BMF_SINGLEALLOC 0x400 +#define BMF_POOLALLOC 0x800 /* Internal interface */ @@ -99,31 +100,30 @@ #define SURFACE_ShareUnlockSurface(pBMObj) \ GDIOBJ_vDereferenceObject ((POBJ)pBMObj) -BOOL NTAPI SURFACE_Cleanup(PVOID ObjectBody); - -PSURFACE -NTAPI -SURFACE_AllocSurface( - IN USHORT iType, - IN ULONG cx, - IN ULONG cy, - IN ULONG iFormat); - -BOOL -NTAPI -SURFACE_bSetBitmapBits( - IN PSURFACE psurf, - IN ULONG fjBitmap, - IN ULONG ulWidth, - IN PVOID pvBits OPTIONAL); - #define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev)) #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions -ULONG FASTCALL BitmapFormat(ULONG cBits, ULONG iCompression); extern UCHAR gajBitsPerFormat[]; #define BitsPerFormat(Format) gajBitsPerFormat[Format] #define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3) #define WIDTH_BYTES_ALIGN16(cx, bpp) ((((cx) * (bpp) + 15) & ~15) >> 3) +ULONG +FASTCALL +BitmapFormat(ULONG cBits, ULONG iCompression); + +BOOL +NTAPI +SURFACE_Cleanup(PVOID ObjectBody); + +PSURFACE +NTAPI +SURFACE_AllocSurface( + _In_ USHORT iType, + _In_ ULONG cx, + _In_ ULONG cy, + _In_ ULONG iFormat, + _In_ ULONG fjBitmap, + _In_opt_ ULONG cjWidth, + _In_opt_ PVOID pvBits); Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Tue May 1 12:14:10 2012 @@ -1160,34 +1160,36 @@ } /* Allocate a surface */ - psurfDest = SURFACE_AllocSurface(STYPE_BITMAP, 1, 1, BMF_32BPP); + psurfDest = SURFACE_AllocSurface(STYPE_BITMAP, + 1, + 1, + BMF_32BPP, + BMF_DONT_FREE, + 0, + &ulRGBColor); if (psurfDest) { - /* Set the bitmap bits */ - if (SURFACE_bSetBitmapBits(psurfDest, 0, 0, &ulRGBColor)) - { - RECTL rclDest = {0, 0, 1, 1}; - EXLATEOBJ exlo; - - /* Translate from the source palette to RGB color */ - EXLATEOBJ_vInitialize(&exlo, - psurfSrc->ppal, - &gpalRGB, - 0, - RGB(0xff,0xff,0xff), - RGB(0,0,0)); - - /* Call the copy bits function */ - EngCopyBits(&psurfDest->SurfObj, - &psurfSrc->SurfObj, - NULL, - &exlo.xlo, - &rclDest, - &ptlSrc); - - /* Cleanup the XLATEOBJ */ - EXLATEOBJ_vCleanup(&exlo); - } + RECTL rclDest = {0, 0, 1, 1}; + EXLATEOBJ exlo; + + /* Translate from the source palette to RGB color */ + EXLATEOBJ_vInitialize(&exlo, + psurfSrc->ppal, + &gpalRGB, + 0, + RGB(0xff,0xff,0xff), + RGB(0,0,0)); + + /* Call the copy bits function */ + EngCopyBits(&psurfDest->SurfObj, + &psurfSrc->SurfObj, + NULL, + &exlo.xlo, + &rclDest, + &ptlSrc); + + /* Cleanup the XLATEOBJ */ + EXLATEOBJ_vCleanup(&exlo); /* Delete the surface */ GDIOBJ_vDeleteObject(&psurfDest->BaseObject); Modified: trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitmaps.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitmaps.c [iso-8859-1] Tue May 1 12:14:10 2012 @@ -56,25 +56,36 @@ { PSURFACE psurf; HBITMAP hbmp; + PVOID pvCompressedBits; /* Verify format */ if (iFormat < BMF_1BPP || iFormat > BMF_PNG) return NULL; + /* The infamous RLE hack */ + if ((iFormat == BMF_4RLE) || (iFormat == BMF_8RLE)) + { + pvCompressedBits = pvBits; + pvBits = NULL; + iFormat = (iFormat == BMF_4RLE) ? BMF_4BPP : BMF_8BPP; + } + /* Allocate a surface */ - psurf = SURFACE_AllocSurface(STYPE_BITMAP, nWidth, nHeight, iFormat); + psurf = SURFACE_AllocSurface(STYPE_BITMAP, + nWidth, + nHeight, + iFormat, + fjBitmap, + cjWidthBytes, + pvBits); if (!psurf) { DPRINT1("SURFACE_AllocSurface failed.\n"); return NULL; } - /* Get the handle for the bitmap */ - hbmp = (HBITMAP)psurf->SurfObj.hsurf; - /* The infamous RLE hack */ - if (iFormat == BMF_4RLE || iFormat == BMF_8RLE) - { - PVOID pvCompressedBits; + if ((iFormat == BMF_4RLE) || (iFormat == BMF_8RLE)) + { SIZEL sizl; LONG lDelta; @@ -82,33 +93,16 @@ sizl.cy = nHeight; lDelta = WIDTH_BYTES_ALIGN32(nWidth, gajBitsPerFormat[iFormat]); - pvCompressedBits = pvBits; - pvBits = EngAllocMem(FL_ZERO_MEMORY, lDelta * nHeight, TAG_DIB); - if (!pvBits) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - GDIOBJ_vDeleteObject(&psurf->BaseObject); - return NULL; - } + pvBits = psurf->SurfObj.pvBits; DecompressBitmap(sizl, pvCompressedBits, pvBits, lDelta, iFormat); - fjBitmap |= BMF_RLE_HACK; - - iFormat = iFormat == BMF_4RLE ? BMF_4BPP : BMF_8BPP; - psurf->SurfObj.iBitmapFormat = iFormat; - } + psurf->SurfObj.fjBitmap |= BMF_RLE_HACK; + } + + /* Get the handle for the bitmap */ + hbmp = (HBITMAP)psurf->SurfObj.hsurf; /* Mark as API bitmap */ psurf->flags |= (flags | API_BITMAP); - - /* Set the bitmap bits */ - if (!SURFACE_bSetBitmapBits(psurf, fjBitmap, cjWidthBytes, pvBits)) - { - /* Bail out if that failed */ - DPRINT1("SURFACE_bSetBitmapBits failed.\n"); - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - GDIOBJ_vDeleteObject(&psurf->BaseObject); - return NULL; - } /* Unlock the surface and return */ SURFACE_UnlockSurface(psurf); @@ -149,8 +143,9 @@ IN OPTIONAL LPBYTE pUnsafeBits) { HBITMAP hbmp; - ULONG cRealBpp, cjWidthBytes, iFormat; + ULONG cRealBpp, cjWidthBytes, iFormat, fjBitmap; ULONGLONG cjSize; + PSURFACE psurf; /* Calculate bitmap format and real bits per pixel. */ iFormat = BitmapFormat(cBitsPixel * cPlanes, BI_RGB); @@ -170,12 +165,27 @@ return NULL; } - /* Call internal function. */ - hbmp = GreCreateBitmapEx(nWidth, nHeight, 0, iFormat, 0, 0, NULL, DDB_SURFACE); - - if (pUnsafeBits && hbmp) - { - PSURFACE psurf = SURFACE_ShareLockSurface(hbmp); + /* Allocate the surface (but don't set the bits) */ + psurf = SURFACE_AllocSurface(STYPE_BITMAP, + nWidth, + nHeight, + iFormat, + fjBitmap, + 0, + NULL); + if (!psurf) + { + DPRINT1("SURFACE_AllocSurface failed.\n"); + return NULL; + } + + /* Mark as API and DDB bitmap */ + psurf->flags |= (API_BITMAP | DDB_SURFACE); + + /* Check if we have bits to set */ + if (pUnsafeBits) + { + /* Protect with SEH and copy the bits */ _SEH2_TRY { ProbeForRead(pUnsafeBits, (SIZE_T)cjSize, 1); @@ -187,9 +197,18 @@ _SEH2_YIELD(return NULL;) } _SEH2_END - - SURFACE_ShareUnlockSurface(psurf); - } + } + else + { + /* Zero the bits */ + RtlZeroMemory(psurf->SurfObj.pvBits, psurf->SurfObj.cjBits); + } + + /* Get the handle for the bitmap */ + hbmp = (HBITMAP)psurf->SurfObj.hsurf; + + /* Unlock the surface */ + SURFACE_UnlockSurface(psurf); return hbmp; } @@ -324,7 +343,8 @@ HBITMAP Bmp; PDC Dc; - if (Width <= 0 || Height <= 0 || (Width * Height) > 0x3FFFFFFF) + /* Check parameters */ + if ((Width <= 0) || (Height <= 0) || ((Width * Height) > 0x3FFFFFFF)) { EngSetLastError(ERROR_INVALID_PARAMETER); return NULL; @@ -351,17 +371,19 @@ return Bmp; } -BOOL APIENTRY +BOOL +APIENTRY NtGdiGetBitmapDimension( HBITMAP hBitmap, - LPSIZE Dimension) + LPSIZE psizDim) { PSURFACE psurfBmp; - BOOL Ret = TRUE; + BOOL bResult = TRUE; if (hBitmap == NULL) return FALSE; + /* Lock the bitmap */ psurfBmp = SURFACE_ShareLockSurface(hBitmap); if (psurfBmp == NULL) { @@ -369,20 +391,22 @@ return FALSE; } + /* Use SEH to copy the data to the caller */ _SEH2_TRY { - ProbeForWrite(Dimension, sizeof(SIZE), 1); - *Dimension = psurfBmp->sizlDim; + ProbeForWrite(psizDim, sizeof(SIZE), 1); + *psizDim = psurfBmp->sizlDim; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Ret = FALSE; + bResult = FALSE; } _SEH2_END + /* Unlock the bitmap */ SURFACE_ShareUnlockSurface(psurfBmp); - return Ret; + return bResult; } @@ -580,7 +604,7 @@ psurfSrc->SurfObj.sizlBitmap.cy, abs(psurfSrc->SurfObj.lDelta), psurfSrc->SurfObj.iBitmapFormat, - psurfSrc->SurfObj.fjBitmap, + psurfSrc->SurfObj.fjBitmap & BMF_TOPDOWN, psurfSrc->SurfObj.cjBits, NULL, psurfSrc->flags);
12 years, 7 months
1
0
0
0
[tkreuzer] 56459: [WIN32K] Use GDIOBJ_vSetObjectOwner instead of GreSetObjectOwner on an exclusively locked object.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue May 1 10:33:36 2012 New Revision: 56459 URL:
http://svn.reactos.org/svn/reactos?rev=56459&view=rev
Log: [WIN32K] Use GDIOBJ_vSetObjectOwner instead of GreSetObjectOwner on an exclusively locked object. Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcstate.…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] Tue May 1 10:33:36 2012 @@ -257,7 +257,7 @@ /* Make it a kernel handle (FIXME: Windows handles this differently, see Wiki) */ - GreSetObjectOwner(hdcSave, GDI_OBJ_HMGR_PUBLIC); + GDIOBJ_vSetObjectOwner(&pdcSave->BaseObject, GDI_OBJ_HMGR_PUBLIC); /* Copy the current state */ DC_vCopyState(pdc, pdcSave, TRUE); @@ -266,7 +266,7 @@ if (pdc->dctype == DCTYPE_MEMORY) DC_vSelectSurface(pdcSave, pdc->dclevel.pSurface); - /* Copy path */ + /* Copy path */ /* FIXME: Why this way? */ pdcSave->dclevel.hPath = pdc->dclevel.hPath; pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE;
12 years, 7 months
1
0
0
0
[tkreuzer] 56458: [WIN32K] Don't calll GDIOBJ_vDereferenceObject from GDIOBJ_vUnlockObject, instead manually decrement the reference count. This allows us to ASSERT that the former function is neve...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue May 1 09:29:41 2012 New Revision: 56458 URL:
http://svn.reactos.org/svn/reactos?rev=56458&view=rev
Log: [WIN32K] Don't calll GDIOBJ_vDereferenceObject from GDIOBJ_vUnlockObject, instead manually decrement the reference count. This allows us to ASSERT that the former function is never called with an exclusive lock held. Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c 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] Tue May 1 09:29:41 2012 @@ -476,6 +476,9 @@ { ULONG cRefs, ulIndex; + /* Must not be exclusively locked */ + ASSERT(pobj->cExclusiveLock == 0); + /* Check if the object has a handle */ if (GDI_HANDLE_GET_INDEX(pobj->hHmgr)) { @@ -647,11 +650,13 @@ NTAPI GDIOBJ_vUnlockObject(POBJ pobj) { + ULONG cRefs, ulIndex; ASSERT(pobj->cExclusiveLock > 0); /* Decrease lock count */ pobj->cExclusiveLock--; DBG_DECREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), pobj->hHmgr); + DBG_LOGEVENT(&pobj->slhLog, EVENT_UNLOCK, 0); /* Check if this was the last lock */ if (pobj->cExclusiveLock == 0) @@ -664,9 +669,13 @@ KeLeaveCriticalRegion(); } - /* Dereference the object */ - DBG_LOGEVENT(&pobj->slhLog, EVENT_UNLOCK, 0); - GDIOBJ_vDereferenceObject(pobj); + /* Calculate the index */ + ulIndex = GDI_HANDLE_GET_INDEX(pobj->hHmgr); + + /* Decrement reference count */ + ASSERT((gpaulRefCount[ulIndex] & REF_MASK_COUNT) > 0); + cRefs = InterlockedDecrement((LONG*)&gpaulRefCount[ulIndex]); + ASSERT(cRefs & REF_MASK_VALID); } HGDIOBJ
12 years, 7 months
1
0
0
0
[tkreuzer] 56457: [WIN32K] Improve formatting
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue May 1 09:26:45 2012 New Revision: 56457 URL:
http://svn.reactos.org/svn/reactos?rev=56457&view=rev
Log: [WIN32K] Improve formatting Modified: trunk/reactos/win32ss/gdi/eng/mem.c Modified: trunk/reactos/win32ss/gdi/eng/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mem.c?rev=…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] Tue May 1 09:26:45 2012 @@ -14,133 +14,144 @@ /* * @implemented */ -PVOID APIENTRY -EngAllocMem(ULONG Flags, - ULONG MemSize, - ULONG Tag) +PVOID +APIENTRY +EngAllocMem( + ULONG Flags, + ULONG cjMemSize, + ULONG ulTag) { - PVOID newMem; + PVOID pvBaseAddress; - newMem = ExAllocatePoolWithTag((Flags & FL_NONPAGED_MEMORY) ? NonPagedPool : PagedPool, - MemSize, - Tag); + pvBaseAddress = ExAllocatePoolWithTag((Flags & FL_NONPAGED_MEMORY) ? + NonPagedPool : PagedPool, + cjMemSize, + ulTag); - if (newMem == NULL) + if (pvBaseAddress == NULL) return NULL; if (Flags & FL_ZERO_MEMORY) - RtlZeroMemory(newMem, MemSize); + RtlZeroMemory(pvBaseAddress, cjMemSize); - return newMem; + return pvBaseAddress; } /* * @implemented */ -VOID APIENTRY -EngFreeMem(PVOID Mem) +VOID +APIENTRY +EngFreeMem(PVOID pvBaseAddress) { - ExFreePool(Mem); + ExFreePool(pvBaseAddress); } /* * @implemented */ -PVOID APIENTRY -EngAllocUserMem(SIZE_T cj, ULONG Tag) +PVOID +APIENTRY +EngAllocUserMem(SIZE_T cjSize, ULONG ulTag) { - PVOID NewMem = NULL; - NTSTATUS Status; - SIZE_T MemSize = cj; + PVOID pvBaseAddress = NULL; + NTSTATUS Status; - Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + Status = ZwAllocateVirtualMemory(NtCurrentProcess(), + &pvBaseAddress, + 0, + &cjSize, + MEM_COMMIT | MEM_RESERVE, + PAGE_READWRITE); - if (! NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { - return NULL; + return NULL; } - /* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */ - //hSecure = EngSecureMem(NewMem, cj); + /* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */ + //hSecure = EngSecureMem(pvBaseAddress, cj); - return NewMem; + return pvBaseAddress; } /* * @implemented */ -VOID APIENTRY -EngFreeUserMem(PVOID pv) +VOID +APIENTRY +EngFreeUserMem(PVOID pvBaseAddress) { - PVOID BaseAddress = pv; - SIZE_T MemSize = 0; + SIZE_T cjSize = 0; - ZwFreeVirtualMemory(NtCurrentProcess(), &BaseAddress, &MemSize, MEM_RELEASE); + ZwFreeVirtualMemory(NtCurrentProcess(), + &pvBaseAddress, + &cjSize, + MEM_RELEASE); /* TODO: Remove allocation info from AVL tree */ } - PVOID APIENTRY HackSecureVirtualMemory( - IN PVOID Address, - IN SIZE_T Size, - IN ULONG ProbeMode, - OUT PVOID *SafeAddress) + IN PVOID Address, + IN SIZE_T Size, + IN ULONG ProbeMode, + OUT PVOID *SafeAddress) { - NTSTATUS Status = STATUS_SUCCESS; - PMDL mdl; - LOCK_OPERATION Operation; + NTSTATUS Status = STATUS_SUCCESS; + PMDL pmdl; + LOCK_OPERATION Operation; - if (ProbeMode == PAGE_READONLY) Operation = IoReadAccess; - else if (ProbeMode == PAGE_READWRITE) Operation = IoModifyAccess; - else return NULL; + if (ProbeMode == PAGE_READONLY) Operation = IoReadAccess; + else if (ProbeMode == PAGE_READWRITE) Operation = IoModifyAccess; + else return NULL; - mdl = IoAllocateMdl(Address, Size, FALSE, TRUE, NULL); - if (mdl == NULL) - { - return NULL; - } + pmdl = IoAllocateMdl(Address, Size, FALSE, TRUE, NULL); + if (pmdl == NULL) + { + return NULL; + } - _SEH2_TRY - { - MmProbeAndLockPages(mdl, UserMode, Operation); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END + _SEH2_TRY + { + MmProbeAndLockPages(pmdl, UserMode, Operation); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END - if (!NT_SUCCESS(Status)) - { - IoFreeMdl(mdl); - return NULL; - } + if (!NT_SUCCESS(Status)) + { + IoFreeMdl(pmdl); + return NULL; + } - *SafeAddress = MmGetSystemAddressForMdlSafe(mdl, NormalPagePriority); + *SafeAddress = MmGetSystemAddressForMdlSafe(pmdl, NormalPagePriority); - if(!*SafeAddress) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - return NULL; - } + if(!*SafeAddress) + { + MmUnlockPages(pmdl); + IoFreeMdl(pmdl); + return NULL; + } - return mdl; + return pmdl; } VOID APIENTRY HackUnsecureVirtualMemory( - IN PVOID SecureHandle) + IN PVOID SecureHandle) { - PMDL mdl = (PMDL)SecureHandle; + PMDL pmdl = (PMDL)SecureHandle; - MmUnlockPages(mdl); - IoFreeMdl(mdl); + MmUnlockPages(pmdl); + IoFreeMdl(pmdl); } /* @@ -150,7 +161,7 @@ EngSecureMem(PVOID Address, ULONG Length) { return (HANDLE)-1; // HACK!!! - return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE); + return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE); } /* @@ -160,7 +171,7 @@ EngUnsecureMem(HANDLE Mem) { if (Mem == (HANDLE)-1) return; // HACK!!! - MmUnsecureVirtualMemory((PVOID) Mem); + MmUnsecureVirtualMemory((PVOID) Mem); } /* EOF */
12 years, 7 months
1
0
0
0
[tfaber] 56456: [KMTESTS] - Fix 64 bit warnings - Do not force assembly syntax on GCC in ExInterlocked
by tfaber@svn.reactos.org
Author: tfaber Date: Tue May 1 09:13:19 2012 New Revision: 56456 URL:
http://svn.reactos.org/svn/reactos?rev=56456&view=rev
Log: [KMTESTS] - Fix 64 bit warnings - Do not force assembly syntax on GCC in ExInterlocked Modified: trunk/rostests/kmtests/include/kmt_test.h trunk/rostests/kmtests/kmtest/support.c trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c trunk/rostests/kmtests/kmtest_drv/printf_stubs.c trunk/rostests/kmtests/ntos_ex/ExInterlocked.c trunk/rostests/kmtests/rtl/RtlMemory.c Modified: trunk/rostests/kmtests/include/kmt_test.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_test.…
============================================================================== --- trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] (original) +++ trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] Tue May 1 09:13:19 2012 @@ -234,7 +234,7 @@ Buffer->Failures = 0; Buffer->Skipped = 0; Buffer->LogBufferLength = 0; - Buffer->LogBufferMaxLength = ResultBufferSize - FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer); + Buffer->LogBufferMaxLength = (ULONG)ResultBufferSize - FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer); return Buffer; } @@ -260,7 +260,7 @@ do { OldLength = Buffer->LogBufferLength; - NewLength = OldLength + Length; + NewLength = OldLength + (ULONG)Length; if (NewLength > Buffer->LogBufferMaxLength) return; } while (InterlockedCompareExchange(&Buffer->LogBufferLength, NewLength, OldLength) != OldLength); Modified: trunk/rostests/kmtests/kmtest/support.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest/support.c?…
============================================================================== --- trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] Tue May 1 09:13:19 2012 @@ -31,7 +31,7 @@ DWORD Error = ERROR_SUCCESS; DWORD BytesRead; - if (!DeviceIoControl(KmtestHandle, IOCTL_KMTEST_RUN_TEST, (PVOID)TestName, strlen(TestName), NULL, 0, &BytesRead, NULL)) + if (!DeviceIoControl(KmtestHandle, IOCTL_KMTEST_RUN_TEST, (PVOID)TestName, (DWORD)strlen(TestName), NULL, 0, &BytesRead, NULL)) error(Error); return Error; @@ -181,7 +181,7 @@ assert(ControlCode < 0x400); - if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), (PVOID)String, strlen(String), NULL, 0, &BytesRead, NULL)) + if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), (PVOID)String, (DWORD)strlen(String), NULL, 0, &BytesRead, NULL)) return GetLastError(); return ERROR_SUCCESS; Modified: trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/kmtest…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Tue May 1 09:13:19 2012 @@ -279,7 +279,7 @@ { NTSTATUS Status = STATUS_SUCCESS; PIO_STACK_LOCATION IoStackLocation; - ULONG Length = 0; + SIZE_T Length = 0; PAGED_CODE(); Modified: trunk/rostests/kmtests/kmtest_drv/printf_stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/printf…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/printf_stubs.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/printf_stubs.c [iso-8859-1] Tue May 1 09:13:19 2012 @@ -26,7 +26,7 @@ stream._base = (char *)buffer; stream._ptr = stream._base; stream._charbuf = 0; - stream._cnt = count; + stream._cnt = (int)count; stream._bufsiz = 0; stream._flag = _IOSTRG | _IOWRT; stream._tmpfname = 0; Modified: trunk/rostests/kmtests/ntos_ex/ExInterlocked.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ex/ExInterlo…
============================================================================== --- trunk/rostests/kmtests/ntos_ex/ExInterlocked.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_ex/ExInterlocked.c [iso-8859-1] Tue May 1 09:13:19 2012 @@ -5,18 +5,18 @@ * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> */ +#include <stddef.h> + /* missing prototypes >:| */ -#ifndef _MSC_VER -typedef long long __int64; -#endif -struct _KSPIN_LOCK; __declspec(dllimport) long __fastcall InterlockedCompareExchange(volatile long *, long, long); __declspec(dllimport) __int64 __fastcall ExInterlockedCompareExchange64(volatile __int64 *, __int64 *, __int64 *, void *); __declspec(dllimport) __int64 __fastcall ExfInterlockedCompareExchange64(volatile __int64 *, __int64 *, __int64 *); __declspec(dllimport) long __fastcall InterlockedExchange(volatile long *, long); __declspec(dllimport) unsigned long __stdcall ExInterlockedExchangeUlong(unsigned long *, unsigned long, void *); __declspec(dllimport) long __fastcall InterlockedExchangeAdd(volatile long *, long); -__declspec(dllimport) unsigned long __stdcall ExInterlockedAddUlong(unsigned long *, unsigned long, void *); +#ifdef _X86_ +__declspec(dllimport) unsigned long __stdcall ExInterlockedAddUlong(unsigned long *, unsigned long, unsigned long *); +#endif __declspec(dllimport) unsigned long __stdcall Exi386InterlockedExchangeUlong(unsigned long *, unsigned long); __declspec(dllimport) long __fastcall InterlockedIncrement(long *); __declspec(dllimport) long __fastcall InterlockedDecrement(long *); @@ -74,13 +74,11 @@ #elif defined(__GNUC__) && defined(_M_IX86) #define SaveState(State) \ asm volatile( \ - ".intel_syntax noprefix\n\t" \ - "mov\t[ecx], esi\n\t" \ - "mov\t[ecx+4], edi\n\t" \ - "mov\t[ecx+8], ebx\n\t" \ - "mov\t[ecx+12], ebp\n\t" \ - "mov\t[ecx+16], esp\n\t" \ - ".att_syntax prefix" \ + "movl\t%%esi, (%%ecx)\n\t" \ + "movl\t%%edi, 4(%%ecx)\n\t" \ + "movl\t%%ebx, 8(%%ecx)\n\t" \ + "movl\t%%ebp, 12(%%ecx)\n\t" \ + "movl\t%%esp, 16(%%ecx)" \ : : "c" (&State) : "memory" \ ); @@ -96,17 +94,15 @@ #elif defined(__GNUC__) && defined(_M_AMD64) #define SaveState(State) \ asm volatile( \ - ".intel_syntax noprefix\n\t" \ - "mov\t[rcx], rsi\n\t" \ - "mov\t[rcx+8], rdi\n\t" \ - "mov\t[rcx+16], rbx\n\t" \ - "mov\t[rcx+24], rbp\n\t" \ - "mov\t[rcx+32], rsp\n\t" \ - "mov\t[rcx+40], r12\n\t" \ - "mov\t[rcx+48], r13\n\t" \ - "mov\t[rcx+56], r14\n\t" \ - "mov\t[rcx+64], r15\n\t" \ - ".att_syntax prefix" \ + "mov\t%%rsi, (%%rcx)\n\t" \ + "mov\t%%rdi, 8(%%rcx)\n\t" \ + "mov\t%%rbx, 16(%%rcx)\n\t" \ + "mov\t%%rbp, 24(%%rcx)\n\t" \ + "mov\t%%rsp, 32(%%rcx)\n\t" \ + "mov\t%%r12, 40(%%rcx)\n\t" \ + "mov\t%%r13, 48(%%rcx)\n\t" \ + "mov\t%%r14, 56(%%rcx)\n\t" \ + "mov\t%%r15, 64(%%rcx)" \ : : "c" (&State) : "memory" \ ); @@ -124,7 +120,11 @@ } while (0) #else #define SaveState(State) -#define CheckState(OldState, NewState) +#define CheckState(OldState, NewState) do \ +{ \ + (void)OldState; \ + (void)NewState; \ +} while (0) #endif static Modified: trunk/rostests/kmtests/rtl/RtlMemory.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlMemory.c?r…
============================================================================== --- trunk/rostests/kmtests/rtl/RtlMemory.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/rtl/RtlMemory.c [iso-8859-1] Tue May 1 09:13:19 2012 @@ -160,7 +160,7 @@ const SIZE_T HalfSize = Size / 2; SIZE_T RetSize; KIRQL Irql; - ULONG i; + SIZE_T i; KeRaiseIrql(HIGH_LEVEL, &Irql); /* zero everything behind 'Size'. Tests will check that this wasn't changed.
12 years, 7 months
1
0
0
0
[tfaber] 56455: [RTL/NDK/DDK/XDK] - RtlDosSearchPath_Ustr returns NTSTATUS, not ULONG - Fix some ULONG vs SIZE_T issues - RtlEqualMemory returns LOGICAL, not ULONG
by tfaber@svn.reactos.org
Author: tfaber Date: Tue May 1 07:16:02 2012 New Revision: 56455 URL:
http://svn.reactos.org/svn/reactos?rev=56455&view=rev
Log: [RTL/NDK/DDK/XDK] - RtlDosSearchPath_Ustr returns NTSTATUS, not ULONG - Fix some ULONG vs SIZE_T issues - RtlEqualMemory returns LOGICAL, not ULONG Modified: trunk/reactos/include/ddk/wdm.h trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/include/xdk/rtlfuncs.h trunk/reactos/lib/rtl/mem.c trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=5645…
============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Tue May 1 07:16:02 2012 @@ -8064,7 +8064,7 @@ #define RtlEqualLuid(Luid1, Luid2) \ (((Luid1)->LowPart == (Luid2)->LowPart) && ((Luid1)->HighPart == (Luid2)->HighPart)) -/* ULONG +/* LOGICAL * RtlEqualMemory( * IN VOID UNALIGNED *Destination, * IN CONST VOID UNALIGNED *Source, Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Tue May 1 07:16:02 2012 @@ -2516,7 +2516,8 @@ OUT PWSTR *PartName ); -ULONG +NTSYSAPI +NTSTATUS NTAPI RtlDosSearchPath_Ustr( IN ULONG Flags, Modified: trunk/reactos/include/xdk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/rtlfuncs.h [iso-8859-1] Tue May 1 07:16:02 2012 @@ -178,7 +178,7 @@ #define RtlEqualLuid(Luid1, Luid2) \ (((Luid1)->LowPart == (Luid2)->LowPart) && ((Luid1)->HighPart == (Luid2)->HighPart)) -/* ULONG +/* LOGICAL * RtlEqualMemory( * IN VOID UNALIGNED *Destination, * IN CONST VOID UNALIGNED *Source, Modified: trunk/reactos/lib/rtl/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=56455&r1…
============================================================================== --- trunk/reactos/lib/rtl/mem.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/mem.c [iso-8859-1] Tue May 1 07:16:02 2012 @@ -85,7 +85,7 @@ NTAPI RtlFillMemory ( PVOID Destination, - ULONG Length, + SIZE_T Length, UCHAR Fill ) { @@ -101,12 +101,12 @@ NTAPI RtlFillMemoryUlong ( PVOID Destination, - ULONG Length, + SIZE_T Length, ULONG Fill ) { PULONG Dest = Destination; - ULONG Count = Length / sizeof(ULONG); + SIZE_T Count = Length / sizeof(ULONG); while (Count > 0) { @@ -126,7 +126,7 @@ RtlMoveMemory ( PVOID Destination, CONST VOID * Source, - ULONG Length + SIZE_T Length ) { memmove ( @@ -160,7 +160,7 @@ NTAPI RtlZeroMemory ( PVOID Destination, - ULONG Length + SIZE_T Length ) { RtlFillMemory ( Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=56455&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Tue May 1 07:16:02 2012 @@ -2011,7 +2011,7 @@ /* * @implemented */ -ULONG +NTSTATUS NTAPI RtlDosSearchPath_Ustr(IN ULONG Flags, IN PUNICODE_STRING PathString,
12 years, 7 months
1
0
0
0
← Newer
1
...
20
21
22
23
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
Results per page:
10
25
50
100
200