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
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2019
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
31 participants
300 discussions
Start a n
N
ew thread
[reactos] 01/01: [FREELDR] Remove unneeded ASSUME line.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8077da05e030c77062ae0…
commit 8077da05e030c77062ae041445e49542c5950530 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Thu Jan 31 23:51:00 2019 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Jan 31 23:51:00 2019 +0100 [FREELDR] Remove unneeded ASSUME line. --- boot/freeldr/freeldr/arch/i386/entry.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/boot/freeldr/freeldr/arch/i386/entry.S b/boot/freeldr/freeldr/arch/i386/entry.S index 799764f858..5e8397e6e0 100644 --- a/boot/freeldr/freeldr/arch/i386/entry.S +++ b/boot/freeldr/freeldr/arch/i386/entry.S @@ -65,8 +65,6 @@ ContinueAddress: _FrldrStartup: -ASSUME /*CS:_TEXT,*/ DS:_DATA, ES:_DATA, FS:_DATA, GS:_DATA, SS:_DATA - /* Store BootDrive and BootPartition */ mov byte ptr ds:[_FrldrBootDrive], dl xor eax, eax
5 years, 11 months
1
0
0
0
[reactos] 01/01: [FREELDR] Fix msvc boot (#1329)
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=71e13274ee4f56a596860…
commit 71e13274ee4f56a5968604a1425b7366ee740444 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Thu Jan 31 23:42:20 2019 +0100 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Jan 31 23:42:20 2019 +0100 [FREELDR] Fix msvc boot (#1329) CORE-15700 --- boot/freeldr/freeldr/arch/i386/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/freeldr/freeldr/arch/i386/entry.S b/boot/freeldr/freeldr/arch/i386/entry.S index 7de40ca026..799764f858 100644 --- a/boot/freeldr/freeldr/arch/i386/entry.S +++ b/boot/freeldr/freeldr/arch/i386/entry.S @@ -153,7 +153,7 @@ _Reboot: PUBLIC _ChainLoadBiosBootSectorCode _ChainLoadBiosBootSectorCode: /* Set the boot drive */ - mov dl, byte ptr [_FrldrBootDrive] + mov dl, byte ptr ds:[_FrldrBootDrive] /* Set the function ID */ mov bx, FNID_ChainLoadBiosBootSectorCode @@ -165,7 +165,7 @@ _ChainLoadBiosBootSectorCode: PUBLIC i386CallRealMode i386CallRealMode: /* Set continue address and switch to real mode */ - mov dword ptr [ContinueAddress], offset i386CallRealMode_return + mov dword ptr ds:[ContinueAddress], offset i386CallRealMode_return jmp SwitchToReal i386CallRealMode_return: ret
5 years, 11 months
1
0
0
0
[reactos] 01/01: [FONT][WIN32SS] Improve font coordinate transformation (#1238)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64987cf2731f9762d0316…
commit 64987cf2731f9762d0316274bf7877a9bd3d88ba Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Jan 31 11:57:28 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Jan 31 11:57:28 2019 +0900 [FONT][WIN32SS] Improve font coordinate transformation (#1238) Improve TextOut/ExtTextOut font rendering with SetWorldTransform. CORE-15554, CORE-15623 --- win32ss/gdi/ntgdi/freetype.c | 303 +++++++++++++++++++------------------------ win32ss/gdi/ntgdi/xformobj.c | 11 +- 2 files changed, 145 insertions(+), 169 deletions(-) diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index a74d223cd5..d76d63dfea 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -703,11 +703,11 @@ FtMatrixFromMx(FT_Matrix *pmat, PMATRIX pmx) FLOATOBJ_MulLong(&ef, 0x00010000); pmat->xx = FLOATOBJ_GetLong(&ef); - ef = pmx->efM12; + ef = pmx->efM21; FLOATOBJ_MulLong(&ef, 0x00010000); pmat->xy = FLOATOBJ_GetLong(&ef); - ef = pmx->efM21; + ef = pmx->efM12; FLOATOBJ_MulLong(&ef, 0x00010000); pmat->yx = FLOATOBJ_GetLong(&ef); @@ -5531,7 +5531,7 @@ GreExtTextOutW( FT_Face face; FT_GlyphSlot glyph; FT_BitmapGlyph realglyph; - LONGLONG TextLeft64, TextTop64, TextWidth64, RealXStart64; + LONGLONG TextLeft64, TextTop64, DeltaX64, DeltaY64, XStart64, YStart64; ULONG previous; FT_Bool use_kerning; RECTL DestRect, MaskRect; @@ -5555,10 +5555,8 @@ GreExtTextOutW( BOOL EmuBold, EmuItalic; int thickness; BOOL bResult; - INT DY1, DY2; - FT_Matrix mat1, mat2 = identityMat; + FT_Matrix mat = identityMat, matWidth, matEscape, matWorld; FT_Vector vecs[9]; - POINT pts[9]; /* Check if String is valid */ if ((Count > 0xFFFF) || (Count > 0 && String == NULL)) @@ -5619,10 +5617,6 @@ GreExtTextOutW( Start.y = YStart; } - IntLPtoDP(dc, &Start, 1); - RealXStart64 = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6; - YStart = Start.y + dc->ptlDCOrig.y; - SourcePoint.x = 0; SourcePoint.y = 0; MaskRect.left = 0; @@ -5720,55 +5714,39 @@ GreExtTextOutW( } /* NOTE: Don't trust face->size->metrics.ascender and descender values. */ + DC_vUpdateWorldToDevice(dc); if (dc->pdcattr->iGraphicsMode == GM_ADVANCED) { pmxWorldToDevice = DC_pmxWorldToDevice(dc); - FtSetCoordinateTransform(face, pmxWorldToDevice); } else { pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault; - FtSetCoordinateTransform(face, pmxWorldToDevice); } - /* - * Process the vertical alignment and determine DY1 and DY2. - */ -#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM) - if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BASELINE) - { - DY1 = FontGDI->tmAscent; - DY2 = FontGDI->tmDescent; - } - else if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BOTTOM) - { - DY1 = FontGDI->tmHeight; - DY2 = 0; - } - else /* TA_TOP */ - { - DY1 = 0; - DY2 = FontGDI->tmHeight; - } -#undef VALIGN_MASK + IntWidthMatrix(face, &matWidth, lfWidth); + FT_Matrix_Multiply(&matWidth, &mat); - IntWidthMatrix(face, &mat1, lfWidth); - FT_Matrix_Multiply(&mat1, &mat2); - FT_Set_Transform(face, &mat2, NULL); + IntEscapeMatrix(&matEscape, lfEscapement); + FT_Matrix_Multiply(&matEscape, &mat); - /* - * Calculate width of the text. - */ - TextWidth64 = 0; + FtMatrixFromMx(&matWorld, pmxWorldToDevice); + matWorld.yx = -matWorld.yx; + matWorld.xy = -matWorld.xy; + FT_Matrix_Multiply(&matWorld, &mat); + + FT_Set_Transform(face, &mat, NULL); + + // Calculate displacement of the text. + DeltaX64 = DeltaY64 = 0; DxShift = fuOptions & ETO_PDY ? 1 : 0; use_kerning = FT_HAS_KERNING(face); previous = 0; if ((fuOptions & ETO_OPAQUE) || (pdcattr->lTextAlign & (TA_CENTER | TA_RIGHT)) || - lfEscapement || plf->lfUnderline || plf->lfStrikeOut) + memcmp(&mat, &identityMat, sizeof(mat)) != 0 || + plf->lfUnderline || plf->lfStrikeOut) { - TextLeft64 = RealXStart64; - TextTop64 = YStart << 6; for (i = 0; i < Count; ++i) { glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions); @@ -5802,50 +5780,52 @@ GreExtTextOutW( { FT_Vector delta; FT_Get_Kerning(face, previous, glyph_index, 0, &delta); - TextLeft64 += delta.x; + DeltaX64 += delta.x; + DeltaY64 -= delta.y; } if (Dx == NULL) { - TextLeft64 += realglyph->root.advance.x >> 10; + DeltaX64 += realglyph->root.advance.x >> 10; + DeltaY64 -= realglyph->root.advance.y >> 10; } else { - // FIXME this should probably be a matrix transform with TextTop64 as well. + // FIXME this should probably be a matrix transform with DeltaY64 as well. Scale = pdcattr->mxWorldToDevice.efM11; if (FLOATOBJ_Equal0(&Scale)) FLOATOBJ_Set1(&Scale); /* do the shift before multiplying to preserve precision */ FLOATOBJ_MulLong(&Scale, Dx[i << DxShift] << 6); - TextLeft64 += FLOATOBJ_GetLong(&Scale); + DeltaX64 += FLOATOBJ_GetLong(&Scale); } if (DxShift) { - TextTop64 -= Dx[2 * i + 1] << 6; + DeltaY64 -= Dx[2 * i + 1] << 6; } previous = glyph_index; FT_Done_Glyph((FT_Glyph)realglyph); } - - TextWidth64 = TextLeft64 - RealXStart64; } - /* - * Process the horizontal alignment and modify XStart accordingly. - */ + // Process the X and Y alignments. if ((pdcattr->lTextAlign & TA_CENTER) == TA_CENTER) { - RealXStart64 -= TextWidth64 / 2; + XStart64 = -DeltaX64 / 2; + YStart64 = -DeltaY64 / 2; } else if ((pdcattr->lTextAlign & TA_RIGHT) == TA_RIGHT) { - RealXStart64 -= TextWidth64; - if (((RealXStart64 + TextWidth64 + 32) >> 6) <= Start.x + dc->ptlDCOrig.x) - RealXStart64 += 1 << 6; + XStart64 = -DeltaX64; + YStart64 = -DeltaY64; + } + else + { + XStart64 = YStart64 = 0; } psurf = dc->dclevel.pSurface; @@ -5866,23 +5846,30 @@ GreExtTextOutW( thickness = 1; } - IntEscapeMatrix(&mat1, lfEscapement); - FT_Matrix_Multiply(&mat1, &mat2); - FT_Set_Transform(face, &mat2, NULL); - - // background rectangle - vecs[0].x = 0; - vecs[0].y = (DY1 - FontGDI->tmHeight) << 16; // Top Left - vecs[1].x = TextWidth64 << 10; - vecs[1].y = (DY1 - FontGDI->tmHeight) << 16; // Top Right - vecs[2].x = TextWidth64 << 10; - vecs[2].y = DY1 << 16; // Bottom Right - vecs[3].x = 0; - vecs[3].y = DY1 << 16; // Bottom Left - - // the starting point - vecs[4].x = 0; - vecs[4].y = (DY1 - FontGDI->tmAscent) << 16; + /* Process the vertical alignment */ +#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM) + RtlZeroMemory(vecs, sizeof(vecs)); + if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BASELINE) + { + vecs[1].y = -FontGDI->tmAscent << 16; // upper left + vecs[4].y = 0; // baseline + vecs[0].y = FontGDI->tmDescent << 16; // lower left + } + else if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BOTTOM) + { + vecs[1].y = -FontGDI->tmHeight << 16; // upper left + vecs[4].y = -FontGDI->tmDescent << 16; // baseline + vecs[0].y = 0; // lower left + } + else /* TA_TOP */ + { + vecs[1].y = 0; // upper left + vecs[4].y = FontGDI->tmAscent << 16; // baseline + vecs[0].y = FontGDI->tmHeight << 16; // lower left + } + vecs[2] = vecs[1]; // upper right + vecs[3] = vecs[0]; // lower right +#undef VALIGN_MASK // underline if (plf->lfUnderline) @@ -5893,65 +5880,62 @@ GreExtTextOutW( position = face->underline_position * face->size->metrics.y_ppem / face->units_per_EM; } - vecs[5].x = 0; - vecs[5].y = (DY1 - FontGDI->tmAscent + position) << 16; - vecs[6].x = TextWidth64 << 10; - vecs[6].y = (DY1 - FontGDI->tmAscent + position) << 16; + vecs[5].y = vecs[6].y = vecs[4].y - (position << 16); } // strike through if (plf->lfStrikeOut) { - vecs[7].x = 0; - vecs[7].y = (DY1 - FontGDI->tmAscent + (FontGDI->tmAscent / 3)) << 16; - vecs[8].x = TextWidth64 << 10; - vecs[8].y = (DY1 - FontGDI->tmAscent + (FontGDI->tmAscent / 3)) << 16; + vecs[7].y = vecs[8].y = vecs[4].y - ((FontGDI->tmAscent / 3) << 16); } - // convert vecs to pts + // invert y axis + IntEscapeMatrix(&matEscape, -lfEscapement); + + // convert vecs for (i = 0; i < 9; ++i) { - FT_Vector_Transform(&vecs[i], &mat1); - pts[i].x = (RealXStart64 >> 6) + (vecs[i].x >> 16); - pts[i].y = YStart - (vecs[i].y >> 16); - } + POINT pt; + FT_Vector_Transform(&vecs[i], &matWidth); + FT_Vector_Transform(&vecs[i], &matEscape); + vecs[i].x += (Start.x << 16) + (XStart64 << 10); + vecs[i].y += (Start.y << 16) + (YStart64 << 10); + pt.x = vecs[i].x >> 16; + pt.y = vecs[i].y >> 16; + IntLPtoDP(dc, &pt, 1); + vecs[i].x = pt.x + dc->ptlDCOrig.x; + vecs[i].y = pt.y + dc->ptlDCOrig.y; + } + vecs[2].x += DeltaX64 >> 6; + vecs[2].y += DeltaY64 >> 6; // upper right + vecs[3].x += DeltaX64 >> 6; + vecs[3].y += DeltaY64 >> 6; // lower right + vecs[6].x += DeltaX64 >> 6; + vecs[6].y += DeltaY64 >> 6; // underline right + vecs[8].x += DeltaX64 >> 6; + vecs[8].y += DeltaY64 >> 6; // strike through right if (fuOptions & ETO_OPAQUE) { /* Draw background */ RECTL Rect; - INT X1 = ((RealXStart64 + 32) >> 6); + RtlZeroMemory(&Rect, sizeof(Rect)); - switch (lfEscapement) + if ((mat.xy == 0 && mat.yx == 0) || (mat.xx == 0 && mat.yy == 0)) { - case 0: - Rect.left = X1; - Rect.top = ((TextTop64 + 32) >> 6) - DY1; - Rect.right = (RealXStart64 + TextWidth64 + 32) >> 6; - Rect.bottom = ((TextTop64 + 32) >> 6) + DY2; - break; - case 90 * 10: - Rect.left = X1 - DY1; - Rect.top = ((TextTop64 - TextWidth64 + 32) >> 6); - Rect.right = X1 + DY2; - Rect.bottom = ((TextTop64 + 32) >> 6); - break; - case 180 * 10: - Rect.left = (RealXStart64 - TextWidth64 + 32) >> 6; - Rect.top = ((TextTop64 + 32) >> 6) - DY2; - Rect.right = X1; - Rect.bottom = ((TextTop64 + 32) >> 6) + DY1; - break; - case 270 * 10: - Rect.left = X1 - DY2; - Rect.top = ((TextTop64 + 32) >> 6); - Rect.right = X1 + DY1; - Rect.bottom = ((TextTop64 + TextWidth64 + 32) >> 6); - break; - default: - DPRINT1("FIXME: Not implemented lfEscapement\n"); - RtlZeroMemory(&Rect, sizeof(Rect)); - // FIXME: Use pts[0] ... pts[3] and EngFillPath + Rect.left = Rect.top = MAXLONG; + Rect.right = Rect.bottom = MINLONG; + for (i = 0; i < 4; ++i) + { + Rect.left = min(Rect.left, vecs[i].x); + Rect.top = min(Rect.top, vecs[i].y); + Rect.right = max(Rect.right, vecs[i].x); + Rect.bottom = max(Rect.bottom, vecs[i].y); + } + } + else + { + // FIXME: Use vecs[0] ... vecs[3] and EngFillPath } if (dc->fs & (DC_ACCUM_APP | DC_ACCUM_WMGR)) @@ -5988,18 +5972,18 @@ GreExtTextOutW( EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, psurf->ppal, 0, 0, 0); EXLATEOBJ_vInitialize(&exloDst2RGB, psurf->ppal, &gpalRGB, 0, 0, 0); - /* - * The main rendering loop. - */ + // The main rendering loop. bResult = TRUE; - TextLeft64 = pts[4].x << 6; - TextTop64 = pts[4].y << 6; + TextLeft64 = vecs[4].x << 6; + TextTop64 = vecs[4].y << 6; previous = 0; for (i = 0; i < Count; ++i) { + BOOL bNeedCache = (!EmuBold && !EmuItalic && + memcmp(&mat, &identityMat, sizeof(mat)) == 0); glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions); realglyph = NULL; - if (!EmuBold && !EmuItalic && !lfEscapement) + if (bNeedCache) { realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight, RenderMode, pmxWorldToDevice); @@ -6013,17 +5997,8 @@ GreExtTextOutW( bResult = FALSE; break; } - glyph = face->glyph; - if (EmuBold || EmuItalic || lfEscapement) - { - if (EmuBold) - FT_GlyphSlot_Embolden(glyph); - if (EmuItalic) - FT_GlyphSlot_Oblique(glyph); - realglyph = ftGdiGlyphSet(face, glyph, RenderMode); - } - else + if (bNeedCache) { realglyph = ftGdiGlyphCacheSet(face, glyph_index, @@ -6032,6 +6007,14 @@ GreExtTextOutW( glyph, RenderMode); } + else + { + if (EmuBold) + FT_GlyphSlot_Embolden(glyph); + if (EmuItalic) + FT_GlyphSlot_Oblique(glyph); + realglyph = ftGdiGlyphSet(face, glyph, RenderMode); + } if (!realglyph) { DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index); @@ -6046,6 +6029,7 @@ GreExtTextOutW( FT_Vector delta; FT_Get_Kerning(face, previous, glyph_index, 0, &delta); TextLeft64 += delta.x; + TextTop64 -= delta.y; } DPRINT("TextLeft64: %I64d\n", TextLeft64); DPRINT("TextTop64: %I64d\n", TextTop64); @@ -6155,6 +6139,7 @@ GreExtTextOutW( TextLeft64 += realglyph->root.advance.x >> 10; TextTop64 -= realglyph->root.advance.y >> 10; DPRINT("New TextLeft64: %I64d\n", TextLeft64); + DPRINT("New TextTop64: %I64d\n", TextTop64); } else { @@ -6177,7 +6162,7 @@ GreExtTextOutW( previous = glyph_index; /* No cache, so clean up */ - if (EmuBold || EmuItalic || lfEscapement) + if (!bNeedCache) { FT_Done_Glyph((FT_Glyph)realglyph); } @@ -6185,43 +6170,26 @@ GreExtTextOutW( if (plf->lfUnderline || plf->lfStrikeOut) { - INT x0, y0, x1, y1; - if (pts[0].x < pts[2].x) - { - x0 = pts[0].x; - x1 = pts[2].x; - } - else - { - x0 = pts[2].x; - x1 = pts[0].x; - } - if (pts[0].y < pts[2].y) - { - y0 = pts[0].y; - y1 = pts[2].y; - } - else - { - y0 = pts[2].y; - y1 = pts[0].y; - } + INT x0 = min(vecs[0].x, vecs[2].x); + INT y0 = min(vecs[0].y, vecs[2].y); + INT x1 = max(vecs[0].x, vecs[2].x); + INT y1 = max(vecs[0].y, vecs[2].y); if (dc->dctype == DCTYPE_DIRECT) MouseSafetyOnDrawStart(dc->ppdev, x0, y0, x1, y1); } if (plf->lfUnderline) { - INT i, nEscape = lfEscapement % (180 * 10); for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i) { - if (nEscape < 45 * 10 || nEscape > (180 - 45) * 10) + LONG dx = (LONG)(DeltaX64 >> 6), dy = (LONG)(DeltaY64 >> 6); + if (labs(dx) > labs(dy)) { // move vertical EngLineTo(SurfObj, (CLIPOBJ *)&dc->co, &dc->eboText.BrushObject, - pts[5].x, pts[5].y + i, - pts[6].x, pts[6].y + i, + vecs[5].x, vecs[5].y + i, + vecs[6].x, vecs[6].y + i, NULL, ROP2_TO_MIX(R2_COPYPEN)); } else @@ -6229,8 +6197,8 @@ GreExtTextOutW( // move horizontal EngLineTo(SurfObj, (CLIPOBJ *)&dc->co, &dc->eboText.BrushObject, - pts[5].x + i, pts[5].y, - pts[6].x + i, pts[6].y, + vecs[5].x + i, vecs[5].y, + vecs[6].x + i, vecs[6].y, NULL, ROP2_TO_MIX(R2_COPYPEN)); } } @@ -6238,16 +6206,16 @@ GreExtTextOutW( if (plf->lfStrikeOut) { - INT i, nEscape = lfEscapement % (180 * 10); for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i) { - if (nEscape < 45 * 10 || nEscape > (180 - 45) * 10) + LONG dx = (LONG)(DeltaX64 >> 6), dy = (LONG)(DeltaY64 >> 6); + if (labs(dx) > labs(dy)) { // move vertical EngLineTo(SurfObj, (CLIPOBJ *)&dc->co, &dc->eboText.BrushObject, - pts[7].x, pts[7].y + i, - pts[8].x, pts[8].y + i, + vecs[7].x, vecs[7].y + i, + vecs[8].x, vecs[8].y + i, NULL, ROP2_TO_MIX(R2_COPYPEN)); } else @@ -6255,10 +6223,9 @@ GreExtTextOutW( // move horizontal EngLineTo(SurfObj, (CLIPOBJ *)&dc->co, &dc->eboText.BrushObject, - pts[7].x + i, pts[7].y, - pts[8].x + i, pts[8].y, - NULL, - ROP2_TO_MIX(R2_COPYPEN)); + vecs[7].x + i, vecs[7].y, + vecs[8].x + i, vecs[8].y, + NULL, ROP2_TO_MIX(R2_COPYPEN)); } } } diff --git a/win32ss/gdi/ntgdi/xformobj.c b/win32ss/gdi/ntgdi/xformobj.c index adf097233a..0d938df687 100644 --- a/win32ss/gdi/ntgdi/xformobj.c +++ b/win32ss/gdi/ntgdi/xformobj.c @@ -150,12 +150,21 @@ XFORMOBJ_iSetXform( IN const XFORML *pxform) { PMATRIX pmx = XFORMOBJ_pmx(pxo); + FLOATOBJ ef1, ef2, efTemp; /* Check parameters */ if (!pxo || !pxform) return DDI_ERROR; /* Check if the xform is valid */ - if ((pxform->eM11 == 0) || (pxform->eM22 == 0)) return DDI_ERROR; + /* M11 * M22 - M12 * M21 != 0 */ + FLOATOBJ_SetFloat(&ef1, pxform->eM11); + FLOATOBJ_SetFloat(&efTemp, pxform->eM22); + FLOATOBJ_Mul(&ef1, &efTemp); + FLOATOBJ_SetFloat(&ef2, pxform->eM12); + FLOATOBJ_SetFloat(&efTemp, pxform->eM21); + FLOATOBJ_Mul(&ef2, &efTemp); + if (FLOATOBJ_Equal(&ef1, &ef2)) + return DDI_ERROR; /* Copy members */ FLOATOBJ_SetFloat(&pmx->efM11, pxform->eM11);
5 years, 11 months
1
0
0
0
[reactos] 01/01: [WIN32KNT_APITEST] Tabs To Spaces (#1326)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62f6e3b397f54b95df149…
commit 62f6e3b397f54b95df1496d742732bca8ee07b04 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 30 22:55:10 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 30 22:55:10 2019 +0900 [WIN32KNT_APITEST] Tabs To Spaces (#1326) Converts Tabs to Spaces. --- .../win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c | 18 +- .../win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c | 20 +- .../apitests/win32nt/ntgdi/NtGdiArcInternal.c | 42 +- .../rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c | 204 +-- .../apitests/win32nt/ntgdi/NtGdiCombineRgn.c | 72 +- .../apitests/win32nt/ntgdi/NtGdiCreateBitmap.c | 372 +++--- .../win32nt/ntgdi/NtGdiCreateCompatibleDC.c | 32 +- .../apitests/win32nt/ntgdi/NtGdiDoPalette.c | 338 ++--- .../apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c | 22 +- .../apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c | 68 +- .../apitests/win32nt/ntgdi/NtGdiExtTextOutW.c | 10 +- .../apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c | 42 +- .../apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c | 78 +- .../apitests/win32nt/ntgdi/NtGdiGetDIBits.c | 206 +-- .../ntgdi/NtGdiGetFontResourceInfoInternalW.c | 58 +- .../apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c | 148 +-- .../rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c | 8 +- .../apitests/win32nt/ntgdi/NtGdiSelectBitmap.c | 132 +- .../apitests/win32nt/ntgdi/NtGdiSelectBrush.c | 120 +- .../apitests/win32nt/ntgdi/NtGdiSelectFont.c | 80 +- .../apitests/win32nt/ntgdi/NtGdiSelectPen.c | 108 +- .../win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c | 158 +-- .../apitests/win32nt/ntuser/NtUserCallHwnd.c | 54 +- .../apitests/win32nt/ntuser/NtUserCallHwndLock.c | 96 +- .../apitests/win32nt/ntuser/NtUserCallHwndOpt.c | 8 +- .../apitests/win32nt/ntuser/NtUserCallHwndParam.c | 32 +- .../apitests/win32nt/ntuser/NtUserCallNoParam.c | 30 +- .../apitests/win32nt/ntuser/NtUserCallOneParam.c | 86 +- .../win32nt/ntuser/NtUserCountClipboardFormats.c | 2 +- .../win32nt/ntuser/NtUserEnumDisplayMonitors.c | 2 +- .../win32nt/ntuser/NtUserEnumDisplaySettings.c | 176 +-- .../apitests/win32nt/ntuser/NtUserGetClassInfo.c | 52 +- .../apitests/win32nt/ntuser/NtUserGetIconInfo.c | 262 ++-- .../apitests/win32nt/ntuser/NtUserRedrawWindow.c | 40 +- .../apitests/win32nt/ntuser/NtUserScrollDC.c | 204 +-- .../apitests/win32nt/ntuser/NtUserSelectPalette.c | 250 ++-- .../apitests/win32nt/ntuser/NtUserSetTimer.c | 6 +- .../win32nt/ntuser/NtUserSystemParametersInfo.c | 1370 ++++++++++---------- .../apitests/win32nt/ntuser/NtUserToUnicodeEx.c | 850 ++++++------ modules/rostests/apitests/win32nt/osver.c | 62 +- modules/rostests/apitests/win32nt/w32knapi.c | 136 +- modules/rostests/apitests/win32nt/w32knapi.h | 6 +- 42 files changed, 3030 insertions(+), 3030 deletions(-) diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c index 7ab06faf16..ffc9eaa46a 100644 --- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c +++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c @@ -9,15 +9,15 @@ START_TEST(NtGdiDdCreateDirectDrawObject) { - HANDLE hDirectDraw; - HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - ok(hdc != NULL, "\n"); + HANDLE hDirectDraw; + HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + ok(hdc != NULL, "\n"); - /* Test ReactX */ - ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n"); - ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); + /* Test ReactX */ + ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n"); + ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); - /* Cleanup ReactX setup */ - DeleteDC(hdc); - NtGdiDdDeleteDirectDrawObject(hDirectDraw); + /* Cleanup ReactX setup */ + DeleteDC(hdc); + NtGdiDdDeleteDirectDrawObject(hDirectDraw); } diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c index 35569f7eb2..7c71988866 100644 --- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c +++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c @@ -9,16 +9,16 @@ START_TEST(NtGdiDdDeleteDirectDrawObject) { - HANDLE hDirectDraw; - HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - ok(hdc != NULL, "\n"); + HANDLE hDirectDraw; + HDC hdc = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + ok(hdc != NULL, "\n"); - /* Test ReactX */ - ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n"); - ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); - ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n"); + /* Test ReactX */ + ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n"); + ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n"); + ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n"); - /* Cleanup ReactX setup */ - DeleteDC(hdc); - NtGdiDdDeleteDirectDrawObject(hDirectDraw); + /* Cleanup ReactX setup */ + DeleteDC(hdc); + NtGdiDdDeleteDirectDrawObject(hDirectDraw); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c index 7720145f23..8ff437e81f 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiArcInternal.c @@ -9,33 +9,33 @@ START_TEST(NtGdiArcInternal) { - HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL); + HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0), TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0), FALSE); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE); - ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0), TRUE); + ok_int(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0), TRUE); // was passiert, wenn left > right ? einfach tauschen? - DeleteDC(hDC); + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c index b54c96ac08..95f838f315 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiBitBlt.c @@ -9,106 +9,106 @@ START_TEST(NtGdiBitBlt) { - BOOL bRet; - HDC hdc1, hdc2; - HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2; - DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; - DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000}; - - /* Test NULL dc */ - SetLastError(ERROR_SUCCESS); - bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0); - ok_int(bRet, FALSE); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test invalid dc */ - SetLastError(ERROR_SUCCESS); - bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0); - ok_int(bRet, FALSE); - ok_long(GetLastError(), ERROR_SUCCESS); - - hdc1 = NtGdiCreateCompatibleDC(0); - ok(hdc1 != NULL, "hdc1 was NULL.\n"); - - hdc2 = NtGdiCreateCompatibleDC(0); - ok(hdc2 != NULL, "hdc2 was NULL.\n"); - - hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 ); - ok(hbmp1 != NULL, "hbmp1 was NULL.\n"); - hOldBmp1 = SelectObject(hdc1, hbmp1); - - ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 ); - ok(hbmp2 != NULL, "hbmp2 was NULL.\n"); - hOldBmp2 = SelectObject(hdc2, hbmp2); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - NtGdiSetPixel(hdc2, 0, 0, 0x00000000); - NtGdiSetPixel(hdc2, 1, 0, 0x00000000); - NtGdiSetPixel(hdc2, 0, 1, 0x00000000); - NtGdiSetPixel(hdc2, 1, 1, 0x00000000); - - bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0); - ok_int(bRet, TRUE); - ok_long(GetLastError(), ERROR_SUCCESS); - ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); - ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); - ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); - ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); - - SelectObject(hdc2, hOldBmp2); - SelectObject(hdc1, hOldBmp1); - - DeleteObject(hbmp2); - DeleteObject(hbmp1); - - DeleteDC(hdc1); - DeleteDC(hdc2); + BOOL bRet; + HDC hdc1, hdc2; + HBITMAP hbmp1, hOldBmp1, hbmp2, hOldBmp2; + DWORD bytes1[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; + DWORD bytes2[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000}; + + /* Test NULL dc */ + SetLastError(ERROR_SUCCESS); + bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0); + ok_int(bRet, FALSE); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test invalid dc */ + SetLastError(ERROR_SUCCESS); + bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0); + ok_int(bRet, FALSE); + ok_long(GetLastError(), ERROR_SUCCESS); + + hdc1 = NtGdiCreateCompatibleDC(0); + ok(hdc1 != NULL, "hdc1 was NULL.\n"); + + hdc2 = NtGdiCreateCompatibleDC(0); + ok(hdc2 != NULL, "hdc2 was NULL.\n"); + + hbmp1 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes1 ); + ok(hbmp1 != NULL, "hbmp1 was NULL.\n"); + hOldBmp1 = SelectObject(hdc1, hbmp1); + + ok(NtGdiGetPixel(hdc1, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc1, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc1, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc1, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + hbmp2 = NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE)bytes2 ); + ok(hbmp2 != NULL, "hbmp2 was NULL.\n"); + hOldBmp2 = SelectObject(hdc2, hbmp2); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 1, 1, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + bRet = NtGdiBitBlt(hdc2, 1, 1, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 2, 2, -2, -2, hdc1, 2, 2, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + NtGdiSetPixel(hdc2, 0, 0, 0x00000000); + NtGdiSetPixel(hdc2, 1, 0, 0x00000000); + NtGdiSetPixel(hdc2, 0, 1, 0x00000000); + NtGdiSetPixel(hdc2, 1, 1, 0x00000000); + + bRet = NtGdiBitBlt(hdc2, 0, 0, 2, 2, hdc1, 0, 0, SRCCOPY, 0, 0); + ok_int(bRet, TRUE); + ok_long(GetLastError(), ERROR_SUCCESS); + ok(NtGdiGetPixel(hdc2, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 0)); + ok(NtGdiGetPixel(hdc2, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 0, 1)); + ok(NtGdiGetPixel(hdc2, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 0)); + ok(NtGdiGetPixel(hdc2, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT)NtGdiGetPixel(hdc2, 1, 1)); + + SelectObject(hdc2, hOldBmp2); + SelectObject(hdc1, hOldBmp1); + + DeleteObject(hbmp2); + DeleteObject(hbmp1); + + DeleteDC(hdc1); + DeleteDC(hdc2); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c index 1c2ede4c26..c5f27cc68e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCombineRgn.c @@ -9,44 +9,44 @@ START_TEST(NtGdiCombineRgn) { - HRGN hRgnDest, hRgn1, hRgn2; + HRGN hRgnDest, hRgn1, hRgn2; // test what params are accepted for what operations // 0? invalid? are params maybe ignored in some cases? // LastError - /* Preparation */ - hRgnDest = CreateRectRgn(0,0,1,1); - hRgn1 = CreateRectRgn(1,1,4,4); - hRgn2 = CreateRectRgn(2,2,6,3); - - /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ - - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR); - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - /* Create intersection */ - ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION); - SetRectRgn(hRgn1, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); - - /* Create intersection with itself */ - SetRectRgn(hRgnDest, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION); - SetRectRgn(hRgn1, 2, 2, 4, 3); - ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); - - /* What if 2 regions are the same */ + /* Preparation */ + hRgnDest = CreateRectRgn(0,0,1,1); + hRgn1 = CreateRectRgn(1,1,4,4); + hRgn2 = CreateRectRgn(2,2,6,3); + + /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ + + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0), ERROR); + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6), ERROR); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + /* Create intersection */ + ok_int(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND), SIMPLEREGION); + SetRectRgn(hRgn1, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); + + /* Create intersection with itself */ + SetRectRgn(hRgnDest, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND), SIMPLEREGION); + SetRectRgn(hRgn1, 2, 2, 4, 3); + ok_int(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR), NULLREGION); + + /* What if 2 regions are the same */ } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c index 828ed402be..b6f2afad9e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateBitmap.c @@ -9,198 +9,198 @@ void Test_NtGdiCreateBitmap_Params(void) { - HBITMAP hBmp; - BITMAP bitmap; - BYTE BitmapData[10] = {0x11, 0x22, 0x33}; - - /* Test simple params */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - /* Test all zero */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cx == 0 */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cx */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cy == 0 */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cy */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test negative cy and valid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test negative cy and invalid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test huge size */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY); - - /* Test huge size and valid bits */ - SetLastError(ERROR_SUCCESS); - TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test huge size and invalid bits */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test cPlanes == 0 */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 1); - ok_int(bitmap.bmHeight, 1); - ok_int(bitmap.bmWidthBytes, 2); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 1); - DeleteObject(hBmp); - - /* Test big cPlanes */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test cBPP == 0 */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 1); - ok_int(bitmap.bmHeight, 1); - ok_int(bitmap.bmWidthBytes, 2); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 1); - DeleteObject(hBmp); - - /* Test negative cBPP */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test bad cBPP */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 4); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 8); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 16); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 24); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 24); - DeleteObject(hBmp); - - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n"); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmBitsPixel, 32); - DeleteObject(hBmp); - - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test bad pointer */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test pointer alignment */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBmp); - - /* Test normal params */ - SetLastError(ERROR_SUCCESS); - ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); - ok_int(bitmap.bmType, 0); - ok_int(bitmap.bmWidth, 5); - ok_int(bitmap.bmHeight, 7); - ok_int(bitmap.bmWidthBytes, 6); - ok_int(bitmap.bmPlanes, 1); - ok_int(bitmap.bmBitsPixel, 8); - DeleteObject(hBmp); - - - /* Test height 0 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test height -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test witdth 0 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); - - /* Test witdth -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + HBITMAP hBmp; + BITMAP bitmap; + BYTE BitmapData[10] = {0x11, 0x22, 0x33}; + + /* Test simple params */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + /* Test all zero */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cx == 0 */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cx */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cy == 0 */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cy */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test negative cy and valid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test negative cy and invalid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test huge size */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_NOT_ENOUGH_MEMORY); + + /* Test huge size and valid bits */ + SetLastError(ERROR_SUCCESS); + TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test huge size and invalid bits */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test cPlanes == 0 */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 1); + ok_int(bitmap.bmHeight, 1); + ok_int(bitmap.bmWidthBytes, 2); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 1); + DeleteObject(hBmp); + + /* Test big cPlanes */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test cBPP == 0 */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 1); + ok_int(bitmap.bmHeight, 1); + ok_int(bitmap.bmWidthBytes, 2); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 1); + DeleteObject(hBmp); + + /* Test negative cBPP */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test bad cBPP */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 4); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 8); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 16); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 24); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 24); + DeleteObject(hBmp); + + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n"); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmBitsPixel, 32); + DeleteObject(hBmp); + + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test bad pointer */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234), NULL); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test pointer alignment */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + DeleteObject(hBmp); + + /* Test normal params */ + SetLastError(ERROR_SUCCESS); + ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP)); + ok_int(bitmap.bmType, 0); + ok_int(bitmap.bmWidth, 5); + ok_int(bitmap.bmHeight, 7); + ok_int(bitmap.bmWidthBytes, 6); + ok_int(bitmap.bmPlanes, 1); + ok_int(bitmap.bmBitsPixel, 8); + DeleteObject(hBmp); + + + /* Test height 0 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test height -1 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test witdth 0 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); /* Test witdth -1 params */ - SetLastError(ERROR_SUCCESS); - ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL); - ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + + /* Test witdth -1 params */ + SetLastError(ERROR_SUCCESS); + ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); } START_TEST(NtGdiCreateBitmap) { - Test_NtGdiCreateBitmap_Params(); -// Test_NtGdiCreateBitmap_Pixel(); + Test_NtGdiCreateBitmap_Params(); +// Test_NtGdiCreateBitmap_Pixel(); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c index 2d662053ec..9edb8e9620 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiCreateCompatibleDC.c @@ -9,25 +9,25 @@ START_TEST(NtGdiCreateCompatibleDC) { - HDC hDC; - HGDIOBJ hObj; + HDC hDC; + HGDIOBJ hObj; - /* Test if aa NULL DC is accepted */ - hDC = NtGdiCreateCompatibleDC(NULL); - ok(hDC != NULL, "hDC was NULL.\n"); + /* Test if aa NULL DC is accepted */ + hDC = NtGdiCreateCompatibleDC(NULL); + ok(hDC != NULL, "hDC was NULL.\n"); - /* We select a nwe palette. Note: SelectObject doesn't work with palettes! */ - hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0); - /* The old palette should be GetStockObject(DEFAULT_PALETTE) */ - ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE)); + /* We select a nwe palette. Note: SelectObject doesn't work with palettes! */ + hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0); + /* The old palette should be GetStockObject(DEFAULT_PALETTE) */ + ok_ptr(hObj, GetStockObject(DEFAULT_PALETTE)); - /* The default bitmap should be GetStockObject(21) */ - hObj = SelectObject(hDC, GetStockObject(21)); - ok_ptr(hObj, GetStockObject(21)); + /* The default bitmap should be GetStockObject(21) */ + hObj = SelectObject(hDC, GetStockObject(21)); + ok_ptr(hObj, GetStockObject(21)); - /* The default pen should be GetStockObject(BLACK_PEN) */ - hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); - ok_ptr(hObj, GetStockObject(BLACK_PEN)); + /* The default pen should be GetStockObject(BLACK_PEN) */ + hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); + ok_ptr(hObj, GetStockObject(BLACK_PEN)); - ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n"); + ok(NtGdiDeleteObjectApp(hDC) != 0, "NtGdiDeleteObjectApp(hDC) was zero.\n"); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c index c8887ffd17..9893cbe487 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiDoPalette.c @@ -10,186 +10,186 @@ HPALETTE CreateTestPalette() { - struct - { - LOGPALETTE logpal; - PALETTEENTRY entry[5]; - } palstruct = - { {0x300,5, - { {1,2,3,0} }}, - { {22,33,44,PC_RESERVED}, - {11,55,77,PC_EXPLICIT}, - {00,77,66,PC_RESERVED | PC_NOCOLLAPSE}, - {12,34,56,78}} }; - - return CreatePalette((LOGPALETTE*)&palstruct); + struct + { + LOGPALETTE logpal; + PALETTEENTRY entry[5]; + } palstruct = + { {0x300,5, + { {1,2,3,0} }}, + { {22,33,44,PC_RESERVED}, + {11,55,77,PC_EXPLICIT}, + {00,77,66,PC_RESERVED | PC_NOCOLLAPSE}, + {12,34,56,78}} }; + + return CreatePalette((LOGPALETTE*)&palstruct); } void Test_NtGdiDoPalette_GdiPalAnimate(void) { - HPALETTE hPal; - PALETTEENTRY palEntries[5] = { - {0,0,0,0}, - {0xff,0xff,0xff,0}, - {0x33,0x66,0x99,0}, - {0x25,0x84,0x14,0}, - {0x12,0x34,0x56,0x11}}; - PALETTEENTRY palEntries2[5]; - - /* Test stock palette */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - - /* Test pEntries = NULL */ - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0); - DeleteObject(hPal); - - /* Test PC_RESERVED */ - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2); - DeleteObject(hPal); - - hPal = CreateTestPalette(); - ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1); - DeleteObject(hPal); - - /* Test if entries are set correctly */ - hPal = CreateTestPalette(); - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE); - NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); - ok_int(palEntries2[0].peRed, 1); - ok_int(palEntries2[0].peGreen, 2); - ok_int(palEntries2[0].peBlue, 3); - ok_int(palEntries2[0].peFlags, 0); - ok_int(palEntries2[1].peRed, palEntries[1].peRed); - ok_int(palEntries2[1].peGreen, palEntries[1].peGreen); - ok_int(palEntries2[1].peBlue, palEntries[1].peBlue); - ok_int(palEntries2[1].peFlags, palEntries[1].peFlags); - ok_int(palEntries2[2].peRed, 11); - ok_int(palEntries2[2].peGreen, 55); - ok_int(palEntries2[2].peBlue, 77); - ok_int(palEntries2[2].peFlags, PC_EXPLICIT); - ok_int(palEntries2[3].peRed, palEntries[3].peRed); - ok_int(palEntries2[3].peGreen, palEntries[3].peGreen); - ok_int(palEntries2[3].peBlue, palEntries[3].peBlue); - ok_int(palEntries2[3].peFlags, palEntries[3].peFlags); - DeleteObject(hPal); + HPALETTE hPal; + PALETTEENTRY palEntries[5] = { + {0,0,0,0}, + {0xff,0xff,0xff,0}, + {0x33,0x66,0x99,0}, + {0x25,0x84,0x14,0}, + {0x12,0x34,0x56,0x11}}; + PALETTEENTRY palEntries2[5]; + + /* Test stock palette */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + + /* Test pEntries = NULL */ + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE), 0); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE), 0); + DeleteObject(hPal); + + /* Test PC_RESERVED */ + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE), 1); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE), 1); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE), 0); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE), 0); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE), 2); + DeleteObject(hPal); + + hPal = CreateTestPalette(); + ok_long(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE), 1); + DeleteObject(hPal); + + /* Test if entries are set correctly */ + hPal = CreateTestPalette(); + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE); + NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); + ok_int(palEntries2[0].peRed, 1); + ok_int(palEntries2[0].peGreen, 2); + ok_int(palEntries2[0].peBlue, 3); + ok_int(palEntries2[0].peFlags, 0); + ok_int(palEntries2[1].peRed, palEntries[1].peRed); + ok_int(palEntries2[1].peGreen, palEntries[1].peGreen); + ok_int(palEntries2[1].peBlue, palEntries[1].peBlue); + ok_int(palEntries2[1].peFlags, palEntries[1].peFlags); + ok_int(palEntries2[2].peRed, 11); + ok_int(palEntries2[2].peGreen, 55); + ok_int(palEntries2[2].peBlue, 77); + ok_int(palEntries2[2].peFlags, PC_EXPLICIT); + ok_int(palEntries2[3].peRed, palEntries[3].peRed); + ok_int(palEntries2[3].peGreen, palEntries[3].peGreen); + ok_int(palEntries2[3].peBlue, palEntries[3].peBlue); + ok_int(palEntries2[3].peFlags, palEntries[3].peFlags); + DeleteObject(hPal); } void Test_NtGdiDoPalette_GdiPalSetEntries(void) { - HDC hDC; - HPALETTE hPal, hOldPal; - PALETTEENTRY palEntries[5] = { - {0,0,0,0}, - {0xff,0xff,0xff,0}, - {0x33,0x66,0x99,0}, - {0x25,0x84,0x14,0}, - {0x12,0x34,0x56,0x11}}; - PALETTEENTRY palEntries2[5]; - - hPal = CreateTestPalette(); - - /* Test invalid handle */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test system palette */ - ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1); - ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2); - ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5); - ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5); - ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2); -// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0); - - /* Test bInbound, FALSE */ - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); - ZeroMemory(palEntries2, sizeof(palEntries2)); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5); - /* we should get the old values returned in our buffer! */ - ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); - - /* check what we have in our palette now */ - ZeroMemory(palEntries2, sizeof(palEntries2)); - ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5); - ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); - - ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4); - ok_long(GetLastError(), ERROR_SUCCESS); - - /* Test if entries are set correctly */ - hPal = CreateTestPalette(); - NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); - NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); - ok_int(palEntries2[0].peRed, 0); - ok_int(palEntries2[0].peGreen, 0); - ok_int(palEntries2[0].peBlue, 0); - ok_int(palEntries2[0].peFlags, 0); - - /* Test that the buffer was not changed */ - - - /* Test with palette selected into dc */ - hDC = CreateCompatibleDC(NULL); - hOldPal = SelectPalette(hDC, hPal, 0); - ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4); - SelectPalette(hDC, hOldPal, 0); - - /* Test pEntries = NULL */ - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); + HDC hDC; + HPALETTE hPal, hOldPal; + PALETTEENTRY palEntries[5] = { + {0,0,0,0}, + {0xff,0xff,0xff,0}, + {0x33,0x66,0x99,0}, + {0x25,0x84,0x14,0}, + {0x12,0x34,0x56,0x11}}; + PALETTEENTRY palEntries2[5]; + + hPal = CreateTestPalette(); + + /* Test invalid handle */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test system palette */ + ok_long(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_long(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE), 1); + ok_long(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE), 2); + ok_long(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE), 3); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE), 5); + ok_long(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE), 5); + ok_long(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE), 2); +// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE), 0); + + /* Test bInbound, FALSE */ + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); + ZeroMemory(palEntries2, sizeof(palEntries2)); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE), 5); + /* we should get the old values returned in our buffer! */ + ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); + + /* check what we have in our palette now */ + ZeroMemory(palEntries2, sizeof(palEntries2)); + ok_long(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE), 5); + ok_int(memcmp(palEntries2, palEntries, sizeof(palEntries)), 0); + + ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE), 4); + ok_long(GetLastError(), ERROR_SUCCESS); + + /* Test if entries are set correctly */ + hPal = CreateTestPalette(); + NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE); + NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE); + ok_int(palEntries2[0].peRed, 0); + ok_int(palEntries2[0].peGreen, 0); + ok_int(palEntries2[0].peBlue, 0); + ok_int(palEntries2[0].peFlags, 0); + + /* Test that the buffer was not changed */ + + + /* Test with palette selected into dc */ + hDC = CreateCompatibleDC(NULL); + hOldPal = SelectPalette(hDC, hPal, 0); + ok_long(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE), 4); + SelectPalette(hDC, hOldPal, 0); + + /* Test pEntries = NULL */ + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); } void Test_NtGdiDoPalette_GdiPalGetEntries(void) { - HPALETTE hPal; + HPALETTE hPal; - hPal = CreateTestPalette(); + hPal = CreateTestPalette(); - /* Test pEntries = NULL */ - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); - ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5); - ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5); + /* Test pEntries = NULL */ + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE), 0); + ok_long(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE), 5); + ok_long(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE), 5); // Test flags 0xf0 @@ -245,7 +245,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void) bmi.bmiColors[7] = 0xE0E0E0; bmi.bmiColors[8] = 0xffffff; hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS, (PVOID*)&pjBits, NULL, 0); - ok(hbmp != NULL, "hbmp was NULL.\n"); + ok(hbmp != NULL, "hbmp was NULL.\n"); ok(pjBits != NULL, "pjBits was NULL.\n"); SelectObject(hdc, hbmp); @@ -264,7 +264,7 @@ Test_NtGdiDoPalette_SetDIBColorTable(void) bmi.bmiColors[2] = 0xC0C0C0; bmi.bmiColors[1] = 0xE0E0E0; bmi.bmiColors[0] = 0xffffff; - ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9); + ok_long(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE), 9); SetDCPenColor(hdc, 0xE0E0E0); SetDCBrushColor(hdc, 0x202020); @@ -276,10 +276,10 @@ Test_NtGdiDoPalette_SetDIBColorTable(void) START_TEST(NtGdiDoPalette) { - Test_NtGdiDoPalette_GdiPalAnimate(); - Test_NtGdiDoPalette_GdiPalSetEntries(); - Test_NtGdiDoPalette_GdiPalGetEntries(); - Test_NtGdiDoPalette_GetSystemPalette(); - Test_NtGdiDoPalette_GetBIBColorTable(); - Test_NtGdiDoPalette_SetDIBColorTable(); + Test_NtGdiDoPalette_GdiPalAnimate(); + Test_NtGdiDoPalette_GdiPalSetEntries(); + Test_NtGdiDoPalette_GdiPalGetEntries(); + Test_NtGdiDoPalette_GetSystemPalette(); + Test_NtGdiDoPalette_GetBIBColorTable(); + Test_NtGdiDoPalette_SetDIBColorTable(); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c index 0606311ff6..a77d0c88fa 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEngCreatePalette.c @@ -9,17 +9,17 @@ START_TEST(NtGdiEngCreatePalette) { - HPALETTE hPal; - ULONG Colors[3] = {1,2,3}; - PENTRY pEntry; + HPALETTE hPal; + ULONG Colors[3] = {1,2,3}; + PENTRY pEntry; - hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00); + hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00); - ok(hPal != NULL, "hPal was NULL.\n"); - ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE); - pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)]; - ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); - ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); - ok_ptr(pEntry->pUser, NULL); - //TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE)); + ok(hPal != NULL, "hPal was NULL.\n"); + ok_int((int)GDI_HANDLE_GET_TYPE(hPal), (int)GDI_OBJECT_TYPE_PALETTE); + pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)]; + ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); + ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); + ok_ptr(pEntry->pUser, NULL); + //TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE)); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c index b359bd951a..6083053235 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiEnumFontOpen.c @@ -9,38 +9,38 @@ START_TEST(NtGdiEnumFontOpen) { - HDC hDC; - ULONG_PTR idEnum; - ULONG ulCount; - PENTRY pEntry; - - hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); - - // FIXME: We should load the font first - - idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount); - ok(idEnum != 0, "idEnum was 0.\n"); - if (idEnum == 0) - { - skip("idEnum == 0"); - return; - } - - /* we should have a gdi handle here */ - ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT); - pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)]; - ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); - ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); - ok_ptr(pEntry->pUser, NULL); - ok_int(pEntry->FullUnique, (idEnum >> 16)); - ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16); - ok_int(pEntry->Flags, 0); - - /* We should not be able to use DeleteObject() on the handle */ - ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE); - - NtGdiEnumFontClose(idEnum); - - // Test no logfont (NULL): should word - // Test empty lfFaceName string: should not work + HDC hDC; + ULONG_PTR idEnum; + ULONG ulCount; + PENTRY pEntry; + + hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); + + // FIXME: We should load the font first + + idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount); + ok(idEnum != 0, "idEnum was 0.\n"); + if (idEnum == 0) + { + skip("idEnum == 0"); + return; + } + + /* we should have a gdi handle here */ + ok_int((int)GDI_HANDLE_GET_TYPE(idEnum), (int)GDI_OBJECT_TYPE_ENUMFONT); + pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)]; + ok(pEntry->einfo.pobj != NULL, "pEntry->einfo.pobj was NULL.\n"); + ok_long(pEntry->ObjectOwner.ulObj, GetCurrentProcessId()); + ok_ptr(pEntry->pUser, NULL); + ok_int(pEntry->FullUnique, (idEnum >> 16)); + ok_int(pEntry->Objt, GDI_OBJECT_TYPE_ENUMFONT >> 16); + ok_int(pEntry->Flags, 0); + + /* We should not be able to use DeleteObject() on the handle */ + ok_int(DeleteObject((HGDIOBJ)idEnum), FALSE); + + NtGdiEnumFontClose(idEnum); + + // Test no logfont (NULL): should word + // Test empty lfFaceName string: should not work } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c index ef25e81ed0..be471ea650 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtTextOutW.c @@ -33,11 +33,11 @@ START_TEST(NtGdiExtTextOutW) ULONG len; INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5}; - /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); - hDC = GetDC(hWnd); + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); + hDC = GetDC(hWnd); lpstr = L"Hallo"; len = wcslen(lpstr); diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c index 842e50ba3c..729a7a49b5 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiFlushUserBatch.c @@ -13,36 +13,36 @@ NTSTATUS START_TEST(NtGdiFlushUserBatch) { - PVOID pRet; - PTEB pTeb; + PVOID pRet; + PTEB pTeb; pNtGdiFlushUserBatch = (PVOID)GetProcAddress(g_hModule, "NtGdiFlushUserBatch"); if (pNtGdiFlushUserBatch == NULL) return APISTATUS_NOT_FOUND; - pTeb = NtCurrentTeb(); - ok(pTeb != NULL, "pTeb was NULL.\n"); + pTeb = NtCurrentTeb(); + ok(pTeb != NULL, "pTeb was NULL.\n"); - pRet = (PVOID)pNtGdiFlushUserBatch(); + pRet = (PVOID)pNtGdiFlushUserBatch(); - ok(pRet != NULL, "pRet was NULL.\n"); - ok_ptr(pRet, &pTeb->RealClientId); + ok(pRet != NULL, "pRet was NULL.\n"); + ok_ptr(pRet, &pTeb->RealClientId); - ok_long(pTeb->GdiBatchCount, 0); - ok_long(pTeb->GdiTebBatch.Offset, 0); - ok_ptr(pTeb->GdiTebBatch.HDC, NULL); + ok_long(pTeb->GdiBatchCount, 0); + ok_long(pTeb->GdiTebBatch.Offset, 0); + ok_ptr(pTeb->GdiTebBatch.HDC, NULL); - /* Set up some bullshit */ - pTeb->InDbgPrint = 1; - pTeb->GdiBatchCount = 12; - pTeb->GdiTebBatch.Offset = 21; - pTeb->GdiTebBatch.HDC = (HDC)123; + /* Set up some bullshit */ + pTeb->InDbgPrint = 1; + pTeb->GdiBatchCount = 12; + pTeb->GdiTebBatch.Offset = 21; + pTeb->GdiTebBatch.HDC = (HDC)123; - pRet = (PVOID)pNtGdiFlushUserBatch(); - ok_ptr(pRet, &pTeb->RealClientId); + pRet = (PVOID)pNtGdiFlushUserBatch(); + ok_ptr(pRet, &pTeb->RealClientId); - ok_int(pTeb->InDbgPrint, 0); - ok_long(pTeb->GdiBatchCount, 12); - ok_long(pTeb->GdiTebBatch.Offset, 0); - ok_ptr(pTeb->GdiTebBatch.HDC, NULL); + ok_int(pTeb->InDbgPrint, 0); + ok_long(pTeb->GdiBatchCount, 12); + ok_long(pTeb->GdiTebBatch.Offset, 0); + ok_ptr(pTeb->GdiTebBatch.HDC, NULL); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c index 51520b433b..e7d0f3e8ed 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetBitmapBits.c @@ -9,60 +9,60 @@ START_TEST(NtGdiGetBitmapBits) { - BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9}; - HBITMAP hBitmap; + BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9}; + HBITMAP hBitmap; - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(0, 0, 0), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(0, 0, 0), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); - /* Test NULL bitmap handle */ - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); + /* Test NULL bitmap handle */ + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); - /* Test invalid bitmap handle */ - hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3)); - SetLastError(ERROR_SUCCESS); - ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - DeleteObject(hBitmap); + /* Test invalid bitmap handle */ + hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3)); + SetLastError(ERROR_SUCCESS); + ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + DeleteObject(hBitmap); - hBitmap = CreateBitmap(3, 3, 1, 8, NULL); - SetLastError(ERROR_SUCCESS); + hBitmap = CreateBitmap(3, 3, 1, 8, NULL); + SetLastError(ERROR_SUCCESS); - /* test NULL pointer and count buffer size != 0 */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12); + /* test NULL pointer and count buffer size != 0 */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, NULL), 12); - /* test NULL pointer and buffer size == 0*/ - ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12); + /* test NULL pointer and buffer size == 0*/ + ok_long(NtGdiGetBitmapBits(hBitmap, 0, NULL), 12); - /* test bad pointer */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0); + /* test bad pointer */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0); - /* Test if we can set a number of bytes between lines */ - ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5); + /* Test if we can set a number of bytes between lines */ + ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5); - /* Test alignment */ - ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4); + /* Test alignment */ + ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4); - /* Test 1 byte too much */ - ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10); + /* Test 1 byte too much */ + ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10); - /* Test one row too much */ - ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12); + /* Test one row too much */ + ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12); - ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12); + ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12); - ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12); + ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12); - /* Test huge bytes count */ - ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12); + /* Test huge bytes count */ + ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12); - /* Test negative bytes count */ - ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12); + /* Test negative bytes count */ + ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12); - ok_long(GetLastError(), ERROR_SUCCESS); + ok_long(GetLastError(), ERROR_SUCCESS); - DeleteObject(hBitmap); + DeleteObject(hBitmap); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c index f8c45dda4e..f8069d6017 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetDIBits.c @@ -33,108 +33,108 @@ DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines ) START_TEST(NtGdiGetDIBitsInternal) { - HBITMAP hBitmap; - struct - { - BITMAPINFO bi; - RGBQUAD Colors[20]; - } bmp; -// BITMAPINFO bi; - INT ScreenBpp; - BITMAPCOREINFO bic; - DWORD data[20*16]; - - HDC hDCScreen = GetDC(NULL); - ok(hDCScreen != NULL, "hDCScreen was NULL.\n"); - - hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16); - ok(hBitmap != NULL, "hBitmap was NULL.\n"); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, - "NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(bmp.Colors[0].rgbRed, 0x44); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, - "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(bmp.Colors[0].rgbRed, 0x44); - - ZeroMemory(&bmp, sizeof(bmp)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL); - - ok_long(bmp.bi.bmiHeader.biWidth, 16); - ok_long(bmp.bi.bmiHeader.biHeight, 16); - ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); - ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); - - ok_int(bmp.Colors[0].rgbRed, 0x44); - - /* Test with pointer */ -// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO)); - bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); -// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344); - - SetLastError(ERROR_SUCCESS); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - ok_long(bmp.bi.bmiHeader.biWidth, 16); - ok_long(bmp.bi.bmiHeader.biHeight, 16); - ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); - ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); - - ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n"); - - /* Test a BITMAPCOREINFO structure */ - SetLastError(ERROR_SUCCESS); - ZeroMemory(&bic, sizeof(BITMAPCOREINFO)); - bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER); - ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS, - DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n"); - ok_long(GetLastError(), ERROR_SUCCESS); - - - ReleaseDC(NULL, hDCScreen); - DeleteObject(hBitmap); + HBITMAP hBitmap; + struct + { + BITMAPINFO bi; + RGBQUAD Colors[20]; + } bmp; +// BITMAPINFO bi; + INT ScreenBpp; + BITMAPCOREINFO bic; + DWORD data[20*16]; + + HDC hDCScreen = GetDC(NULL); + ok(hDCScreen != NULL, "hDCScreen was NULL.\n"); + + hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16); + ok(hBitmap != NULL, "hBitmap was NULL.\n"); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, + "NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(bmp.Colors[0].rgbRed, 0x44); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0, + "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(bmp.Colors[0].rgbRed, 0x44); + + ZeroMemory(&bmp, sizeof(bmp)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL); + + ok_long(bmp.bi.bmiHeader.biWidth, 16); + ok_long(bmp.bi.bmiHeader.biHeight, 16); + ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); + ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); + + ok_int(bmp.Colors[0].rgbRed, 0x44); + + /* Test with pointer */ +// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO)); + bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); +// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344); + + SetLastError(ERROR_SUCCESS); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + ok_long(bmp.bi.bmiHeader.biWidth, 16); + ok_long(bmp.bi.bmiHeader.biHeight, 16); + ok_long(bmp.bi.bmiHeader.biBitCount, ScreenBpp); + ok_long(bmp.bi.bmiHeader.biSizeImage, (16 * 16) * (ScreenBpp / 8)); + + ok(bmp.Colors[0].rgbRed != 0x44, "bmp.Colors[0].rgbRed was 0x44.\n"); + + /* Test a BITMAPCOREINFO structure */ + SetLastError(ERROR_SUCCESS); + ZeroMemory(&bic, sizeof(BITMAPCOREINFO)); + bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER); + ok(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS, + DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0, "The return value was <= 0.\n"); + ok_long(GetLastError(), ERROR_SUCCESS); + + + ReleaseDC(NULL, hDCScreen); + DeleteObject(hBitmap); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c index dde7d7e2be..107a00b814 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetFontResourceInfoInternalW.c @@ -9,34 +9,34 @@ START_TEST(NtGdiGetFontResourceInfoInternalW) { - BOOL bRet; - DWORD dwBufSize; - LOGFONTW logfont; - UNICODE_STRING NtFileName; - - ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf", - &NtFileName, - NULL, - NULL)); - - dwBufSize = sizeof(logfont); - memset(&logfont, 0x0, dwBufSize); - - bRet = NtGdiGetFontResourceInfoInternalW( - NtFileName.Buffer, - (NtFileName.Length / sizeof(WCHAR)) +1, - 1, - dwBufSize, - &dwBufSize, - &logfont, - 2); - - ok(bRet != FALSE, "bRet was FALSE.\n"); - - printf("lfHeight = %ld\n", logfont.lfHeight); - printf("lfWidth = %ld\n", logfont.lfWidth); - printf("lfFaceName = %ls\n", logfont.lfFaceName); - -// RemoveFontResourceW(szFullFileName); + BOOL bRet; + DWORD dwBufSize; + LOGFONTW logfont; + UNICODE_STRING NtFileName; + + ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf", + &NtFileName, + NULL, + NULL)); + + dwBufSize = sizeof(logfont); + memset(&logfont, 0x0, dwBufSize); + + bRet = NtGdiGetFontResourceInfoInternalW( + NtFileName.Buffer, + (NtFileName.Length / sizeof(WCHAR)) +1, + 1, + dwBufSize, + &dwBufSize, + &logfont, + 2); + + ok(bRet != FALSE, "bRet was FALSE.\n"); + + printf("lfHeight = %ld\n", logfont.lfHeight); + printf("lfWidth = %ld\n", logfont.lfWidth); + printf("lfFaceName = %ls\n", logfont.lfFaceName); + +// RemoveFontResourceW(szFullFileName); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c index 1833fdbcd2..05c501ea75 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiGetRandomRgn.c @@ -10,79 +10,79 @@ START_TEST(NtGdiGetRandomRgn) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - HDC hDC; - HRGN hrgn, hrgn2; - - /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); -// UpdateWindow(hWnd); - hDC = GetDC(hWnd); - - ok(hDC != NULL, "hDC was NULL.\n"); - - hrgn = CreateRectRgn(0,0,0,0); - hrgn2 = CreateRectRgn(3,3,10,10); - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1); - ok_long(GetLastError(), ERROR_INVALID_HANDLE); - - SetLastError(ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0); - ok_long(GetLastError(), ERROR_SUCCESS); - - SelectClipRgn(hDC, hrgn2); - ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1); - ok_long(GetLastError(), ERROR_SUCCESS); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); - ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION); - ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION); - - SetRectRgn(hrgn2,0,0,0,0); - SelectClipRgn(hDC, hrgn2); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); - - ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION); - ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION); - - SelectClipRgn(hDC, NULL); - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); - - - ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); - - ok_long(GetLastError(), ERROR_SUCCESS); - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); + HWND hWnd; + HDC hDC; + HRGN hrgn, hrgn2; + + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); +// UpdateWindow(hWnd); + hDC = GetDC(hWnd); + + ok(hDC != NULL, "hDC was NULL.\n"); + + hrgn = CreateRectRgn(0,0,0,0); + hrgn2 = CreateRectRgn(3,3,10,10); + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(0, hrgn, 0), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 1), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, hrgn, 10), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn((HDC)2345, 0, 1), -1); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + + SetLastError(ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(hDC, 0, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, 0, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 0), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 2), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 3), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 5), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 10), 0); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, -10), 0); + ok_long(GetLastError(), ERROR_SUCCESS); + + SelectClipRgn(hDC, hrgn2); + ok_int(NtGdiGetRandomRgn(hDC, 0, 1), -1); + ok_long(GetLastError(), ERROR_SUCCESS); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); + ok_int(CombineRgn(hrgn, hrgn, hrgn, RGN_OR), SIMPLEREGION); + ok_int(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR), NULLREGION); + + SetRectRgn(hrgn2,0,0,0,0); + SelectClipRgn(hDC, hrgn2); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 1); + + ok_int(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR), NULLREGION); + ok_int(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR), NULLREGION); + + SelectClipRgn(hDC, NULL); + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 1), 0); + + + ok_int(NtGdiGetRandomRgn(hDC, hrgn, 4), 1); + + ok_long(GetLastError(), ERROR_SUCCESS); + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c index d5ea7ab81e..0e39eb4d8b 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSaveDC.c @@ -38,10 +38,10 @@ START_TEST(NtGdiSaveDC) TEST(NtGdiSaveDC(hdc) == 2); DeleteDC(hdc); - /* Create a window */ - hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 10, 10, 100, 100, - NULL, NULL, hinst, 0); + /* Create a window */ + hwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 10, 100, 100, + NULL, NULL, hinst, 0); hdc = GetDC(hwnd); TEST(hdc != NULL); TEST(NtGdiSaveDC(hdc) == 1); diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c index a82c2730b6..ec5acdec3a 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBitmap.c @@ -45,72 +45,72 @@ Test_SelectDIBSection(void) START_TEST(NtGdiSelectBitmap) { - HDC hDC; - HBITMAP hBmp, hOldBmp; - HPALETTE hOldPalette, hPalette; - LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}}; - - hBmp = CreateBitmap(2,2,1,1,NULL); - ASSERT(hBmp); - - /* We cannot select a bitmap into a display DC */ - hDC = GetDC(NULL); - ASSERT(hDC); - hOldBmp = NtGdiSelectBitmap(hDC, hBmp); - TEST(hOldBmp == NULL); - - hDC = CreateCompatibleDC(GetDC(NULL)); - ASSERT(hDC); - - /* Check the palette before we mess it up*/ - hPalette = CreatePalette(&logpal); - hOldPalette = SelectPalette(hDC, hPalette, 0); - TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE)); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(NULL, hBmp); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL bitmap */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, NULL); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test bitmap with only index */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff)); - TEST(hOldBmp == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test valid bitmap */ - SetLastError(ERROR_SUCCESS); - hOldBmp = NtGdiSelectBitmap(hDC, hBmp); - TEST(hOldBmp != NULL); - /* The default bitmap should be GetStockObject(21) */ - TEST(hOldBmp == GetStockObject(21)); - - /* Check the palette */ - hOldPalette = SelectPalette(hDC, hOldPalette, 0); - TEST(hOldPalette == hPalette); - DeleteObject(hPalette); - - /* Select the old one again and check */ - hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp); - TEST(hOldBmp == hBmp); - TEST(GetLastError() == ERROR_SUCCESS); - - /* cleanup */ - DeleteObject(hBmp); - DeleteDC(hDC); + HDC hDC; + HBITMAP hBmp, hOldBmp; + HPALETTE hOldPalette, hPalette; + LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}}; + + hBmp = CreateBitmap(2,2,1,1,NULL); + ASSERT(hBmp); + + /* We cannot select a bitmap into a display DC */ + hDC = GetDC(NULL); + ASSERT(hDC); + hOldBmp = NtGdiSelectBitmap(hDC, hBmp); + TEST(hOldBmp == NULL); + + hDC = CreateCompatibleDC(GetDC(NULL)); + ASSERT(hDC); + + /* Check the palette before we mess it up*/ + hPalette = CreatePalette(&logpal); + hOldPalette = SelectPalette(hDC, hPalette, 0); + TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE)); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(NULL, hBmp); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL bitmap */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, NULL); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test bitmap with only index */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff)); + TEST(hOldBmp == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test valid bitmap */ + SetLastError(ERROR_SUCCESS); + hOldBmp = NtGdiSelectBitmap(hDC, hBmp); + TEST(hOldBmp != NULL); + /* The default bitmap should be GetStockObject(21) */ + TEST(hOldBmp == GetStockObject(21)); + + /* Check the palette */ + hOldPalette = SelectPalette(hDC, hOldPalette, 0); + TEST(hOldPalette == hPalette); + DeleteObject(hPalette); + + /* Select the old one again and check */ + hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp); + TEST(hOldBmp == hBmp); + TEST(GetLastError() == ERROR_SUCCESS); + + /* cleanup */ + DeleteObject(hBmp); + DeleteDC(hDC); Test_SelectDIBSection(); diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c index f117b38b03..08451977cb 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectBrush.c @@ -9,65 +9,65 @@ START_TEST(NtGdiSelectBrush) { - HDC hDC; - HBRUSH hBrush, hOldBrush; - DC_ATTR *pdcattr; - - hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); - - hBrush = GetStockObject(GRAY_BRUSH); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(NULL, hBrush); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL brush */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, NULL); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid brush */ - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff)); - TEST(hOldBrush == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - hOldBrush = NtGdiSelectBrush(hDC, hBrush); - TEST(hOldBrush != NULL); - hOldBrush = NtGdiSelectBrush(hDC, hOldBrush); - TEST(hOldBrush == hBrush); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Begin with a white brush */ - NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - /* Select a brush in user mode */ - SelectObject(hDC, GetStockObject(BLACK_BRUSH)); - /* See what we get returned */ - hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - TEST(hOldBrush == GetStockObject(BLACK_BRUSH)); - - - /* Begin with a white brush */ - NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); - - pdcattr = GdiGetHandleUserData(hDC); - /* Change the brush in user mode, without setting flags */ - pdcattr->hbrush = (HBRUSH)12345; - - hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH)); - TEST(hOldBrush == (HBRUSH)12345); - - - DeleteDC(hDC); + HDC hDC; + HBRUSH hBrush, hOldBrush; + DC_ATTR *pdcattr; + + hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); + + hBrush = GetStockObject(GRAY_BRUSH); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(NULL, hBrush); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL brush */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, NULL); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid brush */ + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff)); + TEST(hOldBrush == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + hOldBrush = NtGdiSelectBrush(hDC, hBrush); + TEST(hOldBrush != NULL); + hOldBrush = NtGdiSelectBrush(hDC, hOldBrush); + TEST(hOldBrush == hBrush); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Begin with a white brush */ + NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + /* Select a brush in user mode */ + SelectObject(hDC, GetStockObject(BLACK_BRUSH)); + /* See what we get returned */ + hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + TEST(hOldBrush == GetStockObject(BLACK_BRUSH)); + + + /* Begin with a white brush */ + NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH)); + + pdcattr = GdiGetHandleUserData(hDC); + /* Change the brush in user mode, without setting flags */ + pdcattr->hbrush = (HBRUSH)12345; + + hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH)); + TEST(hOldBrush == (HBRUSH)12345); + + + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c index fae4c95963..08e04b28a8 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectFont.c @@ -9,45 +9,45 @@ START_TEST(NtGdiSelectFont) { - HDC hDC; - HFONT hFont, hOldFont; - - hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); - - hFont = GetStockObject(DEFAULT_GUI_FONT); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(NULL, hFont); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL font */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, NULL); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid font */ - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff)); - TEST(hOldFont == NULL); - TEST(GetLastError() == ERROR_SUCCESS); - - SetLastError(ERROR_SUCCESS); - hOldFont = NtGdiSelectFont(hDC, hFont); - TEST(hOldFont != NULL); - hOldFont = NtGdiSelectFont(hDC, hOldFont); - TEST(hOldFont == hFont); - TEST(GetLastError() == ERROR_SUCCESS); - - - DeleteDC(hDC); + HDC hDC; + HFONT hFont, hOldFont; + + hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL); + + hFont = GetStockObject(DEFAULT_GUI_FONT); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(NULL, hFont); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL font */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, NULL); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid font */ + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff)); + TEST(hOldFont == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + SetLastError(ERROR_SUCCESS); + hOldFont = NtGdiSelectFont(hDC, hFont); + TEST(hOldFont != NULL); + hOldFont = NtGdiSelectFont(hDC, hOldFont); + TEST(hOldFont == hFont); + TEST(GetLastError() == ERROR_SUCCESS); + + + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c index 35c8118455..67e6d66d7e 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSelectPen.c @@ -9,69 +9,69 @@ START_TEST(NtGdiSelectPen) { - HDC hDC; - HPEN hPen, hOldPen; - LOGBRUSH logbrush; + HDC hDC; + HPEN hPen, hOldPen; + LOGBRUSH logbrush; - hDC = GetDC(NULL); - ASSERT(hDC); + hDC = GetDC(NULL); + ASSERT(hDC); - hPen = GetStockObject(WHITE_PEN); + hPen = GetStockObject(WHITE_PEN); - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(NULL, hPen); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(NULL, hPen); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test NULL pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, NULL); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test NULL pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, NULL); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test invalid pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff)); - TEST(hOldPen == NULL); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test invalid pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff)); + TEST(hOldPen == NULL); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test valid pen */ - SelectObject(hDC, GetStockObject(BLACK_PEN)); - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(hOldPen == GetStockObject(BLACK_PEN)); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test valid pen */ + SelectObject(hDC, GetStockObject(BLACK_PEN)); + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(hOldPen == GetStockObject(BLACK_PEN)); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test extpen */ - SetLastError(ERROR_SUCCESS); - logbrush.lbStyle = BS_SOLID; - logbrush.lbColor = RGB(0x12,0x34,0x56); - hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL); - ASSERT(hPen); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(hOldPen != NULL); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test extpen */ + SetLastError(ERROR_SUCCESS); + logbrush.lbStyle = BS_SOLID; + logbrush.lbColor = RGB(0x12,0x34,0x56); + hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL); + ASSERT(hPen); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(hOldPen != NULL); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test deleting pen */ - SetLastError(ERROR_SUCCESS); - hOldPen = NtGdiSelectPen(hDC, hPen); - TEST(DeleteObject(hPen) == 1); - hOldPen = NtGdiSelectPen(hDC, hOldPen); - TEST(hOldPen == hPen); - TEST(GetLastError() == ERROR_SUCCESS); + /* Test deleting pen */ + SetLastError(ERROR_SUCCESS); + hOldPen = NtGdiSelectPen(hDC, hPen); + TEST(DeleteObject(hPen) == 1); + hOldPen = NtGdiSelectPen(hDC, hOldPen); + TEST(hOldPen == hPen); + TEST(GetLastError() == ERROR_SUCCESS); - /* Test that fallback pen is BLACK_PEN */ + /* Test that fallback pen is BLACK_PEN */ - DeleteDC(hDC); + DeleteDC(hDC); } diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c index 983c90e3b4..ff8e3e9dac 100644 --- a/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiSetDIBitsToDeviceInternal.c @@ -10,89 +10,89 @@ void ReadBits(HDC hDC, PDWORD OutBits) { - int x,y; - - for (y = 0; y < 8; y++) - { - DWORD Row = 0; - for (x = 0; x < 8; x++) - Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; - OutBits[y] = Row; - } + int x,y; + + for (y = 0; y < 8; y++) + { + DWORD Row = 0; + for (x = 0; x < 8; x++) + Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; + OutBits[y] = Row; + } } START_TEST(NtGdiSetDIBitsToDeviceInternal) { - static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 }; - DWORD OutBits[8]; - XFORM xform; - - HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE, - 100, 100, 200, 200, - NULL, NULL, NULL, NULL); - /* This DC has an nonzero origin */ - HDC hDC = GetDC(hWnd); - struct - { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[2]; - } bmi; - int x, y; - - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = 8; - bmi.bmiHeader.biHeight = -8; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 1; - bmi.bmiHeader.biCompression = 0; - bmi.bmiHeader.biSizeImage = 0; - bmi.bmiHeader.biXPelsPerMeter = 0; - bmi.bmiHeader.biYPelsPerMeter = 0; - bmi.bmiHeader.biClrUsed = 0; - bmi.bmiHeader.biClrImportant = 0; - *(DWORD *)&bmi.bmiColors[0] = 0x000000; - *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF; - - /* The destination coordinates are relative to the DC origin */ - TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, - (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, - sizeof(InBits), sizeof(bmi), TRUE, NULL)); - - /* Now get the data from the screen, and see if it matches */ - ReadBits(hDC, OutBits); - - TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); - - /* Change transformation */ - GetWorldTransform(hDC, &xform); - xform.eM11 = 2; - xform.eM22 = 2; - xform.eDx = 10; - SetWorldTransform(hDC, &xform); - - TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, - (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, - sizeof(InBits), sizeof(bmi), TRUE, NULL)); - - xform.eM11 = 1; - xform.eM22 = 1; - xform.eDx = 0; - SetWorldTransform(hDC, &xform); - - /* Now get the data from the screen, and see if it matches */ - for (y = 0; y < 8; y++) - { - DWORD Row = 0; - for (x = 0; x < 8; x++) - Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; - OutBits[y] = Row; - } - - TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); - - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); + static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 }; + DWORD OutBits[8]; + XFORM xform; + + HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE, + 100, 100, 200, 200, + NULL, NULL, NULL, NULL); + /* This DC has an nonzero origin */ + HDC hDC = GetDC(hWnd); + struct + { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[2]; + } bmi; + int x, y; + + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = 8; + bmi.bmiHeader.biHeight = -8; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 1; + bmi.bmiHeader.biCompression = 0; + bmi.bmiHeader.biSizeImage = 0; + bmi.bmiHeader.biXPelsPerMeter = 0; + bmi.bmiHeader.biYPelsPerMeter = 0; + bmi.bmiHeader.biClrUsed = 0; + bmi.bmiHeader.biClrImportant = 0; + *(DWORD *)&bmi.bmiColors[0] = 0x000000; + *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF; + + /* The destination coordinates are relative to the DC origin */ + TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, + (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, + sizeof(InBits), sizeof(bmi), TRUE, NULL)); + + /* Now get the data from the screen, and see if it matches */ + ReadBits(hDC, OutBits); + + TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); + + /* Change transformation */ + GetWorldTransform(hDC, &xform); + xform.eM11 = 2; + xform.eM22 = 2; + xform.eDx = 10; + SetWorldTransform(hDC, &xform); + + TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8, + (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS, + sizeof(InBits), sizeof(bmi), TRUE, NULL)); + + xform.eM11 = 1; + xform.eM22 = 1; + xform.eDx = 0; + SetWorldTransform(hDC, &xform); + + /* Now get the data from the screen, and see if it matches */ + for (y = 0; y < 8; y++) + { + DWORD Row = 0; + for (x = 0; x < 8; x++) + Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x; + OutBits[y] = Row; + } + + TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0); + + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c index 4d4b7ba4d4..7fd6881361 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwnd.c @@ -10,22 +10,22 @@ void Test_HwndRoutine_DeregisterShellHookWindow(HWND hWnd) { - TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE); + TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW) == TRUE); } void Test_HwndRoutine_GetWindowContextHelpId (HWND hWnd) { - TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); - TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b); + TEST(NtUserCallHwndParam(hWnd, 0xbadb00b, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); + TEST(NtUserCallHwnd(hWnd, _HWND_ROUTINE_GETWNDCONTEXTHLPID) == 0xbadb00b); } void Test_HwndRoutine_SetMsgBox(HWND hWnd) { - TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE); + TEST(NtUserCallHwnd(hWnd, 0x49) != FALSE); } @@ -34,27 +34,27 @@ START_TEST(NtUserCallHwnd) { HWND hWnd; - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - g_hInstance, - 0); - ASSERT(hWnd); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE); - Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */ - TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup - Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */ - TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE); - Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */ - TEST(GetLastError() == ERROR_SUCCESS); - - DestroyWindow(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + g_hInstance, + 0); + ASSERT(hWnd); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwnd(hWnd, 0x44) == FALSE); + Test_HwndRoutine_DeregisterShellHookWindow(hWnd); /* 0x45 */ + TEST(NtUserCallHwnd(hWnd, 0x46) == FALSE); // DWP_GetEnabledPopup + Test_HwndRoutine_GetWindowContextHelpId (hWnd); /* 0x47 */ + TEST(NtUserCallHwnd(hWnd, 0x48) == TRUE); + Test_HwndRoutine_SetMsgBox(hWnd); /* 0x49 */ + TEST(GetLastError() == ERROR_SUCCESS); + + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c index 60b606c74c..c16bebe164 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndLock.c @@ -15,7 +15,7 @@ HMENU g_hMenu; void Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */ { -// TEST(NtUserCallHwndLock(hWnd, 0x53) == 0); +// TEST(NtUserCallHwndLock(hWnd, 0x53) == 0); } @@ -23,86 +23,86 @@ Test_HwndLockRoutine_WindowHasShadow(HWND hWnd) /* 0x53 */ void Test_HwndLockRoutine_ArrangeIconicWindows(HWND hWnd) /* 0x54 */ { -// TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0); +// TEST(NtUserCallHwndLock(hWnd, _HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS) == 0); } void Test_HwndLockRoutine_DrawMenuBar(HWND hWnd) /* 0x55 */ { - TEST(NtUserCallHwndLock(hWnd, 0x55) == 1); - return APISTATUS_NORMAL; + TEST(NtUserCallHwndLock(hWnd, 0x55) == 1); + return APISTATUS_NORMAL; } void Test_HwndLockRoutine_CheckImeShowStatusInThread(HWND hWnd) /* 0x56 */ { - TEST(NtUserCallHwndLock(hWnd, 0x56) != 0); + TEST(NtUserCallHwndLock(hWnd, 0x56) != 0); } void Test_HwndLockRoutine_GetSysMenuHandle(HWND hWnd) /* 0x57 */ { - NtUserCallHwndLock(hWnd, 0x5c); -// HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57); -// TEST(hMenu != 0); + NtUserCallHwndLock(hWnd, 0x5c); +// HMENU hMenu = (HMENU)NtUserCallHwndLock(hWnd, 0x57); +// TEST(hMenu != 0); } void Test_HwndLockRoutine_RedrawFrame(HWND hWnd) /* 0x58 */ { -// TEST(NtUserCallHwndLock(hWnd, 0x68) != 0); +// TEST(NtUserCallHwndLock(hWnd, 0x68) != 0); } void Test_HwndLockRoutine_UpdateWindow(HWND hWnd) /* 0x5e */ { - TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1); + TEST(NtUserCallHwndLock(hWnd, 0x5e) == 1); } START_TEST(NtUserCallHwndLock) { - HWND hWnd; - g_hMenu = CreateMenu(); - - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - g_hMenu, - g_hInstance, - 0); - ASSERT(hWnd); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock((HWND)-22, 999) == 0); - TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0); - TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); - - SetLastError(ERROR_SUCCESS); - TEST(NtUserCallHwndLock(hWnd, 999) == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */ - Test_HwndLockRoutine_ArrangeIconicWindows(hWnd); - Test_HwndLockRoutine_DrawMenuBar(hWnd); - Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd); - Test_HwndLockRoutine_GetSysMenuHandle(hWnd); - Test_HwndLockRoutine_RedrawFrame(hWnd); - - Test_HwndLockRoutine_UpdateWindow(hWnd); - - DestroyWindow(hWnd); + HWND hWnd; + g_hMenu = CreateMenu(); + + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + g_hMenu, + g_hInstance, + 0); + ASSERT(hWnd); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock((HWND)-22, 999) == 0); + TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock((HWND)0, 0x55) == 0); + TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE); + + SetLastError(ERROR_SUCCESS); + TEST(NtUserCallHwndLock(hWnd, 999) == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + Test_HwndLockRoutine_WindowHasShadow (hWnd); /* 0x53 */ + Test_HwndLockRoutine_ArrangeIconicWindows(hWnd); + Test_HwndLockRoutine_DrawMenuBar(hWnd); + Test_HwndLockRoutine_CheckImeShowStatusInThread(hWnd); + Test_HwndLockRoutine_GetSysMenuHandle(hWnd); + Test_HwndLockRoutine_RedrawFrame(hWnd); + + Test_HwndLockRoutine_UpdateWindow(hWnd); + + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c index 7777b09730..1d98af434d 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndOpt.c @@ -10,18 +10,18 @@ void Test_HwndOptRoutine_SetProgmanWindow(void) /* 0x4a */ { -// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW); +// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETPROGMANWINDOW); } void Test_HwndOptRoutine_SetTaskmanWindow (void) /* 0x4b */ { -// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW); +// NtUserCallHwndOpt(hWnd, HWNDOPT_ROUTINE_SETTASKMANWINDOW); } START_TEST(NtUserCallHwndOpt) { - Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */ - Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */ + Test_HwndOptRoutine_SetProgmanWindow(pti); /* 0x4a */ + Test_HwndOptRoutine_SetTaskmanWindow (pti); /* 0x4b */ } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c index b7c02c1451..93f321c5f7 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallHwndParam.c @@ -10,28 +10,28 @@ void Test_HwndParamRoutine_SetWindowContextHelpId(HWND hWnd) { - TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); - TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345); + TEST(NtUserCallHwndParam(hWnd, 12345, _HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID) == TRUE); + TEST(NtUserCallHwnd(hWnd, HWND_ROUTINE_GETWNDCONTEXTHLPID) == 12345); } START_TEST(NtUserCallHwndParam) { HWND hWnd; - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - g_hInstance, - 0); - ASSERT(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + g_hInstance, + 0); + ASSERT(hWnd); - Test_HwndParamRoutine_SetWindowContextHelpId(hWnd); + Test_HwndParamRoutine_SetWindowContextHelpId(hWnd); - DestroyWindow(hWnd); + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c index 3f3b0743d4..1d269080bc 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallNoParam.c @@ -10,22 +10,22 @@ void Test_NoParamRoutine_CreateMenu(void) /* 0 */ { - HMENU hMenu; + HMENU hMenu; - hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU); - TEST(IsMenu(hMenu) == TRUE); - DestroyMenu(hMenu); + hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU); + TEST(IsMenu(hMenu) == TRUE); + DestroyMenu(hMenu); } void Test_NoParamRoutine_CreatePopupMenu(void) /* 1 */ { - HMENU hMenu; + HMENU hMenu; - hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP); - TEST(IsMenu(hMenu) == TRUE); - DestroyMenu(hMenu); + hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP); + TEST(IsMenu(hMenu) == TRUE); + DestroyMenu(hMenu); } @@ -56,19 +56,19 @@ Test_NoParamRoutine_DestroyCaret(void) /* 5 */ void Test_NoParamRoutine_LoadUserApiHook(void) /* 0x1d */ { - //DWORD dwRet; - /* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK); + //DWORD dwRet; + /* dwRet = */NtUserCallNoParam(_NOPARAM_ROUTINE_LOADUSERAPIHOOK); -// TEST(dwRet != 0); +// TEST(dwRet != 0); } START_TEST(NtUserCallNoParam) { - Test_NoParamRoutine_CreateMenu(); - Test_NoParamRoutine_CreatePopupMenu(); - Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */ + Test_NoParamRoutine_CreateMenu(); + Test_NoParamRoutine_CreatePopupMenu(); + Test_NoParamRoutine_LoadUserApiHook(); /* 0x1d */ - return APISTATUS_NORMAL; + return APISTATUS_NORMAL; } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c index abddf87f1e..1fce205bda 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCallOneParam.c @@ -12,85 +12,85 @@ void Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */ { - HDWP hWinPosInfo; + HDWP hWinPosInfo; - hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); - TEST(hWinPosInfo != 0); - TEST(EndDeferWindowPos(hWinPosInfo) != 0); + hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); + TEST(hWinPosInfo != 0); + TEST(EndDeferWindowPos(hWinPosInfo) != 0); } void Test_OneParamRoutine_WindowFromDC(void) /* 0x1f */ { - HDC hDC = GetDC(NULL); - HWND hWnd; + HDC hDC = GetDC(NULL); + HWND hWnd; - hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f); - TEST(hWnd != 0); - TEST(IsWindow(hWnd)); - TEST(hWnd == GetDesktopWindow()); + hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f); + TEST(hWnd != 0); + TEST(IsWindow(hWnd)); + TEST(hWnd == GetDesktopWindow()); } void Test_OneParamRoutine_CreateEmptyCurObject(void) /* XP/2k3 : 0x21, vista 0x25 */ { - HICON hIcon ; + HICON hIcon ; - /* Test 0 */ - hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); + /* Test 0 */ + hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL); - TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); + TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); - /* Test Garbage */ - hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); + /* Test Garbage */ + hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL); - TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE); + TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE); } void Test_OneParamRoutine_MapDesktopObject(void) /* 0x30 */ { - DWORD pObject; - HWND hWnd; - HMENU hMenu; + DWORD pObject; + HWND hWnd; + HMENU hMenu; - hWnd = GetDesktopWindow(); - pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); - TEST(pObject > 0); - TEST(pObject < 0x80000000); + hWnd = GetDesktopWindow(); + pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); + TEST(pObject > 0); + TEST(pObject < 0x80000000); - hMenu = CreateMenu(); - pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); - DestroyMenu(hMenu); - TEST(pObject > 0); - TEST(pObject < 0x80000000); + hMenu = CreateMenu(); + pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT); + DestroyMenu(hMenu); + TEST(pObject > 0); + TEST(pObject < 0x80000000); } void Test_OneParamRoutine_SwapMouseButtons(void) /* 0x42 */ { - BOOL bInverse; + BOOL bInverse; - NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - TEST(bInverse == TRUE); - bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); - TEST(bInverse == FALSE); + NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + TEST(bInverse == TRUE); + bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON); + TEST(bInverse == FALSE); - // TODO: test other values + // TODO: test other values } START_TEST(NtUserCallOneParam) { - Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */ - Test_OneParamRoutine_WindowFromDC(); /* 0x1f */ - Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */ - Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */ - Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */ + Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */ + Test_OneParamRoutine_WindowFromDC(); /* 0x1f */ + Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */ + Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */ + Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */ } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c b/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c index 465ca21181..5dccf655d6 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserCountClipboardFormats.c @@ -10,6 +10,6 @@ START_TEST(NtUserCountClipboardFormats) { - RTEST(NtUserCountClipboardFormats() < 1000); + RTEST(NtUserCountClipboardFormats() < 1000); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c index 666cce4955..317234320f 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplayMonitors.c @@ -43,7 +43,7 @@ START_TEST(NtUserEnumDisplayMonitors) BOOL ret; // WILL crash! -// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0); +// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0); ret = NtUserEnumDisplayMonitors(0, NULL, MonitorEnumProc, 0); TEST(ret == TRUE); diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c index 00944f5769..0e8e0a4b7d 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserEnumDisplaySettings.c @@ -11,97 +11,97 @@ static struct { - DEVMODEW devmode; - CHAR buffer[0xffff]; + DEVMODEW devmode; + CHAR buffer[0xffff]; } data; START_TEST(NtUserEnumDisplaySettings) { - UNICODE_STRING usDeviceName; - WCHAR szName[] = L"DISPLAY"; - NTSTATUS Status; - INT i; - - SetLastError(ERROR_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0); - TEST(Status == STATUS_ACCESS_VIOLATION); - TEST(GetLastError() == ERROR_SUCCESS); - - data.devmode.dmDriverExtra = 0; - for (i = 0; i < 2 * sizeof(DEVMODEW); i++) - { - data.devmode.dmSize = i; - Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0); - if (i != sizeof(DEVMODEW)) - { - TEST(Status == STATUS_BUFFER_TOO_SMALL); - } - } - TEST(GetLastError() == ERROR_SUCCESS); - - usDeviceName.Buffer = NULL; - usDeviceName.Length = 0; - usDeviceName.MaximumLength = 0; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_BUFFER_TOO_SMALL); - Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_BUFFER_TOO_SMALL); - - data.devmode.dmSize = sizeof(DEVMODEW); - data.devmode.dmDriverExtra = 0xffff; - Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - data.devmode.dmSize = sizeof(DEVMODEW); - data.devmode.dmDriverExtra = 0; - Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - usDeviceName.Buffer = NULL; - usDeviceName.Length = 0; - usDeviceName.MaximumLength = 0; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - - Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_2); - - Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_SUCCESS); - Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_2); - - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - usDeviceName.Buffer = szName; - usDeviceName.Length = (USHORT)wcslen(szName); - usDeviceName.MaximumLength = usDeviceName.Length; - Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456); - TEST(Status == STATUS_INVALID_PARAMETER_1); - - TEST(GetLastError() == ERROR_SUCCESS); + UNICODE_STRING usDeviceName; + WCHAR szName[] = L"DISPLAY"; + NTSTATUS Status; + INT i; + + SetLastError(ERROR_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0); + TEST(Status == STATUS_ACCESS_VIOLATION); + TEST(GetLastError() == ERROR_SUCCESS); + + data.devmode.dmDriverExtra = 0; + for (i = 0; i < 2 * sizeof(DEVMODEW); i++) + { + data.devmode.dmSize = i; + Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0); + if (i != sizeof(DEVMODEW)) + { + TEST(Status == STATUS_BUFFER_TOO_SMALL); + } + } + TEST(GetLastError() == ERROR_SUCCESS); + + usDeviceName.Buffer = NULL; + usDeviceName.Length = 0; + usDeviceName.MaximumLength = 0; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_BUFFER_TOO_SMALL); + Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_BUFFER_TOO_SMALL); + + data.devmode.dmSize = sizeof(DEVMODEW); + data.devmode.dmDriverExtra = 0xffff; + Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + data.devmode.dmSize = sizeof(DEVMODEW); + data.devmode.dmDriverExtra = 0; + Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + usDeviceName.Buffer = NULL; + usDeviceName.Length = 0; + usDeviceName.MaximumLength = 0; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + + Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_2); + + Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_SUCCESS); + Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_2); + + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + usDeviceName.Buffer = szName; + usDeviceName.Length = (USHORT)wcslen(szName); + usDeviceName.MaximumLength = usDeviceName.Length; + Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456); + TEST(Status == STATUS_INVALID_PARAMETER_1); + + TEST(GetLastError() == ERROR_SUCCESS); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c index 4aa40a8232..1e2a8a7926 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserGetClassInfo.c @@ -10,32 +10,32 @@ START_TEST(NtUserGetClassInfo) { HINSTANCE hinst = GetModuleHandle(NULL); - WNDCLASSEXW wclex, wclex2 = {0}; - UNICODE_STRING us; - PWSTR pwstr = NULL; - - us.Length = 8; - us.MaximumLength = 8; - us.Buffer = L"test"; - - wclex.cbSize = sizeof(WNDCLASSEXW); - wclex.style = 0; - wclex.lpfnWndProc = NULL; - wclex.cbClsExtra = 2; - wclex.cbWndExtra = 4; - wclex.hInstance = hinst; - wclex.hIcon = NULL; - wclex.hCursor = NULL; - wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5)); - wclex.lpszMenuName = L"MyMenu"; - wclex.lpszClassName = us.Buffer; - wclex.hIconSm = NULL; - - ASSERT(RegisterClassExW(&wclex) != 0); - - TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0); - wclex2.cbSize = sizeof(WNDCLASSEXW); - TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0); + WNDCLASSEXW wclex, wclex2 = {0}; + UNICODE_STRING us; + PWSTR pwstr = NULL; + + us.Length = 8; + us.MaximumLength = 8; + us.Buffer = L"test"; + + wclex.cbSize = sizeof(WNDCLASSEXW); + wclex.style = 0; + wclex.lpfnWndProc = NULL; + wclex.cbClsExtra = 2; + wclex.cbWndExtra = 4; + wclex.hInstance = hinst; + wclex.hIcon = NULL; + wclex.hCursor = NULL; + wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5)); + wclex.lpszMenuName = L"MyMenu"; + wclex.lpszClassName = us.Buffer; + wclex.hIconSm = NULL; + + ASSERT(RegisterClassExW(&wclex) != 0); + + TEST(GetClassInfoExW(hinst, us.Buffer, &wclex) != 0); + wclex2.cbSize = sizeof(WNDCLASSEXW); + TEST(NtUserGetClassInfo(hinst, &us, &wclex2, &pwstr, 0) != 0); TEST(pwstr == wclex.lpszMenuName); TEST(wclex2.cbSize == wclex.cbSize); diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c index 222b5bc517..2df139a5d7 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserGetIconInfo.c @@ -9,151 +9,151 @@ START_TEST(NtUserGetIconInfo) { - HICON hIcon; - ICONINFO iinfo; - HBITMAP mask, color; - UNICODE_STRING hInstStr; - UNICODE_STRING ResourceStr; - DWORD bpp = 0; - - ZeroMemory(&iinfo, sizeof(ICONINFO)); - - /* BASIC TESTS */ - hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); - TEST(hIcon != NULL); - - /* Last param is unknown */ - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE); - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE); - - TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); - - mask = CreateBitmap(16,16,1,1,NULL); - color = CreateBitmap(16,16,1,16,NULL); - - iinfo.hbmMask = mask; - iinfo.hbmColor = color ; - iinfo.fIcon = TRUE; - iinfo.xHotspot = 8; - iinfo.yHotspot = 8; - - hIcon = CreateIconIndirect(&iinfo); - TEST(hIcon!=NULL); - - // TODO : test last parameter... - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE); - - TEST(iinfo.hbmMask != NULL); - TEST(iinfo.hbmColor != NULL); - TEST(iinfo.fIcon == TRUE); - TEST(iinfo.yHotspot == 8); - TEST(iinfo.xHotspot == 8); - - TEST(iinfo.hbmMask != mask); - TEST(iinfo.hbmColor != color); - - /* Does it make a difference? */ - TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE); - - TEST(iinfo.hbmMask != NULL); - TEST(iinfo.hbmColor != NULL); - TEST(iinfo.fIcon == TRUE); - TEST(iinfo.yHotspot == 8); - TEST(iinfo.xHotspot == 8); - - TEST(iinfo.hbmMask != mask); - TEST(iinfo.hbmColor != color); - - DeleteObject(mask); - DeleteObject(color); - - DestroyIcon(hIcon); - - /* Test full param, with local icon */ - hIcon = LoadImageA(GetModuleHandle(NULL), - MAKEINTRESOURCE(IDI_ICON), - IMAGE_ICON, - 0, - 0, - LR_DEFAULTSIZE); - - TEST(hIcon != NULL); - - RtlInitUnicodeString(&hInstStr, NULL); - RtlInitUnicodeString(&ResourceStr, NULL); - - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - FALSE) == TRUE); - - TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); - TEST(bpp == 32); - - /* Last param doesn't seem to matter*/ - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - TRUE) == TRUE); - - TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); - TEST(bpp == 32); - - DestroyIcon(hIcon); - - /* Test full param, with foreign icon */ - hIcon = LoadImageA(GetModuleHandleA("shell32.dll"), - MAKEINTRESOURCE(293), - IMAGE_ICON, - 0, - 0, - LR_DEFAULTSIZE); + HICON hIcon; + ICONINFO iinfo; + HBITMAP mask, color; + UNICODE_STRING hInstStr; + UNICODE_STRING ResourceStr; + DWORD bpp = 0; + + ZeroMemory(&iinfo, sizeof(ICONINFO)); + + /* BASIC TESTS */ + hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT); + TEST(hIcon != NULL); + + /* Last param is unknown */ + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE); + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE); + + TEST(NtUserDestroyCursor(hIcon, 0) == TRUE); + + mask = CreateBitmap(16,16,1,1,NULL); + color = CreateBitmap(16,16,1,16,NULL); + + iinfo.hbmMask = mask; + iinfo.hbmColor = color ; + iinfo.fIcon = TRUE; + iinfo.xHotspot = 8; + iinfo.yHotspot = 8; + + hIcon = CreateIconIndirect(&iinfo); + TEST(hIcon!=NULL); + + // TODO : test last parameter... + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE); + + TEST(iinfo.hbmMask != NULL); + TEST(iinfo.hbmColor != NULL); + TEST(iinfo.fIcon == TRUE); + TEST(iinfo.yHotspot == 8); + TEST(iinfo.xHotspot == 8); + + TEST(iinfo.hbmMask != mask); + TEST(iinfo.hbmColor != color); + + /* Does it make a difference? */ + TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE); + + TEST(iinfo.hbmMask != NULL); + TEST(iinfo.hbmColor != NULL); + TEST(iinfo.fIcon == TRUE); + TEST(iinfo.yHotspot == 8); + TEST(iinfo.xHotspot == 8); + + TEST(iinfo.hbmMask != mask); + TEST(iinfo.hbmColor != color); + + DeleteObject(mask); + DeleteObject(color); + + DestroyIcon(hIcon); + + /* Test full param, with local icon */ + hIcon = LoadImageA(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + 0, + 0, + LR_DEFAULTSIZE); + + TEST(hIcon != NULL); + + RtlInitUnicodeString(&hInstStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL); + + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + FALSE) == TRUE); + + TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); + TEST(bpp == 32); + + /* Last param doesn't seem to matter*/ + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + TRUE) == TRUE); + + TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON)); + TEST(bpp == 32); + + DestroyIcon(hIcon); + + /* Test full param, with foreign icon */ + hIcon = LoadImageA(GetModuleHandleA("shell32.dll"), + MAKEINTRESOURCE(293), + IMAGE_ICON, + 0, + 0, + LR_DEFAULTSIZE); - TEST(hIcon != NULL); + TEST(hIcon != NULL); hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); hInstStr.MaximumLength = MAX_PATH; hInstStr.Length = 0; - RtlInitUnicodeString(&ResourceStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL); - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - FALSE) == TRUE); + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + FALSE) == TRUE); - TEST(hInstStr.Length != 0); + TEST(hInstStr.Length != 0); hInstStr.Buffer[hInstStr.Length] = 0; - printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); - TEST(ResourceStr.Length == 0); - TEST(ResourceStr.MaximumLength == 0); - TEST(bpp == 32); + printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); + TEST(ResourceStr.Length == 0); + TEST(ResourceStr.MaximumLength == 0); + TEST(bpp == 32); - ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR)); + ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR)); hInstStr.Length = 0; - RtlInitUnicodeString(&ResourceStr, NULL); + RtlInitUnicodeString(&ResourceStr, NULL); - TEST(NtUserGetIconInfo(hIcon, - &iinfo, - &hInstStr, - &ResourceStr, - &bpp, - TRUE) == TRUE); + TEST(NtUserGetIconInfo(hIcon, + &iinfo, + &hInstStr, + &ResourceStr, + &bpp, + TRUE) == TRUE); TEST(hInstStr.Length != 0); hInstStr.Buffer[hInstStr.Length] = 0; - printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); - TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); - TEST(bpp == 32); + printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer); + TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293)); + TEST(bpp == 32); - DestroyIcon(hIcon); + DestroyIcon(hIcon); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c b/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c index bb284eb156..fda0228134 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserRedrawWindow.c @@ -10,29 +10,29 @@ START_TEST(NtUserRedrawWindow) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - RECT rect; + HWND hWnd; + RECT rect; - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - hinst, - 0); - ASSERT(hWnd); + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + hinst, + 0); + ASSERT(hWnd); - rect.left = 0; - rect.top = 0; - rect.right = 10; - rect.bottom = 10; + rect.left = 0; + rect.top = 0; + rect.right = 10; + rect.bottom = 10; - TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE); + TEST(NtUserRedrawWindow(hWnd, &rect, NULL, RDW_VALIDATE) == TRUE); - DestroyWindow(hWnd); + DestroyWindow(hWnd); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c b/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c index bbb5e08001..e002aaee0c 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserScrollDC.c @@ -10,108 +10,108 @@ START_TEST(NtUserScrollDC) { HINSTANCE hinst = GetModuleHandle(NULL); - HWND hWnd; - HDC hDC; - HRGN hRgn, hTmpRgn; - RECT rcScroll, rcClip, rcUpdate; - RECT rect = {0,0,100,100}; - INT Result; - - hWnd = CreateWindowA("BUTTON", - "Test", - BS_PUSHBUTTON | WS_VISIBLE, - 0, - 0, - 50, - 100, - NULL, - NULL, - hinst, - 0); - ASSERT(hWnd); - RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW); - - hDC = GetDC(hWnd); - ASSERT(hDC); - - hRgn = CreateRectRgn(0,0,10,10); - - - /* Test inverted clip rect */ - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = 100; - rcScroll.bottom = 40; - rcClip.left = 0; - rcClip.top = 35; - rcClip.right = -70; - rcClip.bottom = -1000; - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 1); - RTEST(GetLastError() == ERROR_SUCCESS); - - /* Test inverted scroll rect */ - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = -100; - rcScroll.bottom = -40; - rcClip.left = 0; - rcClip.top = 35; - rcClip.right = 70; - rcClip.bottom = 1000; - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 1); - RTEST(GetLastError() == ERROR_SUCCESS); - - rcScroll.left = 0; - rcScroll.top = 25; - rcScroll.right = 100; - rcScroll.bottom = 40; - - /* Test invalid update region */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate); - RTEST(Result == 0); - TEST(GetLastError() == ERROR_INVALID_HANDLE); - - /* Test invalid dc */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - RTEST(Result == 0); - RTEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid update rect */ - SetLastError(ERROR_SUCCESS); - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000); - RTEST(Result == 0); - RTEST(GetLastError() == ERROR_NOACCESS); - - Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); - - RTEST(Result == TRUE); - RTEST(rcUpdate.left == 0); - RTEST(rcUpdate.top == 35); - RTEST(rcUpdate.right == 70); - RTEST(rcUpdate.bottom == 55); - - hTmpRgn = CreateRectRgn(10,45,70,55); - Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); - RTEST(Result == SIMPLEREGION); - - SetRectRgn(hTmpRgn,0,35,70,40); - Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); - RTEST(Result == NULLREGION); - - DeleteObject(hTmpRgn); - - /* TODO: Test with another window in front */ - /* TODO: Test with different viewport extension */ - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); - DeleteObject(hRgn); + HWND hWnd; + HDC hDC; + HRGN hRgn, hTmpRgn; + RECT rcScroll, rcClip, rcUpdate; + RECT rect = {0,0,100,100}; + INT Result; + + hWnd = CreateWindowA("BUTTON", + "Test", + BS_PUSHBUTTON | WS_VISIBLE, + 0, + 0, + 50, + 100, + NULL, + NULL, + hinst, + 0); + ASSERT(hWnd); + RedrawWindow(hWnd, &rect, NULL, RDW_UPDATENOW); + + hDC = GetDC(hWnd); + ASSERT(hDC); + + hRgn = CreateRectRgn(0,0,10,10); + + + /* Test inverted clip rect */ + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = 100; + rcScroll.bottom = 40; + rcClip.left = 0; + rcClip.top = 35; + rcClip.right = -70; + rcClip.bottom = -1000; + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 1); + RTEST(GetLastError() == ERROR_SUCCESS); + + /* Test inverted scroll rect */ + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = -100; + rcScroll.bottom = -40; + rcClip.left = 0; + rcClip.top = 35; + rcClip.right = 70; + rcClip.bottom = 1000; + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 1); + RTEST(GetLastError() == ERROR_SUCCESS); + + rcScroll.left = 0; + rcScroll.top = 25; + rcScroll.right = 100; + rcScroll.bottom = 40; + + /* Test invalid update region */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate); + RTEST(Result == 0); + TEST(GetLastError() == ERROR_INVALID_HANDLE); + + /* Test invalid dc */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + RTEST(Result == 0); + RTEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid update rect */ + SetLastError(ERROR_SUCCESS); + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000); + RTEST(Result == 0); + RTEST(GetLastError() == ERROR_NOACCESS); + + Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate); + + RTEST(Result == TRUE); + RTEST(rcUpdate.left == 0); + RTEST(rcUpdate.top == 35); + RTEST(rcUpdate.right == 70); + RTEST(rcUpdate.bottom == 55); + + hTmpRgn = CreateRectRgn(10,45,70,55); + Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); + RTEST(Result == SIMPLEREGION); + + SetRectRgn(hTmpRgn,0,35,70,40); + Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR); + RTEST(Result == NULLREGION); + + DeleteObject(hTmpRgn); + + /* TODO: Test with another window in front */ + /* TODO: Test with different viewport extension */ + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); + DeleteObject(hRgn); } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c index 089fd23ba2..8c00d39f3b 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSelectPalette.c @@ -11,141 +11,141 @@ FORCEINLINE PALETTEENTRY PALENTRY(BYTE r, BYTE g, BYTE b) { - PALETTEENTRY ret; + PALETTEENTRY ret; - ret.peRed = r; - ret.peGreen = g; - ret.peBlue = b; - ret.peFlags = 0; - return ret; + ret.peRed = r; + ret.peGreen = g; + ret.peBlue = b; + ret.peFlags = 0; + return ret; } START_TEST(NtUserSelectPalette) { HINSTANCE hinst = GetModuleHandle(NULL); - HPALETTE hPal, hOldPal; - HWND hWnd; - HDC hDC, hCompDC; - struct - { - LOGPALETTE logpal; - PALETTEENTRY entry[20]; - } pal; - - ZeroMemory(&pal, sizeof(pal)); - - pal.logpal.palVersion = 0x300; - pal.logpal.palNumEntries = 6; - pal.entry[0] = PALENTRY(0,0,0); - pal.entry[1] = PALENTRY(255,255,255); - pal.entry[2] = PALENTRY(128,128,128); - pal.entry[3] = PALENTRY(128,0,0); - pal.entry[4] = PALENTRY(0,128,0); - pal.entry[5] = PALENTRY(0,0,128); - - hPal = CreatePalette(&pal.logpal); - ASSERT(hPal); - TEST(DeleteObject(hPal) == 1); - hPal = CreatePalette(&pal.logpal); - ASSERT(hPal); - - /* Create a window */ - hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, - NULL, NULL, hinst, 0); - hDC = GetDC(hWnd); - ASSERT(hDC); - hCompDC = CreateCompatibleDC(hDC); - ASSERT(hCompDC); - - /* Test NULL DC */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(NULL, hPal, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid DC */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test NULL palette */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(hDC, NULL, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid palette */ - SetLastError(ERROR_SUCCESS); - hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0); - TEST(hOldPal == 0); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test valid palette */ - hOldPal = NtUserSelectPalette(hDC, hPal, 0); - TEST(hOldPal != 0); - TEST(hOldPal == GetStockObject(DEFAULT_PALETTE)); - - /* We cannot Delete the palette */ - TEST(DeleteObject(hPal) == 0); - - /* We can still select the Palette into a compatible DC */ - hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); - TEST(hOldPal != 0); + HPALETTE hPal, hOldPal; + HWND hWnd; + HDC hDC, hCompDC; + struct + { + LOGPALETTE logpal; + PALETTEENTRY entry[20]; + } pal; + + ZeroMemory(&pal, sizeof(pal)); + + pal.logpal.palVersion = 0x300; + pal.logpal.palNumEntries = 6; + pal.entry[0] = PALENTRY(0,0,0); + pal.entry[1] = PALENTRY(255,255,255); + pal.entry[2] = PALENTRY(128,128,128); + pal.entry[3] = PALENTRY(128,0,0); + pal.entry[4] = PALENTRY(0,128,0); + pal.entry[5] = PALENTRY(0,0,128); + + hPal = CreatePalette(&pal.logpal); + ASSERT(hPal); + TEST(DeleteObject(hPal) == 1); + hPal = CreatePalette(&pal.logpal); + ASSERT(hPal); + + /* Create a window */ + hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, + NULL, NULL, hinst, 0); + hDC = GetDC(hWnd); + ASSERT(hDC); + hCompDC = CreateCompatibleDC(hDC); + ASSERT(hCompDC); + + /* Test NULL DC */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(NULL, hPal, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid DC */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test NULL palette */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(hDC, NULL, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid palette */ + SetLastError(ERROR_SUCCESS); + hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0); + TEST(hOldPal == 0); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test valid palette */ + hOldPal = NtUserSelectPalette(hDC, hPal, 0); + TEST(hOldPal != 0); + TEST(hOldPal == GetStockObject(DEFAULT_PALETTE)); + + /* We cannot Delete the palette */ + TEST(DeleteObject(hPal) == 0); + + /* We can still select the Palette into a compatible DC */ + hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); + TEST(hOldPal != 0); #if 0 - RealizePalette(hDC); - - GetClientRect(hWnd, &rect); - FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW)); - - TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1)); - - ReleaseDC(hWnd, hDC); - DestroyWindow(hWnd); - RECT rect; - HBITMAP hBmp; - - - BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize - 3, // biWidth - 3, // biHeight - 1, // biPlanes - 8, // biBitCount - BI_RGB, // biCompression - 0, // biSizeImage - 92, // biXPelsPerMeter - 92, // biYPelsPerMeter - 6, // biClrUsed - 6}; // biClrImportant - BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}}; - - struct - { - BITMAPINFOHEADER bmih; - RGBQUAD colors[6]; - } bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6}, - {{0,0,0,0},{255,255,255,0},{255,0,0,0}, - {0,255,0,0},{0,0,255,0},{128,128,128,0}}}; - - hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); - ASSERT(hBmp); - - SetLastError(0); - TEST(NtGdiSelectBitmap(hCompDC, hBmp)); - hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); - TEST(hOldPal != NULL); - RealizePalette(hCompDC); - - TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0)); - TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255)); - TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128)); + RealizePalette(hDC); + + GetClientRect(hWnd, &rect); + FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW)); + + TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1)); + + ReleaseDC(hWnd, hDC); + DestroyWindow(hWnd); + RECT rect; + HBITMAP hBmp; + + + BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize + 3, // biWidth + 3, // biHeight + 1, // biPlanes + 8, // biBitCount + BI_RGB, // biCompression + 0, // biSizeImage + 92, // biXPelsPerMeter + 92, // biYPelsPerMeter + 6, // biClrUsed + 6}; // biClrImportant + BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}}; + + struct + { + BITMAPINFOHEADER bmih; + RGBQUAD colors[6]; + } bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6}, + {{0,0,0,0},{255,255,255,0},{255,0,0,0}, + {0,255,0,0},{0,0,255,0},{128,128,128,0}}}; + + hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); + ASSERT(hBmp); + + SetLastError(0); + TEST(NtGdiSelectBitmap(hCompDC, hBmp)); + hOldPal = NtUserSelectPalette(hCompDC, hPal, 0); + TEST(hOldPal != NULL); + RealizePalette(hCompDC); + + TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0)); + TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255)); + TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128)); printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110))); #endif diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c index dae9b1e313..dd1067a515 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSetTimer.c @@ -11,8 +11,8 @@ START_TEST(NtUserSetTimer) { - // check valid argument - // check for replacement / new timers - // check when expiries are handled (msgs and calls) + // check valid argument + // check for replacement / new timers + // check when expiries are handled (msgs and calls) } diff --git a/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c b/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c index feb14b30c7..33f7b26a59 100644 --- a/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c +++ b/modules/rostests/apitests/win32nt/ntuser/NtUserSystemParametersInfo.c @@ -75,13 +75,13 @@ static const WCHAR* VAL_BEEP = L"Beep"; LONG QueryUserRegValueW(PCWSTR pszSubKey, PCWSTR pszValueName, PVOID pData, LPDWORD cbSize, LPDWORD pType) { - HKEY hKey; - LONG ret; + HKEY hKey; + LONG ret; - RegOpenKeyExW(HKEY_CURRENT_USER, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); - ret = RegQueryValueExW(hKey, pszValueName, NULL, pType, (LPBYTE)pData, cbSize); - RegCloseKey(hKey); - return ret; + RegOpenKeyExW(HKEY_CURRENT_USER, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); + ret = RegQueryValueExW(hKey, pszValueName, NULL, pType, (LPBYTE)pData, cbSize); + RegCloseKey(hKey); + return ret; } @@ -89,235 +89,235 @@ HWND CreateTestWindow() { HINSTANCE hinst = GetModuleHandle(NULL); - WNDCLASSA wc; - - wc.style = 0; - wc.lpfnWndProc = DefWindowProcA; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hinst; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = "testclass"; - - RegisterClassA(&wc); - return CreateWindowA("testclass", - "testwnd", - WS_VISIBLE, - 0, - 0, - 50, - 30, - NULL, - NULL, - hinst, - 0); + WNDCLASSA wc; + + wc.style = 0; + wc.lpfnWndProc = DefWindowProcA; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hinst; + wc.hIcon = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = "testclass"; + + RegisterClassA(&wc); + return CreateWindowA("testclass", + "testwnd", + WS_VISIBLE, + 0, + 0, + 50, + 30, + NULL, + NULL, + hinst, + 0); } void Test_NtUserSystemParametersInfo_Params(void) { -// UINT uint; - DWORD data[1000]; - UINT i, uint; - ACCESSTIMEOUT ato; - /* Test normal */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - - /* Test invalid SPI code */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(7, 0, &data, 0) == FALSE); - TEST(GetLastError() == ERROR_INVALID_PARAMETER); - - /* Test wrong cbSize member */ - ato.cbSize = 1; - SetLastError(0xdeadbeef); - TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE); - TEST(GetLastError() == 0xdeadbeef); +// UINT uint; + DWORD data[1000]; + UINT i, uint; + ACCESSTIMEOUT ato; + /* Test normal */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test invalid SPI code */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(7, 0, &data, 0) == FALSE); + TEST(GetLastError() == ERROR_INVALID_PARAMETER); + + /* Test wrong cbSize member */ + ato.cbSize = 1; + SetLastError(0xdeadbeef); + TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE); + TEST(GetLastError() == 0xdeadbeef); #if 0 - /* Test undocumented, but valid SPI codes */ - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] <= 1); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - data[0] = 0; - NtUserSystemParametersInfo(0x1010, 0, &data, 0); - TEST(data[0] == 1); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4139, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4140, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4141, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4142, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4143, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4144, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4145, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4146, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4147, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4148, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4149, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4150, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4151, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4152, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4153, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4154, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4155, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); - - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4156, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] != 0xdeadbeef); - TEST(data[1] == 0xdeadbeef); - - for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(4157, 0, &data, 0) == TRUE); - TEST(GetLastError() == ERROR_SUCCESS); - TEST(data[0] == 0xbeefdead); - TEST(data[1] == 0xbeefdead); + /* Test undocumented, but valid SPI codes */ + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] <= 1); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + data[0] = 0; + NtUserSystemParametersInfo(0x1010, 0, &data, 0); + TEST(data[0] == 1); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4139, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4140, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4141, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4142, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4143, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4144, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4145, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4146, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4147, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4148, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4149, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4150, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4151, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4152, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4153, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4154, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4155, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); + + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4156, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] != 0xdeadbeef); + TEST(data[1] == 0xdeadbeef); + + for(i = 0; i < 1000; i++) data[i] = 0xbeefdead; + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(4157, 0, &data, 0) == TRUE); + TEST(GetLastError() == ERROR_SUCCESS); + TEST(data[0] == 0xbeefdead); + TEST(data[1] == 0xbeefdead); #endif - /* Test invalid pointer */ - SetLastError(ERROR_SUCCESS); - TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) == FALSE); - TEST(GetLastError() == ERROR_NOACCESS); - for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; + /* Test invalid pointer */ + SetLastError(ERROR_SUCCESS); + TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) == FALSE); + TEST(GetLastError() == ERROR_NOACCESS); + for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef; - /* test wrong bools */ + /* test wrong bools */ } void @@ -370,89 +370,89 @@ Test_NtUserSystemParametersInfo_Winsta(void) void Test_NtUserSystemParametersInfo_fWinIni(void) { - ACCESSTIMEOUT ato; -// UINT uFocusBorderHeight; - WCHAR Buffer[6]; - DWORD cbSize; + ACCESSTIMEOUT ato; +// UINT uFocusBorderHeight; + WCHAR Buffer[6]; + DWORD cbSize; - ato.cbSize = sizeof(ato); - NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0); - ato.iTimeOutMSec++; - NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); - ato.iTimeOutMSec--; + ato.cbSize = sizeof(ato); + NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0); + ato.iTimeOutMSec++; + NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); + ato.iTimeOutMSec--; -// NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, 0); -// NtUserSystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, SPIF_UPDATEINIFILE); +// NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, 0); +// NtUserSystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); + NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0); - cbSize = 6; - QueryUserRegValueW(L"Control Panel\\Accessibility\\TimeOut", L"TimeToWait", &Buffer, &cbSize, NULL); + cbSize = 6; + QueryUserRegValueW(L"Control Panel\\Accessibility\\TimeOut", L"TimeToWait", &Buffer, &cbSize, NULL); } void Test_MetricKey(PCWSTR pwszVal, INT iVal) { - WCHAR szReg[10]; - DWORD cbSize; + WCHAR szReg[10]; + DWORD cbSize; - cbSize = sizeof(szReg); - TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) == ERROR_SUCCESS, "Value=%S\n", pwszVal); - TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal); + cbSize = sizeof(szReg); + TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) == ERROR_SUCCESS, "Value=%S\n", pwszVal); + TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal); } void Test_UserPref(UINT uiGet, UINT uiSet, DWORD dwPrefMask) { - BOOL bOrig, bTemp = 0; - DWORD dwUserPref, dwUserPrefOrg; - DWORD cbSize; - - /* Get original values */ - NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0); - cbSize = sizeof(dwUserPrefOrg); - QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL); - - /* Value 0 */ - NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 0); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 1 without Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 2 without Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)2, 0); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == 0); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Value 1 with Registry */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(dwUserPref); - TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); - TEST((dwUserPref & dwPrefMask) == dwPrefMask); - TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); - - /* Restore original value */ - NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE); + BOOL bOrig, bTemp = 0; + DWORD dwUserPref, dwUserPrefOrg; + DWORD cbSize; + + /* Get original values */ + NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0); + cbSize = sizeof(dwUserPrefOrg); + QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL); + + /* Value 0 */ + NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 0); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 1 without Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 2 without Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)2, 0); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == 0); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Value 1 with Registry */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE); + NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0); + TEST(bTemp == 1); + cbSize = sizeof(dwUserPref); + TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS); + TEST((dwUserPref & dwPrefMask) == dwPrefMask); + TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask))); + + /* Restore original value */ + NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE); } @@ -463,64 +463,64 @@ Test_UserPref(UINT uiGet, UINT uiSet, DWORD dwPrefMask) void Test_SPI_SETBEEP(void) { - BOOL bOrig, bTemp = 0; - WCHAR szReg[10]; - DWORD cbSize; - - /* Get original value */ - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bOrig, 0); - - /* Value 0 */ - NtUserSystemParametersInfo(SPI_SETBEEP, 0, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0); - TEST(bTemp == 0); - cbSize = sizeof(szReg); - TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS); - TEST(_wcsicmp(szReg, L"No") == 0); - - /* Value 1 */ - NtUserSystemParametersInfo(SPI_SETBEEP, 1, NULL, SPIF_UPDATEINIFILE); - NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0); - TEST(bTemp == 1); - cbSize = sizeof(szReg); - TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS); - TEST(_wcsicmp(szReg, L"Yes") == 0); - ... 2103 lines suppressed ...
5 years, 11 months
1
0
0
0
[reactos] 01/01: [APITESTS][GDI32] Add TextTransform testcase (#1319)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7846c0c6778c7d2df6a0…
commit e7846c0c6778c7d2df6a0e613299a409e1b25444 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 30 21:23:42 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 30 21:23:42 2019 +0900 [APITESTS][GDI32] Add TextTransform testcase (#1319) Prove text/font transformation functionality (#1238). CORE-15554 --- modules/rostests/apitests/gdi32/CMakeLists.txt | 1 + modules/rostests/apitests/gdi32/TextTransform.c | 269 ++++++++++++++++++++++++ modules/rostests/apitests/gdi32/testlist.c | 2 + 3 files changed, 272 insertions(+) diff --git a/modules/rostests/apitests/gdi32/CMakeLists.txt b/modules/rostests/apitests/gdi32/CMakeLists.txt index 56fa28b97e..bbeeb4fa0b 100644 --- a/modules/rostests/apitests/gdi32/CMakeLists.txt +++ b/modules/rostests/apitests/gdi32/CMakeLists.txt @@ -73,6 +73,7 @@ list(APPEND SOURCE SetSysColors.c SetWindowExtEx.c SetWorldTransform.c + TextTransform.c init.c precomp.h) diff --git a/modules/rostests/apitests/gdi32/TextTransform.c b/modules/rostests/apitests/gdi32/TextTransform.c new file mode 100644 index 0000000000..7f7a1ccfa7 --- /dev/null +++ b/modules/rostests/apitests/gdi32/TextTransform.c @@ -0,0 +1,269 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for World Transformation and font rendering + * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#include "precomp.h" + +typedef struct tagBITMAPINFOEX +{ + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[256]; +} BITMAPINFOEX, FAR *LPBITMAPINFOEX; + +#if 1 + #define SaveBitmapToFile(f, h) +#else +static BOOL SaveBitmapToFile(LPCWSTR pszFileName, HBITMAP hbm) +{ + BOOL f; + BITMAPFILEHEADER bf; + BITMAPINFOEX bmi; + BITMAPINFOHEADER *pbmih; + DWORD cb, cbColors; + HDC hDC; + HANDLE hFile; + LPVOID pBits; + BITMAP bm; + + if (!GetObjectW(hbm, sizeof(BITMAP), &bm)) + return FALSE; + + pbmih = &bmi.bmiHeader; + ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER)); + pbmih->biSize = sizeof(BITMAPINFOHEADER); + pbmih->biWidth = bm.bmWidth; + pbmih->biHeight = bm.bmHeight; + pbmih->biPlanes = 1; + pbmih->biBitCount = bm.bmBitsPixel; + pbmih->biCompression = BI_RGB; + pbmih->biSizeImage = bm.bmWidthBytes * bm.bmHeight; + + if (bm.bmBitsPixel < 16) + cbColors = (1 << bm.bmBitsPixel) * sizeof(RGBQUAD); + else + cbColors = 0; + + bf.bfType = 0x4d42; + bf.bfReserved1 = 0; + bf.bfReserved2 = 0; + cb = sizeof(BITMAPFILEHEADER) + pbmih->biSize + cbColors; + bf.bfOffBits = cb; + bf.bfSize = cb + pbmih->biSizeImage; + + pBits = HeapAlloc(GetProcessHeap(), 0, pbmih->biSizeImage); + if (pBits == NULL) + return FALSE; + + f = FALSE; + hDC = CreateCompatibleDC(NULL); + if (hDC) + { + if (GetDIBits(hDC, hbm, 0, bm.bmHeight, pBits, (BITMAPINFO *)&bmi, + DIB_RGB_COLORS)) + { + hFile = CreateFileW(pszFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | + FILE_FLAG_WRITE_THROUGH, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + f = WriteFile(hFile, &bf, sizeof(BITMAPFILEHEADER), &cb, NULL) && + WriteFile(hFile, &bmi, sizeof(BITMAPINFOHEADER), &cb, NULL) && + WriteFile(hFile, bmi.bmiColors, cbColors, &cb, NULL) && + WriteFile(hFile, pBits, pbmih->biSizeImage, &cb, NULL); + CloseHandle(hFile); + + if (!f) + DeleteFileW(pszFileName); + } + } + DeleteDC(hDC); + } + HeapFree(GetProcessHeap(), 0, pBits); + return f; +} +#endif + +static VOID +setXFORM(XFORM *pxform, + FLOAT eM11, FLOAT eM12, + FLOAT eM21, FLOAT eM22, + FLOAT eDx, FLOAT eDy) +{ + pxform->eM11 = eM11; + pxform->eM12 = eM12; + pxform->eM21 = eM21; + pxform->eM22 = eM22; + pxform->eDx = eDx; + pxform->eDy = eDy; +} + +START_TEST(TextTransform) +{ + HDC hDC; + BITMAPINFO bmi; + LPVOID pvBits; + HBITMAP hbm; + LOGFONTA lf; + HFONT hFont; + HGDIOBJ hbmOld, hFontOld; + RECT rc; + WCHAR chBlackBox = L'g'; + SIZE siz; + POINT pt; + XFORM xform; + HBRUSH hWhiteBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); + const COLORREF BLACK = RGB(0, 0, 0); + const COLORREF WHITE = RGB(255, 255, 255); + + hDC = CreateCompatibleDC(NULL); + ok(hDC != NULL, "hDC was NULL.\n"); + + SetBkMode(hDC, TRANSPARENT); + SetMapMode(hDC, MM_ANISOTROPIC); + + siz.cx = siz.cy = 100; + pt.x = siz.cx / 2; + pt.y = siz.cy / 2; + SetWindowOrgEx(hDC, -pt.x, -pt.y, NULL); + + ZeroMemory(&bmi, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = siz.cx; + bmi.bmiHeader.biHeight = siz.cy; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 24; + hbm = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0); + ok(hbm != NULL, "hbm was NULL.\n"); + + ZeroMemory(&lf, sizeof(lf)); + lf.lfHeight = -50; + lf.lfCharSet = DEFAULT_CHARSET; + lstrcpyA(lf.lfFaceName, "Marlett"); + hFont = CreateFontIndirectA(&lf); + ok(hFont != NULL, "hFont was NULL.\n"); + + hbmOld = SelectObject(hDC, hbm); + hFontOld = SelectObject(hDC, hFont); + + SetRect(&rc, -siz.cx / 2, -siz.cy / 2, siz.cx / 2, siz.cy / 2); + + FillRect(hDC, &rc, hWhiteBrush); + SaveBitmapToFile(L"1.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + FillRect(hDC, &rc, hWhiteBrush); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + SaveBitmapToFile(L"2.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + SetGraphicsMode(hDC, GM_ADVANCED); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, 2, 0, 0, 1, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"3.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, 1, 1, 1, 1, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), FALSE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"4.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, -1, 0, 0, 1, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"5.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), BLACK); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, 0, 1, 1, 0, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"6.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, 0, -1, 1, 0, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"7.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), BLACK); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, 0, 1, -1, 0, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"8.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + FillRect(hDC, &rc, hWhiteBrush); + setXFORM(&xform, -1, 0, 0.5, -1, 0, 0); + ok_int(SetWorldTransform(hDC, &xform), TRUE); + SetTextAlign(hDC, TA_LEFT | TA_BOTTOM); + TextOutW(hDC, 0, 0, &chBlackBox, 1); + ok_int(ModifyWorldTransform(hDC, NULL, MWT_IDENTITY), TRUE); + SaveBitmapToFile(L"9.bmp", hbm); + ok_long(GetPixel(hDC, +siz.cx / 4, +siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, +siz.cy / 4), BLACK); + ok_long(GetPixel(hDC, +siz.cx / 4, -siz.cy / 4), WHITE); + ok_long(GetPixel(hDC, -siz.cx / 4, -siz.cy / 4), WHITE); + + SelectObject(hDC, hFontOld); + SelectObject(hDC, hbmOld); + + DeleteObject(hFont); + DeleteObject(hbm); + + DeleteDC(hDC); +} diff --git a/modules/rostests/apitests/gdi32/testlist.c b/modules/rostests/apitests/gdi32/testlist.c index afe2e5456e..8b9443629e 100644 --- a/modules/rostests/apitests/gdi32/testlist.c +++ b/modules/rostests/apitests/gdi32/testlist.c @@ -74,6 +74,7 @@ extern void func_SetPixel(void); extern void func_SetSysColors(void); extern void func_SetWindowExtEx(void); extern void func_SetWorldTransform(void); +extern void func_TextTransform(void); const struct test winetest_testlist[] = { @@ -148,6 +149,7 @@ const struct test winetest_testlist[] = { "SetSysColors", func_SetSysColors }, { "SetWindowExtEx", func_SetWindowExtEx }, { "SetWorldTransform", func_SetWorldTransform }, + { "TextTransform", func_TextTransform }, { 0, 0 } };
5 years, 11 months
1
0
0
0
[reactos] 01/01: [RPCRT4] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b6fdb56b9adf780902cc9…
commit b6fdb56b9adf780902cc9cf65af1f76365a96ce4 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Wed Jan 30 12:31:33 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Wed Jan 30 12:31:33 2019 +0100 [RPCRT4] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/rpcrt4/CMakeLists.txt | 27 +- dll/win32/rpcrt4/cproxy.c | 118 +-- dll/win32/rpcrt4/cpsf.c | 2 +- dll/win32/rpcrt4/cpsf.h | 30 + dll/win32/rpcrt4/cstub.c | 25 +- dll/win32/rpcrt4/ndr_contexthandle.c | 2 - dll/win32/rpcrt4/ndr_es.c | 15 +- dll/win32/rpcrt4/ndr_marshall.c | 1574 +++++++++++++++++----------------- dll/win32/rpcrt4/ndr_ole.c | 16 +- dll/win32/rpcrt4/ndr_stubless.c | 304 ++++--- dll/win32/rpcrt4/ndr_stubless.h | 16 +- dll/win32/rpcrt4/ndr_typelib.c | 1207 ++++++++++++++++++++++++++ dll/win32/rpcrt4/ndr_types.idl | 30 + dll/win32/rpcrt4/rpc_assoc.c | 23 +- dll/win32/rpcrt4/rpc_assoc.h | 4 +- dll/win32/rpcrt4/rpc_binding.c | 4 +- dll/win32/rpcrt4/rpc_binding.h | 3 +- dll/win32/rpcrt4/rpc_epmap.c | 4 +- dll/win32/rpcrt4/rpc_message.c | 48 +- dll/win32/rpcrt4/rpc_transport.c | 82 +- dll/win32/rpcrt4/rpcrt4.spec | 2 +- dll/win32/rpcrt4/rpcrt4_main.c | 3 +- media/doc/README.WINE | 2 +- 23 files changed, 2457 insertions(+), 1084 deletions(-) diff --git a/dll/win32/rpcrt4/CMakeLists.txt b/dll/win32/rpcrt4/CMakeLists.txt index 9d642696f0..212231a3a2 100644 --- a/dll/win32/rpcrt4/CMakeLists.txt +++ b/dll/win32/rpcrt4/CMakeLists.txt @@ -2,9 +2,21 @@ remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) +add_definitions( + -D__WINESRC__ + -D_RPCRT4_ + -DCOM_NO_WINDOWS_H + -DMSWMSG) + include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) spec2def(rpcrt4.dll rpcrt4.spec ADD_IMPORTLIB) + add_rpc_files(client epm.idl) +add_idl_headers(ndr_types_header ndr_types.idl) + +set(IDL_FLAGS ${IDL_FLAGS} -Oicf) +add_rpcproxy_files(ndr_types.idl) +unset(IDL_FLAGS) list(APPEND SOURCE cproxy.c @@ -29,21 +41,15 @@ list(APPEND SOURCE precomp.h ${CMAKE_CURRENT_BINARY_DIR}/epm_c.c) -remove_definitions(-D_WIN32_WINNT=0x502) -add_definitions(-D_WIN32_WINNT=0x600) - -add_definitions( - -D__WINESRC__ - -D_RPCRT4_ - -DCOM_NO_WINDOWS_H - -DMSWMSG) - if(MSVC AND NOT ARCH STREQUAL "arm") add_asm_files(rpcrt4_asm msvc.S) endif() add_library(rpcrt4 SHARED ${SOURCE} + ndr_typelib.c + ${CMAKE_CURRENT_BINARY_DIR}/ndr_types_p.c + ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c ${rpcrt4_asm} rpcrt4.rc ${CMAKE_CURRENT_BINARY_DIR}/rpcrt4_stubs.c @@ -51,7 +57,8 @@ add_library(rpcrt4 SHARED set_module_type(rpcrt4 win32dll) target_link_libraries(rpcrt4 wine uuid ${PSEH_LIB}) -add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32) +add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32 oleaut32) add_importlibs(rpcrt4 advapi32 advapi32_vista kernel32_vista ws2_32 msvcrt kernel32 ntdll) +add_dependencies(rpcrt4 ndr_types_header) add_pch(rpcrt4 precomp.h SOURCE) add_cd_file(TARGET rpcrt4 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/rpcrt4/cproxy.c b/dll/win32/rpcrt4/cproxy.c index 4f5b4f2b1c..56ef84d273 100644 --- a/dll/win32/rpcrt4/cproxy.c +++ b/dll/win32/rpcrt4/cproxy.c @@ -17,8 +17,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * TODO: Handle non-i386 architectures */ #include "config.h" @@ -42,21 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); -/* I don't know what MS's std proxy structure looks like, - so this probably doesn't match, but that shouldn't matter */ -typedef struct { - IRpcProxyBuffer IRpcProxyBuffer_iface; - LPVOID *PVtbl; - LONG RefCount; - const IID* piid; - LPUNKNOWN pUnkOuter; - IUnknown *base_object; /* must be at offset 0x10 from PVtbl */ - IRpcProxyBuffer *base_proxy; - PCInterfaceName name; - LPPSFACTORYBUFFER pPSFactory; - LPRPCCHANNELBUFFER pChannel; -} StdProxyImpl; - static const IRpcProxyBufferVtbl StdProxy_Vtbl; static inline StdProxyImpl *impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface) @@ -79,7 +62,10 @@ __ASM_GLOBAL_FUNC(call_stubless_func, "movl 8(%ecx),%edx\n\t" /* info->FormatStringOffset */ "movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */ "addl 4(%ecx),%edx\n\t" /* info->ProcFormatString + offset */ - "movzwl 8(%edx),%eax\n\t" /* arguments size */ + "movzbl 1(%edx),%eax\n\t" /* Oi_flags */ + "andl $0x08,%eax\n\t" /* Oi_HAS_RPCFLAGS */ + "shrl $1,%eax\n\t" + "movzwl 4(%edx,%eax),%eax\n\t" /* arguments size */ "pushl %eax\n\t" __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "leal 8(%esp),%eax\n\t" /* &This */ @@ -171,24 +157,43 @@ static inline void init_thunk( struct thunk *thunk, unsigned int index ) extern void call_stubless_func(void); __ASM_GLOBAL_FUNC(call_stubless_func, - "DCD 0xDEFC\n\t" // _assertfail - "" ); + "push {r0-r3}\n\t" + "mov r2, sp\n\t" /* stack_top */ + "push {fp,lr}\n\t" + "mov fp, sp\n\t" + "ldr r0, [r0]\n\t" /* This->lpVtbl */ + "ldr r0, [r0,#-8]\n\t" /* MIDL_STUBLESS_PROXY_INFO */ + "ldr r1, [r0,#8]\n\t" /* info->FormatStringOffset */ + "ldrh r1, [r1,ip]\n\t" /* info->FormatStringOffset[index] */ + "ldr ip, [r0,#4]\n\t" /* info->ProcFormatString */ + "add r1, ip\n\t" /* info->ProcFormatString + offset */ + "ldr r0, [r0]\n\t" /* info->pStubDesc */ +#ifdef __SOFTFP__ + "mov r3, #0\n\t" +#else + "vpush {s0-s15}\n\t" /* store the s0-s15/d0-d7 arguments */ + "mov r3, sp\n\t" /* fpu_stack */ +#endif + "bl " __ASM_NAME("ndr_client_call") "\n\t" + "mov sp, fp\n\t" + "pop {fp,lr}\n\t" + "add sp, #16\n\t" + "bx lr" ); -#include "pshpack1.h" struct thunk { - DWORD assertfail; -}; -#include "poppack.h" - -static const struct thunk thunk_template = -{ - { 0xDEFC } /* _assertfail */ + DWORD ldr_ip; /* ldr ip,[pc] */ + DWORD ldr_pc; /* ldr pc,[pc] */ + DWORD index; + void *func; }; static inline void init_thunk( struct thunk *thunk, unsigned int index ) { - *thunk = thunk_template; + thunk->ldr_ip = 0xe59fc000; /* ldr ip,[pc] */ + thunk->ldr_pc = 0xe59ff000; /* ldr pc,[pc] */ + thunk->index = index * sizeof(unsigned short); + thunk->func = call_stubless_func; } #else /* __i386__ */ @@ -233,7 +238,7 @@ static const struct thunk *allocate_block( unsigned int num ) return block; } -static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num ) +BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num ) { const void **entry = (const void **)(vtbl + 1); DWORD i, j; @@ -317,9 +322,7 @@ HRESULT StdProxy_Construct(REFIID riid, return S_OK; } -static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface, - REFIID riid, - LPVOID *obj) +HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID riid, void **obj) { StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj); @@ -340,7 +343,7 @@ static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface, return E_NOINTERFACE; } -static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface) +ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface) { StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->AddRef()\n",This); @@ -370,8 +373,7 @@ static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface) return refs; } -static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface, - LPRPCCHANNELBUFFER pChannel) +HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel) { StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->Connect(%p)\n",This,pChannel); @@ -382,7 +384,7 @@ static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface, return S_OK; } -static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface) +void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface) { StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->Disconnect()\n",This); @@ -551,45 +553,3 @@ HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode) else return HRESULT_FROM_WIN32(dwExceptionCode); } - -HRESULT WINAPI -CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid, - LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv ) -{ - typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT); - HMODULE hUser32 = LoadLibraryA("user32"); - MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA"); - - FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv); - if (pMessageBoxA) - { - pMessageBoxA(NULL, - "The native implementation of OLEAUT32.DLL cannot be used " - "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n", - "Wine: Unimplemented CreateProxyFromTypeInfo", - 0x10); - ExitProcess(1); - } - return E_NOTIMPL; -} - -HRESULT WINAPI -CreateStubFromTypeInfo(ITypeInfo *pTypeInfo, REFIID riid, IUnknown *pUnkServer, - IRpcStubBuffer **ppStub ) -{ - typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT); - HMODULE hUser32 = LoadLibraryA("user32"); - MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA"); - - FIXME("%p %s %p %p\n", pTypeInfo, debugstr_guid(riid), pUnkServer, ppStub); - if (pMessageBoxA) - { - pMessageBoxA(NULL, - "The native implementation of OLEAUT32.DLL cannot be used " - "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n", - "Wine: Unimplemented CreateProxyFromTypeInfo", - 0x10); - ExitProcess(1); - } - return E_NOTIMPL; -} diff --git a/dll/win32/rpcrt4/cpsf.c b/dll/win32/rpcrt4/cpsf.c index 9375c40fa4..e92d226498 100644 --- a/dll/win32/rpcrt4/cpsf.c +++ b/dll/win32/rpcrt4/cpsf.c @@ -279,7 +279,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll, /* register clsid to point to module */ strcpyW( keyname, clsidW ); strcatW( keyname, clsid ); - len = GetModuleFileNameW(hDll, module, sizeof(module)/sizeof(WCHAR)); + len = GetModuleFileNameW(hDll, module, ARRAY_SIZE(module)); if (len && len < sizeof(module)) { TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module)); if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) { diff --git a/dll/win32/rpcrt4/cpsf.h b/dll/win32/rpcrt4/cpsf.h index 964fb4551f..3cfbf77ff6 100644 --- a/dll/win32/rpcrt4/cpsf.h +++ b/dll/win32/rpcrt4/cpsf.h @@ -21,9 +21,36 @@ #ifndef __WINE_CPSF_H #define __WINE_CPSF_H +typedef struct +{ + IRpcProxyBuffer IRpcProxyBuffer_iface; + void **PVtbl; + LONG RefCount; + const IID *piid; + IUnknown *pUnkOuter; + /* offset of base_object from PVtbl must match assembly thunks; see + * fill_delegated_proxy_table() */ + IUnknown *base_object; + IRpcProxyBuffer *base_proxy; + PCInterfaceName name; + IPSFactoryBuffer *pPSFactory; + IRpcChannelBuffer *pChannel; +} StdProxyImpl; + +typedef struct +{ + IUnknownVtbl *base_obj; + IRpcStubBuffer *base_stub; + CStdStubBuffer stub_buffer; +} cstdstubbuffer_delegating_t; + HRESULT StdProxy_Construct(REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo, int Index, LPPSFACTORYBUFFER pPSFactory, LPRPCPROXYBUFFER *ppProxy, LPVOID *ppvObj) DECLSPEC_HIDDEN; +HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID iid, void **obj) DECLSPEC_HIDDEN; +ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface) DECLSPEC_HIDDEN; +HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *channel) DECLSPEC_HIDDEN; +void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface) DECLSPEC_HIDDEN; HRESULT CStdStubBuffer_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, LPPSFACTORYBUFFER pPSFactory, @@ -41,5 +68,8 @@ extern const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl DECLSPEC_HIDDEN; BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN; HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN; HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN; +BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN; +IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) DECLSPEC_HIDDEN; +void release_delegating_vtbl(IUnknownVtbl *vtbl) DECLSPEC_HIDDEN; #endif /* __WINE_CPSF_H */ diff --git a/dll/win32/rpcrt4/cstub.c b/dll/win32/rpcrt4/cstub.c index dc279b7534..e33d499b15 100644 --- a/dll/win32/rpcrt4/cstub.c +++ b/dll/win32/rpcrt4/cstub.c @@ -50,13 +50,6 @@ static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr) return EXCEPTION_EXECUTE_HANDLER; } -typedef struct -{ - IUnknownVtbl *base_obj; - IRpcStubBuffer *base_stub; - CStdStubBuffer stub_buffer; -} cstdstubbuffer_delegating_t; - static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface ) { return CONTAINING_RECORD((void *)iface, cstdstubbuffer_delegating_t, stub_buffer); @@ -175,11 +168,23 @@ typedef struct static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01, 0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 }; #elif defined(__arm__) + +static const DWORD opcodes[] = +{ + 0xe52d4004, /* push {r4} */ + 0xe5900010, /* ldr r0, [r0, #16] */ + 0xe5904000, /* ldr r4, [r0] */ + 0xe59fc008, /* ldr ip, [pc, #8] */ + 0xe08cc004, /* add ip, ip, r4 */ + 0xe49d4004, /* pop {r4} */ + 0xe59cf000 /* ldr pc, [ip] */ +}; + typedef struct { + DWORD opcodes[ARRAY_SIZE(opcodes)]; DWORD offset; } vtbl_method_t; -static const BYTE opcodes[1]; #else @@ -267,7 +272,7 @@ BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) return TRUE; } -static IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) +IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) { IUnknownVtbl *ret; @@ -303,7 +308,7 @@ static IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) return ret; } -static void release_delegating_vtbl(IUnknownVtbl *vtbl) +void release_delegating_vtbl(IUnknownVtbl *vtbl) { ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1); diff --git a/dll/win32/rpcrt4/ndr_contexthandle.c b/dll/win32/rpcrt4/ndr_contexthandle.c index 3b262854b7..a5e1ffc253 100644 --- a/dll/win32/rpcrt4/ndr_contexthandle.c +++ b/dll/win32/rpcrt4/ndr_contexthandle.c @@ -23,8 +23,6 @@ #include "rpc_assoc.h" #include "rpcndr.h" -#include "wine/rpcfc.h" - #include "wine/debug.h" #include "wine/list.h" diff --git a/dll/win32/rpcrt4/ndr_es.c b/dll/win32/rpcrt4/ndr_es.c index 59ea8166f0..158bc7cda2 100644 --- a/dll/win32/rpcrt4/ndr_es.c +++ b/dll/win32/rpcrt4/ndr_es.c @@ -32,7 +32,6 @@ #include "ndr_stubless.h" #include "wine/debug.h" -#include "wine/rpcfc.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -424,7 +423,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu client_interface = pStubDesc->RpcInterfaceInformation; pEsMsg->InterfaceId = client_interface->InterfaceId; - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) { const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; stack_size = header_rpc->stack_size; @@ -438,17 +437,17 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu pFormat += sizeof(NDR_PROC_HEADER); } - if (pProcHeader->handle_type == RPC_FC_BIND_EXPLICIT) + if (pProcHeader->handle_type == 0) { switch (*pFormat) /* handle_type */ { - case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */ + case FC_BIND_PRIMITIVE: /* explicit primitive */ pFormat += sizeof(NDR_EHD_PRIMITIVE); break; - case RPC_FC_BIND_GENERIC: /* explicit generic */ + case FC_BIND_GENERIC: /* explicit generic */ pFormat += sizeof(NDR_EHD_GENERIC); break; - case RPC_FC_BIND_CONTEXT: /* explicit context */ + case FC_BIND_CONTEXT: /* explicit context */ pFormat += sizeof(NDR_EHD_CONTEXT); break; default: @@ -467,7 +466,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu pEsMsg->StubMsg.pfnFree = pStubDesc->pfnFree; /* create the full pointer translation tables, if requested */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) pEsMsg->StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT); TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags); @@ -510,7 +509,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu return; } /* free the full pointer translation tables */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) NdrFullPointerXlatFree(pEsMsg->StubMsg.FullPtrXlatTables); } diff --git a/dll/win32/rpcrt4/ndr_marshall.c b/dll/win32/rpcrt4/ndr_marshall.c index 6356fb9d98..77bbf986ff 100644 --- a/dll/win32/rpcrt4/ndr_marshall.c +++ b/dll/win32/rpcrt4/ndr_marshall.c @@ -43,8 +43,6 @@ #include "ndrtypes.h" #include "wine/unicode.h" -#include "wine/rpcfc.h" - #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -110,6 +108,19 @@ static inline void align_pointer_clear( unsigned char **ptr, unsigned int align *ptr = (unsigned char *)(((ULONG_PTR)*ptr + mask) & ~mask); } +static inline void align_pointer_offset( unsigned char **ptr, unsigned char *base, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + *ptr = base + (((ULONG_PTR)(*ptr - base) + mask) & ~mask); +} + +static inline void align_pointer_offset_clear( unsigned char **ptr, unsigned char *base, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + memset( *ptr, 0, (align - (ULONG_PTR)(*ptr - base)) & mask ); + *ptr = base + (((ULONG_PTR)(*ptr - base) + mask) & ~mask); +} + #define STD_OVERFLOW_CHECK(_Msg) do { \ TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \ if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \ @@ -438,6 +449,13 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len) return p; } +static void *NdrAllocateZero(MIDL_STUB_MESSAGE *stubmsg, SIZE_T len) +{ + void *mem = NdrAllocate(stubmsg, len); + memset(mem, 0, len); + return mem; +} + static void NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer) { TRACE("(%p, %p)\n", pStubMsg, Pointer); @@ -554,15 +572,15 @@ PFORMAT_STRING ComputeConformanceOrVariance( } switch (pFormat[0] & 0xf0) { - case RPC_FC_NORMAL_CONFORMANCE: + case FC_NORMAL_CONFORMANCE: TRACE("normal conformance, ofs=%d\n", ofs); ptr = pMemory; break; - case RPC_FC_POINTER_CONFORMANCE: + case FC_POINTER_CONFORMANCE: TRACE("pointer conformance, ofs=%d\n", ofs); ptr = pStubMsg->Memory; break; - case RPC_FC_TOP_LEVEL_CONFORMANCE: + case FC_TOP_LEVEL_CONFORMANCE: TRACE("toplevel conformance, ofs=%d\n", ofs); if (pStubMsg->StackTop) { ptr = pStubMsg->StackTop; @@ -572,12 +590,12 @@ PFORMAT_STRING ComputeConformanceOrVariance( goto finish_conf; } break; - case RPC_FC_CONSTANT_CONFORMANCE: + case FC_CONSTANT_CONFORMANCE: data = ofs | ((DWORD)pFormat[1] << 16); TRACE("constant conformance, val=%ld\n", data); *pCount = data; goto finish_conf; - case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE: + case FC_TOP_LEVEL_MULTID_CONFORMANCE: FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs); if (pStubMsg->StackTop) { ptr = pStubMsg->StackTop; @@ -593,10 +611,10 @@ PFORMAT_STRING ComputeConformanceOrVariance( } switch (pFormat[1]) { - case RPC_FC_DEREFERENCE: + case FC_DEREFERENCE: ptr = *(LPVOID*)((char *)ptr + ofs); break; - case RPC_FC_CALLBACK: + case FC_CALLBACK: { unsigned char *old_stack_top = pStubMsg->StackTop; ULONG_PTR max_count, old_max_count = pStubMsg->MaxCount; @@ -621,25 +639,25 @@ PFORMAT_STRING ComputeConformanceOrVariance( } switch (dtype) { - case RPC_FC_LONG: - case RPC_FC_ULONG: + case FC_LONG: + case FC_ULONG: data = *(DWORD*)ptr; break; - case RPC_FC_SHORT: + case FC_SHORT: data = *(SHORT*)ptr; break; - case RPC_FC_USHORT: + case FC_USHORT: data = *(USHORT*)ptr; break; - case RPC_FC_CHAR: - case RPC_FC_SMALL: + case FC_CHAR: + case FC_SMALL: data = *(CHAR*)ptr; break; - case RPC_FC_BYTE: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_USMALL: data = *(UCHAR*)ptr; break; - case RPC_FC_HYPER: + case FC_HYPER: data = *(ULONGLONG *)ptr; break; default: @@ -650,20 +668,20 @@ PFORMAT_STRING ComputeConformanceOrVariance( done_conf_grab: switch (pFormat[1]) { - case RPC_FC_DEREFERENCE: /* already handled */ + case FC_DEREFERENCE: /* already handled */ case 0: /* no op */ *pCount = data; break; - case RPC_FC_ADD_1: + case FC_ADD_1: *pCount = data + 1; break; - case RPC_FC_SUB_1: + case FC_SUB_1: *pCount = data - 1; break; - case RPC_FC_MULT_2: + case FC_MULT_2: *pCount = data * 2; break; - case RPC_FC_DIV_2: + case FC_DIV_2: *pCount = data / 2; break; default: @@ -779,16 +797,16 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO static inline void dump_pointer_attr(unsigned char attr) { - if (attr & RPC_FC_P_ALLOCALLNODES) - TRACE(" RPC_FC_P_ALLOCALLNODES"); - if (attr & RPC_FC_P_DONTFREE) - TRACE(" RPC_FC_P_DONTFREE"); - if (attr & RPC_FC_P_ONSTACK) - TRACE(" RPC_FC_P_ONSTACK"); - if (attr & RPC_FC_P_SIMPLEPOINTER) - TRACE(" RPC_FC_P_SIMPLEPOINTER"); - if (attr & RPC_FC_P_DEREF) - TRACE(" RPC_FC_P_DEREF"); + if (attr & FC_ALLOCATE_ALL_NODES) + TRACE(" FC_ALLOCATE_ALL_NODES"); + if (attr & FC_DONT_FREE) + TRACE(" FC_DONT_FREE"); + if (attr & FC_ALLOCED_ON_STACK) + TRACE(" FC_ALLOCED_ON_STACK"); + if (attr & FC_SIMPLE_POINTER) + TRACE(" FC_SIMPLE_POINTER"); + if (attr & FC_POINTER_DEREF) + TRACE(" FC_POINTER_DEREF"); TRACE("\n"); } @@ -809,11 +827,11 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat); TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr); pFormat += 2; - if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; + if (attr & FC_SIMPLE_POINTER) desc = pFormat; else desc = pFormat + *(const SHORT*)pFormat; switch (type) { - case RPC_FC_RP: /* ref pointer (always non-null) */ + case FC_RP: /* ref pointer (always non-null) */ if (!Pointer) { ERR("NULL ref pointer is not allowed\n"); @@ -821,8 +839,8 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, } pointer_needs_marshaling = TRUE; break; - case RPC_FC_UP: /* unique pointer */ - case RPC_FC_OP: /* object pointer - same as unique here */ + case FC_UP: /* unique pointer */ + case FC_OP: /* object pointer - same as unique here */ if (Pointer) pointer_needs_marshaling = TRUE; else @@ -831,7 +849,7 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("writing 0x%08x to buffer\n", pointer_id); NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id); break; - case RPC_FC_FP: + case FC_FP: pointer_needs_marshaling = !NdrFullPointerQueryPointer( pStubMsg->FullPtrXlatTables, Pointer, 1, &pointer_id); TRACE("writing 0x%08x to buffer\n", pointer_id); @@ -846,7 +864,7 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("calling marshaller for type 0x%x\n", (int)*desc); if (pointer_needs_marshaling) { - if (attr & RPC_FC_P_DEREF) { + if (attr & FC_POINTER_DEREF) { Pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", Pointer); } @@ -858,9 +876,13 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, STD_OVERFLOW_CHECK(pStubMsg); } -/*********************************************************************** - * PointerUnmarshall [internal] - */ +/* pPointer is the pointer that we will unmarshal into; pSrcPointer is the + * pointer to memory which we may attempt to reuse if non-NULL. Usually these + * are the same; for the case when they aren't, see EmbeddedPointerUnmarshall(). + * + * fMustAlloc seems to determine whether we can allocate from the buffer (if we + * are on the server side). It's ignored here, since we can't allocate a pointer + * from the buffer. */ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char **pPointer, @@ -872,19 +894,19 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING desc; NDR_UNMARSHALL m; DWORD pointer_id = 0; - BOOL pointer_needs_unmarshaling; + BOOL pointer_needs_unmarshaling, need_alloc = FALSE, inner_must_alloc = FALSE; TRACE("(%p,%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pSrcPointer, pFormat, fMustAlloc); TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr); pFormat += 2; - if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; + if (attr & FC_SIMPLE_POINTER) desc = pFormat; else desc = pFormat + *(const SHORT*)pFormat; switch (type) { - case RPC_FC_RP: /* ref pointer (always non-null) */ + case FC_RP: /* ref pointer (always non-null) */ pointer_needs_unmarshaling = TRUE; break; - case RPC_FC_UP: /* unique pointer */ + case FC_UP: /* unique pointer */ pointer_id = NDR_LOCAL_UINT32_READ(Buffer); TRACE("pointer_id is 0x%08x\n", pointer_id); if (pointer_id) @@ -894,14 +916,16 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pointer_needs_unmarshaling = FALSE; } break; - case RPC_FC_OP: /* object pointer - we must free data before overwriting it */ + case FC_OP: /* object pointer - we must free data before overwriting it */ pointer_id = NDR_LOCAL_UINT32_READ(Buffer); TRACE("pointer_id is 0x%08x\n", pointer_id); - if (!fMustAlloc && pSrcPointer) - { + + /* An object pointer always allocates new memory (it cannot point to the + * buffer). */ + inner_must_alloc = TRUE; + + if (pSrcPointer) FIXME("free object pointer %p\n", pSrcPointer); - fMustAlloc = TRUE; - } if (pointer_id) pointer_needs_unmarshaling = TRUE; else @@ -910,7 +934,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pointer_needs_unmarshaling = FALSE; } break; - case RPC_FC_FP: + case FC_FP: pointer_id = NDR_LOCAL_UINT32_READ(Buffer); TRACE("pointer_id is 0x%08x\n", pointer_id); pointer_needs_unmarshaling = !NdrFullPointerQueryRefId( @@ -926,50 +950,51 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **current_ptr = pPointer; if (pStubMsg->IsClient) { TRACE("client\n"); - /* if we aren't forcing allocation of memory then try to use the existing - * (source) pointer to unmarshall the data into so that [in,out] - * parameters behave correctly. it doesn't matter if the parameter is - * [out] only since in that case the pointer will be NULL. we force - * allocation when the source pointer is NULL here instead of in the type - * unmarshalling routine for the benefit of the deref code below */ - if (!fMustAlloc) { - if (pSrcPointer) { - TRACE("setting *pPointer to %p\n", pSrcPointer); - *pPointer = pSrcPointer; - } else - fMustAlloc = TRUE; + /* Try to use the existing (source) pointer to unmarshall the data into + * so that [in, out] or [out, ref] parameters behave correctly. If the + * source pointer is NULL and we are not dereferencing, we must force the + * inner marshalling routine to allocate, since otherwise it will crash. */ + if (pSrcPointer) + { + TRACE("setting *pPointer to %p\n", pSrcPointer); + *pPointer = pSrcPointer; } + else + need_alloc = inner_must_alloc = TRUE; } else { TRACE("server\n"); - /* the memory in a stub is never initialised, so we have to work out here - * whether we have to initialise it so we can use the optimisation of - * setting the pointer to the buffer, if possible, or set fMustAlloc to - * TRUE. */ - if (attr & RPC_FC_P_DEREF) { - fMustAlloc = TRUE; - } else { - *current_ptr = NULL; + /* We can use an existing source pointer here only if it is on-stack, + * probably since otherwise NdrPointerFree() might later try to free a + * pointer we don't know the provenance of. Otherwise we must always + * allocate if we are dereferencing. We never need to force the inner + * routine to allocate here, since it will either write into an existing + * pointer, or use a pointer to the buffer. */ + if (attr & FC_POINTER_DEREF) + { + if (pSrcPointer && (attr & FC_ALLOCED_ON_STACK)) + *pPointer = pSrcPointer; + else + need_alloc = TRUE; } + else + *pPointer = NULL; } - if (attr & RPC_FC_P_ALLOCALLNODES) - FIXME("RPC_FC_P_ALLOCALLNODES not implemented\n"); + if (attr & FC_ALLOCATE_ALL_NODES) + FIXME("FC_ALLOCATE_ALL_NODES not implemented\n"); + + if (attr & FC_POINTER_DEREF) { + if (need_alloc) + *pPointer = NdrAllocateZero(pStubMsg, sizeof(void *)); - if (attr & RPC_FC_P_DEREF) { - if (fMustAlloc) { - unsigned char *base_ptr_val = NdrAllocate(pStubMsg, sizeof(void *)); - *pPointer = base_ptr_val; - current_ptr = (unsigned char **)base_ptr_val; - } else - current_ptr = *(unsigned char***)current_ptr; + current_ptr = *(unsigned char***)current_ptr; TRACE("deref => %p\n", current_ptr); - if (!fMustAlloc && !*current_ptr) fMustAlloc = TRUE; } m = NdrUnmarshaller[*desc & NDR_TABLE_MASK]; - if (m) m(pStubMsg, current_ptr, desc, fMustAlloc); + if (m) m(pStubMsg, current_ptr, desc, inner_must_alloc); else FIXME("no unmarshaller for data type=%02x\n", *desc); - if (type == RPC_FC_FP) + if (type == FC_FP) NdrFullPointerInsertRefId(pStubMsg->FullPtrXlatTables, pointer_id, *pPointer); } @@ -993,24 +1018,24 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat); TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr); pFormat += 2; - if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; + if (attr & FC_SIMPLE_POINTER) desc = pFormat; else desc = pFormat + *(const SHORT*)pFormat; switch (type) { - case RPC_FC_RP: /* ref pointer (always non-null) */ + case FC_RP: /* ref pointer (always non-null) */ if (!Pointer) { ERR("NULL ref pointer is not allowed\n"); RpcRaiseException(RPC_X_NULL_REF_POINTER); } break; - case RPC_FC_OP: - case RPC_FC_UP: + case FC_OP: + case FC_UP: /* NULL pointer has no further representation */ if (!Pointer) return; break; - case RPC_FC_FP: + case FC_FP: pointer_needs_sizing = !NdrFullPointerQueryPointer( pStubMsg->FullPtrXlatTables, Pointer, 0, &pointer_id); if (!pointer_needs_sizing) @@ -1022,7 +1047,7 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, return; } - if (attr & RPC_FC_P_DEREF) { + if (attr & FC_POINTER_DEREF) { Pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", Pointer); } @@ -1047,15 +1072,15 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, Buffer, pFormat); TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr); pFormat += 2; - if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; + if (attr & FC_SIMPLE_POINTER) desc = pFormat; else desc = pFormat + *(const SHORT*)pFormat; switch (type) { - case RPC_FC_RP: /* ref pointer (always non-null) */ + case FC_RP: /* ref pointer (always non-null) */ pointer_needs_sizing = TRUE; break; - case RPC_FC_UP: /* unique pointer */ - case RPC_FC_OP: /* object pointer - we must free data before overwriting it */ + case FC_UP: /* unique pointer */ + case FC_OP: /* object pointer - we must free data before overwriting it */ pointer_id = NDR_LOCAL_UINT32_READ(Buffer); TRACE("pointer_id is 0x%08x\n", pointer_id); if (pointer_id) @@ -1063,7 +1088,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, else pointer_needs_sizing = FALSE; break; - case RPC_FC_FP: + case FC_FP: { void *pointer; pointer_id = NDR_LOCAL_UINT32_READ(Buffer); @@ -1078,7 +1103,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, return 0; } - if (attr & RPC_FC_P_DEREF) { + if (attr & FC_POINTER_DEREF) { align_length(&pStubMsg->MemorySize, sizeof(void*)); pStubMsg->MemorySize += sizeof(void*); TRACE("deref\n"); @@ -1107,21 +1132,21 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat); TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr); - if (attr & RPC_FC_P_DONTFREE) return; + if (attr & FC_DONT_FREE) return; pFormat += 2; - if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; + if (attr & FC_SIMPLE_POINTER) desc = pFormat; else desc = pFormat + *(const SHORT*)pFormat; if (!Pointer) return; - if (type == RPC_FC_FP) { + if (type == FC_FP) { int pointer_needs_freeing = NdrFullPointerFree( pStubMsg->FullPtrXlatTables, Pointer); if (!pointer_needs_freeing) return; } - if (attr & RPC_FC_P_DEREF) { + if (attr & FC_POINTER_DEREF) { current_pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", current_pointer); } @@ -1138,7 +1163,7 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg, if (Pointer >= pStubMsg->BufferStart && Pointer <= pStubMsg->BufferEnd) goto notfree; - if (attr & RPC_FC_P_ONSTACK) { + if (attr & FC_ALLOCED_ON_STACK) { TRACE("not freeing stack ptr %p\n", Pointer); return; } @@ -1163,7 +1188,7 @@ static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (*pFormat != RPC_FC_PP) return NULL; + if (*pFormat != FC_PP) return NULL; pFormat += 2; if (pStubMsg->PointerBufferMark) @@ -1173,25 +1198,25 @@ static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; } - while (pFormat[0] != RPC_FC_END) { + while (pFormat[0] != FC_END) { switch (pFormat[0]) { default: FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]); /* fallthrough */ - case RPC_FC_NO_REPEAT: + case FC_NO_REPEAT: rep = 1; stride = 0; count = 1; pFormat += 2; break; - case RPC_FC_FIXED_REPEAT: + case FC_FIXED_REPEAT: rep = *(const WORD*)&pFormat[2]; stride = *(const WORD*)&pFormat[4]; count = *(const WORD*)&pFormat[8]; pFormat += 10; break; - case RPC_FC_VARIABLE_REPEAT: - rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; + case FC_VARIABLE_REPEAT: + rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; stride = *(const WORD*)&pFormat[2]; count = *(const WORD*)&pFormat[6]; pFormat += 8; @@ -1227,9 +1252,14 @@ static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } -/*********************************************************************** - * EmbeddedPointerUnmarshall - */ +/* rpcrt4 does something bizarre with embedded pointers: instead of copying the + * struct/array/union from the buffer to memory and then unmarshalling pointers + * into it, it unmarshals pointers into the buffer itself and then copies it to + * memory. However, it will still attempt to use a user-supplied pointer where + * appropriate (i.e. one on stack). Therefore we need to pass both pointers to + * this function and to PointerUnmarshall: the pointer (to the buffer) that we + * will actually unmarshal into (pDstBuffer), and the pointer (to memory) that + * we will attempt to use for storage if possible (pSrcMemoryPtrs). */ static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pDstBuffer, unsigned char *pSrcMemoryPtrs, @@ -1243,7 +1273,7 @@ static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p,%p,%d)\n", pStubMsg, pDstBuffer, pSrcMemoryPtrs, pFormat, fMustAlloc); - if (*pFormat != RPC_FC_PP) return NULL; + if (*pFormat != FC_PP) return NULL; pFormat += 2; if (pStubMsg->PointerBufferMark) @@ -1253,26 +1283,26 @@ static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; } - while (pFormat[0] != RPC_FC_END) { + while (pFormat[0] != FC_END) { TRACE("pFormat[0] = 0x%x\n", pFormat[0]); switch (pFormat[0]) { default: FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]); /* fallthrough */ - case RPC_FC_NO_REPEAT: + case FC_NO_REPEAT: rep = 1; stride = 0; count = 1; pFormat += 2; break; - case RPC_FC_FIXED_REPEAT: + case FC_FIXED_REPEAT: rep = *(const WORD*)&pFormat[2]; stride = *(const WORD*)&pFormat[4]; count = *(const WORD*)&pFormat[8]; pFormat += 10; break; - case RPC_FC_VARIABLE_REPEAT: - rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; + case FC_VARIABLE_REPEAT: + rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; stride = *(const WORD*)&pFormat[2]; count = *(const WORD*)&pFormat[6]; pFormat += 8; @@ -1319,7 +1349,7 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (pStubMsg->IgnoreEmbeddedPointers) return; - if (*pFormat != RPC_FC_PP) return; + if (*pFormat != FC_PP) return; pFormat += 2; if (pStubMsg->PointerLength) @@ -1329,25 +1359,25 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerLength = 0; } - while (pFormat[0] != RPC_FC_END) { + while (pFormat[0] != FC_END) { switch (pFormat[0]) { default: FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]); /* fallthrough */ - case RPC_FC_NO_REPEAT: + case FC_NO_REPEAT: rep = 1; stride = 0; count = 1; pFormat += 2; break; - case RPC_FC_FIXED_REPEAT: + case FC_FIXED_REPEAT: rep = *(const WORD*)&pFormat[2]; stride = *(const WORD*)&pFormat[4]; count = *(const WORD*)&pFormat[8]; pFormat += 10; break; - case RPC_FC_VARIABLE_REPEAT: - rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; + case FC_VARIABLE_REPEAT: + rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; stride = *(const WORD*)&pFormat[2]; count = *(const WORD*)&pFormat[6]; pFormat += 8; @@ -1399,28 +1429,28 @@ static ULONG EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; } - if (*pFormat != RPC_FC_PP) return 0; + if (*pFormat != FC_PP) return 0; pFormat += 2; - while (pFormat[0] != RPC_FC_END) { + while (pFormat[0] != FC_END) { switch (pFormat[0]) { default: FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]); /* fallthrough */ - case RPC_FC_NO_REPEAT: + case FC_NO_REPEAT: rep = 1; stride = 0; count = 1; pFormat += 2; break; - case RPC_FC_FIXED_REPEAT: + case FC_FIXED_REPEAT: rep = *(const WORD*)&pFormat[2]; stride = *(const WORD*)&pFormat[4]; count = *(const WORD*)&pFormat[8]; pFormat += 10; break; - case RPC_FC_VARIABLE_REPEAT: - rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; + case FC_VARIABLE_REPEAT: + rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; stride = *(const WORD*)&pFormat[2]; count = *(const WORD*)&pFormat[6]; pFormat += 8; @@ -1458,28 +1488,28 @@ static void EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned i; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (*pFormat != RPC_FC_PP) return; + if (*pFormat != FC_PP) return; pFormat += 2; - while (pFormat[0] != RPC_FC_END) { + while (pFormat[0] != FC_END) { switch (pFormat[0]) { default: FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]); /* fallthrough */ - case RPC_FC_NO_REPEAT: + case FC_NO_REPEAT: rep = 1; stride = 0; count = 1; pFormat += 2; break; - case RPC_FC_FIXED_REPEAT: + case FC_FIXED_REPEAT: rep = *(const WORD*)&pFormat[2]; stride = *(const WORD*)&pFormat[4]; count = *(const WORD*)&pFormat[8]; pFormat += 10; break; - case RPC_FC_VARIABLE_REPEAT: - rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; + case FC_VARIABLE_REPEAT: + rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount; stride = *(const WORD*)&pFormat[2]; count = *(const WORD*)&pFormat[6]; pFormat += 8; @@ -1517,7 +1547,7 @@ unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, /* Increment the buffer here instead of in PointerMarshall, * as that is used by embedded pointers which already handle the incrementing * the buffer, and shouldn't write any additional pointer data to the wire */ - if (*pFormat != RPC_FC_RP) + if (*pFormat != FC_RP) { align_pointer_clear(&pStubMsg->Buffer, 4); Buffer = pStubMsg->Buffer; @@ -1543,7 +1573,7 @@ unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if (*pFormat == RPC_FC_RP) + if (*pFormat == FC_RP) { Buffer = pStubMsg->Buffer; /* Do the NULL ref pointer check here because embedded pointers can be @@ -1583,7 +1613,7 @@ void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, /* Increment the buffer length here instead of in PointerBufferSize, * as that is used by embedded pointers which already handle the buffer * length, and shouldn't write anything more to the wire */ - if (*pFormat != RPC_FC_RP) + if (*pFormat != FC_RP) { align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); @@ -1599,7 +1629,7 @@ ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { unsigned char *Buffer = pStubMsg->Buffer; - if (*pFormat != RPC_FC_RP) + if (*pFormat != FC_RP) { align_pointer(&pStubMsg->Buffer, 4); safe_buffer_increment(pStubMsg, 4); @@ -1648,39 +1678,39 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* switch(FormatChar) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: BASE_TYPE_UNMARSHALL(UCHAR); TRACE("value: 0x%02x\n", *pMemory); break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: BASE_TYPE_UNMARSHALL(USHORT); TRACE("value: 0x%04x\n", *(USHORT *)pMemory); break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ERROR_STATUS_T: + case FC_ENUM32: BASE_TYPE_UNMARSHALL(ULONG); TRACE("value: 0x%08x\n", *(ULONG *)pMemory); break; - case RPC_FC_FLOAT: + case FC_FLOAT: BASE_TYPE_UNMARSHALL(float); TRACE("value: %f\n", *(float *)pMemory); break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: BASE_TYPE_UNMARSHALL(double); TRACE("value: %f\n", *(double *)pMemory); break; - case RPC_FC_HYPER: + case FC_HYPER: BASE_TYPE_UNMARSHALL(ULONGLONG); TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG *)pMemory)); break; - case RPC_FC_ENUM16: + case FC_ENUM16: align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); TRACE("pMemory: %p\n", pMemory); /* 16-bits on the wire, but int in memory */ @@ -1688,21 +1718,21 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pStubMsg->Buffer += sizeof(USHORT); TRACE("value: 0x%08x\n", *(UINT *)pMemory); break; - case RPC_FC_INT3264: + case FC_INT3264: align_pointer(&pStubMsg->Buffer, sizeof(INT)); /* 32-bits on the wire, but int_ptr in memory */ *(INT_PTR *)pMemory = *(INT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(INT); TRACE("value: 0x%08lx\n", *(INT_PTR *)pMemory); break; - case RPC_FC_UINT3264: + case FC_UINT3264: align_pointer(&pStubMsg->Buffer, sizeof(UINT)); /* 32-bits on the wire, but int_ptr in memory */ *(UINT_PTR *)pMemory = *(UINT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(UINT); TRACE("value: 0x%08lx\n", *(UINT_PTR *)pMemory); break; - case RPC_FC_IGNORE: + case FC_IGNORE: break; default: FIXME("Unhandled base type: 0x%02x\n", FormatChar); @@ -1725,7 +1755,7 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferMark = pStubMsg->Buffer; safe_copy_to_buffer(pStubMsg, pMemory, size); - if (pFormat[0] != RPC_FC_STRUCT) + if (pFormat[0] != FC_STRUCT) EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4); return NULL; @@ -1746,7 +1776,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, size); + *ppMemory = NdrAllocateZero(pStubMsg, size); else { if (!pStubMsg->IsClient && !*ppMemory) @@ -1756,7 +1786,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, size); - if (pFormat[0] == RPC_FC_PSTRUCT) + if (pFormat[0] == FC_PSTRUCT) EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat+4, fMustAlloc); TRACE("copying %p to %p\n", saved_buffer, *ppMemory); @@ -1779,7 +1809,7 @@ void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, align_length(&pStubMsg->BufferLength, pFormat[1] + 1); safe_buffer_length_increment(pStubMsg, size); - if (pFormat[0] != RPC_FC_STRUCT) + if (pFormat[0] != FC_STRUCT) EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat+4); } @@ -1797,7 +1827,7 @@ ULONG WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->MemorySize += size; safe_buffer_increment(pStubMsg, size); - if (pFormat[0] != RPC_FC_STRUCT) + if (pFormat[0] != FC_STRUCT) EmbeddedPointerMemorySize(pStubMsg, pFormat+4); return pStubMsg->MemorySize; } @@ -1810,7 +1840,7 @@ void WINAPI NdrSimpleStructFree(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_STRUCT) + if (pFormat[0] != FC_STRUCT) EmbeddedPointerFree(pStubMsg, pMemory, pFormat+4); } @@ -1824,18 +1854,18 @@ static inline void array_compute_and_size_conformance( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); SizeConformance(pStubMsg); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); SizeConformance(pStubMsg); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) { TRACE("string=%s\n", debugstr_a((const char *)pMemory)); pStubMsg->ActualCount = strlen((const char *)pMemory)+1; @@ -1846,14 +1876,14 @@ static inline void array_compute_and_size_conformance( pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1; } - if (pFormat[1] == RPC_FC_STRING_SIZED) + if (pFormat[1] == FC_STRING_SIZED) pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0); else pStubMsg->MaxCount = pStubMsg->ActualCount; SizeConformance(pStubMsg); break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: count = *(const WORD *)(pFormat + 2); pFormat += 4; if (IsConformanceOrVariancePresent(pFormat)) SizeConformance(pStubMsg); @@ -1876,7 +1906,7 @@ static inline void array_buffer_size( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -1891,7 +1921,7 @@ static inline void array_buffer_size( if (fHasPointers) EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -1908,9 +1938,9 @@ static inline void array_buffer_size( if (fHasPointers) EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) esize = 1; else esize = 2; @@ -1920,7 +1950,7 @@ static inline void array_buffer_size( size = safe_multiply(esize, pStubMsg->ActualCount); safe_buffer_length_increment(pStubMsg, size); break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: alignment = pFormat[1] + 1; pFormat = SkipConformance(pStubMsg, pFormat + 4); if (IsConformanceOrVariancePresent(pFormat)) SizeVariance(pStubMsg); @@ -1947,18 +1977,18 @@ static inline void array_compute_and_write_conformance( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); WriteConformance(pStubMsg); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); WriteConformance(pStubMsg); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) { TRACE("string=%s\n", debugstr_a((const char *)pMemory)); pStubMsg->ActualCount = strlen((const char *)pMemory)+1; @@ -1968,14 +1998,14 @@ static inline void array_compute_and_write_conformance( TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory)); pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1; } - if (pFormat[1] == RPC_FC_STRING_SIZED) + if (pFormat[1] == FC_STRING_SIZED) pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0); else pStubMsg->MaxCount = pStubMsg->ActualCount; pStubMsg->Offset = 0; WriteConformance(pStubMsg); break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: def = *(const WORD *)(pFormat + 2); pFormat += 4; conformance_present = IsConformanceOrVariancePresent(pFormat); @@ -1999,7 +2029,7 @@ static inline void array_write_variance_and_marshall( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2015,7 +2045,7 @@ static inline void array_write_variance_and_marshall( if (fHasPointers) EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2035,9 +2065,9 @@ static inline void array_write_variance_and_marshall( if (fHasPointers) EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) esize = 1; else esize = 2; @@ -2047,7 +2077,7 @@ static inline void array_write_variance_and_marshall( size = safe_multiply(esize, pStubMsg->ActualCount); safe_copy_to_buffer(pStubMsg, pMemory, size); /* the string itself */ break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: alignment = pFormat[1] + 1; pFormat = SkipConformance(pStubMsg, pFormat + 4); if (IsConformanceOrVariancePresent(pFormat)) WriteVariance(pStubMsg); @@ -2072,27 +2102,27 @@ static inline ULONG array_read_conformance( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: esize = *(const WORD*)(pFormat+2); pFormat = ReadConformance(pStubMsg, pFormat+4); return safe_multiply(esize, pStubMsg->MaxCount); - case RPC_FC_CVARRAY: + case FC_CVARRAY: esize = *(const WORD*)(pFormat+2); pFormat = ReadConformance(pStubMsg, pFormat+4); return safe_multiply(esize, pStubMsg->MaxCount); - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) esize = 1; else esize = 2; - if (pFormat[1] == RPC_FC_STRING_SIZED) + if (pFormat[1] == FC_STRING_SIZED) ReadConformance(pStubMsg, pFormat + 2); else ReadConformance(pStubMsg, NULL); return safe_multiply(esize, pStubMsg->MaxCount); - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: def = *(const WORD *)(pFormat + 2); pFormat += 4; if (IsConformanceOrVariancePresent(pFormat)) pFormat = ReadConformance(pStubMsg, pFormat); @@ -2124,7 +2154,7 @@ static inline ULONG array_read_variance_and_unmarshall( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2137,7 +2167,7 @@ static inline ULONG array_read_variance_and_unmarshall( if (fUnmarshall) { if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, memsize); + *ppMemory = NdrAllocateZero(pStubMsg, memsize); else { if (fUseBufferMemoryServer && !pStubMsg->IsClient && !*ppMemory) @@ -2156,7 +2186,7 @@ static inline ULONG array_read_variance_and_unmarshall( memcpy(*ppMemory, saved_buffer, bufsize); } return bufsize; - case RPC_FC_CVARRAY: + case FC_CVARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2176,7 +2206,7 @@ static inline ULONG array_read_variance_and_unmarshall( if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, memsize); + *ppMemory = NdrAllocateZero(pStubMsg, memsize); saved_buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -2187,16 +2217,16 @@ static inline ULONG array_read_variance_and_unmarshall( memcpy(*ppMemory + offset, saved_buffer, bufsize); } return bufsize; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) esize = 1; else esize = 2; ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount); - if (pFormat[1] != RPC_FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount)) + if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount)) { ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n", pStubMsg->ActualCount, pStubMsg->MaxCount); @@ -2233,14 +2263,14 @@ static inline ULONG array_read_variance_and_unmarshall( else safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize); - if (*pFormat == RPC_FC_C_CSTRING) + if (*pFormat == FC_C_CSTRING) TRACE("string=%s\n", debugstr_a((char*)*ppMemory)); else TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory)); } return bufsize; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: alignment = pFormat[1] + 1; pFormat = SkipConformance(pStubMsg, pFormat + 4); pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); @@ -2253,7 +2283,7 @@ static inline ULONG array_read_variance_and_unmarshall( if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, memsize); + *ppMemory = NdrAllocateZero(pStubMsg, memsize); align_pointer(&pStubMsg->Buffer, alignment); saved_buffer = pStubMsg->Buffer; @@ -2281,7 +2311,7 @@ static inline void array_memory_size( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2298,7 +2328,7 @@ static inline void array_memory_size( if (fHasPointers) EmbeddedPointerMemorySize(pStubMsg, pFormat); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; @@ -2318,16 +2348,16 @@ static inline void array_memory_size( if (fHasPointers) EmbeddedPointerMemorySize(pStubMsg, pFormat); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (fc == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (fc == FC_C_CSTRING) esize = 1; else esize = 2; ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount); - if (pFormat[1] != RPC_FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount)) + if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount)) { ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n", pStubMsg->ActualCount, pStubMsg->MaxCount); @@ -2347,7 +2377,7 @@ static inline void array_memory_size( safe_buffer_increment(pStubMsg, bufsize); pStubMsg->MemorySize += memsize; break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: alignment = pFormat[1] + 1; pFormat = SkipConformance(pStubMsg, pFormat + 4); pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); @@ -2379,22 +2409,22 @@ static inline void array_free( switch (fc) { - case RPC_FC_CARRAY: + case FC_CARRAY: pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); if (fHasPointers) EmbeddedPointerFree(pStubMsg, pMemory, pFormat); break; - case RPC_FC_CVARRAY: + case FC_CVARRAY: pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); if (fHasPointers) EmbeddedPointerFree(pStubMsg, pMemory, pFormat); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: + case FC_C_CSTRING: + case FC_C_WSTRING: /* No embedded pointers so nothing to do */ break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: count = *(const WORD *)(pFormat + 2); pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, count); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); @@ -2434,22 +2464,22 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg, { TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat); - if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) { + if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) { ERR("Unhandled string type: %#x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } /* allow compiler to optimise inline function by passing constant into * these functions */ - if (pFormat[0] == RPC_FC_C_CSTRING) { - array_compute_and_write_conformance(RPC_FC_C_CSTRING, pStubMsg, pszMessage, + if (pFormat[0] == FC_C_CSTRING) { + array_compute_and_write_conformance(FC_C_CSTRING, pStubMsg, pszMessage, pFormat); - array_write_variance_and_marshall(RPC_FC_C_CSTRING, pStubMsg, pszMessage, + array_write_variance_and_marshall(FC_C_CSTRING, pStubMsg, pszMessage, pFormat, TRUE /* fHasPointers */); } else { - array_compute_and_write_conformance(RPC_FC_C_WSTRING, pStubMsg, pszMessage, + array_compute_and_write_conformance(FC_C_WSTRING, pStubMsg, pszMessage, pFormat); - array_write_variance_and_marshall(RPC_FC_C_WSTRING, pStubMsg, pszMessage, + array_write_variance_and_marshall(FC_C_WSTRING, pStubMsg, pszMessage, pFormat, TRUE /* fHasPointers */); } @@ -2464,22 +2494,22 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) { + if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) { ERR("Unhandled string type: %#x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } /* allow compiler to optimise inline function by passing constant into * these functions */ - if (pFormat[0] == RPC_FC_C_CSTRING) { - array_compute_and_size_conformance(RPC_FC_C_CSTRING, pStubMsg, pMemory, + if (pFormat[0] == FC_C_CSTRING) { + array_compute_and_size_conformance(FC_C_CSTRING, pStubMsg, pMemory, pFormat); - array_buffer_size(RPC_FC_C_CSTRING, pStubMsg, pMemory, pFormat, + array_buffer_size(FC_C_CSTRING, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } else { - array_compute_and_size_conformance(RPC_FC_C_WSTRING, pStubMsg, pMemory, + array_compute_and_size_conformance(FC_C_WSTRING, pStubMsg, pMemory, pFormat); - array_buffer_size(RPC_FC_C_WSTRING, pStubMsg, pMemory, pFormat, + array_buffer_size(FC_C_WSTRING, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } } @@ -2492,20 +2522,20 @@ ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat); - if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) { + if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) { ERR("Unhandled string type: %#x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } /* allow compiler to optimise inline function by passing constant into * these functions */ - if (pFormat[0] == RPC_FC_C_CSTRING) { - array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat); - array_memory_size(RPC_FC_C_CSTRING, pStubMsg, pFormat, + if (pFormat[0] == FC_C_CSTRING) { + array_read_conformance(FC_C_CSTRING, pStubMsg, pFormat); + array_memory_size(FC_C_CSTRING, pStubMsg, pFormat, TRUE /* fHasPointers */); } else { - array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat); - array_memory_size(RPC_FC_C_WSTRING, pStubMsg, pFormat, + array_read_conformance(FC_C_WSTRING, pStubMsg, pFormat); + array_memory_size(FC_C_WSTRING, pStubMsg, pFormat, TRUE /* fHasPointers */); } @@ -2521,22 +2551,22 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n", pStubMsg, *ppMemory, pFormat, fMustAlloc); - if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) { + if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) { ERR("Unhandled string type: %#x\n", *pFormat); RpcRaiseException(RPC_X_BAD_STUB_DATA); } /* allow compiler to optimise inline function by passing constant into * these functions */ - if (pFormat[0] == RPC_FC_C_CSTRING) { - array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat); - array_read_variance_and_unmarshall(RPC_FC_C_CSTRING, pStubMsg, ppMemory, + if (pFormat[0] == FC_C_CSTRING) { + array_read_conformance(FC_C_CSTRING, pStubMsg, pFormat); + array_read_variance_and_unmarshall(FC_C_CSTRING, pStubMsg, ppMemory, pFormat, fMustAlloc, TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); } else { - array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat); - array_read_variance_and_unmarshall(RPC_FC_C_WSTRING, pStubMsg, ppMemory, + array_read_conformance(FC_C_WSTRING, pStubMsg, pFormat); + array_read_variance_and_unmarshall(FC_C_WSTRING, pStubMsg, ppMemory, pFormat, fMustAlloc, TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); @@ -2558,7 +2588,7 @@ unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM maxsize = *(const USHORT *)&pFormat[2]; - if (*pFormat == RPC_FC_CSTRING) + if (*pFormat == FC_CSTRING) { ULONG i = 0; const char *str = (const char *)pMemory; @@ -2567,7 +2597,7 @@ unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM pStubMsg->ActualCount = i + 1; esize = 1; } - else if (*pFormat == RPC_FC_WSTRING) + else if (*pFormat == FC_WSTRING) { ULONG i = 0; const WCHAR *str = (const WCHAR *)pMemory; @@ -2613,8 +2643,8 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu RpcRaiseException(RPC_S_INVALID_BOUND); } - if (*pFormat == RPC_FC_CSTRING) esize = 1; - else if (*pFormat == RPC_FC_WSTRING) esize = 2; + if (*pFormat == FC_CSTRING) esize = 1; + else if (*pFormat == FC_WSTRING) esize = 2; else { ERR("Unhandled string type: %#x\n", *pFormat); @@ -2633,10 +2663,10 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize); - if (*pFormat == RPC_FC_CSTRING) { + if (*pFormat == FC_CSTRING) { TRACE("string=%s\n", debugstr_an((char*)*ppMemory, pStubMsg->ActualCount)); } - else if (*pFormat == RPC_FC_WSTRING) { + else if (*pFormat == FC_WSTRING) { TRACE("string=%s\n", debugstr_wn((LPWSTR)*ppMemory, pStubMsg->ActualCount)); } @@ -2658,7 +2688,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, SizeVariance(pStubMsg); - if (*pFormat == RPC_FC_CSTRING) + if (*pFormat == FC_CSTRING) { ULONG i = 0; const char *str = (const char *)pMemory; @@ -2667,7 +2697,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->ActualCount = i + 1; esize = 1; } - else if (*pFormat == RPC_FC_WSTRING) + else if (*pFormat == FC_WSTRING) { ULONG i = 0; const WCHAR *str = (const WCHAR *)pMemory; @@ -2705,8 +2735,8 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg, RpcRaiseException(RPC_S_INVALID_BOUND); } - if (*pFormat == RPC_FC_CSTRING) esize = 1; - else if (*pFormat == RPC_FC_WSTRING) esize = 2; + if (*pFormat == FC_CSTRING) esize = 1; + else if (*pFormat == FC_WSTRING) esize = 2; else { ERR("Unhandled string type: %#x\n", *pFormat); @@ -2740,54 +2770,55 @@ static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) { switch (*pFormat) { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_BOGUS_STRUCT: - case RPC_FC_SMFARRAY: - case RPC_FC_SMVARRAY: - case RPC_FC_CSTRING: + case FC_STRUCT: + case FC_PSTRUCT: + case FC_CSTRUCT: + case FC_BOGUS_STRUCT: + case FC_SMFARRAY: + case FC_SMVARRAY: + case FC_CSTRING: return *(const WORD*)&pFormat[2]; - case RPC_FC_USER_MARSHAL: + case FC_LGFARRAY: + case FC_LGVARRAY: + return *(const ULONG*)&pFormat[2]; + case FC_USER_MARSHAL: return *(const WORD*)&pFormat[4]; - case RPC_FC_RANGE: { + case FC_RANGE: { switch (((const NDR_RANGE *)pFormat)->flags_type & 0xf) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: return sizeof(UCHAR); - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: return sizeof(USHORT); - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: return sizeof(ULONG); - case RPC_FC_FLOAT: + case FC_FLOAT: return sizeof(float); - case RPC_FC_DOUBLE: + case FC_DOUBLE: return sizeof(double); - case RPC_FC_HYPER: + case FC_HYPER: return sizeof(ULONGLONG); - case RPC_FC_ENUM16: + case FC_ENUM16: return sizeof(UINT); default: ERR("unknown type 0x%x\n", ((const NDR_RANGE *)pFormat)->flags_type & 0xf); RpcRaiseException(RPC_X_BAD_STUB_DATA); } } - case RPC_FC_NON_ENCAPSULATED_UNION: + case FC_NON_ENCAPSULATED_UNION: pFormat += 2; pFormat = SkipConformance(pStubMsg, pFormat); pFormat += *(const SHORT*)pFormat; return *(const SHORT*)pFormat; - case RPC_FC_IP: + case FC_IP: return sizeof(void *); - case RPC_FC_WSTRING: + case FC_WSTRING: return *(const WORD*)&pFormat[2] * 2; default: FIXME("unhandled embedded type %02x\n", *pFormat); @@ -2816,28 +2847,29 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer) { + unsigned char *mem_base = pMemory; PFORMAT_STRING desc; NDR_MARSHALL m; ULONG size; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: TRACE("byte=%d <= %p\n", *(WORD*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, 1); pMemory += 1; break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: TRACE("short=%d <= %p\n", *(WORD*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, 2); pMemory += 2; break; - case RPC_FC_ENUM16: + case FC_ENUM16: { USHORT val = *(DWORD *)pMemory; TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory); @@ -2847,15 +2879,15 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += 4; break; } - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, 4); pMemory += 4; break; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: { UINT val = *(UINT_PTR *)pMemory; TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory); @@ -2863,34 +2895,34 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(UINT_PTR); break; } - case RPC_FC_FLOAT: + case FC_FLOAT: TRACE("float=%f <= %p\n", *(float*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float)); pMemory += sizeof(float); break; - case RPC_FC_HYPER: + case FC_HYPER: TRACE("longlong=%s <= %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory); safe_copy_to_buffer(pStubMsg, pMemory, 8); pMemory += 8; break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: TRACE("double=%f <= %p\n", *(double*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double)); pMemory += sizeof(double); break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: { unsigned char *saved_buffer; BOOL pointer_buffer_mark_set = FALSE; TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory); TRACE("pStubMsg->Buffer before %p\n", pStubMsg->Buffer); - if (*pFormat != RPC_FC_POINTER) + if (*pFormat != FC_POINTER) pPointer = pFormat; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) @@ -2899,7 +2931,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; pointer_buffer_mark_set = TRUE; } - else if (*pPointer != RPC_FC_RP) + else if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ PointerMarshall(pStubMsg, saved_buffer, *(unsigned char**)pMemory, pPointer); if (pointer_buffer_mark_set) @@ -2907,36 +2939,36 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, STD_OVERFLOW_CHECK(pStubMsg); pStubMsg->PointerBufferMark = pStubMsg->Buffer; pStubMsg->Buffer = saved_buffer; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ } TRACE("pStubMsg->Buffer after %p\n", pStubMsg->Buffer); - if (*pFormat == RPC_FC_POINTER) + if (*pFormat == FC_POINTER) pPointer += 4; else pFormat += 4; pMemory += sizeof(void *); break; } - case RPC_FC_ALIGNM2: - align_pointer(&pMemory, 2); + case FC_ALIGNM2: + align_pointer_offset(&pMemory, mem_base, 2); break; - case RPC_FC_ALIGNM4: - align_pointer(&pMemory, 4); + case FC_ALIGNM4: + align_pointer_offset(&pMemory, mem_base, 4); break; - case RPC_FC_ALIGNM8: - align_pointer(&pMemory, 8); + case FC_ALIGNM8: + align_pointer_offset(&pMemory, mem_base, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + pMemory += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; @@ -2946,10 +2978,10 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (m) { /* for some reason interface pointers aren't generated as - * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet + * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet * they still need the dereferencing treatment that pointers are * given */ - if (*desc == RPC_FC_IP) + if (*desc == FC_IP) m(pStubMsg, *(unsigned char **)pMemory, desc); else m(pStubMsg, pMemory, desc); @@ -2958,7 +2990,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += size; pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format 0x%02x\n", *pFormat); @@ -2975,28 +3007,29 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pPointer, unsigned char fMustAlloc) { + unsigned char *mem_base = pMemory; PFORMAT_STRING desc; NDR_UNMARSHALL m; ULONG size; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: safe_copy_from_buffer(pStubMsg, pMemory, 1); TRACE("byte=%d => %p\n", *(WORD*)pMemory, pMemory); pMemory += 1; break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: safe_copy_from_buffer(pStubMsg, pMemory, 2); TRACE("short=%d => %p\n", *(WORD*)pMemory, pMemory); pMemory += 2; break; - case RPC_FC_ENUM16: + case FC_ENUM16: { WORD val; safe_copy_from_buffer(pStubMsg, &val, 2); @@ -3007,14 +3040,14 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += 4; break; } - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: safe_copy_from_buffer(pStubMsg, pMemory, 4); TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory); pMemory += 4; break; - case RPC_FC_INT3264: + case FC_INT3264: { INT val; safe_copy_from_buffer(pStubMsg, &val, 4); @@ -3023,7 +3056,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(INT_PTR); break; } - case RPC_FC_UINT3264: + case FC_UINT3264: { UINT val; safe_copy_from_buffer(pStubMsg, &val, 4); @@ -3032,33 +3065,33 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(UINT_PTR); break; } - case RPC_FC_FLOAT: + case FC_FLOAT: safe_copy_from_buffer(pStubMsg, pMemory, sizeof(float)); TRACE("float=%f => %p\n", *(float*)pMemory, pMemory); pMemory += sizeof(float); break; - case RPC_FC_HYPER: + case FC_HYPER: safe_copy_from_buffer(pStubMsg, pMemory, 8); TRACE("longlong=%s => %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory); pMemory += 8; break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: safe_copy_from_buffer(pStubMsg, pMemory, sizeof(double)); TRACE("double=%f => %p\n", *(double*)pMemory, pMemory); pMemory += sizeof(double); break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: { unsigned char *saved_buffer; BOOL pointer_buffer_mark_set = FALSE; TRACE("pointer => %p\n", pMemory); - if (*pFormat != RPC_FC_POINTER) + if (*pFormat != FC_POINTER) pPointer = pFormat; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) @@ -3067,7 +3100,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; pointer_buffer_mark_set = TRUE; } - else if (*pPointer != RPC_FC_RP) + else if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ PointerUnmarshall(pStubMsg, saved_buffer, (unsigned char**)pMemory, *(unsigned char**)pMemory, pPointer, fMustAlloc); @@ -3076,36 +3109,36 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, STD_OVERFLOW_CHECK(pStubMsg); pStubMsg->PointerBufferMark = pStubMsg->Buffer; pStubMsg->Buffer = saved_buffer; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ } - if (*pFormat == RPC_FC_POINTER) + if (*pFormat == FC_POINTER) pPointer += 4; else pFormat += 4; pMemory += sizeof(void *); break; } - case RPC_FC_ALIGNM2: - align_pointer_clear(&pMemory, 2); + case FC_ALIGNM2: + align_pointer_offset_clear(&pMemory, mem_base, 2); break; - case RPC_FC_ALIGNM4: - align_pointer_clear(&pMemory, 4); + case FC_ALIGNM4: + align_pointer_offset_clear(&pMemory, mem_base, 4); break; - case RPC_FC_ALIGNM8: - align_pointer_clear(&pMemory, 8); + case FC_ALIGNM8: + align_pointer_offset_clear(&pMemory, mem_base, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - memset(pMemory, 0, *pFormat - RPC_FC_STRUCTPAD1 + 1); - pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + memset(pMemory, 0, *pFormat - FC_STRUCTPAD1 + 1); + pMemory += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; @@ -3122,10 +3155,10 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (m) { /* for some reason interface pointers aren't generated as - * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet + * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet * they still need the dereferencing treatment that pointers are * given */ - if (*desc == RPC_FC_IP) + if (*desc == FC_IP) m(pStubMsg, (unsigned char **)pMemory, desc, FALSE); else m(pStubMsg, &pMemory, desc, FALSE); @@ -3134,7 +3167,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += size; pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format %d\n", *pFormat); @@ -3150,52 +3183,53 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer) { + unsigned char *mem_base = pMemory; PFORMAT_STRING desc; NDR_BUFFERSIZE m; ULONG size; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: safe_buffer_length_increment(pStubMsg, 1); pMemory += 1; break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: safe_buffer_length_increment(pStubMsg, 2); pMemory += 2; break; - case RPC_FC_ENUM16: + case FC_ENUM16: safe_buffer_length_increment(pStubMsg, 2); pMemory += 4; break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: + case FC_FLOAT: safe_buffer_length_increment(pStubMsg, 4); pMemory += 4; break; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: safe_buffer_length_increment(pStubMsg, 4); pMemory += sizeof(INT_PTR); break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: + case FC_HYPER: + case FC_DOUBLE: safe_buffer_length_increment(pStubMsg, 8); pMemory += 8; break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: - if (*pFormat != RPC_FC_POINTER) + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: + if (*pFormat != FC_POINTER) pPointer = pFormat; if (!pStubMsg->IgnoreEmbeddedPointers) { @@ -3208,36 +3242,36 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerLength = pStubMsg->BufferLength; pStubMsg->BufferLength = saved_buffer_length; } - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) { align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); } - if (*pFormat == RPC_FC_POINTER) + if (*pFormat == FC_POINTER) pPointer += 4; else pFormat += 4; pMemory += sizeof(void*); break; - case RPC_FC_ALIGNM2: - align_pointer(&pMemory, 2); + case FC_ALIGNM2: + align_pointer_offset(&pMemory, mem_base, 2); break; - case RPC_FC_ALIGNM4: - align_pointer(&pMemory, 4); + case FC_ALIGNM4: + align_pointer_offset(&pMemory, mem_base, 4); break; - case RPC_FC_ALIGNM8: - align_pointer(&pMemory, 8); + case FC_ALIGNM8: + align_pointer_offset(&pMemory, mem_base, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + pMemory += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; @@ -3246,10 +3280,10 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (m) { /* for some reason interface pointers aren't generated as - * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet + * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet * they still need the dereferencing treatment that pointers are * given */ - if (*desc == RPC_FC_IP) + if (*desc == FC_IP) m(pStubMsg, *(unsigned char **)pMemory, desc); else m(pStubMsg, pMemory, desc); @@ -3258,7 +3292,7 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pMemory += size; pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format 0x%02x\n", *pFormat); @@ -3274,71 +3308,72 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer) { + unsigned char *mem_base = pMemory; PFORMAT_STRING desc; NDR_FREE m; ULONG size; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: pMemory += 1; break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: pMemory += 2; break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: + case FC_LONG: + case FC_ULONG: + case FC_ENUM16: + case FC_ENUM32: + case FC_FLOAT: pMemory += 4; break; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: pMemory += sizeof(INT_PTR); break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: + case FC_HYPER: + case FC_DOUBLE: pMemory += 8; break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: - if (*pFormat != RPC_FC_POINTER) + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: + if (*pFormat != FC_POINTER) pPointer = pFormat; NdrPointerFree(pStubMsg, *(unsigned char**)pMemory, pPointer); - if (*pFormat == RPC_FC_POINTER) + if (*pFormat == FC_POINTER) pPointer += 4; else pFormat += 4; pMemory += sizeof(void *); break; - case RPC_FC_ALIGNM2: - align_pointer(&pMemory, 2); + case FC_ALIGNM2: + align_pointer_offset(&pMemory, mem_base, 2); break; - case RPC_FC_ALIGNM4: - align_pointer(&pMemory, 4); + case FC_ALIGNM4: + align_pointer_offset(&pMemory, mem_base, 4); break; - case RPC_FC_ALIGNM8: - align_pointer(&pMemory, 8); + case FC_ALIGNM8: + align_pointer_offset(&pMemory, mem_base, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + pMemory += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; @@ -3347,10 +3382,10 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, if (m) { /* for some reason interface pointers aren't generated as - * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet + * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet * they still need the dereferencing treatment that pointers are * given */ - if (*desc == RPC_FC_IP) + if (*desc == FC_IP) m(pStubMsg, *(unsigned char **)pMemory, desc); else m(pStubMsg, pMemory, desc); @@ -3358,7 +3393,7 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, pMemory += size; pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format 0x%02x\n", *pFormat); @@ -3376,53 +3411,53 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING desc; ULONG size = 0; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: size += 1; safe_buffer_increment(pStubMsg, 1); break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: size += 2; safe_buffer_increment(pStubMsg, 2); break; - case RPC_FC_ENUM16: + case FC_ENUM16: size += 4; safe_buffer_increment(pStubMsg, 2); break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: + case FC_FLOAT: size += 4; safe_buffer_increment(pStubMsg, 4); break; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: size += sizeof(INT_PTR); safe_buffer_increment(pStubMsg, 4); break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: + case FC_HYPER: + case FC_DOUBLE: size += 8; safe_buffer_increment(pStubMsg, 8); break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: { unsigned char *saved_buffer; BOOL pointer_buffer_mark_set = FALSE; - if (*pFormat != RPC_FC_POINTER) + if (*pFormat != FC_POINTER) pPointer = pFormat; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) @@ -3431,7 +3466,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->PointerBufferMark = NULL; pointer_buffer_mark_set = TRUE; } - else if (*pPointer != RPC_FC_RP) + else if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ if (!pStubMsg->IgnoreEmbeddedPointers) @@ -3441,42 +3476,42 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, STD_OVERFLOW_CHECK(pStubMsg); pStubMsg->PointerBufferMark = pStubMsg->Buffer; pStubMsg->Buffer = saved_buffer; - if (*pPointer != RPC_FC_RP) + if (*pPointer != FC_RP) safe_buffer_increment(pStubMsg, 4); /* for pointer ID */ } - if (*pFormat == RPC_FC_POINTER) + if (*pFormat == FC_POINTER) pPointer += 4; else pFormat += 4; size += sizeof(void *); break; } - case RPC_FC_ALIGNM2: + case FC_ALIGNM2: align_length(&size, 2); break; - case RPC_FC_ALIGNM4: + case FC_ALIGNM4: align_length(&size, 4); break; - case RPC_FC_ALIGNM8: + case FC_ALIGNM8: align_length(&size, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - size += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + size += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: size += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; size += EmbeddedComplexMemorySize(pStubMsg, desc); pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format 0x%02x\n", *pFormat); @@ -3492,69 +3527,69 @@ ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) PFORMAT_STRING desc; ULONG size = 0; - while (*pFormat != RPC_FC_END) { + while (*pFormat != FC_END) { switch (*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: size += 1; break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: size += 2; break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: + case FC_LONG: + case FC_ULONG: + case FC_ENUM16: + case FC_ENUM32: + case FC_FLOAT: size += 4; break; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: size += sizeof(INT_PTR); break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: + case FC_HYPER: + case FC_DOUBLE: size += 8; break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_POINTER: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_POINTER: size += sizeof(void *); - if (*pFormat != RPC_FC_POINTER) + if (*pFormat != FC_POINTER) pFormat += 4; break; - case RPC_FC_ALIGNM2: + case FC_ALIGNM2: align_length(&size, 2); break; - case RPC_FC_ALIGNM4: + case FC_ALIGNM4: align_length(&size, 4); break; - case RPC_FC_ALIGNM8: + case FC_ALIGNM8: align_length(&size, 8); break; - case RPC_FC_STRUCTPAD1: - case RPC_FC_STRUCTPAD2: - case RPC_FC_STRUCTPAD3: - case RPC_FC_STRUCTPAD4: - case RPC_FC_STRUCTPAD5: - case RPC_FC_STRUCTPAD6: - case RPC_FC_STRUCTPAD7: - size += *pFormat - RPC_FC_STRUCTPAD1 + 1; + case FC_STRUCTPAD1: + case FC_STRUCTPAD2: + case FC_STRUCTPAD3: + case FC_STRUCTPAD4: + case FC_STRUCTPAD5: + case FC_STRUCTPAD6: + case FC_STRUCTPAD7: + size += *pFormat - FC_STRUCTPAD1 + 1; break; - case RPC_FC_EMBEDDED_COMPLEX: + case FC_EMBEDDED_COMPLEX: size += pFormat[1]; pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; size += EmbeddedComplexSize(pStubMsg, desc); pFormat += 2; continue; - case RPC_FC_PAD: + case FC_PAD: break; default: FIXME("unhandled format 0x%02x\n", *pFormat); @@ -3712,7 +3747,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, size); + *ppMemory = NdrAllocateZero(pStubMsg, size); pMemory = ComplexUnmarshall(pStubMsg, *ppMemory, pFormat, pointer_desc, fMustAlloc); @@ -3904,15 +3939,15 @@ unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CARRAY) + if (pFormat[0] != FC_CARRAY) { ERR("invalid format = 0x%x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - array_compute_and_write_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, + array_compute_and_write_conformance(FC_CARRAY, pStubMsg, pMemory, pFormat); - array_write_variance_and_marshall(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat, + array_write_variance_and_marshall(FC_CARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); return NULL; @@ -3927,14 +3962,14 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char fMustAlloc) { TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if (pFormat[0] != RPC_FC_CARRAY) + if (pFormat[0] != FC_CARRAY) { ERR("invalid format = 0x%x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat); - array_read_variance_and_unmarshall(RPC_FC_CARRAY, pStubMsg, ppMemory, pFormat, + array_read_conformance(FC_CARRAY, pStubMsg, pFormat); + array_read_variance_and_unmarshall(FC_CARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc, TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); @@ -3950,14 +3985,14 @@ void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CARRAY) + if (pFormat[0] != FC_CARRAY) { ERR("invalid format = 0x%x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - array_compute_and_size_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat); - array_buffer_size(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat, + array_compute_and_size_conformance(FC_CARRAY, pStubMsg, pMemory, pFormat); + array_buffer_size(FC_CARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } @@ -3968,14 +4003,14 @@ ULONG WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { TRACE("(%p,%p)\n", pStubMsg, pFormat); - if (pFormat[0] != RPC_FC_CARRAY) + if (pFormat[0] != FC_CARRAY) { ERR("invalid format = 0x%x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat); - array_memory_size(RPC_FC_CARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); + array_read_conformance(FC_CARRAY, pStubMsg, pFormat); + array_memory_size(FC_CARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); return pStubMsg->MemorySize; } @@ -3988,13 +4023,13 @@ void WINAPI NdrConformantArrayFree(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CARRAY) + if (pFormat[0] != FC_CARRAY) { ERR("invalid format = 0x%x\n", pFormat[0]); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - array_free(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat, + array_free(FC_CARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } @@ -4008,16 +4043,16 @@ unsigned char* WINAPI NdrConformantVaryingArrayMarshall( PMIDL_STUB_MESSAGE pStu { TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CVARRAY) + if (pFormat[0] != FC_CVARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return NULL; } - array_compute_and_write_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory, + array_compute_and_write_conformance(FC_CVARRAY, pStubMsg, pMemory, pFormat); - array_write_variance_and_marshall(RPC_FC_CVARRAY, pStubMsg, pMemory, + array_write_variance_and_marshall(FC_CVARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); return NULL; @@ -4034,15 +4069,15 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS { TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if (pFormat[0] != RPC_FC_CVARRAY) + if (pFormat[0] != FC_CVARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return NULL; } - array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat); - array_read_variance_and_unmarshall(RPC_FC_CVARRAY, pStubMsg, ppMemory, + array_read_conformance(FC_CVARRAY, pStubMsg, pFormat); + array_read_variance_and_unmarshall(FC_CVARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc, TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); @@ -4060,14 +4095,14 @@ void WINAPI NdrConformantVaryingArrayFree( PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CVARRAY) + if (pFormat[0] != FC_CVARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return; } - array_free(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat, + array_free(FC_CVARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } @@ -4080,16 +4115,16 @@ void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_CVARRAY) + if (pFormat[0] != FC_CVARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return; } - array_compute_and_size_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory, + array_compute_and_size_conformance(FC_CVARRAY, pStubMsg, pMemory, pFormat); - array_buffer_size(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat, + array_buffer_size(FC_CVARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); } @@ -4102,15 +4137,15 @@ ULONG WINAPI NdrConformantVaryingArrayMemorySize( PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p)\n", pStubMsg, pFormat); - if (pFormat[0] != RPC_FC_CVARRAY) + if (pFormat[0] != FC_CVARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return pStubMsg->MemorySize; } - array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat); - array_memory_size(RPC_FC_CVARRAY, pStubMsg, pFormat, + array_read_conformance(FC_CVARRAY, pStubMsg, pFormat); + array_memory_size(FC_CVARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); return pStubMsg->MemorySize; @@ -4128,7 +4163,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_BOGUS_ARRAY) + if (pFormat[0] != FC_BOGUS_ARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4164,8 +4199,8 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } - array_compute_and_write_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); - array_write_variance_and_marshall(RPC_FC_BOGUS_ARRAY, pStubMsg, + array_compute_and_write_conformance(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); + array_write_variance_and_marshall(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); STD_OVERFLOW_CHECK(pStubMsg); @@ -4193,7 +4228,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if (pFormat[0] != RPC_FC_BOGUS_ARRAY) + if (pFormat[0] != FC_BOGUS_ARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4220,8 +4255,8 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, /* restore the original buffer */ pStubMsg->Buffer = saved_buffer; - array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat); - array_read_variance_and_unmarshall(RPC_FC_BOGUS_ARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc, + array_read_conformance(FC_BOGUS_ARRAY, pStubMsg, pFormat); + array_read_variance_and_unmarshall(FC_BOGUS_ARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc, TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); if (pointer_buffer_mark_set) @@ -4244,7 +4279,7 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_BOGUS_ARRAY) + if (pFormat[0] != FC_BOGUS_ARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4278,8 +4313,8 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } - array_compute_and_size_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); - array_buffer_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); + array_compute_and_size_conformance(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); + array_buffer_size(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); if(pointer_length_set) { @@ -4296,15 +4331,15 @@ ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p,%p)\n", pStubMsg, pFormat); - if (pFormat[0] != RPC_FC_BOGUS_ARRAY) + if (pFormat[0] != FC_BOGUS_ARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return 0; } - array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat); - array_memory_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); + array_read_conformance(FC_BOGUS_ARRAY, pStubMsg, pFormat); + array_memory_size(FC_BOGUS_ARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); return pStubMsg->MemorySize; } @@ -4319,7 +4354,7 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - if (pFormat[0] != RPC_FC_BOGUS_ARRAY) + if (pFormat[0] != FC_BOGUS_ARRAY) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4678,7 +4713,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CSTRUCT_FORMAT); - if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT)) + if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT)) { ERR("invalid format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4687,7 +4722,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description + pCStructFormat->offset_to_array_description; - if (*pCArrayFormat != RPC_FC_CARRAY) + if (*pCArrayFormat != FC_CARRAY) { ERR("invalid array format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4715,7 +4750,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferMark = pStubMsg->Buffer; safe_copy_to_buffer(pStubMsg, pMemory, pCStructFormat->memory_size + bufsize); - if (pCStructFormat->type == RPC_FC_CPSTRUCT) + if (pCStructFormat->type == FC_CPSTRUCT) EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat); return NULL; @@ -4737,7 +4772,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); pFormat += sizeof(NDR_CSTRUCT_FORMAT); - if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT)) + if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT)) { ERR("invalid format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4745,7 +4780,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs } pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description + pCStructFormat->offset_to_array_description; - if (*pCArrayFormat != RPC_FC_CARRAY) + if (*pCArrayFormat != FC_CARRAY) { ERR("invalid array format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4770,7 +4805,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs if (fMustAlloc) { SIZE_T size = pCStructFormat->memory_size + bufsize; - *ppMemory = NdrAllocate(pStubMsg, size); + *ppMemory = NdrAllocateZero(pStubMsg, size); } else { @@ -4781,7 +4816,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, pCStructFormat->memory_size + bufsize); - if (pCStructFormat->type == RPC_FC_CPSTRUCT) + if (pCStructFormat->type == FC_CPSTRUCT) EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc); TRACE("copying %p to %p\n", saved_buffer, *ppMemory); @@ -4805,7 +4840,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CSTRUCT_FORMAT); - if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT)) + if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT)) { ERR("invalid format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4813,7 +4848,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, } pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description + pCStructFormat->offset_to_array_description; - if (*pCArrayFormat != RPC_FC_CARRAY) + if (*pCArrayFormat != FC_CARRAY) { ERR("invalid array format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4831,7 +4866,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, safe_buffer_length_increment(pStubMsg, pCStructFormat->memory_size); safe_buffer_length_increment(pStubMsg, safe_multiply(pStubMsg->MaxCount, esize)); - if (pCStructFormat->type == RPC_FC_CPSTRUCT) + if (pCStructFormat->type == FC_CPSTRUCT) EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); } @@ -4858,7 +4893,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CSTRUCT_FORMAT); - if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT)) + if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT)) { ERR("invalid format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4867,7 +4902,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg, pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description + pCStructFormat->offset_to_array_description; - if (*pCArrayFormat != RPC_FC_CARRAY) + if (*pCArrayFormat != FC_CARRAY) { ERR("invalid array format type %x\n", pCStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4882,7 +4917,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg, /* copy constant sized part of struct */ pStubMsg->BufferMark = pStubMsg->Buffer; - if (pCStructFormat->type == RPC_FC_CPSTRUCT) + if (pCStructFormat->type == FC_CPSTRUCT) EmbeddedPointerFree(pStubMsg, pMemory, pFormat); } @@ -4899,7 +4934,7 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CVSTRUCT_FORMAT); - if (pCVStructFormat->type != RPC_FC_CVSTRUCT) + if (pCVStructFormat->type != FC_CVSTRUCT) { ERR("invalid format type %x\n", pCVStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4948,7 +4983,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); pFormat += sizeof(NDR_CVSTRUCT_FORMAT); - if (pCVStructFormat->type != RPC_FC_CVSTRUCT) + if (pCVStructFormat->type != FC_CVSTRUCT) { ERR("invalid format type %x\n", pCVStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -4971,7 +5006,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE if (fMustAlloc) { SIZE_T size = pCVStructFormat->memory_size + memsize; - *ppMemory = NdrAllocate(pStubMsg, size); + *ppMemory = NdrAllocateZero(pStubMsg, size); } /* mark the start of the constant data */ @@ -5001,9 +5036,9 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE memcpy(*ppMemory + pCVStructFormat->memory_size + offset, saved_array_buffer, bufsize); - if (*pCVArrayFormat == RPC_FC_C_CSTRING) + if (*pCVArrayFormat == FC_C_CSTRING) TRACE("string=%s\n", debugstr_a((char *)(*ppMemory + pCVStructFormat->memory_size))); - else if (*pCVArrayFormat == RPC_FC_C_WSTRING) + else if (*pCVArrayFormat == FC_C_WSTRING) TRACE("string=%s\n", debugstr_w((WCHAR *)(*ppMemory + pCVStructFormat->memory_size))); return NULL; @@ -5022,7 +5057,7 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CVSTRUCT_FORMAT); - if (pCVStructFormat->type != RPC_FC_CVSTRUCT) + if (pCVStructFormat->type != FC_CVSTRUCT) { ERR("invalid format type %x\n", pCVStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5060,7 +5095,7 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p)\n", pStubMsg, pFormat); pFormat += sizeof(NDR_CVSTRUCT_FORMAT); - if (pCVStructFormat->type != RPC_FC_CVSTRUCT) + if (pCVStructFormat->type != FC_CVSTRUCT) { ERR("invalid format type %x\n", pCVStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5099,7 +5134,7 @@ void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat += sizeof(NDR_CVSTRUCT_FORMAT); - if (pCVStructFormat->type != RPC_FC_CVSTRUCT) + if (pCVStructFormat->type != FC_CVSTRUCT) { ERR("invalid format type %x\n", pCVStructFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5145,8 +5180,8 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) && - (pSmFArrayFormat->type != RPC_FC_LGFARRAY)) + if ((pSmFArrayFormat->type != FC_SMFARRAY) && + (pSmFArrayFormat->type != FC_LGFARRAY)) { ERR("invalid format type %x\n", pSmFArrayFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5155,7 +5190,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, align_pointer_clear(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); - if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) + if (pSmFArrayFormat->type == FC_SMFARRAY) { total_size = pSmFArrayFormat->total_size; pFormat = (const unsigned char *)(pSmFArrayFormat + 1); @@ -5189,8 +5224,8 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) && - (pSmFArrayFormat->type != RPC_FC_LGFARRAY)) + if ((pSmFArrayFormat->type != FC_SMFARRAY) && + (pSmFArrayFormat->type != FC_LGFARRAY)) { ERR("invalid format type %x\n", pSmFArrayFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5199,7 +5234,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); - if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) + if (pSmFArrayFormat->type == FC_SMFARRAY) { total_size = pSmFArrayFormat->total_size; pFormat = (const unsigned char *)(pSmFArrayFormat + 1); @@ -5212,7 +5247,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, } if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, total_size); + *ppMemory = NdrAllocateZero(pStubMsg, total_size); else { if (!pStubMsg->IsClient && !*ppMemory) @@ -5243,8 +5278,8 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) && - (pSmFArrayFormat->type != RPC_FC_LGFARRAY)) + if ((pSmFArrayFormat->type != FC_SMFARRAY) && + (pSmFArrayFormat->type != FC_LGFARRAY)) { ERR("invalid format type %x\n", pSmFArrayFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5253,7 +5288,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, align_length(&pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1); - if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) + if (pSmFArrayFormat->type == FC_SMFARRAY) { total_size = pSmFArrayFormat->total_size; pFormat = (const unsigned char *)(pSmFArrayFormat + 1); @@ -5280,8 +5315,8 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p)\n", pStubMsg, pFormat); - if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) && - (pSmFArrayFormat->type != RPC_FC_LGFARRAY)) + if ((pSmFArrayFormat->type != FC_SMFARRAY) && + (pSmFArrayFormat->type != FC_LGFARRAY)) { ERR("invalid format type %x\n", pSmFArrayFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5290,7 +5325,7 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); - if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) + if (pSmFArrayFormat->type == FC_SMFARRAY) { total_size = pSmFArrayFormat->total_size; pFormat = (const unsigned char *)(pSmFArrayFormat + 1); @@ -5321,15 +5356,15 @@ void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) && - (pSmFArrayFormat->type != RPC_FC_LGFARRAY)) + if ((pSmFArrayFormat->type != FC_SMFARRAY) && + (pSmFArrayFormat->type != FC_LGFARRAY)) { ERR("invalid format type %x\n", pSmFArrayFormat->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); return; } - if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) + if (pSmFArrayFormat->type == FC_SMFARRAY) pFormat = (const unsigned char *)(pSmFArrayFormat + 1); else { @@ -5353,8 +5388,8 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pFormat[0] != RPC_FC_SMVARRAY) && - (pFormat[0] != RPC_FC_LGVARRAY)) + if ((pFormat[0] != FC_SMVARRAY) && + (pFormat[0] != FC_LGVARRAY)) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5363,7 +5398,7 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, alignment = pFormat[1] + 1; - if (pFormat[0] == RPC_FC_SMVARRAY) + if (pFormat[0] == FC_SMVARRAY) { pFormat += 2; pFormat += sizeof(WORD); @@ -5418,8 +5453,8 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - if ((pFormat[0] != RPC_FC_SMVARRAY) && - (pFormat[0] != RPC_FC_LGVARRAY)) + if ((pFormat[0] != FC_SMVARRAY) && + (pFormat[0] != FC_LGVARRAY)) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5428,7 +5463,7 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, alignment = pFormat[1] + 1; - if (pFormat[0] == RPC_FC_SMVARRAY) + if (pFormat[0] == FC_SMVARRAY) { pFormat += 2; size = *(const WORD*)pFormat; @@ -5458,7 +5493,7 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, size); + *ppMemory = NdrAllocateZero(pStubMsg, size); saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -5481,8 +5516,8 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pFormat[0] != RPC_FC_SMVARRAY) && - (pFormat[0] != RPC_FC_LGVARRAY)) + if ((pFormat[0] != FC_SMVARRAY) && + (pFormat[0] != FC_LGVARRAY)) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5491,7 +5526,7 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, alignment = pFormat[1] + 1; - if (pFormat[0] == RPC_FC_SMVARRAY) + if (pFormat[0] == FC_SMVARRAY) { pFormat += 2; pFormat += sizeof(WORD); @@ -5537,8 +5572,8 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p)\n", pStubMsg, pFormat); - if ((pFormat[0] != RPC_FC_SMVARRAY) && - (pFormat[0] != RPC_FC_LGVARRAY)) + if ((pFormat[0] != FC_SMVARRAY) && + (pFormat[0] != FC_LGVARRAY)) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -5547,7 +5582,7 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, alignment = pFormat[1] + 1; - if (pFormat[0] == RPC_FC_SMVARRAY) + if (pFormat[0] == FC_SMVARRAY) { pFormat += 2; size = *(const WORD*)pFormat; @@ -5590,15 +5625,15 @@ void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); - if ((pFormat[0] != RPC_FC_SMVARRAY) && - (pFormat[0] != RPC_FC_LGVARRAY)) + if ((pFormat[0] != FC_SMVARRAY) && + (pFormat[0] != FC_LGVARRAY)) { ERR("invalid format type %x\n", pFormat[0]); RpcRaiseException(RPC_S_INTERNAL_ERROR); return; } - if (pFormat[0] == RPC_FC_SMVARRAY) + if (pFormat[0] == FC_SMVARRAY) { pFormat += 2; pFormat += sizeof(WORD); @@ -5630,23 +5665,20 @@ static ULONG get_discriminant(unsigned char fc, const unsigned char *pMemory) { switch (fc) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: return *pMemory; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: + case FC_ENUM16: return *(const USHORT *)pMemory; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: return *(const ULONG *)pMemory; - case RPC_FC_INT3264: - case RPC_FC_UINT3264: - return *(const ULONG_PTR *)pMemory; default: FIXME("Unhandled base type: 0x%02x\n", fc); return 0; @@ -5716,10 +5748,10 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c BOOL pointer_buffer_mark_set = FALSE; switch(*desc) { - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) @@ -5745,7 +5777,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c pStubMsg->Buffer = saved_buffer + 4; } break; - case RPC_FC_IP: + case FC_IP: /* must be dereferenced first */ m(pStubMsg, *(unsigned char **)pMemory, desc); break; @@ -5789,10 +5821,10 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg, BOOL pointer_buffer_mark_set = FALSE; switch(*desc) { - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) @@ -5819,7 +5851,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = saved_buffer + 4; } break; - case RPC_FC_IP: + case FC_IP: /* must be dereferenced first */ m(pStubMsg, *(unsigned char ***)ppMemory, desc, fMustAlloc); break; @@ -5860,10 +5892,10 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg, { switch(*desc) { - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); /* for pointer ID */ if (!pStubMsg->IgnoreEmbeddedPointers) @@ -5878,7 +5910,7 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } break; - case RPC_FC_IP: + case FC_IP: /* must be dereferenced first */ m(pStubMsg, *(unsigned char **)pMemory, desc); break; @@ -5919,10 +5951,10 @@ static ULONG union_arm_memory_size(PMIDL_STUB_MESSAGE pStubMsg, { switch(*desc) { - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); @@ -5965,13 +5997,13 @@ static void union_arm_free(PMIDL_STUB_MESSAGE pStubMsg, { switch(*desc) { - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case FC_RP: + case FC_UP: + case FC_OP: + case FC_FP: PointerFree(pStubMsg, *(unsigned char **)pMemory, desc); break; - case RPC_FC_IP: + case FC_IP: /* must be dereferenced first */ m(pStubMsg, *(unsigned char **)pMemory, desc); break; @@ -6164,20 +6196,20 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, switch(**ppFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: { UCHAR d; safe_copy_from_buffer(pStubMsg, &d, sizeof(d)); discriminant = d; break; } - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: + case FC_ENUM16: { USHORT d; align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); @@ -6185,8 +6217,8 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, discriminant = d; break; } - case RPC_FC_LONG: - case RPC_FC_ULONG: + case FC_LONG: + case FC_ULONG: { ULONG d; align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); @@ -6416,7 +6448,7 @@ static unsigned char *WINAPI NdrRangeMarshall( TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); - if (pRange->type != RPC_FC_RANGE) + if (pRange->type != FC_RANGE) { ERR("invalid format type %x\n", pRange->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6442,7 +6474,7 @@ unsigned char *WINAPI NdrRangeUnmarshall( TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false"); - if (pRange->type != RPC_FC_RANGE) + if (pRange->type != FC_RANGE) { ERR("invalid format type %x\n", pRange->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6483,41 +6515,41 @@ unsigned char *WINAPI NdrRangeUnmarshall( switch(base_type) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: + case FC_CHAR: + case FC_SMALL: RANGE_UNMARSHALL(UCHAR, UCHAR, "%d"); TRACE("value: 0x%02x\n", **ppMemory); break; - case RPC_FC_BYTE: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_USMALL: RANGE_UNMARSHALL(CHAR, CHAR, "%u"); TRACE("value: 0x%02x\n", **ppMemory); break; - case RPC_FC_WCHAR: /* FIXME: valid? */ - case RPC_FC_USHORT: + case FC_WCHAR: /* FIXME: valid? */ + case FC_USHORT: RANGE_UNMARSHALL(USHORT, USHORT, "%u"); TRACE("value: 0x%04x\n", **(USHORT **)ppMemory); break; - case RPC_FC_SHORT: + case FC_SHORT: RANGE_UNMARSHALL(SHORT, SHORT, "%d"); TRACE("value: 0x%04x\n", **(USHORT **)ppMemory); break; - case RPC_FC_LONG: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ENUM32: RANGE_UNMARSHALL(LONG, LONG, "%d"); TRACE("value: 0x%08x\n", **(ULONG **)ppMemory); break; - case RPC_FC_ULONG: + case FC_ULONG: RANGE_UNMARSHALL(ULONG, ULONG, "%u"); TRACE("value: 0x%08x\n", **(ULONG **)ppMemory); break; - case RPC_FC_ENUM16: + case FC_ENUM16: RANGE_UNMARSHALL(UINT, USHORT, "%u"); TRACE("value: 0x%08x\n", **(UINT **)ppMemory); break; - case RPC_FC_FLOAT: - case RPC_FC_DOUBLE: - case RPC_FC_HYPER: + case FC_FLOAT: + case FC_DOUBLE: + case FC_HYPER: default: ERR("invalid range base type: 0x%02x\n", base_type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6539,7 +6571,7 @@ static void WINAPI NdrRangeBufferSize( TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); - if (pRange->type != RPC_FC_RANGE) + if (pRange->type != FC_RANGE) { ERR("invalid format type %x\n", pRange->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6559,7 +6591,7 @@ static ULONG WINAPI NdrRangeMemorySize( const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat; unsigned char base_type; - if (pRange->type != RPC_FC_RANGE) + if (pRange->type != FC_RANGE) { ERR("invalid format type %x\n", pRange->type); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6594,42 +6626,42 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( switch(*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: safe_copy_to_buffer(pStubMsg, pMemory, sizeof(UCHAR)); TRACE("value: 0x%02x\n", *pMemory); break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(USHORT)); TRACE("value: 0x%04x\n", *(USHORT *)pMemory); break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ERROR_STATUS_T: + case FC_ENUM32: align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG)); TRACE("value: 0x%08x\n", *(ULONG *)pMemory); break; - case RPC_FC_FLOAT: + case FC_FLOAT: align_pointer_clear(&pStubMsg->Buffer, sizeof(float)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float)); break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: align_pointer_clear(&pStubMsg->Buffer, sizeof(double)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double)); break; - case RPC_FC_HYPER: + case FC_HYPER: align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONGLONG)); TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory)); break; - case RPC_FC_ENUM16: + case FC_ENUM16: { USHORT val = *(UINT *)pMemory; /* only 16-bits on the wire, so do a sanity check */ @@ -6640,15 +6672,15 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( TRACE("value: 0x%04x\n", *(UINT *)pMemory); break; } - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: { UINT val = *(UINT_PTR *)pMemory; align_pointer_clear(&pStubMsg->Buffer, sizeof(UINT)); safe_copy_to_buffer(pStubMsg, &val, sizeof(val)); break; } - case RPC_FC_IGNORE: + case FC_IGNORE: break; default: FIXME("Unhandled base type: 0x%02x\n", *pFormat); @@ -6688,39 +6720,39 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( switch(*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: BASE_TYPE_UNMARSHALL(UCHAR); TRACE("value: 0x%02x\n", **ppMemory); break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: BASE_TYPE_UNMARSHALL(USHORT); TRACE("value: 0x%04x\n", **(USHORT **)ppMemory); break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ERROR_STATUS_T: + case FC_ENUM32: BASE_TYPE_UNMARSHALL(ULONG); TRACE("value: 0x%08x\n", **(ULONG **)ppMemory); break; - case RPC_FC_FLOAT: + case FC_FLOAT: BASE_TYPE_UNMARSHALL(float); TRACE("value: %f\n", **(float **)ppMemory); break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: BASE_TYPE_UNMARSHALL(double); TRACE("value: %f\n", **(double **)ppMemory); break; - case RPC_FC_HYPER: + case FC_HYPER: BASE_TYPE_UNMARSHALL(ULONGLONG); TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory)); break; - case RPC_FC_ENUM16: + case FC_ENUM16: { USHORT val; align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); @@ -6734,7 +6766,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("value: 0x%08x\n", **(UINT **)ppMemory); break; } - case RPC_FC_INT3264: + case FC_INT3264: if (sizeof(INT_PTR) == sizeof(INT)) BASE_TYPE_UNMARSHALL(INT); else { @@ -6749,7 +6781,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("value: 0x%08lx\n", **(INT_PTR **)ppMemory); } break; - case RPC_FC_UINT3264: + case FC_UINT3264: if (sizeof(UINT_PTR) == sizeof(UINT)) BASE_TYPE_UNMARSHALL(UINT); else { @@ -6764,7 +6796,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("value: 0x%08lx\n", **(UINT_PTR **)ppMemory); } break; - case RPC_FC_IGNORE: + case FC_IGNORE: break; default: FIXME("Unhandled base type: 0x%02x\n", *pFormat); @@ -6788,44 +6820,44 @@ static void WINAPI NdrBaseTypeBufferSize( switch(*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: safe_buffer_length_increment(pStubMsg, sizeof(UCHAR)); break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: + case FC_ENUM16: align_length(&pStubMsg->BufferLength, sizeof(USHORT)); safe_buffer_length_increment(pStubMsg, sizeof(USHORT)); break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: + case FC_INT3264: + case FC_UINT3264: align_length(&pStubMsg->BufferLength, sizeof(ULONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONG)); break; - case RPC_FC_FLOAT: + case FC_FLOAT: align_length(&pStubMsg->BufferLength, sizeof(float)); safe_buffer_length_increment(pStubMsg, sizeof(float)); break; - case RPC_FC_DOUBLE: + case FC_DOUBLE: align_length(&pStubMsg->BufferLength, sizeof(double)); safe_buffer_length_increment(pStubMsg, sizeof(double)); break; - case RPC_FC_HYPER: + case FC_HYPER: align_length(&pStubMsg->BufferLength, sizeof(ULONGLONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONGLONG)); break; - case RPC_FC_ERROR_STATUS_T: + case FC_ERROR_STATUS_T: align_length(&pStubMsg->BufferLength, sizeof(error_status_t)); safe_buffer_length_increment(pStubMsg, sizeof(error_status_t)); break; - case RPC_FC_IGNORE: + case FC_IGNORE: break; default: FIXME("Unhandled base type: 0x%02x\n", *pFormat); @@ -6843,67 +6875,67 @@ static ULONG WINAPI NdrBaseTypeMemorySize( switch(*pFormat) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: safe_buffer_increment(pStubMsg, sizeof(UCHAR)); pStubMsg->MemorySize += sizeof(UCHAR); return sizeof(UCHAR); - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); align_length(&pStubMsg->MemorySize, sizeof(USHORT)); pStubMsg->MemorySize += sizeof(USHORT); return sizeof(USHORT); - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: + case FC_LONG: + case FC_ULONG: + case FC_ENUM32: align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); safe_buffer_increment(pStubMsg, sizeof(ULONG)); align_length(&pStubMsg->MemorySize, sizeof(ULONG)); pStubMsg->MemorySize += sizeof(ULONG); return sizeof(ULONG); - case RPC_FC_FLOAT: + case FC_FLOAT: align_pointer(&pStubMsg->Buffer, sizeof(float)); safe_buffer_increment(pStubMsg, sizeof(float)); align_length(&pStubMsg->MemorySize, sizeof(float)); pStubMsg->MemorySize += sizeof(float); return sizeof(float); - case RPC_FC_DOUBLE: + case FC_DOUBLE: align_pointer(&pStubMsg->Buffer, sizeof(double)); safe_buffer_increment(pStubMsg, sizeof(double)); align_length(&pStubMsg->MemorySize, sizeof(double)); pStubMsg->MemorySize += sizeof(double); return sizeof(double); - case RPC_FC_HYPER: + case FC_HYPER: align_pointer(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_buffer_increment(pStubMsg, sizeof(ULONGLONG)); align_length(&pStubMsg->MemorySize, sizeof(ULONGLONG)); pStubMsg->MemorySize += sizeof(ULONGLONG); return sizeof(ULONGLONG); - case RPC_FC_ERROR_STATUS_T: + case FC_ERROR_STATUS_T: align_pointer(&pStubMsg->Buffer, sizeof(error_status_t)); safe_buffer_increment(pStubMsg, sizeof(error_status_t)); align_length(&pStubMsg->MemorySize, sizeof(error_status_t)); pStubMsg->MemorySize += sizeof(error_status_t); return sizeof(error_status_t); - case RPC_FC_ENUM16: + case FC_ENUM16: align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); align_length(&pStubMsg->MemorySize, sizeof(UINT)); pStubMsg->MemorySize += sizeof(UINT); return sizeof(UINT); - case RPC_FC_INT3264: - case RPC_FC_UINT3264: + case FC_INT3264: + case FC_UINT3264: align_pointer(&pStubMsg->Buffer, sizeof(UINT)); safe_buffer_increment(pStubMsg, sizeof(UINT)); align_length(&pStubMsg->MemorySize, sizeof(UINT_PTR)); pStubMsg->MemorySize += sizeof(UINT_PTR); return sizeof(UINT_PTR); - case RPC_FC_IGNORE: + case FC_IGNORE: align_length(&pStubMsg->MemorySize, sizeof(void *)); pStubMsg->MemorySize += sizeof(void *); return sizeof(void *); @@ -6935,7 +6967,7 @@ static void WINAPI NdrContextHandleBufferSize( { TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); - if (*pFormat != RPC_FC_BIND_CONTEXT) + if (*pFormat != FC_BIND_CONTEXT) { ERR("invalid format type %x\n", *pFormat); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6954,7 +6986,7 @@ static unsigned char *WINAPI NdrContextHandleMarshall( { TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); - if (*pFormat != RPC_FC_BIND_CONTEXT) + if (*pFormat != FC_BIND_CONTEXT) { ERR("invalid format type %x\n", *pFormat); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -6990,7 +7022,7 @@ static unsigned char *WINAPI NdrContextHandleUnmarshall( TRACE("pStubMsg %p, ppMemory %p, pFormat %p, fMustAlloc %s\n", pStubMsg, ppMemory, pFormat, fMustAlloc ? "TRUE": "FALSE"); - if (*pFormat != RPC_FC_BIND_CONTEXT) + if (*pFormat != FC_BIND_CONTEXT) { ERR("invalid format type %x\n", *pFormat); RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -7126,7 +7158,7 @@ NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg, if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE) flags |= RPC_CONTEXT_HANDLE_SERIALIZE; - if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE) + if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE) flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE; if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE) { @@ -7160,7 +7192,7 @@ void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE) flags |= RPC_CONTEXT_HANDLE_SERIALIZE; - if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE) + if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE) flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE; if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE) { @@ -7193,7 +7225,7 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE) flags |= RPC_CONTEXT_HANDLE_SERIALIZE; - if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE) + if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE) flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE; if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE) { diff --git a/dll/win32/rpcrt4/ndr_ole.c b/dll/win32/rpcrt4/ndr_ole.c index 0f0b7e7df2..c8026c0ff1 100644 --- a/dll/win32/rpcrt4/ndr_ole.c +++ b/dll/win32/rpcrt4/ndr_ole.c @@ -36,8 +36,8 @@ #include "ndr_misc.h" #include "rpcndr.h" +#include "ndrtypes.h" #include "rpcproxy.h" -#include "wine/rpcfc.h" #include "cpsf.h" #include "wine/debug.h" @@ -288,8 +288,8 @@ static const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory const IID *riid; if (!pFormat) return &IID_IUnknown; TRACE("format=%02x %02x\n", pFormat[0], pFormat[1]); - if (pFormat[0] != RPC_FC_IP) FIXME("format=%d\n", pFormat[0]); - if (pFormat[1] == RPC_FC_CONSTANT_IID) { + if (pFormat[0] != FC_IP) FIXME("format=%d\n", pFormat[0]); + if (pFormat[1] == FC_CONSTANT_IID) { riid = (const IID *)&pFormat[2]; } else { ComputeConformance(pStubMsg, pMemory, pFormat+2, 0); @@ -338,19 +338,25 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg PFORMAT_STRING pFormat, unsigned char fMustAlloc) { + IUnknown **unk = (IUnknown **)ppMemory; LPSTREAM stream; HRESULT hr; TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); if (!LoadCOM()) return NULL; - *(LPVOID*)ppMemory = NULL; + + /* Avoid reference leaks for [in, out] pointers. */ + if (pStubMsg->IsClient && *unk) + IUnknown_Release(*unk); + + *unk = NULL; if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { ULONG size; hr = RpcStream_Create(pStubMsg, FALSE, &size, &stream); if (hr == S_OK) { if (size != 0) - hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory); + hr = COM_UnmarshalInterface(stream, &IID_NULL, (void **)unk); IStream_Release(stream); } diff --git a/dll/win32/rpcrt4/ndr_stubless.c b/dll/win32/rpcrt4/ndr_stubless.c index f84c61751a..c2f260c764 100644 --- a/dll/win32/rpcrt4/ndr_stubless.c +++ b/dll/win32/rpcrt4/ndr_stubless.c @@ -40,7 +40,6 @@ #include "wine/exception.h" #include "wine/debug.h" -#include "wine/rpcfc.h" #include "cpsf.h" #include "ndr_misc.h" @@ -154,61 +153,60 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) DWORD size; switch(*pFormat) { - case RPC_FC_RP: - if (pFormat[1] & RPC_FC_P_SIMPLEPOINTER) + case FC_RP: + if (pFormat[1] & FC_SIMPLE_POINTER) { - FIXME("Simple reference pointer (type %#x).\n", pFormat[2]); - size = sizeof(void *); + size = 0; break; } size = calc_arg_size(pStubMsg, &pFormat[2] + *(const SHORT*)&pFormat[2]); break; - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: + case FC_STRUCT: + case FC_PSTRUCT: size = *(const WORD*)(pFormat + 2); break; - case RPC_FC_BOGUS_STRUCT: + case FC_BOGUS_STRUCT: size = *(const WORD*)(pFormat + 2); if(*(const WORD*)(pFormat + 4)) FIXME("Unhandled conformant description\n"); break; - case RPC_FC_CARRAY: - case RPC_FC_CVARRAY: + case FC_CARRAY: + case FC_CVARRAY: size = *(const WORD*)(pFormat + 2); ComputeConformance(pStubMsg, NULL, pFormat + 4, 0); size *= pStubMsg->MaxCount; break; - case RPC_FC_SMFARRAY: - case RPC_FC_SMVARRAY: + case FC_SMFARRAY: + case FC_SMVARRAY: size = *(const WORD*)(pFormat + 2); break; - case RPC_FC_LGFARRAY: - case RPC_FC_LGVARRAY: + case FC_LGFARRAY: + case FC_LGVARRAY: size = *(const DWORD*)(pFormat + 2); break; - case RPC_FC_BOGUS_ARRAY: + case FC_BOGUS_ARRAY: pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]); TRACE("conformance = %ld\n", pStubMsg->MaxCount); pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount); size = ComplexStructSize(pStubMsg, pFormat); size *= pStubMsg->MaxCount; break; - case RPC_FC_USER_MARSHAL: + case FC_USER_MARSHAL: size = *(const WORD*)(pFormat + 4); break; - case RPC_FC_CSTRING: + case FC_CSTRING: size = *(const WORD*)(pFormat + 2); break; - case RPC_FC_WSTRING: + case FC_WSTRING: size = *(const WORD*)(pFormat + 2) * sizeof(WCHAR); break; - case RPC_FC_C_CSTRING: - case RPC_FC_C_WSTRING: - if (*pFormat == RPC_FC_C_CSTRING) + case FC_C_CSTRING: + case FC_C_WSTRING: + if (*pFormat == FC_C_CSTRING) size = sizeof(CHAR); else size = sizeof(WCHAR); - if (pFormat[1] == RPC_FC_STRING_SIZED) + if (pFormat[1] == FC_STRING_SIZED) ComputeConformance(pStubMsg, NULL, pFormat + 2, 0); else pStubMsg->MaxCount = 0; @@ -217,7 +215,10 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) default: FIXME("Unhandled type %02x\n", *pFormat); /* fallthrough */ - case RPC_FC_IP: + case FC_UP: + case FC_OP: + case FC_FP: + case FC_IP: size = sizeof(void *); break; } @@ -279,10 +280,10 @@ static PFORMAT_STRING client_get_handle( switch (pProcHeader->handle_type) { /* explicit binding: parse additional section */ - case RPC_FC_BIND_EXPLICIT: + case 0: switch (*pFormat) /* handle_type */ { - case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */ + case FC_BIND_PRIMITIVE: /* explicit primitive */ { const NDR_EHD_PRIMITIVE *pDesc = (const NDR_EHD_PRIMITIVE *)pFormat; @@ -294,7 +295,7 @@ static PFORMAT_STRING client_get_handle( *phBinding = *(handle_t *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); return pFormat + sizeof(NDR_EHD_PRIMITIVE); } - case RPC_FC_BIND_GENERIC: /* explicit generic */ + case FC_BIND_GENERIC: /* explicit generic */ { const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat; void *pObject = NULL; @@ -312,7 +313,7 @@ static PFORMAT_STRING client_get_handle( *phBinding = pGenPair->pfnBind(pObject); return pFormat + sizeof(NDR_EHD_GENERIC); } - case RPC_FC_BIND_CONTEXT: /* explicit context */ + case FC_BIND_CONTEXT: /* explicit context */ { const NDR_EHD_CONTEXT *pDesc = (const NDR_EHD_CONTEXT *)pFormat; NDR_CCONTEXT context_handle; @@ -340,22 +341,22 @@ static PFORMAT_STRING client_get_handle( RpcRaiseException(RPC_X_BAD_STUB_DATA); } break; - case RPC_FC_BIND_GENERIC: /* implicit generic */ - FIXME("RPC_FC_BIND_GENERIC\n"); + case FC_BIND_GENERIC: /* implicit generic */ + FIXME("FC_BIND_GENERIC\n"); RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */ break; - case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */ + case FC_BIND_PRIMITIVE: /* implicit primitive */ TRACE("Implicit primitive handle\n"); *phBinding = *pStubMsg->StubDesc->IMPLICIT_HANDLE_INFO.pPrimitiveHandle; break; - case RPC_FC_CALLBACK_HANDLE: /* implicit callback */ - TRACE("RPC_FC_CALLBACK_HANDLE\n"); + case FC_CALLBACK_HANDLE: /* implicit callback */ + TRACE("FC_CALLBACK_HANDLE\n"); /* server calls callback procedures only in response to remote call, and most recent binding handle is used. Calling back to a client can potentially result in another callback with different current handle. */ *phBinding = I_RpcGetCurrentCallHandle(); break; - case RPC_FC_AUTO_HANDLE: /* implicit auto handle */ + case FC_AUTO_HANDLE: /* implicit auto handle */ /* strictly speaking, it isn't necessary to set hBinding here * since it isn't actually used (hence the automatic in its name), * but then why does MIDL generate a valid entry in the @@ -378,10 +379,10 @@ static void client_free_handle( switch (pProcHeader->handle_type) { /* explicit binding: parse additional section */ - case RPC_FC_BIND_EXPLICIT: + case 0: switch (*pFormat) /* handle_type */ { - case RPC_FC_BIND_GENERIC: /* explicit generic */ + case FC_BIND_GENERIC: /* explicit generic */ { const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat; void *pObject = NULL; @@ -399,21 +400,21 @@ static void client_free_handle( pGenPair->pfnUnbind(pObject, hBinding); break; } - case RPC_FC_BIND_CONTEXT: /* explicit context */ - case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */ + case FC_BIND_CONTEXT: /* explicit context */ + case FC_BIND_PRIMITIVE: /* explicit primitive */ break; default: ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type); RpcRaiseException(RPC_X_BAD_STUB_DATA); } break; - case RPC_FC_BIND_GENERIC: /* implicit generic */ - FIXME("RPC_FC_BIND_GENERIC\n"); + case FC_BIND_GENERIC: /* implicit generic */ + FIXME("FC_BIND_GENERIC\n"); RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */ break; - case RPC_FC_CALLBACK_HANDLE: /* implicit callback */ - case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */ - case RPC_FC_AUTO_HANDLE: /* implicit auto handle */ + case FC_CALLBACK_HANDLE: /* implicit callback */ + case FC_BIND_PRIMITIVE: /* implicit primitive */ + case FC_AUTO_HANDLE: /* implicit auto handle */ break; default: ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type); @@ -421,6 +422,50 @@ static void client_free_handle( } } +static inline BOOL param_needs_alloc( PARAM_ATTRIBUTES attr ) +{ + return attr.IsOut && !attr.IsIn && !attr.IsBasetype && !attr.IsByValue; +} + +static inline BOOL param_is_out_basetype( PARAM_ATTRIBUTES attr ) +{ + return attr.IsOut && !attr.IsIn && attr.IsBasetype && attr.IsSimpleRef; +} + +static size_t basetype_arg_size( unsigned char fc ) +{ + switch (fc) + { + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: + return sizeof(char); + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: + return sizeof(short); + case FC_LONG: + case FC_ULONG: + case FC_ENUM16: + case FC_ENUM32: + case FC_ERROR_STATUS_T: + return sizeof(int); + case FC_FLOAT: + return sizeof(float); + case FC_HYPER: + return sizeof(LONGLONG); + case FC_DOUBLE: + return sizeof(double); + case FC_INT3264: + case FC_UINT3264: + return sizeof(INT_PTR); + default: + FIXME("Unhandled basetype %#x.\n", fc); + return 0; + } +} + void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal ) { @@ -436,7 +481,7 @@ void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum s float f; if (params[i].attr.IsBasetype && - params[i].u.type_format_char == RPC_FC_FLOAT && + params[i].u.type_format_char == FC_FLOAT && !params[i].attr.IsSimpleRef && !fpu_args) { @@ -452,10 +497,12 @@ void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum s switch (phase) { case STUBLESS_INITOUT: - if (!params[i].attr.IsBasetype && params[i].attr.IsOut && - !params[i].attr.IsIn && !params[i].attr.IsByValue) + if (*(unsigned char **)pArg) { - memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat )); + if (param_needs_alloc(params[i].attr)) + memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat )); + else if (param_is_out_basetype(params[i].attr)) + memset( *(unsigned char **)pArg, 0, basetype_arg_size( params[i].u.type_format_char )); } break; case STUBLESS_CALCSIZE: @@ -487,26 +534,26 @@ static unsigned int type_stack_size(unsigned char fc) { switch (fc) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_INT3264: - case RPC_FC_UINT3264: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_IGNORE: + case FC_BYTE: + case FC_CHAR: + case FC_SMALL: + case FC_USMALL: + case FC_WCHAR: + case FC_SHORT: + case FC_USHORT: + case FC_LONG: + case FC_ULONG: + case FC_INT3264: + case FC_UINT3264: + case FC_ENUM16: + case FC_ENUM32: + case FC_FLOAT: + case FC_ERROR_STATUS_T: + case FC_IGNORE: return sizeof(void *); - case RPC_FC_DOUBLE: + case FC_DOUBLE: return sizeof(double); - case RPC_FC_HYPER: + case FC_HYPER: return sizeof(ULONGLONG); default: ERR("invalid base type 0x%x\n", fc); @@ -518,13 +565,13 @@ static BOOL is_by_value( PFORMAT_STRING format ) { switch (*format) { - case RPC_FC_USER_MARSHAL: - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: + case FC_USER_MARSHAL: + case FC_STRUCT: + case FC_PSTRUCT: + case FC_CSTRUCT: + case FC_CPSTRUCT: + case FC_CVSTRUCT: + case FC_BOGUS_STRUCT: return TRUE; default: return FALSE; @@ -554,32 +601,32 @@ PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo switch (param->param_direction) { - case RPC_FC_IN_PARAM_BASETYPE: + case FC_IN_PARAM_BASETYPE: args[i].attr.IsIn = 1; args[i].attr.IsBasetype = 1; break; - case RPC_FC_RETURN_PARAM_BASETYPE: + case FC_RETURN_PARAM_BASETYPE: args[i].attr.IsOut = 1; args[i].attr.IsReturn = 1; args[i].attr.IsBasetype = 1; break; - case RPC_FC_IN_PARAM: + case FC_IN_PARAM: args[i].attr.IsIn = 1; args[i].attr.MustFree = 1; break; - case RPC_FC_IN_PARAM_NO_FREE_INST: + case FC_IN_PARAM_NO_FREE_INST: args[i].attr.IsIn = 1; args[i].attr.IsDontCallFreeInst = 1; break; - case RPC_FC_IN_OUT_PARAM: + case FC_IN_OUT_PARAM: args[i].attr.IsIn = 1; args[i].attr.IsOut = 1; args[i].attr.MustFree = 1; break; - case RPC_FC_OUT_PARAM: + case FC_OUT_PARAM: args[i].attr.IsOut = 1; break; - case RPC_FC_RETURN_PARAM: + case FC_RETURN_PARAM: args[i].attr.IsOut = 1; args[i].attr.IsReturn = 1; break; @@ -633,7 +680,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM TRACE("NDR Version: 0x%x\n", pStubDesc->Version); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) { const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; stack_size = header_rpc->stack_size; @@ -650,10 +697,10 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM TRACE("proc num: %d\n", procedure_number); /* create the full pointer translation tables, if requested */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { /* object is always the first argument */ This = stack_top[0]; @@ -669,7 +716,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM pHandleFormat = pFormat; /* we only need a handle if this isn't an object method */ - if (!(pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)) + if (!(pProcHeader->Oi_flags & Oi_OBJECT_PROC)) { pFormat = client_get_handle(&stubMsg, pProcHeader, pHandleFormat, &hBinding); if (!pFormat) goto done; @@ -710,7 +757,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM else { pFormat = convert_old_args( &stubMsg, pFormat, stack_size, - pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + pProcHeader->Oi_flags & Oi_OBJECT_PROC, /* reuse the correlation cache, it's not needed for v1 format */ NdrCorrCache, sizeof(NdrCorrCache), &number_of_params ); } @@ -718,11 +765,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM stubMsg.BufferLength = 0; /* store the RPC flags away */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) rpcMsg.RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags; /* use alternate memory allocation routines */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC) + if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED) NdrRpcSmSetClientToOsf(&stubMsg); if (Oif_flags.HasPipes) @@ -749,11 +796,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM * 6. UNMARSHAL - unmarshal [out] params from buffer * 7. FREE - clear [out] parameters (for proxies, and only on error) */ - if ((pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) || - (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT)) + if ((pProcHeader->Oi_flags & Oi_OBJECT_PROC) || + (pProcHeader->Oi_flags & Oi_HAS_COMM_OR_FAULT)) { /* 1. INITOUT */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { TRACE( "INITOUT\n" ); client_do_args(&stubMsg, pFormat, STUBLESS_INITOUT, fpu_stack, @@ -769,7 +816,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM /* 3. GETBUFFER */ TRACE( "GETBUFFER\n" ); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { /* allocate the buffer */ NdrProxyGetBuffer(This, &stubMsg); @@ -782,7 +829,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM FIXME("pipes not supported yet\n"); else { - if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) + if (pProcHeader->handle_type == FC_AUTO_HANDLE) #if 0 NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); #else @@ -800,7 +847,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM /* 5. SENDRECEIVE */ TRACE( "SENDRECEIVE\n" ); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { /* send the [in] params and receive the [out] and [retval] * params */ @@ -815,7 +862,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM FIXME("pipes not supported yet\n"); else { - if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) + if (pProcHeader->handle_type == FC_AUTO_HANDLE) #if 0 NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); #else @@ -838,7 +885,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM } __EXCEPT_ALL { - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { /* 7. FREE */ TRACE( "FREE\n" ); @@ -888,7 +935,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM FIXME("pipes not supported yet\n"); else { - if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) + if (pProcHeader->handle_type == FC_AUTO_HANDLE) #if 0 NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); #else @@ -910,7 +957,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM FIXME("pipes not supported yet\n"); else { - if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) + if (pProcHeader->handle_type == FC_AUTO_HANDLE) #if 0 NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); #else @@ -943,11 +990,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM } /* free the full pointer translation tables */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) NdrFullPointerXlatFree(stubMsg.FullPtrXlatTables); /* free marshalling buffer */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) NdrProxyFreeBuffer(This, &stubMsg); else { @@ -1137,11 +1184,6 @@ LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, uns } #endif -static inline BOOL param_needs_alloc( PARAM_ATTRIBUTES attr ) -{ - return attr.IsOut && !attr.IsIn && !attr.IsBasetype && !attr.IsByValue; -} - static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params) @@ -1180,13 +1222,13 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, else if (param_needs_alloc(params[i].attr) && (!params[i].attr.MustFree || params[i].attr.IsSimpleRef)) { - if (*pTypeFormat != RPC_FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg); + if (*pTypeFormat != FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg); } break; case STUBLESS_INITOUT: if (param_needs_alloc(params[i].attr) && !params[i].attr.ServerAllocSize) { - if (*pTypeFormat == RPC_FC_BIND_CONTEXT) + if (*pTypeFormat == FC_BIND_CONTEXT) { NDR_SCONTEXT ctxt = NdrContextHandleInitialize(pStubMsg, pTypeFormat); *(void **)pArg = NDRSContextValue(ctxt); @@ -1276,7 +1318,7 @@ LONG WINAPI NdrStubCall2( TRACE("NDR Version: 0x%x\n", pStubDesc->Version); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) { const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; stack_size = header_rpc->stack_size; @@ -1295,16 +1337,16 @@ LONG WINAPI NdrStubCall2( switch (pProcHeader->handle_type) { /* explicit binding: parse additional section */ - case RPC_FC_BIND_EXPLICIT: + case 0: switch (*pFormat) /* handle_type */ { - case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */ + case FC_BIND_PRIMITIVE: /* explicit primitive */ pFormat += sizeof(NDR_EHD_PRIMITIVE); break; - case RPC_FC_BIND_GENERIC: /* explicit generic */ + case FC_BIND_GENERIC: /* explicit generic */ pFormat += sizeof(NDR_EHD_GENERIC); break; - case RPC_FC_BIND_CONTEXT: /* explicit context */ + case FC_BIND_CONTEXT: /* explicit context */ pFormat += sizeof(NDR_EHD_CONTEXT); break; default: @@ -1312,31 +1354,31 @@ LONG WINAPI NdrStubCall2( RpcRaiseException(RPC_X_BAD_STUB_DATA); } break; - case RPC_FC_BIND_GENERIC: /* implicit generic */ - case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */ - case RPC_FC_CALLBACK_HANDLE: /* implicit callback */ - case RPC_FC_AUTO_HANDLE: /* implicit auto handle */ + case FC_BIND_GENERIC: /* implicit generic */ + case FC_BIND_PRIMITIVE: /* implicit primitive */ + case FC_CALLBACK_HANDLE: /* implicit callback */ + case FC_AUTO_HANDLE: /* implicit auto handle */ break; default: ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type); RpcRaiseException(RPC_X_BAD_STUB_DATA); } - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) NdrStubInitialize(pRpcMsg, &stubMsg, pStubDesc, pChannel); else NdrServerInitializeNew(pRpcMsg, &stubMsg, pStubDesc); /* create the full pointer translation tables, if requested */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_SERVER); /* store the RPC flags away */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags; /* use alternate memory allocation routines */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC) + if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED) #if 0 NdrRpcSsEnableAllocate(&stubMsg); #else @@ -1389,7 +1431,7 @@ LONG WINAPI NdrStubCall2( else { pFormat = convert_old_args( &stubMsg, pFormat, stack_size, - pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + pProcHeader->Oi_flags & Oi_OBJECT_PROC, /* reuse the correlation cache, it's not needed for v1 format */ NdrCorrCache, sizeof(NdrCorrCache), &number_of_params ); } @@ -1413,7 +1455,7 @@ LONG WINAPI NdrStubCall2( SERVER_ROUTINE func; LONG_PTR retval; - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { SERVER_ROUTINE *vtbl = *(SERVER_ROUTINE **)((CStdStubBuffer *)pThis)->pvServerObject; func = vtbl[pRpcMsg->ProcNum]; @@ -1438,7 +1480,7 @@ LONG WINAPI NdrStubCall2( break; case STUBLESS_GETBUFFER: - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) NdrStubGetBuffer(pThis, pChannel, &stubMsg); else { @@ -1480,7 +1522,7 @@ LONG WINAPI NdrStubCall2( } /* free the full pointer translation tables */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) NdrFullPointerXlatFree(stubMsg.FullPtrXlatTables); /* free server function stack */ @@ -1565,7 +1607,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, async_call_data->pStubMsg = pStubMsg = (PMIDL_STUB_MESSAGE)(async_call_data + 1); pRpcMsg = (PRPC_MESSAGE)(pStubMsg + 1); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) { const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; async_call_data->stack_size = header_rpc->stack_size; @@ -1582,10 +1624,10 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, TRACE("proc num: %d\n", procedure_number); /* create the full pointer translation tables, if requested */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED) pStubMsg->FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if (pProcHeader->Oi_flags & Oi_OBJECT_PROC) { ERR("objects not supported\n"); I_RpcFree(async_call_data); @@ -1631,7 +1673,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, else { pFormat = convert_old_args( pStubMsg, pFormat, async_call_data->stack_size, - pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + pProcHeader->Oi_flags & Oi_OBJECT_PROC, async_call_data->NdrCorrCache, sizeof(async_call_data->NdrCorrCache), &async_call_data->number_of_params ); } @@ -1641,11 +1683,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, pStubMsg->BufferLength = 0; /* store the RPC flags away */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS) pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags; /* use alternate memory allocation routines */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC) + if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED) NdrRpcSmSetClientToOsf(pStubMsg); if (Oif_flags.HasPipes) @@ -1684,7 +1726,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, FIXME("pipes not supported yet\n"); else { - if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) + if (pProcHeader->handle_type == FC_AUTO_HANDLE) #if 0 ... 1861 lines suppressed ...
5 years, 11 months
1
0
0
0
[reactos] 01/01: [WIN32SS][NTGDI] Use ProbeForWrite in NtGdiSetBitmapBits (#1325)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bb33692400b3d59d6c907…
commit bb33692400b3d59d6c9070d339bf666b997b3624 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 30 16:54:45 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 30 16:54:45 2019 +0900 [WIN32SS][NTGDI] Use ProbeForWrite in NtGdiSetBitmapBits (#1325) Use ProbeForWrite instead of ProbeForRead. CORE-15657 and CORE-15695 --- win32ss/gdi/ntgdi/bitmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/gdi/ntgdi/bitmaps.c b/win32ss/gdi/ntgdi/bitmaps.c index 0f556f9b91..59fb5dd9d1 100644 --- a/win32ss/gdi/ntgdi/bitmaps.c +++ b/win32ss/gdi/ntgdi/bitmaps.c @@ -645,7 +645,7 @@ NtGdiSetBitmapBits( _SEH2_TRY { /* NOTE: Win2k3 doesn't check WORD alignment here. */ - ProbeForRead(pUnsafeBits, Bytes, 1); + ProbeForWrite(pUnsafeBits, Bytes, 1); ret = UnsafeSetBitmapBits(psurf, Bytes, pUnsafeBits); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
5 years, 11 months
1
0
0
0
[reactos] 01/01: [USETUP] Improve lang/ReadMe.txt
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8886a2261ae7bb3f438df…
commit 8886a2261ae7bb3f438dfb73cea356eca54e95d9 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 30 14:59:10 2019 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Jan 30 14:59:10 2019 +0900 [USETUP] Improve lang/ReadMe.txt --- base/setup/usetup/lang/ReadMe.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/setup/usetup/lang/ReadMe.txt b/base/setup/usetup/lang/ReadMe.txt index 184e8e53de..eb6bd2ca51 100644 --- a/base/setup/usetup/lang/ReadMe.txt +++ b/base/setup/usetup/lang/ReadMe.txt @@ -4,7 +4,7 @@ code7bit:
https://github.com/katahiromz/code7bit
code7bit makes the string literals 8-bit clean. If source contains any non-8-bit-clean strings, -non-latin developer cannot build the project. +non-Latin developer cannot build the project on MSVC. 8-bit clean
https://en.wikipedia.org/wiki/8-bit_clean
@@ -12,4 +12,4 @@
https://en.wikipedia.org/wiki/8-bit_clean
To edit a file converted by code7bit, you have to revert it at first. To revert, please execute code7bit -r <file>. -After edit it, to convert again, please execute code7bit -c <file>. +After edit, to convert again, please execute code7bit -c <file>.
5 years, 11 months
1
0
0
0
[reactos] 01/01: [NTOS:OB] Correctly check SeSinglePrivilegeCheck() return value (#1323)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0483a5a38089217868401…
commit 0483a5a38089217868401fb9fe5e9885cddebcc6 Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Wed Jan 30 00:43:13 2019 +0100 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Jan 30 00:43:13 2019 +0100 [NTOS:OB] Correctly check SeSinglePrivilegeCheck() return value (#1323) SeSinglePrivilegeCheck() returns a BOOLEAN, not a NTSTATUS. CORE-14271 --- ntoskrnl/ob/oblife.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/ob/oblife.c b/ntoskrnl/ob/oblife.c index 6cc1403e63..d649b0f049 100644 --- a/ntoskrnl/ob/oblife.c +++ b/ntoskrnl/ob/oblife.c @@ -1427,9 +1427,10 @@ NtMakePermanentObject(IN HANDLE ObjectHandle) PAGED_CODE(); /* Make sure that the caller has SeCreatePermanentPrivilege */ - Status = SeSinglePrivilegeCheck(SeCreatePermanentPrivilege, - PreviousMode); - if (!NT_SUCCESS(Status)) return STATUS_PRIVILEGE_NOT_HELD; + if (!SeSinglePrivilegeCheck(SeCreatePermanentPrivilege, PreviousMode)) + { + return STATUS_PRIVILEGE_NOT_HELD; + } /* Reference the object */ Status = ObReferenceObjectByHandle(ObjectHandle,
5 years, 11 months
1
0
0
0
[reactos] 01/01: [COMCTL32] Revert "button: Don't erase the area of the checkbox or the text."
by Joachim Henze
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1e05f9cc32dda973acc1e…
commit 1e05f9cc32dda973acc1e46ecbad793d1187b238 Author: Joachim Henze <Joachim.Henze(a)reactos.org> AuthorDate: Tue Jan 29 19:25:57 2019 +0100 Commit: Joachim Henze <Joachim.Henze(a)reactos.org> CommitDate: Tue Jan 29 19:25:57 2019 +0100 [COMCTL32] Revert "button: Don't erase the area of the checkbox or the text." This reverts commit 0.4.12-dev-347-g 75a80ec82309a19632251bfe6aa9e7f14132a86f by explcit request of Giannis Adamopoulos. I double-checked and confirm, that this revert fixes both regressions CORE-15595 & CORE-15696. On the downside the revert will intensify again the regression CORE-13278 (will make the text flash again as well). Giannis Adamopoulos mentioned earlier, that using double-buffering eventually could be a valid way out of CORE-13278 instead. --- dll/win32/comctl32/button.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/dll/win32/comctl32/button.c b/dll/win32/comctl32/button.c index 602a37c7a7..59067471f1 100644 --- a/dll/win32/comctl32/button.c +++ b/dll/win32/comctl32/button.c @@ -1550,9 +1550,7 @@ static void CB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) /* Since WM_ERASEBKGND does nothing, first prepare background */ if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush ); -#ifndef __REACTOS__ if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush ); -#endif /* Draw label */ client = rtext; @@ -1618,15 +1616,6 @@ static void CB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) if (action == ODA_DRAWENTIRE) BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rtext); -#ifdef __REACTOS__ - if (action == ODA_DRAWENTIRE) - { - ExcludeClipRect(hDC, rbox.left, rbox.top, rbox.right, rbox.bottom); - ExcludeClipRect(hDC, rtext.left, rtext.top + 1, rtext.right, rtext.bottom - 1); - FillRect( hDC, &client, hBrush ); - } -#endif - /* ... and focus */ if (action == ODA_FOCUS || (state & BST_FOCUS)) {
5 years, 12 months
1
0
0
0
← Newer
1
2
3
4
...
30
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
Results per page:
10
25
50
100
200