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
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
June 2009
----- 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
21 participants
496 discussions
Start a n
N
ew thread
[tkreuzer] 41364: [FORMATTING] dibobj.c: fix indentation, no code change
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Jun 10 04:23:15 2009 New Revision: 41364 URL:
http://svn.reactos.org/svn/reactos?rev=41364&view=rev
Log: [FORMATTING] dibobj.c: fix indentation, no code change Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Wed Jun 10 04:23:15 2009 @@ -69,343 +69,354 @@ }; -UINT APIENTRY -IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Colors) +UINT +APIENTRY +IntSetDIBColorTable( + HDC hDC, + UINT StartIndex, + UINT Entries, + CONST RGBQUAD *Colors) { - PDC dc; - PSURFACE psurf; - PPALETTE PalGDI; - UINT Index; - ULONG biBitCount; - - if (!(dc = DC_LockDc(hDC))) return 0; - if (dc->dctype == DC_TYPE_INFO) - { - DC_UnlockDc(dc); - return 0; - } - - psurf = dc->dclevel.pSurface; - if (psurf == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - if (psurf->hSecure == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - if (biBitCount <= 8 && StartIndex < (1 << biBitCount)) - { - if (StartIndex + Entries > (1 << biBitCount)) - Entries = (1 << biBitCount) - StartIndex; - - PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); - if (PalGDI == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - for (Index = StartIndex; - Index < StartIndex + Entries && Index < PalGDI->NumColors; - Index++) - { - PalGDI->IndexedColors[Index].peRed = Colors[Index - StartIndex].rgbRed; - PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen; - PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue; - } - PALETTE_UnlockPalette(PalGDI); - } - else - Entries = 0; - - /* Mark the brushes invalid */ - dc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE|DIRTY_BACKGROUND|DIRTY_TEXT; - - DC_UnlockDc(dc); - - return Entries; + PDC dc; + PSURFACE psurf; + PPALETTE PalGDI; + UINT Index; + ULONG biBitCount; + + if (!(dc = DC_LockDc(hDC))) return 0; + if (dc->dctype == DC_TYPE_INFO) + { + DC_UnlockDc(dc); + return 0; + } + + psurf = dc->dclevel.pSurface; + if (psurf == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + if (psurf->hSecure == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); + if (biBitCount <= 8 && StartIndex < (1 << biBitCount)) + { + if (StartIndex + Entries > (1 << biBitCount)) + Entries = (1 << biBitCount) - StartIndex; + + PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); + if (PalGDI == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + for (Index = StartIndex; + Index < StartIndex + Entries && Index < PalGDI->NumColors; + Index++) + { + PalGDI->IndexedColors[Index].peRed = Colors[Index - StartIndex].rgbRed; + PalGDI->IndexedColors[Index].peGreen = Colors[Index - StartIndex].rgbGreen; + PalGDI->IndexedColors[Index].peBlue = Colors[Index - StartIndex].rgbBlue; + } + PALETTE_UnlockPalette(PalGDI); + } + else + Entries = 0; + + /* Mark the brushes invalid */ + dc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE|DIRTY_BACKGROUND|DIRTY_TEXT; + + DC_UnlockDc(dc); + + return Entries; } -UINT APIENTRY -IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors) +UINT +APIENTRY +IntGetDIBColorTable( + HDC hDC, + UINT StartIndex, + UINT Entries, + RGBQUAD *Colors) { - PDC dc; - PSURFACE psurf; - PPALETTE PalGDI; - UINT Index; - ULONG biBitCount; - - if (!(dc = DC_LockDc(hDC))) return 0; - if (dc->dctype == DC_TYPE_INFO) - { - DC_UnlockDc(dc); - return 0; - } - - psurf = dc->dclevel.pSurface; - if (psurf == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - if (psurf->hSecure == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - if (biBitCount <= 8 && - StartIndex < (1 << biBitCount)) - { - if (StartIndex + Entries > (1 << biBitCount)) - Entries = (1 << biBitCount) - StartIndex; - - PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); - if (PalGDI == NULL) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - for (Index = StartIndex; - Index < StartIndex + Entries && Index < PalGDI->NumColors; - Index++) - { - Colors[Index - StartIndex].rgbRed = PalGDI->IndexedColors[Index].peRed; - Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen; - Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue; - Colors[Index - StartIndex].rgbReserved = 0; - } - PALETTE_UnlockPalette(PalGDI); - } - else - Entries = 0; - - DC_UnlockDc(dc); - - return Entries; + PDC dc; + PSURFACE psurf; + PPALETTE PalGDI; + UINT Index; + ULONG biBitCount; + + if (!(dc = DC_LockDc(hDC))) return 0; + if (dc->dctype == DC_TYPE_INFO) + { + DC_UnlockDc(dc); + return 0; + } + + psurf = dc->dclevel.pSurface; + if (psurf == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + if (psurf->hSecure == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); + if (biBitCount <= 8 && + StartIndex < (1 << biBitCount)) + { + if (StartIndex + Entries > (1 << biBitCount)) + Entries = (1 << biBitCount) - StartIndex; + + PalGDI = PALETTE_LockPalette(psurf->hDIBPalette); + if (PalGDI == NULL) + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + for (Index = StartIndex; + Index < StartIndex + Entries && Index < PalGDI->NumColors; + Index++) + { + Colors[Index - StartIndex].rgbRed = PalGDI->IndexedColors[Index].peRed; + Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen; + Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue; + Colors[Index - StartIndex].rgbReserved = 0; + } + PALETTE_UnlockPalette(PalGDI); + } + else + Entries = 0; + + DC_UnlockDc(dc); + + return Entries; } // Converts a DIB to a device-dependent bitmap -static INT FASTCALL +static INT +FASTCALL IntSetDIBits( - PDC DC, - HBITMAP hBitmap, - UINT StartScan, - UINT ScanLines, - CONST VOID *Bits, - CONST BITMAPINFO *bmi, - UINT ColorUse) + PDC DC, + HBITMAP hBitmap, + UINT StartScan, + UINT ScanLines, + CONST VOID *Bits, + CONST BITMAPINFO *bmi, + UINT ColorUse) { - SURFACE *bitmap; - HBITMAP SourceBitmap; - INT result = 0; - BOOL copyBitsResult; - SURFOBJ *DestSurf, *SourceSurf; - SIZEL SourceSize; - POINTL ZeroPoint; - RECTL DestRect; - XLATEOBJ *XlateObj; - PPALETTE hDCPalette; - //RGBQUAD *lpRGB; - HPALETTE DDB_Palette, DIB_Palette; - ULONG DDB_Palette_Type, DIB_Palette_Type; - INT DIBWidth; - - // Check parameters - if (!(bitmap = SURFACE_LockSurface(hBitmap))) - { - return 0; - } - - // Get RGB values - //if (ColorUse == DIB_PAL_COLORS) - // lpRGB = DIB_MapPaletteColors(hDC, bmi); - //else - // lpRGB = &bmi->bmiColors; - - DestSurf = &bitmap->SurfObj; - - // Create source surface - SourceSize.cx = bmi->bmiHeader.biWidth; - SourceSize.cy = ScanLines; - - // Determine width of DIB - DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount); - - SourceBitmap = EngCreateBitmap(SourceSize, - DIBWidth, - BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression), - bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0, - (PVOID) Bits); - if (0 == SourceBitmap) - { - SURFACE_UnlockSurface(bitmap); - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return 0; - } - - SourceSurf = EngLockSurface((HSURF)SourceBitmap); - if (NULL == SourceSurf) - { - EngDeleteSurface((HSURF)SourceBitmap); - SURFACE_UnlockSurface(bitmap); - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return 0; - } - - // Use hDIBPalette if it exists - if (bitmap->hDIBPalette) - { - DDB_Palette = bitmap->hDIBPalette; - } - else - { - // Destination palette obtained from the hDC - DDB_Palette = DC->ppdev->DevInfo.hpalDefault; - } - hDCPalette = PALETTE_LockPalette(DDB_Palette); - if (NULL == hDCPalette) - { - EngUnlockSurface(SourceSurf); - EngDeleteSurface((HSURF)SourceBitmap); - SURFACE_UnlockSurface(bitmap); - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - DDB_Palette_Type = hDCPalette->Mode; - PALETTE_UnlockPalette(hDCPalette); - - // Source palette obtained from the BITMAPINFO - DIB_Palette = BuildDIBPalette ( (PBITMAPINFO)bmi, (PINT)&DIB_Palette_Type ); - if (NULL == DIB_Palette) - { - EngUnlockSurface(SourceSurf); - EngDeleteSurface((HSURF)SourceBitmap); - SURFACE_UnlockSurface(bitmap); - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return 0; - } - - // Determine XLATEOBJ for color translation - XlateObj = IntEngCreateXlate(DDB_Palette_Type, DIB_Palette_Type, DDB_Palette, DIB_Palette); - if (NULL == XlateObj) - { - PALETTE_FreePaletteByHandle(DIB_Palette); - EngUnlockSurface(SourceSurf); - EngDeleteSurface((HSURF)SourceBitmap); - SURFACE_UnlockSurface(bitmap); - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return 0; - } - - // Zero point - ZeroPoint.x = 0; - ZeroPoint.y = 0; - - // Determine destination rectangle - DestRect.left = 0; - DestRect.top = abs(bmi->bmiHeader.biHeight) - StartScan - ScanLines; - DestRect.right = SourceSize.cx; - DestRect.bottom = DestRect.top + ScanLines; - - copyBitsResult = IntEngCopyBits(DestSurf, SourceSurf, NULL, XlateObj, &DestRect, &ZeroPoint); - - // If it succeeded, return number of scanlines copies - if(copyBitsResult == TRUE) - { - result = SourceSize.cy; + SURFACE *bitmap; + HBITMAP SourceBitmap; + INT result = 0; + BOOL copyBitsResult; + SURFOBJ *DestSurf, *SourceSurf; + SIZEL SourceSize; + POINTL ZeroPoint; + RECTL DestRect; + XLATEOBJ *XlateObj; + PPALETTE hDCPalette; + //RGBQUAD *lpRGB; + HPALETTE DDB_Palette, DIB_Palette; + ULONG DDB_Palette_Type, DIB_Palette_Type; + INT DIBWidth; + + // Check parameters + if (!(bitmap = SURFACE_LockSurface(hBitmap))) + { + return 0; + } + + // Get RGB values + //if (ColorUse == DIB_PAL_COLORS) + // lpRGB = DIB_MapPaletteColors(hDC, bmi); + //else + // lpRGB = &bmi->bmiColors; + + DestSurf = &bitmap->SurfObj; + + // Create source surface + SourceSize.cx = bmi->bmiHeader.biWidth; + SourceSize.cy = ScanLines; + + // Determine width of DIB + DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount); + + SourceBitmap = EngCreateBitmap(SourceSize, + DIBWidth, + BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression), + bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0, + (PVOID) Bits); + if (0 == SourceBitmap) + { + SURFACE_UnlockSurface(bitmap); + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return 0; + } + + SourceSurf = EngLockSurface((HSURF)SourceBitmap); + if (NULL == SourceSurf) + { + EngDeleteSurface((HSURF)SourceBitmap); + SURFACE_UnlockSurface(bitmap); + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return 0; + } + + // Use hDIBPalette if it exists + if (bitmap->hDIBPalette) + { + DDB_Palette = bitmap->hDIBPalette; + } + else + { + // Destination palette obtained from the hDC + DDB_Palette = DC->ppdev->DevInfo.hpalDefault; + } + + hDCPalette = PALETTE_LockPalette(DDB_Palette); + if (NULL == hDCPalette) + { + EngUnlockSurface(SourceSurf); + EngDeleteSurface((HSURF)SourceBitmap); + SURFACE_UnlockSurface(bitmap); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + DDB_Palette_Type = hDCPalette->Mode; + PALETTE_UnlockPalette(hDCPalette); + + // Source palette obtained from the BITMAPINFO + DIB_Palette = BuildDIBPalette((PBITMAPINFO)bmi, (PINT)&DIB_Palette_Type); + if (NULL == DIB_Palette) + { + EngUnlockSurface(SourceSurf); + EngDeleteSurface((HSURF)SourceBitmap); + SURFACE_UnlockSurface(bitmap); + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return 0; + } + + // Determine XLATEOBJ for color translation + XlateObj = IntEngCreateXlate(DDB_Palette_Type, DIB_Palette_Type, DDB_Palette, DIB_Palette); + if (NULL == XlateObj) + { + PALETTE_FreePaletteByHandle(DIB_Palette); + EngUnlockSurface(SourceSurf); + EngDeleteSurface((HSURF)SourceBitmap); + SURFACE_UnlockSurface(bitmap); + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return 0; + } + + // Zero point + ZeroPoint.x = 0; + ZeroPoint.y = 0; + + // Determine destination rectangle + DestRect.left = 0; + DestRect.top = abs(bmi->bmiHeader.biHeight) - StartScan - ScanLines; + DestRect.right = SourceSize.cx; + DestRect.bottom = DestRect.top + ScanLines; + + copyBitsResult = IntEngCopyBits(DestSurf, SourceSurf, NULL, XlateObj, &DestRect, &ZeroPoint); + + // If it succeeded, return number of scanlines copies + if (copyBitsResult == TRUE) + { + result = SourceSize.cy; // or -// result = abs(bmi->bmiHeader.biHeight) - StartScan; - } - - // Clean up - EngDeleteXlate(XlateObj); - PALETTE_FreePaletteByHandle(DIB_Palette); - EngUnlockSurface(SourceSurf); - EngDeleteSurface((HSURF)SourceBitmap); - -// if (ColorUse == DIB_PAL_COLORS) -// WinFree((LPSTR)lpRGB); - - SURFACE_UnlockSurface(bitmap); - - return result; +// result = abs(bmi->bmiHeader.biHeight) - StartScan; + } + + // Clean up + EngDeleteXlate(XlateObj); + PALETTE_FreePaletteByHandle(DIB_Palette); + EngUnlockSurface(SourceSurf); + EngDeleteSurface((HSURF)SourceBitmap); + +// if (ColorUse == DIB_PAL_COLORS) +// WinFree((LPSTR)lpRGB); + + SURFACE_UnlockSurface(bitmap); + + return result; } -// FIXME by Removing NtGdiSetDIBits!!! +// FIXME by Removing NtGdiSetDIBits!!! // This is a victim of the Win32k Initialization BUG!!!!! // Converts a DIB to a device-dependent bitmap -INT APIENTRY +INT +APIENTRY NtGdiSetDIBits( - HDC hDC, - HBITMAP hBitmap, - UINT StartScan, - UINT ScanLines, - CONST VOID *Bits, - CONST BITMAPINFO *bmi, - UINT ColorUse) + HDC hDC, + HBITMAP hBitmap, + UINT StartScan, + UINT ScanLines, + CONST VOID *Bits, + CONST BITMAPINFO *bmi, + UINT ColorUse) { - PDC Dc; - INT Ret; - NTSTATUS Status = STATUS_SUCCESS; - UINT cjBits; - - if (!Bits) return 0; - - _SEH2_TRY - { // FYI: We converted from CORE in gdi. - ProbeForRead(bmi, sizeof(BITMAPINFO), 1); - cjBits = bmi->bmiHeader.biBitCount * bmi->bmiHeader.biPlanes * bmi->bmiHeader.biWidth; - cjBits = ((cjBits + 31) & ~31 ) / 8; - cjBits *= ScanLines; - ProbeForRead(Bits, cjBits, 1); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - return 0; - } - - Dc = DC_LockDc(hDC); - if (NULL == Dc) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - if (Dc->dctype == DC_TYPE_INFO) - { - DC_UnlockDc(Dc); - return 0; - } - - Ret = IntSetDIBits(Dc, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse); - - DC_UnlockDc(Dc); - - return Ret; + PDC Dc; + INT Ret; + NTSTATUS Status = STATUS_SUCCESS; + UINT cjBits; + + if (!Bits) return 0; + + _SEH2_TRY + { // FYI: We converted from CORE in gdi. + ProbeForRead(bmi, sizeof(BITMAPINFO), 1); + cjBits = bmi->bmiHeader.biBitCount * bmi->bmiHeader.biPlanes * bmi->bmiHeader.biWidth; + cjBits = ((cjBits + 31) & ~31) / 8; + cjBits *= ScanLines; + ProbeForRead(Bits, cjBits, 1); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + + if (!NT_SUCCESS(Status)) + { + return 0; + } + + Dc = DC_LockDc(hDC); + if (NULL == Dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + if (Dc->dctype == DC_TYPE_INFO) + { + DC_UnlockDc(Dc); + return 0; + } + + Ret = IntSetDIBits(Dc, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse); + + DC_UnlockDc(Dc); + + return Ret; } - - W32KAPI INT @@ -426,8 +437,7 @@ IN UINT cjMaxBits, IN UINT cjMaxInfo, IN BOOL bTransformCoordinates, - IN OPTIONAL HANDLE hcmXform -) + IN OPTIONAL HANDLE hcmXform) { INT ret = 0; NTSTATUS Status = STATUS_SUCCESS; @@ -448,18 +458,18 @@ _SEH2_TRY { - ProbeForRead(bmi, cjMaxInfo , 1); + ProbeForRead(bmi, cjMaxInfo , 1); ProbeForRead(Bits, cjMaxBits, 1); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Status = _SEH2_GetExceptionCode(); + Status = _SEH2_GetExceptionCode(); } _SEH2_END if (!NT_SUCCESS(Status)) { - return 0; + return 0; } pDC = DC_LockDc(hDC); @@ -499,7 +509,6 @@ ptSource.x = XSrc; ptSource.y = YSrc; - SourceSize.cx = bmi->bmiHeader.biWidth; SourceSize.cy = ScanLines; // this one --> abs(bmi->bmiHeader.biHeight) - StartScan DIBWidth = DIB_GetDIBWidthBytes(SourceSize.cx, bmi->bmiHeader.biBitCount); @@ -519,17 +528,17 @@ pSourceSurf = EngLockSurface((HSURF)hSourceBitmap); if (!pSourceSurf) { - Status = STATUS_UNSUCCESSFUL; - goto Exit; + Status = STATUS_UNSUCCESSFUL; + goto Exit; } /* Obtain destination palette */ pDCPalette = PALETTE_LockPalette(DDBPalette); if (!pDCPalette) { - SetLastWin32Error(ERROR_INVALID_HANDLE); - Status = STATUS_UNSUCCESSFUL; - goto Exit; + SetLastWin32Error(ERROR_INVALID_HANDLE); + Status = STATUS_UNSUCCESSFUL; + goto Exit; } DDBPaletteType = pDCPalette->Mode; @@ -538,18 +547,18 @@ DIBPalette = BuildDIBPalette(bmi, (PINT)&DIBPaletteType); if (!DIBPalette) { - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - Status = STATUS_NO_MEMORY; - goto Exit; + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + Status = STATUS_NO_MEMORY; + goto Exit; } /* Determine XlateObj */ XlateObj = IntEngCreateXlate(DDBPaletteType, DIBPaletteType, DDBPalette, DIBPalette); if (!XlateObj) { - SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - Status = STATUS_NO_MEMORY; - goto Exit; + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + Status = STATUS_NO_MEMORY; + goto Exit; } /* Copy the bits */ @@ -567,7 +576,7 @@ Exit: if (NT_SUCCESS(Status)) { - /* FIXME: Should probably be only the number of lines actually copied */ + /* FIXME: Should probably be only the number of lines actually copied */ ret = ScanLines; // this one --> abs(Info->bmiHeader.biHeight) - StartScan; } @@ -582,16 +591,18 @@ /* Converts a device-dependent bitmap to a DIB */ -INT APIENTRY -NtGdiGetDIBitsInternal(HDC hDC, - HBITMAP hBitmap, - UINT StartScan, - UINT ScanLines, - LPBYTE Bits, - LPBITMAPINFO Info, - UINT Usage, - UINT MaxBits, - UINT MaxInfo) +INT +APIENTRY +NtGdiGetDIBitsInternal( + HDC hDC, + HBITMAP hBitmap, + UINT StartScan, + UINT ScanLines, + LPBYTE Bits, + LPBITMAPINFO Info, + UINT Usage, + UINT MaxBits, + UINT MaxInfo) { PDC Dc; SURFACE *psurf = NULL; @@ -612,13 +623,12 @@ DPRINT("Entered NtGdiGetDIBitsInternal()\n"); - if ( (Usage && Usage != DIB_PAL_COLORS) || - !Info || - !hBitmap ) - return 0; + if ((Usage && Usage != DIB_PAL_COLORS) || !Info || !hBitmap) + return 0; // if ScanLines == 0, no need to copy Bits. - if (!ScanLines) ChkBits = NULL; + if (!ScanLines) + ChkBits = NULL; _SEH2_TRY { @@ -627,13 +637,13 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Status = _SEH2_GetExceptionCode(); + Status = _SEH2_GetExceptionCode(); } _SEH2_END if (!NT_SUCCESS(Status)) { - return 0; + return 0; } Dc = DC_LockDc(hDC); @@ -648,7 +658,7 @@ /* Get a pointer to the source bitmap object */ psurf = SURFACE_LockSurface(hBitmap); if (psurf == NULL) - return 0; + return 0; hSourcePalette = psurf->hDIBPalette; if (!hSourcePalette) @@ -664,11 +674,11 @@ if (Info->bmiHeader.biBitCount == BitsPerFormat(psurf->SurfObj.iBitmapFormat) && Info->bmiHeader.biBitCount != 15 && Info->bmiHeader.biBitCount != 16) { - hDestPalette = hSourcePalette; - bPaletteMatch = TRUE; + hDestPalette = hSourcePalette; + bPaletteMatch = TRUE; } else - hDestPalette = BuildDIBPalette(Info, (PINT)&DestPaletteType); //hDestPalette = Dc->DevInfo->hpalDefault; + hDestPalette = BuildDIBPalette(Info, (PINT)&DestPaletteType); //hDestPalette = Dc->DevInfo->hpalDefault; SourcePalette = PALETTE_LockPalette(hSourcePalette); /* FIXME - SourcePalette can be NULL!!! Don't assert here! */ @@ -678,286 +688,286 @@ if (bPaletteMatch) { - DestPalette = PALETTE_LockPalette(hDestPalette); - /* FIXME - DestPalette can be NULL!!!! Don't assert here!!! */ - DPRINT("DestPalette : %p\n", DestPalette); - ASSERT(DestPalette); - DestPaletteType = DestPalette->Mode; + DestPalette = PALETTE_LockPalette(hDestPalette); + /* FIXME - DestPalette can be NULL!!!! Don't assert here!!! */ + DPRINT("DestPalette : %p\n", DestPalette); + ASSERT(DestPalette); + DestPaletteType = DestPalette->Mode; } else { - DestPalette = SourcePalette; + DestPalette = SourcePalette; } /* Copy palette. */ /* FIXME: This is largely incomplete. ATM no Core!*/ - switch(Info->bmiHeader.biBitCount) - { - case 1: - case 4: - case 8: - Info->bmiHeader.biClrUsed = 0; - if ( psurf->hSecure && - BitsPerFormat(psurf->SurfObj.iBitmapFormat) == Info->bmiHeader.biBitCount) - { - if (Usage == DIB_RGB_COLORS) + switch (Info->bmiHeader.biBitCount) + { + case 1: + case 4: + case 8: + Info->bmiHeader.biClrUsed = 0; + if (psurf->hSecure && + BitsPerFormat(psurf->SurfObj.iBitmapFormat) == Info->bmiHeader.biBitCount) { - if (DestPalette->NumColors != 1 << Info->bmiHeader.biBitCount) - Info->bmiHeader.biClrUsed = DestPalette->NumColors; - for (Index = 0; - Index < (1 << Info->bmiHeader.biBitCount) && Index < DestPalette->NumColors; - Index++) + if (Usage == DIB_RGB_COLORS) { - rgbQuads[Index].rgbRed = DestPalette->IndexedColors[Index].peRed; - rgbQuads[Index].rgbGreen = DestPalette->IndexedColors[Index].peGreen; - rgbQuads[Index].rgbBlue = DestPalette->IndexedColors[Index].peBlue; - rgbQuads[Index].rgbReserved = 0; + if (DestPalette->NumColors != 1 << Info->bmiHeader.biBitCount) + Info->bmiHeader.biClrUsed = DestPalette->NumColors; + for (Index = 0; + Index < (1 << Info->bmiHeader.biBitCount) && Index < DestPalette->NumColors; + Index++) + { + rgbQuads[Index].rgbRed = DestPalette->IndexedColors[Index].peRed; + rgbQuads[Index].rgbGreen = DestPalette->IndexedColors[Index].peGreen; + rgbQuads[Index].rgbBlue = DestPalette->IndexedColors[Index].peBlue; + rgbQuads[Index].rgbReserved = 0; + } + } + else + { + PWORD Ptr = ColorPtr; + for (Index = 0; + Index < (1 << Info->bmiHeader.biBitCount); + Index++) + { + Ptr[Index] = (WORD)Index; + } } } else { - PWORD Ptr = ColorPtr; - for (Index = 0; - Index < (1 << Info->bmiHeader.biBitCount); - Index++) - { - Ptr[Index] = (WORD)Index; - } + if (Usage == DIB_PAL_COLORS) + { + PWORD Ptr = ColorPtr; + for (Index = 0; + Index < (1 << Info->bmiHeader.biBitCount); + Index++) + { + Ptr[Index] = (WORD)Index; + } + } + else if (Info->bmiHeader.biBitCount > 1 && bPaletteMatch) + { + for (Index = 0; + Index < (1 << Info->bmiHeader.biBitCount) && Index < DestPalette->NumColors; + Index++) + { + Info->bmiColors[Index].rgbRed = DestPalette->IndexedColors[Index].peRed; + Info->bmiColors[Index].rgbGreen = DestPalette->IndexedColors[Index].peGreen; + Info->bmiColors[Index].rgbBlue = DestPalette->IndexedColors[Index].peBlue; + Info->bmiColors[Index].rgbReserved = 0; + } + } + else + { + switch (Info->bmiHeader.biBitCount) + { + case 1: + rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0; + rgbQuads[0].rgbReserved = 0; + rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff; + rgbQuads[1].rgbReserved = 0; + break; + case 4: + RtlCopyMemory(ColorPtr, EGAColorsQuads, sizeof(EGAColorsQuads)); + break; + case 8: + { + INT r, g, b; + RGBQUAD *color; + + RtlCopyMemory(rgbQuads, DefLogPaletteQuads, 10 * sizeof(RGBQUAD)); + RtlCopyMemory(rgbQuads + 246, DefLogPaletteQuads + 10, 10 * sizeof(RGBQUAD)); + color = rgbQuads + 10; + for (r = 0; r <= 5; r++) /* FIXME */ + for (g = 0; g <= 5; g++) + for (b = 0; b <= 5; b++) + { + color->rgbRed = (r * 0xff) / 5; + color->rgbGreen = (g * 0xff) / 5; + color->rgbBlue = (b * 0xff) / 5; + color->rgbReserved = 0; + color++; + } + } + break; + } + } } - } - else - { - if (Usage == DIB_PAL_COLORS) + + case 15: + if (Info->bmiHeader.biCompression == BI_BITFIELDS) { - PWORD Ptr = ColorPtr; - for (Index = 0; - Index < (1 << Info->bmiHeader.biBitCount); - Index++) - { - Ptr[Index] = (WORD)Index; - } + ((PDWORD)Info->bmiColors)[0] = 0x7c00; + ((PDWORD)Info->bmiColors)[1] = 0x03e0; + ((PDWORD)Info->bmiColors)[2] = 0x001f; } - else if (Info->bmiHeader.biBitCount > 1 && bPaletteMatch) + break; + + case 16: + if (Info->bmiHeader.biCompression == BI_BITFIELDS) { - for (Index = 0; - Index < (1 << Info->bmiHeader.biBitCount) && Index < DestPalette->NumColors; - Index++) - { - Info->bmiColors[Index].rgbRed = DestPalette->IndexedColors[Index].peRed; - Info->bmiColors[Index].rgbGreen = DestPalette->IndexedColors[Index].peGreen; - Info->bmiColors[Index].rgbBlue = DestPalette->IndexedColors[Index].peBlue; - Info->bmiColors[Index].rgbReserved = 0; - } + ((PDWORD)Info->bmiColors)[0] = 0xf800; + ((PDWORD)Info->bmiColors)[1] = 0x07e0; + ((PDWORD)Info->bmiColors)[2] = 0x001f; } - else + break; + + case 24: + case 32: + if (Info->bmiHeader.biCompression == BI_BITFIELDS) { - switch(Info->bmiHeader.biBitCount) - { - case 1: - rgbQuads[0].rgbRed = rgbQuads[0].rgbGreen = rgbQuads[0].rgbBlue = 0; - rgbQuads[0].rgbReserved = 0; - rgbQuads[1].rgbRed = rgbQuads[1].rgbGreen = rgbQuads[1].rgbBlue = 0xff; - rgbQuads[1].rgbReserved = 0; - break; - case 4: - RtlCopyMemory(ColorPtr, EGAColorsQuads, sizeof(EGAColorsQuads)); - break; - case 8: - { - INT r, g, b; - RGBQUAD *color; - - RtlCopyMemory(rgbQuads, DefLogPaletteQuads, 10 * sizeof(RGBQUAD)); - RtlCopyMemory(rgbQuads + 246, DefLogPaletteQuads + 10, 10 * sizeof(RGBQUAD)); - color = rgbQuads + 10; - for(r = 0; r <= 5; r++) /* FIXME */ - for(g = 0; g <= 5; g++) - for(b = 0; b <= 5; b++) - { - color->rgbRed = (r * 0xff) / 5; - color->rgbGreen = (g * 0xff) / 5; - color->rgbBlue = (b * 0xff) / 5; - color->rgbReserved = 0; - color++; - } - } - break; - } + ((PDWORD)Info->bmiColors)[0] = 0xff0000; + ((PDWORD)Info->bmiColors)[1] = 0x00ff00; + ((PDWORD)Info->bmiColors)[2] = 0x0000ff; } - } - - case 15: - if (Info->bmiHeader.biCompression == BI_BITFIELDS) - { - ((PDWORD)Info->bmiColors)[0] = 0x7c00; - ((PDWORD)Info->bmiColors)[1] = 0x03e0; - ((PDWORD)Info->bmiColors)[2] = 0x001f; - } - break; - - case 16: - if (Info->bmiHeader.biCompression == BI_BITFIELDS) - { - ((PDWORD)Info->bmiColors)[0] = 0xf800; - ((PDWORD)Info->bmiColors)[1] = 0x07e0; - ((PDWORD)Info->bmiColors)[2] = 0x001f; - } - break; - - case 24: - case 32: - if (Info->bmiHeader.biCompression == BI_BITFIELDS) - { - ((PDWORD)Info->bmiColors)[0] = 0xff0000; - ((PDWORD)Info->bmiColors)[1] = 0x00ff00; - ((PDWORD)Info->bmiColors)[2] = 0x0000ff; - } - break; + break; } if (bPaletteMatch) - PALETTE_UnlockPalette(DestPalette); + PALETTE_UnlockPalette(DestPalette); /* fill out the BITMAPINFO struct */ if (!ChkBits) { // Core or not to Core? We have converted from Core in Gdi~ so? - if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; - coreheader->bcWidth = psurf->SurfObj.sizlBitmap.cx; - coreheader->bcPlanes = 1; - coreheader->bcBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - coreheader->bcHeight = psurf->SurfObj.sizlBitmap.cy; - if (psurf->SurfObj.lDelta > 0) - coreheader->bcHeight = -coreheader->bcHeight; - } - - if (Info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) - { - Info->bmiHeader.biWidth = psurf->SurfObj.sizlBitmap.cx; - Info->bmiHeader.biHeight = psurf->SurfObj.sizlBitmap.cy; - Info->bmiHeader.biPlanes = 1; - Info->bmiHeader.biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); - switch (psurf->SurfObj.iBitmapFormat) - { - /* FIXME: What about BI_BITFIELDS? */ - case BMF_1BPP: - case BMF_4BPP: - case BMF_8BPP: - case BMF_16BPP: - case BMF_24BPP: - case BMF_32BPP: - Info->bmiHeader.biCompression = BI_RGB; - break; - case BMF_4RLE: - Info->bmiHeader.biCompression = BI_RLE4; - break; - case BMF_8RLE: - Info->bmiHeader.biCompression = BI_RLE8; - break; - case BMF_JPEG: - Info->bmiHeader.biCompression = BI_JPEG; - break; - case BMF_PNG: - Info->bmiHeader.biCompression = BI_PNG; - break; - } - /* Image size has to be calculated */ - Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(Info->bmiHeader.biWidth, - Info->bmiHeader.biBitCount) * Info->bmiHeader.biHeight; - Info->bmiHeader.biXPelsPerMeter = 0; /* FIXME */ - Info->bmiHeader.biYPelsPerMeter = 0; /* FIXME */ - Info->bmiHeader.biClrUsed = 0; - Info->bmiHeader.biClrImportant = 1 << Info->bmiHeader.biBitCount; /* FIXME */ - /* Report negtive height for top-down bitmaps. */ - if (psurf->SurfObj.lDelta > 0) - Info->bmiHeader.biHeight = -Info->bmiHeader.biHeight; - } - Result = psurf->SurfObj.sizlBitmap.cy; + if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; + coreheader->bcWidth = psurf->SurfObj.sizlBitmap.cx; + coreheader->bcPlanes = 1; + coreheader->bcBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); + coreheader->bcHeight = psurf->SurfObj.sizlBitmap.cy; + if (psurf->SurfObj.lDelta > 0) + coreheader->bcHeight = -coreheader->bcHeight; + } + + if (Info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) + { + Info->bmiHeader.biWidth = psurf->SurfObj.sizlBitmap.cx; + Info->bmiHeader.biHeight = psurf->SurfObj.sizlBitmap.cy; + Info->bmiHeader.biPlanes = 1; + Info->bmiHeader.biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat); + switch (psurf->SurfObj.iBitmapFormat) + { + /* FIXME: What about BI_BITFIELDS? */ + case BMF_1BPP: + case BMF_4BPP: + case BMF_8BPP: + case BMF_16BPP: + case BMF_24BPP: + case BMF_32BPP: + Info->bmiHeader.biCompression = BI_RGB; + break; + case BMF_4RLE: + Info->bmiHeader.biCompression = BI_RLE4; + break; + case BMF_8RLE: + Info->bmiHeader.biCompression = BI_RLE8; + break; + case BMF_JPEG: + Info->bmiHeader.biCompression = BI_JPEG; + break; + case BMF_PNG: + Info->bmiHeader.biCompression = BI_PNG; + break; + } + /* Image size has to be calculated */ + Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(Info->bmiHeader.biWidth, + Info->bmiHeader.biBitCount) * Info->bmiHeader.biHeight; + Info->bmiHeader.biXPelsPerMeter = 0; /* FIXME */ + Info->bmiHeader.biYPelsPerMeter = 0; /* FIXME */ + Info->bmiHeader.biClrUsed = 0; + Info->bmiHeader.biClrImportant = 1 << Info->bmiHeader.biBitCount; /* FIXME */ + /* Report negtive height for top-down bitmaps. */ + if (psurf->SurfObj.lDelta > 0) + Info->bmiHeader.biHeight = -Info->bmiHeader.biHeight; + } + Result = psurf->SurfObj.sizlBitmap.cy; } else { - SIZEL DestSize; - POINTL SourcePoint; + SIZEL DestSize; + POINTL SourcePoint; // // If we have a good dib pointer, why not just copy bits from there w/o XLATE'ing them. // - /* Create the destination bitmap too for the copy operation */ - if (StartScan > psurf->SurfObj.sizlBitmap.cy) - { - goto cleanup; - } - else - { - ScanLines = min(ScanLines, psurf->SurfObj.sizlBitmap.cy - StartScan); - DestSize.cx = psurf->SurfObj.sizlBitmap.cx; - DestSize.cy = ScanLines; - - hDestBitmap = NULL; - - if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; - hDestBitmap = EngCreateBitmap(DestSize, - DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount), - BitmapFormat(coreheader->bcBitCount, BI_RGB), - 0 < coreheader->bcHeight ? 0 : BMF_TOPDOWN, - Bits); - } - - if (Info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) - { - Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(DestSize.cx, - Info->bmiHeader.biBitCount) * DestSize.cy; - - hDestBitmap = EngCreateBitmap(DestSize, - DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount), - BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression), - 0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN, - Bits); - } - - if (hDestBitmap == NULL) - goto cleanup; - } - - if (NT_SUCCESS(Status)) - { - XLATEOBJ *XlateObj; - SURFOBJ *DestSurfObj; - RECTL DestRect; - - XlateObj = IntEngCreateXlate(DestPaletteType, - SourcePaletteType, - hDestPalette, - hSourcePalette); - - SourcePoint.x = 0; - SourcePoint.y = psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines); - - /* Determine destination rectangle */ - DestRect.top = 0; - DestRect.left = 0; - DestRect.right = DestSize.cx; - DestRect.bottom = DestSize.cy; - - DestSurfObj = EngLockSurface((HSURF)hDestBitmap); - - if (IntEngCopyBits( DestSurfObj, - &psurf->SurfObj, - NULL, - XlateObj, - &DestRect, - &SourcePoint)) - { - DPRINT("GetDIBits %d \n",abs(Info->bmiHeader.biHeight) - StartScan); - Result = ScanLines; - } - - EngDeleteXlate(XlateObj); - EngUnlockSurface(DestSurfObj); - } + /* Create the destination bitmap too for the copy operation */ + if (StartScan > psurf->SurfObj.sizlBitmap.cy) + { + goto cleanup; + } + else + { + ScanLines = min(ScanLines, psurf->SurfObj.sizlBitmap.cy - StartScan); + DestSize.cx = psurf->SurfObj.sizlBitmap.cx; + DestSize.cy = ScanLines; + + hDestBitmap = NULL; + + if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER* coreheader = (BITMAPCOREHEADER*) Info; + hDestBitmap = EngCreateBitmap(DestSize, + DIB_GetDIBWidthBytes(DestSize.cx, coreheader->bcBitCount), + BitmapFormat(coreheader->bcBitCount, BI_RGB), + 0 < coreheader->bcHeight ? 0 : BMF_TOPDOWN, + Bits); + } + + if (Info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) + { + Info->bmiHeader.biSizeImage = DIB_GetDIBWidthBytes(DestSize.cx, + Info->bmiHeader.biBitCount) * DestSize.cy; + + hDestBitmap = EngCreateBitmap(DestSize, + DIB_GetDIBWidthBytes(DestSize.cx, Info->bmiHeader.biBitCount), + BitmapFormat(Info->bmiHeader.biBitCount, Info->bmiHeader.biCompression), + 0 < Info->bmiHeader.biHeight ? 0 : BMF_TOPDOWN, + Bits); + } + + if (hDestBitmap == NULL) + goto cleanup; + } + + if (NT_SUCCESS(Status)) + { + XLATEOBJ *XlateObj; + SURFOBJ *DestSurfObj; + RECTL DestRect; + + XlateObj = IntEngCreateXlate(DestPaletteType, + SourcePaletteType, + hDestPalette, + hSourcePalette); + + SourcePoint.x = 0; + SourcePoint.y = psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines); + + /* Determine destination rectangle */ + DestRect.top = 0; + DestRect.left = 0; + DestRect.right = DestSize.cx; + DestRect.bottom = DestSize.cy; + + DestSurfObj = EngLockSurface((HSURF)hDestBitmap); + + if (IntEngCopyBits(DestSurfObj, + &psurf->SurfObj, + NULL, + XlateObj, + &DestRect, + &SourcePoint)) + { + DPRINT("GetDIBits %d \n",abs(Info->bmiHeader.biHeight) - StartScan); + Result = ScanLines; + } + + EngDeleteXlate(XlateObj); + EngUnlockSurface(DestSurfObj); + } } cleanup: if (hDestBitmap != NULL) @@ -993,455 +1003,466 @@ UINT cjMaxBits, HANDLE hcmXform) { - HBITMAP hBitmap, hOldBitmap = NULL; - HDC hdcMem; - HPALETTE hPal = NULL; - PDC pDC; - BOOL Hit = FALSE; - - if (!Bits || !BitsInfo) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - _SEH2_TRY - { - ProbeForRead(BitsInfo, cjMaxInfo, 1); - ProbeForRead(Bits, cjMaxBits, 1); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Hit = TRUE; - } - _SEH2_END - - if (Hit) - { - DPRINT1("NtGdiStretchDIBitsInternal fail to read BitMapInfo: %x or Bits: %x\n",BitsInfo,Bits); - return 0; - } - - hdcMem = NtGdiCreateCompatibleDC(hDC); - if (hdcMem == NULL) - { - DPRINT1("NtGdiCreateCompatibleDC fail create hdc\n"); - return 0; - } - - hBitmap = NtGdiCreateCompatibleBitmap( hDC, - abs(BitsInfo->bmiHeader.biWidth), - abs(BitsInfo->bmiHeader.biHeight)); - if (hBitmap == NULL) - { - DPRINT1("NtGdiCreateCompatibleBitmap fail create bitmap\n"); - DPRINT1("hDC : 0x%08x \n", hDC); - DPRINT1("BitsInfo->bmiHeader.biWidth : 0x%08x \n", BitsInfo->bmiHeader.biWidth); - DPRINT1("BitsInfo->bmiHeader.biHeight : 0x%08x \n", BitsInfo->bmiHeader.biHeight); - return 0; - } - - /* Select the bitmap into hdcMem, and save a handle to the old bitmap */ - hOldBitmap = NtGdiSelectBitmap(hdcMem, hBitmap); - - if(Usage == DIB_PAL_COLORS) - { - hPal = NtGdiGetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE); - hPal = GdiSelectPalette(hdcMem, hPal, FALSE); - } - - if (BitsInfo->bmiHeader.biCompression == BI_RLE4 || - BitsInfo->bmiHeader.biCompression == BI_RLE8) - { - /* copy existing bitmap from destination dc */ - if (SrcWidth == DestWidth && SrcHeight == DestHeight) - NtGdiBitBlt(hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, - SrcWidth, SrcHeight, hDC, XDest, YDest, ROP, 0, 0); - else - NtGdiStretchBlt(hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, - SrcWidth, SrcHeight, hDC, XDest, YDest, DestWidth, DestHeight, - ROP, 0); - } - - pDC = DC_LockDc(hdcMem); - if (pDC != NULL) - { - /* Note BitsInfo->bmiHeader.biHeight is the number of scanline, + HBITMAP hBitmap, hOldBitmap = NULL; + HDC hdcMem; + HPALETTE hPal = NULL; + PDC pDC; + BOOL Hit = FALSE; + + if (!Bits || !BitsInfo) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + _SEH2_TRY + { + ProbeForRead(BitsInfo, cjMaxInfo, 1); + ProbeForRead(Bits, cjMaxBits, 1); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Hit = TRUE; + } + _SEH2_END + + if (Hit) + { + DPRINT1("NtGdiStretchDIBitsInternal fail to read BitMapInfo: %x or Bits: %x\n",BitsInfo,Bits); + return 0; + } + + hdcMem = NtGdiCreateCompatibleDC(hDC); + if (hdcMem == NULL) + { + DPRINT1("NtGdiCreateCompatibleDC fail create hdc\n"); + return 0; + } + + hBitmap = NtGdiCreateCompatibleBitmap(hDC, + abs(BitsInfo->bmiHeader.biWidth), + abs(BitsInfo->bmiHeader.biHeight)); + if (hBitmap == NULL) + { + DPRINT1("NtGdiCreateCompatibleBitmap fail create bitmap\n"); + DPRINT1("hDC : 0x%08x \n", hDC); + DPRINT1("BitsInfo->bmiHeader.biWidth : 0x%08x \n", BitsInfo->bmiHeader.biWidth); + DPRINT1("BitsInfo->bmiHeader.biHeight : 0x%08x \n", BitsInfo->bmiHeader.biHeight); + return 0; + } + + /* Select the bitmap into hdcMem, and save a handle to the old bitmap */ + hOldBitmap = NtGdiSelectBitmap(hdcMem, hBitmap); + + if (Usage == DIB_PAL_COLORS) + { + hPal = NtGdiGetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE); + hPal = GdiSelectPalette(hdcMem, hPal, FALSE); + } + + if (BitsInfo->bmiHeader.biCompression == BI_RLE4 || + BitsInfo->bmiHeader.biCompression == BI_RLE8) + { + /* copy existing bitmap from destination dc */ + if (SrcWidth == DestWidth && SrcHeight == DestHeight) + NtGdiBitBlt(hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, + SrcWidth, SrcHeight, hDC, XDest, YDest, ROP, 0, 0); + else + NtGdiStretchBlt(hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, + SrcWidth, SrcHeight, hDC, XDest, YDest, DestWidth, DestHeight, + ROP, 0); + } + + pDC = DC_LockDc(hdcMem); + if (pDC != NULL) + { + /* Note BitsInfo->bmiHeader.biHeight is the number of scanline, * if it negitve we getting to many scanline for scanline is UINT not * a INT, so we need make the negtive value to positve and that make the * count correct for negtive bitmap, TODO : we need testcase for this api */ - IntSetDIBits(pDC, hBitmap, 0, abs(BitsInfo->bmiHeader.biHeight), Bits, - BitsInfo, Usage); + IntSetDIBits(pDC, hBitmap, 0, abs(BitsInfo->bmiHeader.biHeight), Bits, + BitsInfo, Usage); DC_UnlockDc(pDC); - } - - - /* Origin for DIBitmap may be bottom left (positive biHeight) or top - left (negative biHeight) */ - if (SrcWidth == DestWidth && SrcHeight == DestHeight) - NtGdiBitBlt(hDC, XDest, YDest, DestWidth, DestHeight, - hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, - ROP, 0, 0); - else - NtGdiStretchBlt(hDC, XDest, YDest, DestWidth, DestHeight, - hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, - SrcWidth, SrcHeight, ROP, 0); + } + + + /* Origin for DIBitmap may be bottom left (positive biHeight) or top + left (negative biHeight) */ + if (SrcWidth == DestWidth && SrcHeight == DestHeight) + NtGdiBitBlt(hDC, XDest, YDest, DestWidth, DestHeight, + hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, + ROP, 0, 0); + else + NtGdiStretchBlt(hDC, XDest, YDest, DestWidth, DestHeight, + hdcMem, XSrc, abs(BitsInfo->bmiHeader.biHeight) - SrcHeight - YSrc, + SrcWidth, SrcHeight, ROP, 0); /* cleanup */ - if(hPal) - GdiSelectPalette(hdcMem, hPal, FALSE); - - if (hOldBitmap) - NtGdiSelectBitmap(hdcMem, hOldBitmap); - - NtGdiDeleteObjectApp(hdcMem); - - GreDeleteObject(hBitmap); - - return SrcHeight; + if (hPal) + GdiSelectPalette(hdcMem, hPal, FALSE); + + if (hOldBitmap) + NtGdiSelectBitmap(hdcMem, hOldBitmap); + + NtGdiDeleteObjectApp(hdcMem); + + GreDeleteObject(hBitmap); + + return SrcHeight; } HBITMAP FASTCALL -IntCreateDIBitmap(PDC Dc, - INT width, - INT height, - UINT bpp, - DWORD init, - LPBYTE bits, - PBITMAPINFO data, - DWORD coloruse) +IntCreateDIBitmap( + PDC Dc, + INT width, + INT height, + UINT bpp, + DWORD init, + LPBYTE bits, + PBITMAPINFO data, + DWORD coloruse) { - HBITMAP handle; - BOOL fColor; - - // Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2 - // colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap. - - if (bpp != 1) fColor = TRUE; - else if ((coloruse != DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor = FALSE; - else - { - if (data->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) - { - const RGBQUAD *rgb = data->bmiColors; - DWORD col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue ); - - // Check if the first color of the colormap is black - if ((col == RGB(0, 0, 0))) - { - rgb++; - col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue ); - - // If the second color is white, create a monochrome bitmap - fColor = (col != RGB(0xff,0xff,0xff)); - } - else fColor = TRUE; - } - else if (data->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - RGBTRIPLE *rgb = ((BITMAPCOREINFO *)data)->bmciColors; - DWORD col = RGB( rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue); - - if ((col == RGB(0,0,0))) - { - rgb++; - col = RGB( rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue ); - fColor = (col != RGB(0xff,0xff,0xff)); - } - else fColor = TRUE; - } + HBITMAP handle; + BOOL fColor; + + // Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2 + // colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap. + + if (bpp != 1) fColor = TRUE; + else if ((coloruse != DIB_RGB_COLORS) || (init != CBM_INIT) || !data) fColor = FALSE; else { - DPRINT("(%ld): wrong size for data\n", data->bmiHeader.biSize ); - return 0; - } - } - - // Now create the bitmap - if (fColor) - { - handle = IntCreateCompatibleBitmap(Dc, width, height); - } - else - { - handle = IntGdiCreateBitmap(width, - height, - 1, - 1, - NULL); - } - - if (height < 0) - height = -height; - - if (NULL != handle && CBM_INIT == init) - { - IntSetDIBits(Dc, handle, 0, height, bits, data, coloruse); - } - - return handle; + if (data->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) + { + const RGBQUAD *rgb = data->bmiColors; + DWORD col = RGB(rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue); + + // Check if the first color of the colormap is black + if ((col == RGB(0, 0, 0))) + { + rgb++; + col = RGB(rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue); + + // If the second color is white, create a monochrome bitmap + fColor = (col != RGB(0xff,0xff,0xff)); + } + else fColor = TRUE; + } + else if (data->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + RGBTRIPLE *rgb = ((BITMAPCOREINFO *)data)->bmciColors; + DWORD col = RGB(rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue); + + if ((col == RGB(0,0,0))) + { + rgb++; + col = RGB(rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue); + fColor = (col != RGB(0xff,0xff,0xff)); + } + else fColor = TRUE; + } + else + { + DPRINT("(%ld): wrong size for data\n", data->bmiHeader.biSize); + return 0; + } + } + + // Now create the bitmap + if (fColor) + { + handle = IntCreateCompatibleBitmap(Dc, width, height); + } + else + { + handle = IntGdiCreateBitmap(width, + height, + 1, + 1, + NULL); + } + + if (height < 0) + height = -height; + + if (NULL != handle && CBM_INIT == init) + { + IntSetDIBits(Dc, handle, 0, height, bits, data, coloruse); + } + + return handle; } // The CreateDIBitmap function creates a device-dependent bitmap (DDB) from a DIB and, optionally, sets the bitmap bits // The DDB that is created will be whatever bit depth your reference DC is HBITMAP APIENTRY -NtGdiCreateDIBitmapInternal(IN HDC hDc, - IN INT cx, - IN INT cy, - IN DWORD fInit, - IN OPTIONAL LPBYTE pjInit, - IN OPTIONAL LPBITMAPINFO pbmi, - IN DWORD iUsage, - IN UINT cjMaxInitInfo, - IN UINT cjMaxBits, - IN FLONG fl, - IN HANDLE hcmXform) +NtGdiCreateDIBitmapInternal( + IN HDC hDc, + IN INT cx, + IN INT cy, + IN DWORD fInit, + IN OPTIONAL LPBYTE pjInit, + IN OPTIONAL LPBITMAPINFO pbmi, + IN DWORD iUsage, + IN UINT cjMaxInitInfo, + IN UINT cjMaxBits, + IN FLONG fl, + IN HANDLE hcmXform) { - PDC Dc; - HBITMAP Bmp; - UINT bpp; - - if (!hDc) // CreateBitmap - { // Should use System Bitmap DC hSystemBM, with CreateCompatibleDC for this. - hDc = IntGdiCreateDC(NULL, NULL, NULL, NULL,FALSE); - if (!hDc) - { + PDC Dc; + HBITMAP Bmp; + UINT bpp; + + if (!hDc) // CreateBitmap + { // Should use System Bitmap DC hSystemBM, with CreateCompatibleDC for this. + hDc = IntGdiCreateDC(NULL, NULL, NULL, NULL,FALSE); + if (!hDc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + + Dc = DC_LockDc(hDc); + if (!Dc) + { + NtGdiDeleteObjectApp(hDc); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + bpp = 1; + Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); + + DC_UnlockDc(Dc); + NtGdiDeleteObjectApp(hDc); + } + else // CreateCompatibleBitmap + { + Dc = DC_LockDc(hDc); + if (!Dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + /* pbmi == null + First create an un-initialised bitmap. The depth of the bitmap + should match that of the hdc and not that supplied in bmih. + */ + if (pbmi) + bpp = pbmi->bmiHeader.biBitCount; + else + { + if (Dc->dctype != DC_TYPE_MEMORY) + bpp = IntGdiGetDeviceCaps(Dc, BITSPIXEL); + else + { + DIBSECTION dibs; + INT Count; + SURFACE *psurf = Dc->dclevel.pSurface; + Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs); + if (!Count) + bpp = 1; + else + { + if (Count == sizeof(BITMAP)) + /* A device-dependent bitmap is selected in the DC */ + bpp = dibs.dsBm.bmBitsPixel; + else + /* A DIB section is selected in the DC */ + bpp = dibs.dsBmih.biBitCount; + } + } + } + Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); + DC_UnlockDc(Dc); + } + return Bmp; +} + + +HBITMAP +APIENTRY +NtGdiCreateDIBSection( + IN HDC hDC, + IN OPTIONAL HANDLE hSection, + IN DWORD dwOffset, + IN LPBITMAPINFO bmi, + IN DWORD Usage, + IN UINT cjHeader, + IN FLONG fl, + IN ULONG_PTR dwColorSpace, + OUT PVOID *Bits) +{ + HBITMAP hbitmap = 0; + DC *dc; + BOOL bDesktopDC = FALSE; + + if (!bmi) return hbitmap; // Make sure. + + // If the reference hdc is null, take the desktop dc + if (hDC == 0) + { + hDC = NtGdiCreateCompatibleDC(0); + bDesktopDC = TRUE; + } + + if ((dc = DC_LockDc(hDC))) + { + hbitmap = DIB_CreateDIBSection(dc, + (BITMAPINFO*)bmi, + Usage, + Bits, + hSection, + dwOffset, + 0); + DC_UnlockDc(dc); + } + else + { SetLastWin32Error(ERROR_INVALID_HANDLE); - return NULL; - } - - Dc = DC_LockDc(hDc); - if (!Dc) - { - NtGdiDeleteObjectApp(hDc); - SetLastWin32Error(ERROR_INVALID_HANDLE); - return NULL; - } - bpp = 1; - Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); - - DC_UnlockDc(Dc); - NtGdiDeleteObjectApp(hDc); - } - else // CreateCompatibleBitmap - { - Dc = DC_LockDc(hDc); - if (!Dc) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return NULL; - } - /* pbmi == null - First create an un-initialised bitmap. The depth of the bitmap - should match that of the hdc and not that supplied in bmih. - */ - if (pbmi) - bpp = pbmi->bmiHeader.biBitCount; - else - { - if (Dc->dctype != DC_TYPE_MEMORY ) - bpp = IntGdiGetDeviceCaps(Dc, BITSPIXEL); - else - { - DIBSECTION dibs; - INT Count; - SURFACE *psurf = Dc->dclevel.pSurface; - Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs); - if (!Count) - bpp = 1; - else - { - if (Count == sizeof(BITMAP)) - /* A device-dependent bitmap is selected in the DC */ - bpp = dibs.dsBm.bmBitsPixel; - else - /* A DIB section is selected in the DC */ - bpp = dibs.dsBmih.biBitCount; - } - } - } - Bmp = IntCreateDIBitmap(Dc, cx, cy, bpp, fInit, pjInit, pbmi, iUsage); - DC_UnlockDc(Dc); - } - return Bmp; + } + + if (bDesktopDC) + NtGdiDeleteObjectApp(hDC); + + return hbitmap; } - -HBITMAP APIENTRY NtGdiCreateDIBSection(HDC hDC, - IN OPTIONAL HANDLE hSection, - IN DWORD dwOffset, - IN LPBITMAPINFO bmi, - DWORD Usage, - IN UINT cjHeader, - IN FLONG fl, - IN ULONG_PTR dwColorSpace, - PVOID *Bits) +HBITMAP +APIENTRY +DIB_CreateDIBSection( + PDC dc, + BITMAPINFO *bmi, + UINT usage, + LPVOID *bits, + HANDLE section, + DWORD offset, + DWORD ovr_pitch) { - HBITMAP hbitmap = 0; - DC *dc; - BOOL bDesktopDC = FALSE; - - if (!bmi) return hbitmap; // Make sure. - - // If the reference hdc is null, take the desktop dc - if (hDC == 0) - { - hDC = NtGdiCreateCompatibleDC(0); - bDesktopDC = TRUE; - } - - if ((dc = DC_LockDc(hDC))) - { - hbitmap = DIB_CreateDIBSection ( dc, (BITMAPINFO*)bmi, Usage, Bits, - hSection, dwOffset, 0); - DC_UnlockDc(dc); - } - else - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - } - - if (bDesktopDC) - NtGdiDeleteObjectApp(hDC); - - return hbitmap; -} - -HBITMAP APIENTRY -DIB_CreateDIBSection( - PDC dc, - BITMAPINFO *bmi, - UINT usage, - LPVOID *bits, - HANDLE section, - DWORD offset, - DWORD ovr_pitch) -{ - HBITMAP res = 0; - SURFACE *bmp = NULL; - void *mapBits = NULL; - PDC_ATTR pdcattr; - - // Fill BITMAP32 structure with DIB data - BITMAPINFOHEADER *bi = &bmi->bmiHeader; - INT effHeight; - ULONG totalSize; - BITMAP bm; - SIZEL Size; - RGBQUAD *lpRGB; - HANDLE hSecure; - DWORD dsBitfields[3] = {0}; - - DPRINT("format (%ld,%ld), planes %d, bpp %d, size %ld, colors %ld (%s)\n", - bi->biWidth, bi->biHeight, bi->biPlanes, bi->biBitCount, - bi->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL" : "RGB"); - - /* CreateDIBSection should fail for compressed formats */ - if (bi->biCompression == BI_RLE4 || bi->biCompression == BI_RLE8) - { - return (HBITMAP)NULL; - } - - pdcattr = dc->pdcattr; - - effHeight = bi->biHeight >= 0 ? bi->biHeight : -bi->biHeight; - bm.bmType = 0; - bm.bmWidth = bi->biWidth; - bm.bmHeight = effHeight; - bm.bmWidthBytes = ovr_pitch ? ovr_pitch : (ULONG) DIB_GetDIBWidthBytes(bm.bmWidth, bi->biBitCount); - - bm.bmPlanes = bi->biPlanes; - bm.bmBitsPixel = bi->biBitCount; - bm.bmBits = NULL; - - // Get storage location for DIB bits. Only use biSizeImage if it's valid and - // we're dealing with a compressed bitmap. Otherwise, use width * height. - totalSize = bi->biSizeImage && bi->biCompression != BI_RGB - ? bi->biSizeImage : (ULONG) (bm.bmWidthBytes * effHeight); - - if (section) - { - SYSTEM_BASIC_INFORMATION Sbi; - NTSTATUS Status; - DWORD mapOffset; - LARGE_INTEGER SectionOffset; - SIZE_T mapSize; - - Status = ZwQuerySystemInformation ( SystemBasicInformation, - &Sbi, - sizeof Sbi, - 0); - if (!NT_SUCCESS(Status)) - { - return NULL; - } - - mapOffset = offset - (offset % Sbi.AllocationGranularity); - mapSize = bi->biSizeImage + (offset - mapOffset); - - SectionOffset.LowPart = mapOffset; - SectionOffset.HighPart = 0; - - Status = ZwMapViewOfSection ( section, - NtCurrentProcess(), - &mapBits, - 0, - 0, - &SectionOffset, - &mapSize, - ViewShare, - 0, - PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return NULL; - } - - if (mapBits) bm.bmBits = (char *)mapBits + (offset - mapOffset); - } - else if (ovr_pitch && offset) - bm.bmBits = (LPVOID) offset; - else - { - offset = 0; - bm.bmBits = EngAllocUserMem( totalSize, 0 ); - } + HBITMAP res = 0; + SURFACE *bmp = NULL; + void *mapBits = NULL; + PDC_ATTR pdcattr; + + // Fill BITMAP32 structure with DIB data + BITMAPINFOHEADER *bi = &bmi->bmiHeader; + INT effHeight; + ULONG totalSize; + BITMAP bm; + SIZEL Size; + RGBQUAD *lpRGB; + HANDLE hSecure; + DWORD dsBitfields[3] = {0}; + + DPRINT("format (%ld,%ld), planes %d, bpp %d, size %ld, colors %ld (%s)\n", + bi->biWidth, bi->biHeight, bi->biPlanes, bi->biBitCount, + bi->biSizeImage, bi->biClrUsed, usage == DIB_PAL_COLORS? "PAL" : "RGB"); + + /* CreateDIBSection should fail for compressed formats */ + if (bi->biCompression == BI_RLE4 || bi->biCompression == BI_RLE8) + { + return (HBITMAP)NULL; + } + + pdcattr = dc->pdcattr; + + effHeight = bi->biHeight >= 0 ? bi->biHeight : -bi->biHeight; + bm.bmType = 0; + bm.bmWidth = bi->biWidth; + bm.bmHeight = effHeight; + bm.bmWidthBytes = ovr_pitch ? ovr_pitch : (ULONG) DIB_GetDIBWidthBytes(bm.bmWidth, bi->biBitCount); + + bm.bmPlanes = bi->biPlanes; + bm.bmBitsPixel = bi->biBitCount; + bm.bmBits = NULL; + + // Get storage location for DIB bits. Only use biSizeImage if it's valid and + // we're dealing with a compressed bitmap. Otherwise, use width * height. + totalSize = bi->biSizeImage && bi->biCompression != BI_RGB + ? bi->biSizeImage : (ULONG)(bm.bmWidthBytes * effHeight); + + if (section) + { + SYSTEM_BASIC_INFORMATION Sbi; + NTSTATUS Status; + DWORD mapOffset; + LARGE_INTEGER SectionOffset; + SIZE_T mapSize; + + Status = ZwQuerySystemInformation(SystemBasicInformation, + &Sbi, + sizeof Sbi, + 0); + if (!NT_SUCCESS(Status)) + { + return NULL; + } + + mapOffset = offset - (offset % Sbi.AllocationGranularity); + mapSize = bi->biSizeImage + (offset - mapOffset); + + SectionOffset.LowPart = mapOffset; + SectionOffset.HighPart = 0; + + Status = ZwMapViewOfSection(section, + NtCurrentProcess(), + &mapBits, + 0, + 0, + &SectionOffset, + &mapSize, + ViewShare, + 0, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return NULL; + } + + if (mapBits) bm.bmBits = (char *)mapBits + (offset - mapOffset); + } + else if (ovr_pitch && offset) + bm.bmBits = (LPVOID) offset; + else + { + offset = 0; + bm.bmBits = EngAllocUserMem(totalSize, 0); + } // hSecure = MmSecureVirtualMemory(bm.bmBits, totalSize, PAGE_READWRITE); - hSecure = (HANDLE)0x1; // HACK OF UNIMPLEMENTED KERNEL STUFF !!!! - - if(usage == DIB_PAL_COLORS) - lpRGB = DIB_MapPaletteColors(dc, bmi); - else - lpRGB = bmi->bmiColors; + hSecure = (HANDLE)0x1; // HACK OF UNIMPLEMENTED KERNEL STUFF !!!! + + if (usage == DIB_PAL_COLORS) + lpRGB = DIB_MapPaletteColors(dc, bmi); + else + lpRGB = bmi->bmiColors; /* Set dsBitfields values */ - if ( usage == DIB_PAL_COLORS || bi->biBitCount <= 8) - { - dsBitfields[0] = dsBitfields[1] = dsBitfields[2] = 0; + if (usage == DIB_PAL_COLORS || bi->biBitCount <= 8) + { + dsBitfields[0] = dsBitfields[1] = dsBitfields[2] = 0; } else if (bi->biCompression == BI_RGB) { - switch(bi->biBitCount) - { - case 15: - case 16: - dsBitfields[0] = (bi->biCompression == BI_BITFIELDS) ? *(DWORD *)lpRGB : 0x7c00; - dsBitfields[1] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 1) : 0x03e0; - dsBitfields[2] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 2) : 0x001f; - break; - - case 24: - case 32: - dsBitfields[0] = (bi->biCompression == BI_BITFIELDS) ? *(DWORD *)lpRGB : 0xff0000; - dsBitfields[1] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 1) : 0x00ff00; - dsBitfields[2] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 2) : 0x0000ff; - break; + switch (bi->biBitCount) + { + case 15: + case 16: + dsBitfields[0] = (bi->biCompression == BI_BITFIELDS) ? *(DWORD *)lpRGB : 0x7c00; + dsBitfields[1] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 1) : 0x03e0; + dsBitfields[2] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 2) : 0x001f; + break; + + case 24: + case 32: + dsBitfields[0] = (bi->biCompression == BI_BITFIELDS) ? *(DWORD *)lpRGB : 0xff0000; + dsBitfields[1] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 1) : 0x00ff00; + dsBitfields[2] = (bi->biCompression == BI_BITFIELDS) ? *((DWORD *)lpRGB + 2) : 0x0000ff; + break; } } else @@ -1454,20 +1475,20 @@ // Create Device Dependent Bitmap and add DIB pointer Size.cx = bm.bmWidth; Size.cy = abs(bm.bmHeight); - res = IntCreateBitmap( Size, - bm.bmWidthBytes, - BitmapFormat(bi->biBitCount * bi->biPlanes, bi->biCompression), - BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | - (bi->biHeight < 0 ? BMF_TOPDOWN : 0), - bm.bmBits); - if ( !res ) + res = IntCreateBitmap(Size, + bm.bmWidthBytes, + BitmapFormat(bi->biBitCount * bi->biPlanes, bi->biCompression), + BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | + (bi->biHeight < 0 ? BMF_TOPDOWN : 0), + bm.bmBits); + if (!res) { if (lpRGB != bmi->bmiColors) { ExFreePoolWithTag(lpRGB, TAG_COLORMAP); } SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); - return NULL; + return NULL; } bmp = SURFACE_LockSurface(res); if (NULL == bmp) @@ -1487,9 +1508,15 @@ we call NtGdiSetDIBColorTable. */ bi->biClrUsed = 0; /* set number of entries in bmi.bmiColors table */ - if(bi->biBitCount == 1) { bi->biClrUsed = 2; } else - if(bi->biBitCount == 4) { bi->biClrUsed = 16; } else - if(bi->biBitCount == 8) { bi->biClrUsed = 256; } + if (bi->biBitCount == 1) { + bi->biClrUsed = 2; + } else + if (bi->biBitCount == 4) { + bi->biClrUsed = 16; + } else + if (bi->biBitCount == 8) { + bi->biClrUsed = 256; + } bmp->hDIBSection = section; bmp->hSecure = hSecure; @@ -1502,53 +1529,59 @@ bmp->biClrImportant = bi->biClrImportant; if (bi->biClrUsed != 0) - bmp->hDIBPalette = PALETTE_AllocPaletteIndexedRGB(bi->biClrUsed, lpRGB); + bmp->hDIBPalette = PALETTE_AllocPaletteIndexedRGB(bi->biClrUsed, lpRGB); else - bmp->hDIBPalette = PALETTE_AllocPalette(PAL_BITFIELDS, 0, NULL, - dsBitfields[0], - dsBitfields[1], - dsBitfields[2]); - - // Clean up in case of errors - if (!res || !bmp || !bm.bmBits) - { - DPRINT("got an error res=%08x, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits); - if (bm.bmBits) - { - // MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this! - if (section) - { - ZwUnmapViewOfSection(NtCurrentProcess(), mapBits); - bm.bmBits = NULL; - } - else - if (!offset) - EngFreeUserMem(bm.bmBits), bm.bmBits = NULL; - } - - if (bmp) { bmp = NULL; } - if (res) { SURFACE_FreeSurfaceByHandle(res); res = 0; } - } - - if (lpRGB != bmi->bmiColors) - { - ExFreePoolWithTag(lpRGB, TAG_COLORMAP); - } - - if (bmp) - { - SURFACE_UnlockSurface(bmp); - } - - // Return BITMAP handle and storage location - if (NULL != bm.bmBits && NULL != bits) - { - *bits = bm.bmBits; - } + bmp->hDIBPalette = PALETTE_AllocPalette(PAL_BITFIELDS, 0, NULL, + dsBitfields[0], + dsBitfields[1], + dsBitfields[2]); + + // Clean up in case of errors + if (!res || !bmp || !bm.bmBits) + { + DPRINT("got an error res=%08x, bmp=%p, bm.bmBits=%p\n", res, bmp, bm.bmBits); + if (bm.bmBits) + { + // MmUnsecureVirtualMemory(hSecure); // FIXME: Implement this! + if (section) + { + ZwUnmapViewOfSection(NtCurrentProcess(), mapBits); + bm.bmBits = NULL; + } + else + if (!offset) + EngFreeUserMem(bm.bmBits), bm.bmBits = NULL; + } + + if (bmp) + bmp = NULL; + + if (res) + { + SURFACE_FreeSurfaceByHandle(res); + res = 0; + } + } + + if (lpRGB != bmi->bmiColors) + { + ExFreePoolWithTag(lpRGB, TAG_COLORMAP); + } + + if (bmp) + { + SURFACE_UnlockSurface(bmp); + } + + // Return BITMAP handle and storage location + if (NULL != bm.bmBits && NULL != bits) + { + *bits = bm.bmBits; + } // if (res) pdcattr->ulDirty_ |= DC_DIBSECTION; - return res; + return res; } /*********************************************************************** @@ -1558,9 +1591,9 @@ *
http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/struc/src/str01.h…
* 11/16/1999 (RJJ) lifted from wine */ -INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth) +INT FASTCALL DIB_GetDIBWidthBytes(INT width, INT depth) { - return ((width * depth + 31) & ~31) >> 3; + return ((width * depth + 31) & ~31) >> 3; } /*********************************************************************** @@ -1570,9 +1603,9 @@ * 11/16/1999 (RJJ) lifted from wine */ -INT APIENTRY DIB_GetDIBImageBytes (INT width, INT height, INT depth) +INT APIENTRY DIB_GetDIBImageBytes(INT width, INT height, INT depth) { - return DIB_GetDIBWidthBytes( width, depth ) * (height < 0 ? -height : height); + return DIB_GetDIBWidthBytes(width, depth) * (height < 0 ? -height : height); } /*********************************************************************** @@ -1582,134 +1615,136 @@ * 11/16/1999 (RJJ) lifted from wine */ -INT FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse) +INT FASTCALL DIB_BitmapInfoSize(const BITMAPINFO * info, WORD coloruse) { - int colors; - - if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) - { - BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)info; - colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0; - return sizeof(BITMAPCOREHEADER) + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD)); - } - else /* assume BITMAPINFOHEADER */ - { - colors = info->bmiHeader.biClrUsed; - if (!colors && (info->bmiHeader.biBitCount <= 8)) colors = 1 << info->bmiHeader.biBitCount; - return sizeof(BITMAPINFOHEADER) + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD)); - } + int colors; + + if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)info; + colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0; + return sizeof(BITMAPCOREHEADER) + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD)); + } + else /* assume BITMAPINFOHEADER */ + { + colors = info->bmiHeader.biClrUsed; + if (!colors && (info->bmiHeader.biBitCount <= 8)) colors = 1 << info->bmiHeader.biBitCount; + return sizeof(BITMAPINFOHEADER) + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD)); + } } -RGBQUAD * FASTCALL +RGBQUAD * +FASTCALL DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi) { - RGBQUAD *lpRGB; - ULONG nNumColors,i; - USHORT *lpIndex; - PPALETTE palGDI; - - palGDI = PALETTE_LockPalette(dc->dclevel.hpal); - - if (NULL == palGDI) - { - return NULL; - } - - if (palGDI->Mode != PAL_INDEXED) - { - PALETTE_UnlockPalette(palGDI); - return NULL; - } - - nNumColors = 1 << lpbmi->bmiHeader.biBitCount; - if (lpbmi->bmiHeader.biClrUsed) - { - nNumColors = min(nNumColors, lpbmi->bmiHeader.biClrUsed); - } - - lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP); - if (lpRGB == NULL) - { - PALETTE_UnlockPalette(palGDI); - return NULL; - } - - lpIndex = (USHORT *)&lpbmi->bmiColors[0]; - - for (i = 0; i < nNumColors; i++) - { - lpRGB[i].rgbRed = palGDI->IndexedColors[*lpIndex].peRed; - lpRGB[i].rgbGreen = palGDI->IndexedColors[*lpIndex].peGreen; - lpRGB[i].rgbBlue = palGDI->IndexedColors[*lpIndex].peBlue; - lpRGB[i].rgbReserved = 0; - lpIndex++; - } - PALETTE_UnlockPalette(palGDI); - - return lpRGB; + RGBQUAD *lpRGB; + ULONG nNumColors,i; + USHORT *lpIndex; + PPALETTE palGDI; + + palGDI = PALETTE_LockPalette(dc->dclevel.hpal); + + if (NULL == palGDI) + { + return NULL; + } + + if (palGDI->Mode != PAL_INDEXED) + { + PALETTE_UnlockPalette(palGDI); + return NULL; + } + + nNumColors = 1 << lpbmi->bmiHeader.biBitCount; + if (lpbmi->bmiHeader.biClrUsed) + { + nNumColors = min(nNumColors, lpbmi->bmiHeader.biClrUsed); + } + + lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP); + if (lpRGB == NULL) + { + PALETTE_UnlockPalette(palGDI); + return NULL; + } + + lpIndex = (USHORT *)&lpbmi->bmiColors[0]; + + for (i = 0; i < nNumColors; i++) + { + lpRGB[i].rgbRed = palGDI->IndexedColors[*lpIndex].peRed; + lpRGB[i].rgbGreen = palGDI->IndexedColors[*lpIndex].peGreen; + lpRGB[i].rgbBlue = palGDI->IndexedColors[*lpIndex].peBlue; + lpRGB[i].rgbReserved = 0; + lpIndex++; + } + PALETTE_UnlockPalette(palGDI); + + return lpRGB; } -HPALETTE FASTCALL -BuildDIBPalette (CONST BITMAPINFO *bmi, PINT paletteType) +HPALETTE +FASTCALL +BuildDIBPalette(CONST BITMAPINFO *bmi, PINT paletteType) { - BYTE bits; - ULONG ColorCount; - PALETTEENTRY *palEntries = NULL; - HPALETTE hPal; - ULONG RedMask, GreenMask, BlueMask; - - // Determine Bits Per Pixel - bits = bmi->bmiHeader.biBitCount; - - // Determine paletteType from Bits Per Pixel - if (bits <= 8) - { - *paletteType = PAL_INDEXED; - RedMask = GreenMask = BlueMask = 0; - } - else if(bmi->bmiHeader.biCompression == BI_BITFIELDS) - { - *paletteType = PAL_BITFIELDS; - RedMask = ((ULONG *)bmi->bmiColors)[0]; - GreenMask = ((ULONG *)bmi->bmiColors)[1]; - BlueMask = ((ULONG *)bmi->bmiColors)[2]; - } - else if(bits < 24) - { - *paletteType = PAL_BITFIELDS; - RedMask = 0x7c00; - GreenMask = 0x03e0; - BlueMask = 0x001f; - } - else - { - *paletteType = PAL_BGR; - RedMask = 0xff0000; - GreenMask = 0x00ff00; - BlueMask = 0x0000ff; - } - - if (bmi->bmiHeader.biClrUsed == 0) - { - ColorCount = 1 << bmi->bmiHeader.biBitCount; - } - else - { - ColorCount = bmi->bmiHeader.biClrUsed; - } - - if (PAL_INDEXED == *paletteType) - { - hPal = PALETTE_AllocPaletteIndexedRGB(ColorCount, (RGBQUAD*)bmi->bmiColors); - } - else - { - hPal = PALETTE_AllocPalette(*paletteType, ColorCount, - (ULONG*) palEntries, - RedMask, GreenMask, BlueMask ); - } - - return hPal; + BYTE bits; + ULONG ColorCount; + PALETTEENTRY *palEntries = NULL; + HPALETTE hPal; + ULONG RedMask, GreenMask, BlueMask; + + // Determine Bits Per Pixel + bits = bmi->bmiHeader.biBitCount; + + // Determine paletteType from Bits Per Pixel + if (bits <= 8) + { + *paletteType = PAL_INDEXED; + RedMask = GreenMask = BlueMask = 0; + } + else if (bmi->bmiHeader.biCompression == BI_BITFIELDS) + { + *paletteType = PAL_BITFIELDS; + RedMask = ((ULONG *)bmi->bmiColors)[0]; + GreenMask = ((ULONG *)bmi->bmiColors)[1]; + BlueMask = ((ULONG *)bmi->bmiColors)[2]; + } + else if (bits < 24) + { + *paletteType = PAL_BITFIELDS; + RedMask = 0x7c00; + GreenMask = 0x03e0; + BlueMask = 0x001f; + } + else + { + *paletteType = PAL_BGR; + RedMask = 0xff0000; + GreenMask = 0x00ff00; + BlueMask = 0x0000ff; + } + + if (bmi->bmiHeader.biClrUsed == 0) + { + ColorCount = 1 << bmi->bmiHeader.biBitCount; + } + else + { + ColorCount = bmi->bmiHeader.biClrUsed; + } + + if (PAL_INDEXED == *paletteType) + { + hPal = PALETTE_AllocPaletteIndexedRGB(ColorCount, (RGBQUAD*)bmi->bmiColors); + } + else + { + hPal = PALETTE_AllocPalette(*paletteType, ColorCount, + (ULONG*) palEntries, + RedMask, GreenMask, BlueMask); + } + + return hPal; } /* EOF */
15 years, 5 months
1
0
0
0
[janderwald] 41363: - Topology nodes can have a nullable name - Disable releasing resources when IPortFilterWaveCyclic is closed
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Jun 10 01:55:12 2009 New Revision: 41363 URL:
http://svn.reactos.org/svn/reactos?rev=41363&view=rev
Log: - Topology nodes can have a nullable name - Disable releasing resources when IPortFilterWaveCyclic is closed Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Wed Jun 10 01:55:12 2009 @@ -236,7 +236,7 @@ IN PIRP Irp) { ULONG Index; - PMINIPORTWAVECYCLIC Miniport; + //PMINIPORTWAVECYCLIC Miniport; IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface; for(Index = 0; Index < This->Descriptor->Factory.PinDescriptorCount; Index++) @@ -246,12 +246,12 @@ } /* release reference to port */ - This->Port->lpVtbl->Release(This->Port); + //This->Port->lpVtbl->Release(This->Port); /* get the miniport driver */ - Miniport = GetWaveCyclicMiniport(This->Port); + //Miniport = GetWaveCyclicMiniport(This->Port); /* release miniport driver */ - Miniport->lpVtbl->Release(Miniport); + //Miniport->lpVtbl->Release(Miniport); Irp->IoStatus.Status = STATUS_SUCCESS; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Wed Jun 10 01:55:12 2009 @@ -393,13 +393,15 @@ /* insert into list to free later */ ExInterlockedInsertTailList(&This->FreeHead, &CurMapping->Entry, &This->Lock); + DPRINT("IIrpQueue_fnGetMappingWithTag Tag %p Mapping %p\n", Tag, CurMapping); } else { /* we can free this entry now */ FreeItem(CurMapping, TAG_PORTCLASS); - } - DPRINT("IIrpQueue_fnGetMappingWithTag Tag %p\n", Tag); + DPRINT("IIrpQueue_fnGetMappingWithTag Tag %p Mapping %p FREED\n", Tag, CurMapping); + } + return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] Wed Jun 10 01:55:12 2009 @@ -236,8 +236,14 @@ for(Index = 0; Index < FilterDescription->NodeCount; Index++) { - RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodes[Index], FilterDescription->Nodes[Index].Type, sizeof(GUID)); - RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodesNames[Index], FilterDescription->Nodes[Index].Name, sizeof(GUID)); + if (FilterDescription->Nodes[Index].Type) + { + RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodes[Index], FilterDescription->Nodes[Index].Type, sizeof(GUID)); + } + if (FilterDescription->Nodes[Index].Name) + { + RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodesNames[Index], FilterDescription->Nodes[Index].Name, sizeof(GUID)); + } } Descriptor->Topology->TopologyNodesCount = FilterDescription->NodeCount; }
15 years, 5 months
1
0
0
0
[spetreolle] 41362: Dhcp HostName isn't mandatory. Fixes nat networking in vbox.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Wed Jun 10 00:22:48 2009 New Revision: 41362 URL:
http://svn.reactos.org/svn/reactos?rev=41362&view=rev
Log: Dhcp HostName isn't mandatory. Fixes nat networking in vbox. Modified: trunk/reactos/base/services/dhcp/dhclient.c Modified: trunk/reactos/base/services/dhcp/dhclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/dhclien…
============================================================================== --- trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] Wed Jun 10 00:22:48 2009 @@ -1961,11 +1961,9 @@ case DHO_HOST_NAME: case DHO_DOMAIN_NAME: case DHO_NIS_DOMAIN: - if (!res_hnok(sbuf)) { + if (!res_hnok(sbuf)) warning("Bogus Host Name option %d: %s (%s)", option, sbuf, opbuf); - return (0); - } return (1); case DHO_PAD: case DHO_TIME_OFFSET:
15 years, 5 months
1
0
0
0
[fireball] 41361: - Fix accidentally committed change in a function prototype. Spotted by Stefan Ginsberg.
by fireball@svn.reactos.org
Author: fireball Date: Tue Jun 9 20:43:22 2009 New Revision: 41361 URL:
http://svn.reactos.org/svn/reactos?rev=41361&view=rev
Log: - Fix accidentally committed change in a function prototype. Spotted by Stefan Ginsberg. Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h trunk/reactos/ntoskrnl/io/iomgr/irp.c Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] Tue Jun 9 20:43:22 2009 @@ -92,7 +92,7 @@ static __inline VOID -IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG_PTR TransferCount) +IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount) { PLARGE_INTEGER CountToChange; PLARGE_INTEGER TransferToChange; Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Tue Jun 9 20:43:22 2009 @@ -400,19 +400,19 @@ { /* Update write transfer count */ IopUpdateTransferCount(IopWriteTransfer, - Irp->IoStatus.Information); + (ULONG)Irp->IoStatus.Information); } else if (Irp->Flags & IRP_READ_OPERATION) { /* Update read transfer count */ IopUpdateTransferCount(IopReadTransfer, - Irp->IoStatus.Information); + (ULONG)Irp->IoStatus.Information); } else { /* Update other transfer count */ IopUpdateTransferCount(IopOtherTransfer, - Irp->IoStatus.Information); + (ULONG)Irp->IoStatus.Information); } }
15 years, 5 months
1
0
0
0
[spetreolle] 41360: don't include private.h twice fix include path
by spetreolle@svn.reactos.org
Author: spetreolle Date: Tue Jun 9 20:42:42 2009 New Revision: 41360 URL:
http://svn.reactos.org/svn/reactos?rev=41360&view=rev
Log: don't include private.h twice fix include path Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.c [iso-8859-1] Tue Jun 9 20:42:42 2009 @@ -5,8 +5,6 @@ * PURPOSE: DMus IRP Audio Pin * PROGRAMMER: Johannes Anderwald */ - -#include "private.h" #include "private.h" Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.c [iso-8859-1] Tue Jun 9 20:42:42 2009 @@ -5,8 +5,6 @@ * PURPOSE: WavePci IRP Audio Pin * PROGRAMMER: Johannes Anderwald */ - -#include "private.h" #include "private.h" Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1] Tue Jun 9 20:42:42 2009 @@ -4,7 +4,7 @@ <importlibrary definition="portcls.spec" /> <define name="PC_NO_IMPORTS" /> <redefine name="_WIN32_WINNT">0x600</redefine> - <include base="portcls">../include</include> + <include base="portcls">.</include> <library>ntoskrnl</library> <library>ks</library> <library>drmk</library>
15 years, 5 months
1
0
0
0
[fireball] 41359: - Make use of the implemented transfer counter.
by fireball@svn.reactos.org
Author: fireball Date: Tue Jun 9 20:38:05 2009 New Revision: 41359 URL:
http://svn.reactos.org/svn/reactos?rev=41359&view=rev
Log: - Make use of the implemented transfer counter. Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h trunk/reactos/ntoskrnl/io/iomgr/iofunc.c trunk/reactos/ntoskrnl/io/iomgr/irp.c Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] Tue Jun 9 20:38:05 2009 @@ -92,7 +92,7 @@ static __inline VOID -IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount) +IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG_PTR TransferCount) { PLARGE_INTEGER CountToChange; PLARGE_INTEGER TransferToChange; Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] Tue Jun 9 20:38:05 2009 @@ -2353,6 +2353,9 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; + + /* Update transfer count */ + IopUpdateTransferCount(IopOtherTransfer, Length); /* Release the file lock, dereference the file and return */ IopUnlockFileObject(FileObject); Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Tue Jun 9 20:38:05 2009 @@ -390,6 +390,29 @@ /* Clear the APC Routine and remember this */ Irp->Overlay.AsynchronousParameters.UserApcRoutine = NULL; SignaledCreateRequest = TRUE; + } + } + + /* Update transfer count for everything but create operation */ + if (!(Irp->Flags & IRP_CREATE_OPERATION)) + { + if (Irp->Flags & IRP_WRITE_OPERATION) + { + /* Update write transfer count */ + IopUpdateTransferCount(IopWriteTransfer, + Irp->IoStatus.Information); + } + else if (Irp->Flags & IRP_READ_OPERATION) + { + /* Update read transfer count */ + IopUpdateTransferCount(IopReadTransfer, + Irp->IoStatus.Information); + } + else + { + /* Update other transfer count */ + IopUpdateTransferCount(IopOtherTransfer, + Irp->IoStatus.Information); } }
15 years, 5 months
1
0
0
0
[fireball] 41358: - Implement a helper for updating IO transfer counters. Based on a patch by Dmitry Chapyshev.
by fireball@svn.reactos.org
Author: fireball Date: Tue Jun 9 20:17:34 2009 New Revision: 41358 URL:
http://svn.reactos.org/svn/reactos?rev=41358&view=rev
Log: - Implement a helper for updating IO transfer counters. Based on a patch by Dmitry Chapyshev. Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] Tue Jun 9 20:17:34 2009 @@ -91,6 +91,44 @@ static __inline +VOID +IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount) +{ + PLARGE_INTEGER CountToChange; + PLARGE_INTEGER TransferToChange; + + /* Make sure I/O operations are being counted */ + if (IoCountOperations) + { + if (Type == IopReadTransfer) + { + /* Increase read count */ + CountToChange = &PsGetCurrentProcess()->ReadTransferCount; + TransferToChange = &IoReadTransferCount; + } + else if (Type == IopWriteTransfer) + { + /* Increase write count */ + CountToChange = &PsGetCurrentProcess()->WriteTransferCount; + TransferToChange = &IoWriteTransferCount; + } + else + { + /* Increase other count */ + CountToChange = &PsGetCurrentProcess()->OtherTransferCount; + TransferToChange = &IoOtherTransferCount; + } + + /* Increase the process-wide count */ + ExInterlockedAddLargeStatistic(CountToChange, TransferCount); + + /* Increase global count */ + ExInterlockedAddLargeStatistic(TransferToChange, TransferCount); + } +} + +static +__inline BOOLEAN IopValidateOpenPacket(IN POPEN_PACKET OpenPacket) {
15 years, 5 months
1
0
0
0
[janderwald] 41357: - Add a few sanity assert to KsCreate - Pass a create item and use an object class when creating an object header - Return zero mixer count when wdmaud fails to enumerate virtual device count - Should fix high cpu usage after installing audio drivers
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Jun 9 18:50:24 2009 New Revision: 41357 URL:
http://svn.reactos.org/svn/reactos?rev=41357&view=rev
Log: - Add a few sanity assert to KsCreate - Pass a create item and use an object class when creating an object header - Return zero mixer count when wdmaud fails to enumerate virtual device count - Should fix high cpu usage after installing audio drivers Modified: trunk/reactos/drivers/ksfilter/ks/irp.c trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c trunk/reactos/drivers/wdm/audio/sysaudio/control.c trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c Modified: trunk/reactos/drivers/ksfilter/ks/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Tue Jun 9 18:50:24 2009 @@ -759,7 +759,13 @@ } else if (DeviceHeader->ItemList[Index].bCreated && IoStack->FileObject->FileName.Buffer != NULL) { - ULONG Length = wcslen(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer); + ULONG Length; + + ASSERT(DeviceHeader->ItemList[Index].ObjectHeader); + ASSERT(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem); + ASSERT(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer); + + Length = wcslen(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer); /* filter for that type has already exists */ if (!_wcsnicmp(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer, Modified: trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/filters/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c [iso-8859-1] Tue Jun 9 18:50:24 2009 @@ -189,6 +189,7 @@ KSOBJECT_HEADER ObjectHeader; PIO_STACK_LOCATION IoStatus; LPWSTR Buffer; + PKSOBJECT_CREATE_ITEM CreateItem; static LPWSTR KS_NAME_PIN = L"{146F1A80-4791-11D0-A5D6-28DB04C10000}"; @@ -211,8 +212,23 @@ } } + /* allocate create item */ + CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM)); + if (!CreateItem) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* zero create struct */ + RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM)); + + RtlInitUnicodeString(&CreateItem->ObjectClass, L"KMixer"); + /* allocate object header */ - Status = KsAllocateObjectHeader(&ObjectHeader, 0, NULL, Irp, &DispatchTable); + Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable); DPRINT("KsAllocateObjectHeader result %x\n", Status); /* complete the irp */ Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] Tue Jun 9 18:50:24 2009 @@ -133,7 +133,6 @@ NTSTATUS Status; PWDMAUD_DEVICE_EXTENSION DeviceExtension; - Pin.Property.Set = KSPROPSETID_Sysaudio; Pin.Property.Id = KSPROPERTY_SYSAUDIO_DEVICE_COUNT; Pin.Property.Flags = KSPROPERTY_TYPE_GET; @@ -143,7 +142,7 @@ Count = 0; Status = KsSynchronousIoControlDevice(DeviceExtension->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned); if (!NT_SUCCESS(Status) || !Count) - return STATUS_UNSUCCESSFUL; + return 0; NumPins = 0; for(Index = 0; Index < Count; Index++) Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
============================================================================== --- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Tue Jun 9 18:50:24 2009 @@ -256,7 +256,7 @@ HANDLE PinHandle; PFILE_OBJECT FileObject; - Status = KsCreatePin(KMixerHandle, PinConnect, GENERIC_READ | GENERIC_WRITE, &PinHandle); + Status = KsoCreatePin(KMixerHandle, PinConnect, GENERIC_READ | GENERIC_WRITE, &PinHandle, L"KMixer"); if (!NT_SUCCESS(Status)) { @@ -419,7 +419,7 @@ DPRINT1("creating virtual pin\n"); /* now create the virtual audio pin which is exposed to wdmaud */ - Status = KsCreatePin(Filter, WorkerContext->PinConnect, GENERIC_READ | GENERIC_WRITE, &VirtualPinHandle); + Status = KsoCreatePin(Filter, WorkerContext->PinConnect, GENERIC_READ | GENERIC_WRITE, &VirtualPinHandle, L"SysAudio"); if (!NT_SUCCESS(Status)) { Modified: trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
============================================================================== --- trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] Tue Jun 9 18:50:24 2009 @@ -346,6 +346,7 @@ /* store create context */ CreateItem->Context = (PVOID)Client; + RtlInitUnicodeString(&CreateItem->ObjectClass, L"SysAudio"); /* store the object in FsContext */ IoStatus->FileObject->FsContext2 = (PVOID)Client;
15 years, 5 months
1
0
0
0
[mjmartin] 41356: - MmUnmapViewOfSection: Unlock address space before notifying debugger. Fixes a case where OllyDbg deadlocks in a GateWait while trying to read virtual memory.
by mjmartin@svn.reactos.org
Author: mjmartin Date: Tue Jun 9 16:50:32 2009 New Revision: 41356 URL:
http://svn.reactos.org/svn/reactos?rev=41356&view=rev
Log: - MmUnmapViewOfSection: Unlock address space before notifying debugger. Fixes a case where OllyDbg deadlocks in a GateWait while trying to read virtual memory. Modified: trunk/reactos/ntoskrnl/mm/section.c Modified: trunk/reactos/ntoskrnl/mm/section.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Tue Jun 9 16:50:32 2009 @@ -4148,10 +4148,11 @@ Status = MmUnmapViewOfSegment(AddressSpace, BaseAddress); } + MmUnlockAddressSpace(AddressSpace); + /* Notify debugger */ if (ImageBaseAddress) DbgkUnMapViewOfSection(ImageBaseAddress); - MmUnlockAddressSpace(AddressSpace); return(STATUS_SUCCESS); }
15 years, 5 months
1
0
0
0
[cwittich] 41355: fix some bugs with external tools
by cwittich@svn.reactos.org
Author: cwittich Date: Tue Jun 9 12:42:36 2009 New Revision: 41355 URL:
http://svn.reactos.org/svn/reactos?rev=41355&view=rev
Log: fix some bugs with external tools Modified: trunk/tools/reactosdbg/RosDBG/ExtTools.cs trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs Modified: trunk/tools/reactosdbg/RosDBG/ExtTools.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/ExtTools.c…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/ExtTools.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/ExtTools.cs [iso-8859-1] Tue Jun 9 12:42:36 2009 @@ -40,7 +40,8 @@ mAddRemove = true; ExternalTool t = new ExternalTool(); ToolsListBox.Items.Add(t); - ToolsListBox.SelectedIndex = ToolsListBox.Items.Count - 1; + mExternalToolsList.Add(t); + ToolsListBox.SelectedIndex = ToolsListBox.Items.Count - 1; btnRemove.Enabled = true; mAddRemove = false; } @@ -71,7 +72,7 @@ private void SaveItem(int Idx) { - if (!mAddRemove) + if ((!mAddRemove) && (Idx >= 0)) { ExternalTool item = new ExternalTool(txtTitle.Text, txtPath.Text); mUpdatingList = true; Modified: trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Properties…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] Tue Jun 9 12:42:36 2009 @@ -39,5 +39,5 @@ // will be increased as well. MSI installers must not be generated with the same Build Number // otherwise they won't upgrade the old installation! -[assembly: AssemblyVersion("1.0.2.61")] -[assembly: AssemblyFileVersion("1.0.2.61")] +[assembly: AssemblyVersion("1.0.2.62")] +[assembly: AssemblyFileVersion("1.0.2.62")]
15 years, 5 months
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
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