ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2011
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
18 participants
369 discussions
Start a n
N
ew thread
[jimtabor] 54210: [Win32k] - Fix path support, now all wine path tests pass. - Need a PolyDraw test for non-path functions! The non-path code was synced ported, but still failed 16 path tests, then...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Oct 20 12:02:15 2011 New Revision: 54210 URL:
http://svn.reactos.org/svn/reactos?rev=54210&view=rev
Log: [Win32k] - Fix path support, now all wine path tests pass. - Need a PolyDraw test for non-path functions! The non-path code was synced ported, but still failed 16 path tests, then path was moved out. Purged missing patches from the last trunk freeze, tested with the program Area. - Sync Information: Evan Stade <estade(a)gmail.com> : Improved PolyDraw in path closed case. Added PATH_PolyDraw. Modified: trunk/reactos/subsystems/win32/win32k/include/path.h trunk/reactos/subsystems/win32/win32k/objects/line.c trunk/reactos/subsystems/win32/win32k/objects/path.c Modified: trunk/reactos/subsystems/win32/win32k/include/path.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/path.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/path.h [iso-8859-1] Thu Oct 20 12:02:15 2011 @@ -55,6 +55,7 @@ BOOL FASTCALL PATH_MoveTo (PDC dc); BOOL FASTCALL PATH_PolyBezier (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolyBezierTo (PDC dc, const POINT *pts, DWORD cbPoints); +BOOL FASTCALL PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints); BOOL FASTCALL PATH_Polygon (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_Polyline (PDC dc, const POINT *pts, DWORD cbPoints); BOOL FASTCALL PATH_PolylineTo (PDC dc, const POINT *pts, DWORD cbPoints); Modified: trunk/reactos/subsystems/win32/win32k/objects/line.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] Thu Oct 20 12:02:15 2011 @@ -417,73 +417,110 @@ IN ULONG cCount) { PDC dc; - PPATH pPath; + PDC_ATTR pdcattr; + POINT *line_pts = NULL, *line_pts_old, *bzr_pts = NULL, bzr[4]; + INT i, num_pts, num_bzr_pts, space, space_old, size; BOOL result = FALSE; - POINT lastmove; - unsigned int i; - PDC_ATTR pdcattr; dc = DC_LockDc(hdc); if (!dc) return FALSE; pdcattr = dc->pdcattr; + if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) + DC_vUpdateFillBrush(dc); + + if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY)) + DC_vUpdateLineBrush(dc); + + if (!cCount) + { + DC_UnlockDc(dc); + return TRUE; + } + _SEH2_TRY { ProbeArrayForRead(lppt, sizeof(POINT), cCount, sizeof(LONG)); ProbeArrayForRead(lpbTypes, sizeof(BYTE), cCount, sizeof(BYTE)); - /* check for each bezierto if there are two more points */ + if (PATH_IsPathOpen(dc->dclevel)) + { + result = PATH_PolyDraw(dc, (const POINT *)lppt, (const BYTE *)lpbTypes, cCount); + _SEH2_LEAVE; + } + + /* check for valid point types */ + for (i = 0; i < cCount; i++) + { + switch (lpbTypes[i]) + { + case PT_MOVETO: + case PT_LINETO | PT_CLOSEFIGURE: + case PT_LINETO: + break; + case PT_BEZIERTO: + if((i + 2 < cCount) && (lpbTypes[i + 1] == PT_BEZIERTO) && + ((lpbTypes[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO)) + { + i += 2; + break; + } + default: + _SEH2_LEAVE; + } + } + + space = cCount + 300; + line_pts = ExAllocatePoolWithTag(PagedPool, space * sizeof(POINT), TAG_SHAPE); + num_pts = 1; + + line_pts[0].x = pdcattr->ptlCurrent.x; + line_pts[0].y = pdcattr->ptlCurrent.y; + for ( i = 0; i < cCount; i++ ) { - if ( lpbTypes[i] != PT_MOVETO && - lpbTypes[i] & PT_BEZIERTO ) - { - if ( cCount < i+3 ) _SEH2_LEAVE; - else i += 2; - } - } - - /* if no moveto occurs, we will close the figure here */ - lastmove.x = pdcattr->ptlCurrent.x; - lastmove.y = pdcattr->ptlCurrent.y; - - /* now let's draw */ - for ( i = 0; i < cCount; i++ ) - { - if ( lpbTypes[i] == PT_MOVETO ) - { - IntGdiMoveToEx( dc, lppt[i].x, lppt[i].y, NULL, FALSE ); - lastmove.x = pdcattr->ptlCurrent.x; - lastmove.y = pdcattr->ptlCurrent.y; - } - else if ( lpbTypes[i] & PT_LINETO ) - IntGdiLineTo( dc, lppt[i].x, lppt[i].y ); - else if ( lpbTypes[i] & PT_BEZIERTO ) - { - POINT pts[4]; - pts[0].x = pdcattr->ptlCurrent.x; - pts[0].y = pdcattr->ptlCurrent.y; - RtlCopyMemory(pts + 1, &lppt[i], sizeof(POINT) * 3); - IntGdiPolyBezier(dc, pts, 4); - i += 2; - } - else _SEH2_LEAVE; - - if ( lpbTypes[i] & PT_CLOSEFIGURE ) - { - if ( PATH_IsPathOpen(dc->dclevel) ) - { - pPath = PATH_LockPath( dc->dclevel.hPath ); - if (pPath) - { - IntGdiCloseFigure( pPath ); - PATH_UnlockPath( pPath ); - } - } - else IntGdiLineTo( dc, lastmove.x, lastmove.y ); - } - } - + switch (lpbTypes[i]) + { + case PT_MOVETO: + if (num_pts >= 2) IntGdiPolyline( dc, line_pts, num_pts ); + num_pts = 0; + line_pts[num_pts++] = lppt[i]; + break; + case PT_LINETO: + case (PT_LINETO | PT_CLOSEFIGURE): + line_pts[num_pts++] = lppt[i]; + break; + case PT_BEZIERTO: + bzr[0].x = line_pts[num_pts - 1].x; + bzr[0].y = line_pts[num_pts - 1].y; + RtlCopyMemory( &bzr[1], &lppt[i], 3 * sizeof(POINT) ); + + if ((bzr_pts = GDI_Bezier( bzr, 4, &num_bzr_pts ))) + { + size = num_pts + (cCount - i) + num_bzr_pts; + if (space < size) + { + space_old = space; + space = size * 2; + line_pts_old = line_pts; + line_pts = ExAllocatePoolWithTag(PagedPool, space * sizeof(POINT), TAG_SHAPE); + if (!line_pts) _SEH2_LEAVE; + RtlCopyMemory(line_pts, line_pts_old, space_old * sizeof(POINT)); + ExFreePoolWithTag(line_pts_old, TAG_SHAPE); + } + RtlCopyMemory( &line_pts[num_pts], &bzr_pts[1], (num_bzr_pts - 1) * sizeof(POINT) ); + num_pts += num_bzr_pts - 1; + ExFreePoolWithTag(bzr_pts, TAG_BEZIER); + } + i += 2; + break; + } + if (lpbTypes[i] & PT_CLOSEFIGURE) line_pts[num_pts++] = line_pts[0]; + } + + if (num_pts >= 2) IntGdiPolyline( dc, line_pts, num_pts ); + IntGdiMoveToEx( dc, line_pts[num_pts - 1].x, line_pts[num_pts - 1].y, NULL, TRUE ); + ExFreePoolWithTag(line_pts, TAG_SHAPE); result = TRUE; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -497,8 +534,8 @@ return result; } - /* - * @unimplemented +/* + * @implemented */ BOOL APIENTRY @@ -508,8 +545,32 @@ IN INT y, OUT OPTIONAL LPPOINT pptOut) { - UNIMPLEMENTED; - return FALSE; + PDC dc; + BOOL Ret; + POINT Point; + + dc = DC_LockDc(hdc); + if (!dc) return FALSE; + + Ret = IntGdiMoveToEx(dc, x, y, &Point, TRUE); + + if (pptOut) + { + _SEH2_TRY + { + ProbeForWrite( pptOut, sizeof(POINT), 1); + RtlCopyMemory( pptOut, &Point, sizeof(POINT)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + Ret = FALSE; + } + _SEH2_END; + } + DC_UnlockDc(dc); + + return Ret; } /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Thu Oct 20 12:02:15 2011 @@ -62,6 +62,18 @@ pPath->pFlags[pPath->numEntriesUsed-1]|=PT_CLOSEFIGURE; pPath->newStroke=TRUE; } +} + +/* MSDN: This fails if the device coordinates exceed 27 bits, or if the converted + logical coordinates exceed 32 bits. */ +BOOL +FASTCALL +GdiPathDPtoLP(PDC pdc, PPOINT ppt, INT count) +{ + XFORMOBJ xo; + + XFORMOBJ_vInit(&xo, &pdc->dclevel.mxDeviceToWorld); + return XFORMOBJ_bApplyXform(&xo, XF_LTOL, count, (PPOINTL)ppt, (PPOINTL)ppt); } /* PATH_FillPath @@ -722,6 +734,103 @@ BOOL FASTCALL +PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints) +{ + PPATH pPath; + POINT lastmove, orig_pos; + INT i; + PDC_ATTR pdcattr; + BOOL State = FALSE, Ret = FALSE; + + pPath = PATH_LockPath( dc->dclevel.hPath ); + if (!pPath) return FALSE; + + if ( pPath->state != PATH_Open ) + { + PATH_UnlockPath( pPath ); + return FALSE; + } + + pdcattr = dc->pdcattr; + + lastmove.x = orig_pos.x = pdcattr->ptlCurrent.x; + lastmove.y = orig_pos.y = pdcattr->ptlCurrent.y; + + for (i = pPath->numEntriesUsed - 1; i >= 0; i--) + { + if (pPath->pFlags[i] == PT_MOVETO) + { + lastmove.x = pPath->pPoints[i].x; + lastmove.y = pPath->pPoints[i].y; + if (!GdiPathDPtoLP(dc, &lastmove, 1)) + { + PATH_UnlockPath( pPath ); + return FALSE; + } + break; + } + } + + for (i = 0; i < cbPoints; i++) + { + if (types[i] == PT_MOVETO) + { + pPath->newStroke = TRUE; + lastmove.x = pts[i].x; + lastmove.y = pts[i].y; + } + else if((types[i] & ~PT_CLOSEFIGURE) == PT_LINETO) + { + PATH_LineTo(dc, pts[i].x, pts[i].y); + } + else if(types[i] == PT_BEZIERTO) + { + if (!((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO) + && ((types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO))) + goto err; + PATH_PolyBezierTo(dc, &(pts[i]), 3); + i += 2; + } + else + goto err; + + pdcattr->ptlCurrent.x = pts[i].x; + pdcattr->ptlCurrent.y = pts[i].y; + State = TRUE; + + if (types[i] & PT_CLOSEFIGURE) + { + pPath->pFlags[pPath->numEntriesUsed-1] |= PT_CLOSEFIGURE; + pPath->newStroke = TRUE; + pdcattr->ptlCurrent.x = lastmove.x; + pdcattr->ptlCurrent.y = lastmove.y; + State = TRUE; + } + } + Ret = TRUE; + goto Exit; + +err: + if ((pdcattr->ptlCurrent.x != orig_pos.x) || (pdcattr->ptlCurrent.y != orig_pos.y)) + { + pPath->newStroke = TRUE; + pdcattr->ptlCurrent.x = orig_pos.x; + pdcattr->ptlCurrent.y = orig_pos.y; + State = TRUE; + } +Exit: + if (State) // State change? + { + pdcattr->ptfxCurrent = pdcattr->ptlCurrent; + CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx + pdcattr->ulDirty_ &= ~(DIRTY_PTLCURRENT|DIRTY_PTFXCURRENT|DIRTY_STYLESTATE); + } + PATH_UnlockPath( pPath ); + return Ret; +} + +BOOL +FASTCALL PATH_Polyline ( PDC dc, const POINT *pts, DWORD cbPoints ) { POINT pt; @@ -1467,7 +1576,7 @@ FASTCALL PATH_WidenPath(DC *dc) { - INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; + INT i, j, numStrokes, numOldStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; BOOL ret = FALSE; PPATH pPath, pNewPath, *pStrokes = NULL, *pOldStrokes, pUpPath, pDownPath; EXTLOGPEN *elp; @@ -1554,6 +1663,7 @@ { pStrokes[numStrokes - 1]->state = PATH_Closed; } + numOldStrokes = numStrokes; numStrokes++; j = 0; if (numStrokes == 1) @@ -1563,7 +1673,7 @@ pOldStrokes = pStrokes; // Save old pointer. pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH); if (!pStrokes) return FALSE; - RtlCopyMemory(pStrokes, pOldStrokes, numStrokes * sizeof(PPATH)); + RtlCopyMemory(pStrokes, pOldStrokes, numOldStrokes * sizeof(PPATH)); ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer. } if (!pStrokes) return FALSE; @@ -2392,7 +2502,11 @@ memcpy(Types, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed); /* Convert the points to logical coordinates */ - IntDPtoLP(dc, Points, pPath->numEntriesUsed); + if (!GdiPathDPtoLP(dc, Points, pPath->numEntriesUsed)) + { + EngSetLastError(ERROR_ARITHMETIC_OVERFLOW); + _SEH2_LEAVE; + } ret = pPath->numEntriesUsed; }
13 years
1
0
0
0
[jimtabor] 54209: [Win32k] - Fix crash in PATH_ExtTextOut. See bug 6587. - Sync Information: Huw Davies <huw@codeweavers.com> : Add support for ETO_PDY and improve world transform support. Massimo ...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Wed Oct 19 23:50:54 2011 New Revision: 54209 URL:
http://svn.reactos.org/svn/reactos?rev=54209&view=rev
Log: [Win32k] - Fix crash in PATH_ExtTextOut. See bug 6587. - Sync Information: Huw Davies <huw(a)codeweavers.com> : Add support for ETO_PDY and improve world transform support. Massimo Del Fedele <max(a)veneto.com> : Fix PATH_add_outline when mapping mode != MM_TEXT. PATH_ExtTextOut remove incorrect shift to DC origin. Correctly handle space char on Path_ExtTextOut(). Dmitry Timoshkov <dmitry(a)codeweavers.com> : The MAT2 parameter of GetGlyphOutline is mandatory. Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Wed Oct 19 23:50:54 2011 @@ -1909,7 +1909,6 @@ pt.x = x + int_from_fixed(header->pfxStart.x); pt.y = y - int_from_fixed(header->pfxStart.y); - IntLPtoDP(dc, &pt, 1); PATH_AddEntry(pPath, &pt, PT_MOVETO); curve = (TTPOLYCURVE *)(header + 1); @@ -1928,7 +1927,6 @@ { pt.x = x + int_from_fixed(curve->apfx[i].x); pt.y = y - int_from_fixed(curve->apfx[i].y); - IntLPtoDP(dc, &pt, 1); PATH_AddEntry(pPath, &pt, PT_LINETO); } break; @@ -1947,13 +1945,11 @@ pts[0].x = x + int_from_fixed(ptfx.x); pts[0].y = y - int_from_fixed(ptfx.y); - IntLPtoDP(dc, &pts[0], 1); for (i = 0; i < curve->cpfx; i++) { pts[i + 1].x = x + int_from_fixed(curve->apfx[i].x); pts[i + 1].y = y - int_from_fixed(curve->apfx[i].y); - IntLPtoDP(dc, &pts[i + 1], 1); } PATH_BezierTo(pPath, pts, curve->cpfx + 1); @@ -1986,37 +1982,13 @@ LPCWSTR str, UINT count, const INT *dx) { unsigned int idx; - double cosEsc, sinEsc; - PDC_ATTR pdcattr; - PTEXTOBJ TextObj; - LOGFONTW lf; - POINTL org; - INT offset = 0, xoff = 0, yoff = 0; + POINT offset = {0, 0}; if (!count) return TRUE; - pdcattr = dc->pdcattr; - - TextObj = RealizeFontInit( pdcattr->hlfntNew); - if ( !TextObj ) return FALSE; - - FontGetObject( TextObj, sizeof(lf), &lf); - TEXTOBJ_UnlockText(TextObj); - - if (lf.lfEscapement != 0) - { - cosEsc = cos(lf.lfEscapement * M_PI / 1800); - sinEsc = sin(lf.lfEscapement * M_PI / 1800); - } else - { - cosEsc = 1; - sinEsc = 0; - } - - org = dc->ptlDCOrig; - for (idx = 0; idx < count; idx++) { + MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; GLYPHMETRICS gm; DWORD dwSize; void *outline; @@ -2027,36 +1999,44 @@ &gm, 0, NULL, - NULL, + &identity, TRUE); - if (!dwSize) return FALSE; - - outline = ExAllocatePoolWithTag(PagedPool, dwSize, TAG_PATH); - if (!outline) return FALSE; - - ftGdiGetGlyphOutline( dc, - str[idx], - GGO_GLYPH_INDEX | GGO_NATIVE, - &gm, - dwSize, - outline, - NULL, - TRUE); - - PATH_add_outline(dc, org.x + x + xoff, org.x + y + yoff, outline, dwSize); - - ExFreePoolWithTag(outline, TAG_PATH); + if (dwSize == GDI_ERROR) return FALSE; + + /* add outline only if char is printable */ + if (dwSize) + { + outline = ExAllocatePoolWithTag(PagedPool, dwSize, TAG_PATH); + if (!outline) return FALSE; + + ftGdiGetGlyphOutline( dc, + str[idx], + GGO_GLYPH_INDEX | GGO_NATIVE, + &gm, + dwSize, + outline, + &identity, + TRUE); + + PATH_add_outline(dc, x + offset.x, y + offset.y, outline, dwSize); + + ExFreePoolWithTag(outline, TAG_PATH); + } if (dx) { - offset += dx[idx]; - xoff = offset * cosEsc; - yoff = offset * -sinEsc; + if (flags & ETO_PDY) + { + offset.x += dx[idx * 2]; + offset.y += dx[idx * 2 + 1]; + } + else + offset.x += dx[idx]; } else { - xoff += gm.gmCellIncX; - yoff += gm.gmCellIncY; + offset.x += gm.gmCellIncX; + offset.y += gm.gmCellIncY; } } return TRUE;
13 years
1
0
0
0
[khornicek] 54208: [POWERCFG] Sync with the english resource file to fix some misplaced controls.
by khornicek@svn.reactos.org
Author: khornicek Date: Wed Oct 19 21:40:45 2011 New Revision: 54208 URL:
http://svn.reactos.org/svn/reactos?rev=54208&view=rev
Log: [POWERCFG] Sync with the english resource file to fix some misplaced controls. Modified: trunk/reactos/dll/cpl/powercfg/lang/cs-CZ.rc Modified: trunk/reactos/dll/cpl/powercfg/lang/cs-CZ.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/lang/cs-C…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/lang/cs-CZ.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/powercfg/lang/cs-CZ.rc [iso-8859-1] Wed Oct 19 21:40:45 2011 @@ -1,120 +1,118 @@ -// Czech (cz) resources by tykef (at atlas cz) - LANGUAGE LANG_CZECH, SUBLANG_DEFAULT -IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 250, 220 +IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 252, 237 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Schémata napájení" FONT 8, "MS Shell Dlg" BEGIN - ICON IDI_ACDC, IDI_ACDC, 5,5,20,20 + ICON IDI_ACDC, IDI_ACDC, 7, 7, 28, 22 LTEXT "Vyberte napájecí schéma, které se nejvíce hodí pro tento poèítaè. Vechny zmìny nastavení se uloí do vybraného schématu.", - -1,45,13,194,36 - GROUPBOX "&Schéma napájení", -1, 7,57,240,46 - COMBOBOX IDC_ENERGYLIST, 14,70,224,92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Uloit jako...", IDC_SAVEAS_BTN, 100,85,75,15,WS_DISABLED - PUSHBUTTON "&Odstranit", IDC_DELETE_BTN, 180,85,55,15,WS_DISABLED - GROUPBOX "Neznámý", IDC_GRPDETAIL, 7,108,240,105 - LTEXT "Pokud je poèítaè:",IDC_SAT,15,120,60,10 - LTEXT "Pøipojen",IDC_SAC,100,120,45,15 - ICON IDI_AC, IDC_IAC, 75,115,25,15 - LTEXT "Funguje na baterie",IDC_SDC,197,120,45,15 - ICON IDI_DC, IDC_IDC, 165,115,25,15 - LTEXT "Vypnout &monitor:",IDC_MONITOR,15,145,80,10 - COMBOBOX IDC_MONITORACLIST, 100,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_MONITORDCLIST, 175,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Vypnout pevné &disky:",IDC_DISK,15,160,80,10 - COMBOBOX IDC_DISKACLIST, 100,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_DISKDCLIST, 175,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Úsporný &reim:",IDC_STANDBY,15,180,80,10 - COMBOBOX IDC_STANDBYACLIST, 100,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_STANDBYDCLIST, 175,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Reim spánku:",IDC_HYBERNATE,15,195,80,10 - COMBOBOX IDC_HYBERNATEACLIST, 100,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_HYBERNATEDCLIST, 175,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + -1,37, 6, 209, 36 + GROUPBOX "&Schéma napájení", -1, 6, 43, 240, 50 + COMBOBOX IDC_ENERGYLIST, 14, 54, 224, 92, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL + PUSHBUTTON "&Uloit jako...", IDC_SAVEAS_BTN, 109, 72, 70, 14, WS_DISABLED + PUSHBUTTON "&Odstranit", IDC_DELETE_BTN, 183, 72, 55, 14, WS_DISABLED + GROUPBOX "Neznámý", IDC_GRPDETAIL, 6, 95, 240, 136 + LTEXT "Pokud je poèítaè:",IDC_SAT, 12, 109, 60, 12 + LTEXT "Pøipojen",IDC_SAC, 123, 110, 45, 15 + ICON IDI_AC, IDC_IAC, 97, 108, 21, 20 + LTEXT "Funguje na baterie",IDC_SDC, 195, 110, 45, 15 + ICON IDI_DC, IDC_IDC, 170, 108, 21, 20 + LTEXT "Vypnout &monitor:",IDC_MONITOR, 13, 148, 84, 10 + COMBOBOX IDC_MONITORACLIST, 100, 145, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_MONITORDCLIST, 173, 145, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Vypnout pevné &disky:",IDC_DISK, 13, 171, 84, 10 + COMBOBOX IDC_DISKACLIST, 100, 167, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_DISKDCLIST, 173, 167, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Úsporný &reim:",IDC_STANDBY, 13, 191, 84, 10 + COMBOBOX IDC_STANDBYACLIST, 100, 188, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_STANDBYDCLIST, 173, 188, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Reim spánku:",IDC_HYBERNATE, 13, 212, 84, 10 + COMBOBOX IDC_HYBERNATEACLIST, 100, 209, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HYBERNATEDCLIST, 173, 209, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END -IDD_PROPPAGEALARMS DIALOGEX DISCARDABLE 0, 0, 250, 220 +IDD_PROPPAGEALARMS DIALOGEX DISCARDABLE 0, 0, 252, 237 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Varování" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Varování o nízkém stavu baterie",-1,10,15,235,95 CONTROL "Aktivovat &varování o nízkém stavu baterie, kdy úroveò nabití dosáhne:",IDC_ALARM1, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 - LTEXT "neznámá",IDC_ALARMVALUE1,200,25,40,10 - LTEXT "0%",-1,20,40,15,15 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 15, 17, 190, 15 + LTEXT "neznámá",IDC_ALARMVALUE1, 209, 20, 33, 10 + LTEXT "0%",-1, 28, 43, 15, 10 CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | - TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 - LTEXT "100%",-1,215,40,25,10 - PUSHBUTTON "&Akce pøi varování...",-1,20,70,70,15,WS_DISABLED - LTEXT "Oznámení:",-1,95,70,50,10 - LTEXT "Neznámé",IDC_ALARMMSG1,145,70,95,10 - LTEXT "Akce:",-1,95,80,45,10 - LTEXT "Neznámá",IDC_ALARMAKTION1,145,80,95,10 - LTEXT "Spustit program:",-1,95,90,50,10 - LTEXT "Neznámý",IDC_ALARMPROG1,150,90,40,10 + TBS_AUTOTICKS | WS_TABSTOP, 42, 45, 170, 15 + LTEXT "100%", -1,214, 43, 25, 10 + PUSHBUTTON "&Akce pøi varování...",-1, 17, 69, 70, 14,WS_DISABLED + LTEXT "Oznámení:",-1, 95, 71, 57, 10 + LTEXT "Neznámé",IDC_ALARMMSG1, 154, 71, 84, 10 + LTEXT "Akce:",-1, 95, 83, 55, 10 + LTEXT "Neznámá",IDC_ALARMAKTION1, 154, 83, 84, 10 + LTEXT "Spustit program:",-1, 95, 95, 55, 10 + LTEXT "Neznámý",IDC_ALARMPROG1, 154, 95, 84, 10 - GROUPBOX "Varování o kritickém stavu baterie",-1,10,115,235,95 + GROUPBOX "Varování o kritickém stavu baterie",-1, 6, 120, 239, 106 CONTROL "Aktivovat varování o &kritickém stavu baterie, kdy úroveò nabití dosáhne:",IDC_ALARM2, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 - LTEXT "neznámá",IDC_ALARMVALUE2,200,125,40,10 - LTEXT "0%",-1,20,140,15,15 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 15, 131, 180, 15 + LTEXT "neznámá",IDC_ALARMVALUE2, 209, 133, 33, 10 + LTEXT "0%",-1, 28, 154, 15, 10 CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | - TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 - LTEXT "100%",-1,215,140,25,10 - PUSHBUTTON "Akce &pøi varování...",-1,20,170,70,15,WS_DISABLED - LTEXT "Oznámení:",-1,95,170,50,10 - LTEXT "Neznámé",IDC_ALARMMSG2,145,170,95,10 - LTEXT "Akce:",-1,95,180,45,10 - LTEXT "Neznámá",IDC_ALARMAKTION2,145,180,95,10 - LTEXT "Spustit program:",-1,95,190,50,10 - LTEXT "Neznámý",IDC_ALARMPROG2,150,190,40,10 + TBS_AUTOTICKS | WS_TABSTOP, 42, 158, 170, 15 + LTEXT "100%",-1, 214, 154, 25, 10 + PUSHBUTTON "Akce &pøi varování...",-1, 17, 183, 70, 14, WS_DISABLED + LTEXT "Oznámení:",-1, 95, 185, 50, 10 + LTEXT "Neznámé",IDC_ALARMMSG2, 154, 185, 84, 10 + LTEXT "Akce:",-1, 95, 198, 45, 10 + LTEXT "Neznámá",IDC_ALARMAKTION2, 154, 198, 84, 10 + LTEXT "Spustit program:",-1, 95, 211, 50, 10 + LTEXT "Neznámý",IDC_ALARMPROG2, 154, 211, 84, 10 END -IDD_PROPPAGEADVANCED DIALOGEX DISCARDABLE 0, 0, 250, 220 +IDD_PROPPAGEADVANCED DIALOGEX DISCARDABLE 0, 0, 252, 237 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Upøesnit" FONT 8, "MS Shell Dlg" BEGIN - ICON IDI_ACDC,IDI_ACDC,5,5,20,20 - LTEXT "Vyberte, které nastavení sníené spotøeby chcete pouít.",-1,30,5,205,20 - GROUPBOX "Monosti",-1,5,35,225,55 + ICON IDI_ACDC,IDI_ACDC, 7, 7, 20, 20 + LTEXT "Vyberte, které nastavení sníené spotøeby chcete pouít.",-1, 37, 6, 207, 20 + GROUPBOX "Monosti",-1, 6, 30, 240, 65 CONTROL "Vdy zobrazovat &ikonu na hlavním panelu",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,45,200,10 + WS_TABSTOP, 17, 43, 220, 10 CONTROL "Dotázat se na &heslo pøi pøechodu z úsporného reimu",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,55,200,10 + WS_TABSTOP, 17, 60, 220, 10 CONTROL "&Sníit jas displeje pøi chodu na baterie.",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,15,65,200,10 - GROUPBOX "Tlaèítka napájení",-1,5,100,230,105 - LTEXT "&Pøi sklopení displeje pøenosného poèítaèe:", IDC_SLIDCLOSE,10,110,210,10 - COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_TABSTOP, 17, 78, 220, 10 + GROUPBOX "Tlaèítka napájení",-1, 6, 101, 240, 127 + LTEXT "&Pøi sklopení displeje pøenosného poèítaèe:", IDC_SLIDCLOSE, 15, 115, 222, 10 + COMBOBOX IDC_LIDCLOSE, 15, 127, 220, 90, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Pøi stisknutí tlaèítka &napájení:", IDC_SPOWERBUTTON,10,135,210,10 - COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | + LTEXT "Pøi stisknutí tlaèítka &napájení:", IDC_SPOWERBUTTON, 15, 153, 222, 10 + COMBOBOX IDC_POWERBUTTON, 15, 165, 220, 90, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Pøi stisknutí tlaèítka reimu &spánku:", IDC_SSLEEPBUTTON,10,165,210,10 - COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | + LTEXT "Pøi stisknutí tlaèítka reimu &spánku:", IDC_SSLEEPBUTTON, 15, 191, 222, 10 + COMBOBOX IDC_SLEEPBUTTON, 15, 203, 220, 90, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END -IDD_PROPPAGEHIBERNATE DIALOGEX DISCARDABLE 0, 0, 250, 220 +IDD_PROPPAGEHIBERNATE DIALOGEX DISCARDABLE 0, 0, 252, 237 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Reim spánku" FONT 8, "MS Shell Dlg" BEGIN - ICON IDI_SCREEN,IDI_SCREEN,5,5,20,20 + ICON IDI_HIBERNATE,IDI_HIBERNATE, 7, 7, 20, 20 LTEXT "Pokud Vá poèítaè pøejde do reimu spánku, uloí obsah své pamìti na pevný disk a vypne se. Po opìtovném sputìní se vrátí do pùvodního stavu.", - -1,35,5,195,35 - GROUPBOX "Reim spánku",-1,5,45,235,25 + -1, 37, 6, 210, 35 + GROUPBOX "Reim spánku",-1, 6, 41, 240, 32 CONTROL "Zapnout funkci reim &spánku",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,10,55,210,10 - GROUPBOX "Místo na disku potøebné pro reim spánku",-1,5,80,240,60 - LTEXT "Volné místo:",-1,10,90,100,10 - LTEXT "Neznámé",IDC_FREESPACE,120,90,70,10 - LTEXT "Potøebné místo na disku:",-1,10,100,115,10 - LTEXT "Neznámé",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 - LTEXT "Pro funkci reim spánku musíte uvolnit místo na disku. ",IDC_TOLESSFREESPACE,10,115,220,20 + WS_TABSTOP, 17, 55, 210, 10 + GROUPBOX "Místo na disku potøebné pro reim spánku",-1, 6, 80, 240, 76 + LTEXT "Volné místo:",-1, 15, 95, 140, 10 + LTEXT "Neznámé",IDC_FREESPACE, 160, 95, 80, 10 + LTEXT "Potøebné místo na disku:",-1, 15, 115, 140, 10 + LTEXT "Neznámé",IDC_SPACEFORHIBERNATEFILE, 160, 115, 80, 10 + LTEXT "Pro funkci reim spánku musíte uvolnit místo na disku. ",IDC_TOLESSFREESPACE, 15, 135, 224, 20 END STRINGTABLE @@ -159,8 +157,6 @@ IDS_TIMEOUT15 "Po 5 hodinách" IDS_TIMEOUT16 "Nikdy" - IDS_DEL_SCHEME "Urèitì chcete vymazat toto schéma napájení?" + IDS_DEL_SCHEME "Opravdu si pøejete smazat toto schéma napájení?" IDS_DEL_SCHEME_TITLE "Smazat schéma" END - -
13 years
1
0
0
0
[rharabien] 54207: - Fix Linux build
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 21:02:41 2011 New Revision: 54207 URL:
http://svn.reactos.org/svn/reactos?rev=54207&view=rev
Log: - Fix Linux build Modified: trunk/reactos/dll/win32/user32/include/user32.h Modified: trunk/reactos/dll/win32/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Wed Oct 19 21:02:41 2011 @@ -21,7 +21,7 @@ #include <windows.h> #include <windowsx.h> #include <winnls32.h> -#include <Strsafe.h> +#include <strsafe.h> #include <ndk/cmfuncs.h> #include <ndk/kefuncs.h> #include <ndk/obfuncs.h>
13 years
1
0
0
0
[rharabien] 54206: - Really fix build
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 20:18:42 2011 New Revision: 54206 URL:
http://svn.reactos.org/svn/reactos?rev=54206&view=rev
Log: - Really fix build Modified: trunk/reactos/dll/win32/user32/include/user32.h Modified: trunk/reactos/dll/win32/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Wed Oct 19 20:18:42 2011 @@ -21,6 +21,7 @@ #include <windows.h> #include <windowsx.h> #include <winnls32.h> +#include <Strsafe.h> #include <ndk/cmfuncs.h> #include <ndk/kefuncs.h> #include <ndk/obfuncs.h>
13 years
1
0
0
0
[rharabien] 54205: - Fix build
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 20:08:25 2011 New Revision: 54205 URL:
http://svn.reactos.org/svn/reactos?rev=54205&view=rev
Log: - Fix build Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Wed Oct 19 20:08:25 2011 @@ -69,7 +69,7 @@ PTL ptl; PPROCESSINFO ppi; struct _USER_MESSAGE_QUEUE* MessageQueue; - struct _KL* KeyboardLayout; + struct tagKL* KeyboardLayout; PCLIENTTHREADINFO pcti; struct _DESKTOP* rpdesk; PDESKTOPINFO pDeskInfo; @@ -188,7 +188,7 @@ LIST_ENTRY PrivateFontListHead; FAST_MUTEX DriverObjListLock; LIST_ENTRY DriverObjListHead; - struct _KL* KeyboardLayout; // THREADINFO only + struct tagKL* KeyboardLayout; // THREADINFO only W32HEAP_USER_MAPPING HeapMappings; struct _GDI_POOL *pPoolDcAttr; struct _GDI_POOL *pPoolBrushAttr;
13 years
1
0
0
0
[rharabien] 54204: - Forgotten file
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 20:07:41 2011 New Revision: 54204 URL:
http://svn.reactos.org/svn/reactos?rev=54204&view=rev
Log: - Forgotten file Modified: trunk/reactos/dll/win32/user32/windows/input.c Modified: trunk/reactos/dll/win32/user32/windows/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] Wed Oct 19 20:07:41 2011 @@ -149,29 +149,24 @@ LPSTR lpString, int nSize) { - LPWSTR intermediateString = - HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR)); - int ret = 0; - UINT wstrLen = 0; + LPWSTR pwszBuf; + UINT cchBuf = 0; + int iRet = 0; BOOL defChar = FALSE; - if (!intermediateString) + pwszBuf = HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR)); + if (!pwszBuf) return 0; - ret = GetKeyNameTextW(lParam, intermediateString, nSize); - if (ret == 0) - { - lpString[0] = 0; - return 0; - } - - wstrLen = wcslen(intermediateString); - ret = WideCharToMultiByte(CP_ACP, 0, - intermediateString, wstrLen, - lpString, nSize, ".", &defChar); - lpString[ret] = 0; - HeapFree(GetProcessHeap(), 0, intermediateString); - - return ret; + + cchBuf = NtUserGetKeyNameText(lParam, pwszBuf, nSize); + + iRet = WideCharToMultiByte(CP_ACP, 0, + pwszBuf, cchBuf, + lpString, nSize, ".", &defChar); // FIXME: do we need defChar? + lpString[iRet] = 0; + HeapFree(GetProcessHeap(), 0, pwszBuf); + + return iRet; } /* @@ -211,7 +206,6 @@ return TRUE; } - /* * @implemented */ @@ -220,7 +214,6 @@ { return NtUserGetKeyboardLayoutName(pwszKLID); } - /* * @implemented @@ -253,12 +246,18 @@ * @implemented */ HKL WINAPI -LoadKeyboardLayoutA(LPCSTR pwszKLID, +LoadKeyboardLayoutA(LPCSTR pszKLID, UINT Flags) { - return NtUserLoadKeyboardLayoutEx(NULL, 0, NULL, NULL, NULL, - strtoul(pwszKLID, NULL, 16), - Flags); + WCHAR wszKLID[16]; + + if (!MultiByteToWideChar(CP_ACP, 0, pszKLID, -1, + wszKLID, sizeof(wszKLID)/sizeof(wszKLID[0]))) + { + return FALSE; + } + + return LoadKeyboardLayoutW(wszKLID, Flags); } /* @@ -268,11 +267,68 @@ LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags) { - // Look at revision 25596 to see how it's done in windows. - // We will do things our own way. Also be compatible too! - return NtUserLoadKeyboardLayoutEx(NULL, 0, NULL, NULL, NULL, - wcstoul(pwszKLID, NULL, 16), - Flags); + DWORD dwhkl, dwType, dwSize; + UNICODE_STRING ustrKbdName; + UNICODE_STRING ustrKLID; + WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"; + WCHAR wszLayoutId[10], wszNewKLID[10]; + HKEY hKey; + + /* LOWORD of dwhkl is Locale Identifier */ + dwhkl = wcstol(pwszKLID, NULL, 16); + + if (Flags & KLF_SUBSTITUTE_OK) + { + /* Check substitutes key */ + if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + { + dwSize = sizeof(wszNewKLID); + if (RegQueryValueExW(hKey, pwszKLID, NULL, &dwType, (LPBYTE)wszNewKLID, &dwSize) == ERROR_SUCCESS) + { + /* Use new KLID value */ + pwszKLID = wszNewKLID; + } + + /* Close the key now */ + RegCloseKey(hKey); + } + } + + /* Append KLID at the end of registry key */ + StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID); + + /* Open layout registry key for read */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + { + dwSize = sizeof(wszLayoutId); + if (RegQueryValueExW(hKey, L"Layout Id", NULL, &dwType, (LPBYTE)wszLayoutId, &dwSize) == ERROR_SUCCESS) + { + /* If Layout Id is specified, use this value | f000 as HIWORD */ + /* FIXME: Microsoft Office expects this value to be something specific + * for Japanese and Korean Windows with an IME the value is 0xe001 + * We should probably check to see if an IME exists and if so then + * set this word properly. + */ + dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16; + } + + /* Close the key now */ + RegCloseKey(hKey); + } + else + ERR("RegOpenKeyExW failed!\n"); + + /* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */ + if (!HIWORD(dwhkl)) + dwhkl |= dwhkl << 16; + + ZeroMemory(&ustrKbdName, sizeof(ustrKbdName)); + RtlInitUnicodeString(&ustrKLID, pwszKLID); + return NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, + NULL, &ustrKLID, + dwhkl, Flags); } /* @@ -477,7 +533,7 @@ VkKeyScanExW(WCHAR ch, HKL dwhkl) { - return (SHORT) NtUserVkKeyScanEx(ch, dwhkl, TRUE); + return (SHORT)NtUserVkKeyScanEx(ch, dwhkl, TRUE); } @@ -487,7 +543,7 @@ SHORT WINAPI VkKeyScanW(WCHAR ch) { - return (SHORT) NtUserVkKeyScanEx(ch, 0, FALSE); + return (SHORT)NtUserVkKeyScanEx(ch, 0, FALSE); }
13 years
1
0
0
0
[rharabien] 54203: [WIN32K|USER32] - Make keyboard layouts code more compatible - Layouts and kbd files are user objects - Preloaded layouts are added by Winlogon, not win32k - Support Keyboard Lay...
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 20:03:50 2011 New Revision: 54203 URL:
http://svn.reactos.org/svn/reactos?rev=54203&view=rev
Log: [WIN32K|USER32] - Make keyboard layouts code more compatible - Layouts and kbd files are user objects - Preloaded layouts are added by Winlogon, not win32k - Support Keyboard Layout substitutes in registry Modified: trunk/reactos/base/system/winlogon/winlogon.c trunk/reactos/base/system/winlogon/winlogon.h trunk/reactos/boot/bootdata/hivesys_i386.inf trunk/reactos/subsystems/win32/win32k/include/input.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c Modified: trunk/reactos/base/system/winlogon/winlogon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
============================================================================== --- trunk/reactos/base/system/winlogon/winlogon.c [iso-8859-1] (original) +++ trunk/reactos/base/system/winlogon/winlogon.c [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -267,6 +267,65 @@ } +static BOOL +InitKeyboardLayouts() +{ + WCHAR wszKeyName[12], wszKLID[10]; + DWORD dwSize = sizeof(wszKLID), dwType, i; + HKEY hKey; + UINT Flags; + BOOL bRet = FALSE; + + /* Open registry key with preloaded layouts */ + if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey) != ERROR_SUCCESS) + { + ERR("RegOpenKeyExW failed!\n"); + return FALSE; + } + + i = 1; + while(TRUE) + { + /* Read values with integer names only */ + swprintf(wszKeyName, L"%d", i); + if (RegQueryValueExW(hKey, wszKeyName, NULL, &dwType, (LPBYTE)wszKLID, &dwSize) != ERROR_SUCCESS) + { + /* If we loaded at least one layout and there is no more + registry values return TRUE */ + if (i > 1) + bRet = TRUE; + break; + } + + /* Only REG_SZ values are valid */ + if (dwType != REG_SZ) + { + ERR("Wrong type!\n"); + break; + } + + /* Load keyboard layout with given locale id */ + Flags = KLF_SUBSTITUTE_OK; + if (i > 1) + Flags |= KLF_NOTELLSHELL|KLF_REPLACELANG; + else // First layout + Flags |= KLF_ACTIVATE; // |0x40000000 + if (!LoadKeyboardLayoutW(wszKLID, Flags)) + { + ERR("LoadKeyboardLayoutW failed!\n"); + break; + } + + /* Move to the next entry */ + ++i; + } + + /* Close the key now */ + RegCloseKey(hKey); + + return bRet; +} + BOOL DisplayStatusMessage( IN PWLSESSION Session, @@ -390,6 +449,14 @@ } LockWorkstation(WLSession); + /* Load default keyboard layouts */ + if (!InitKeyboardLayouts()) + { + ERR("WL: Could not preload keyboard layouts\n"); + NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse); + ExitProcess(1); + } + if (!StartServicesManager()) { ERR("WL: Could not start services.exe\n"); Modified: trunk/reactos/base/system/winlogon/winlogon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
============================================================================== --- trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] (original) +++ trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -29,6 +29,7 @@ #define USE_GETLASTINPUTINFO #define WIN32_NO_STATUS +#include <stdio.h> #include <windows.h> #include <userenv.h> #include <winwlx.h> Modified: trunk/reactos/boot/bootdata/hivesys_i386.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys_i386…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys_i386.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesys_i386.inf [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -423,6 +423,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000411","Layout File",0x00000000,"kbdja.dll" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000411","Layout Text",0x00000000,"Japanese" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000411","Layout Display Name",0x00000000,"@%SystemRoot%\system32\input.dll,-5061" +HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000411","Layout Id",0x00000000,"0001" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000041c","Layout File",0x00000000,"kbdal.dll" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0000041c","Layout Text",0x00000000,"Albanian" @@ -625,6 +626,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000412","Layout File",0x00000000,"kbdko.dll" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000412","Layout Text",0x00000000,"Korean" HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000412","Layout Display Name",0x00000000,"@%SystemRoot%\system32\input.dll,-5063" +HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000412","Layout Id",0x00000000,"0001" ; Keyboard layouts HKLM,"SYSTEM\CurrentControlSet\Control\Keyboard Layout",,0x00000012 Modified: trunk/reactos/subsystems/win32/win32k/include/input.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -1,31 +1,54 @@ #pragma once #include <ndk/kbd.h> + +typedef struct tagKBDNLSLAYER +{ + USHORT OEMIdentifier; + USHORT LayoutInformation; + UINT NumOfVkToF; + struct _VK_TO_FUNCTION_TABLE *pVkToF; + INT NumOfMouseVKey; + PUSHORT pusMouseVKey; +} KBDNLSLAYER, *PKBDNLSLAYER; + +typedef struct tagKBDFILE +{ + HEAD head; + struct tagKBDFILE *pkfNext; + WCHAR awchKF[20]; + HANDLE hBase; + struct _KBDTABLES *pKbdTbl; + ULONG Size; + PKBDNLSLAYER pKbdNlsTbl; +} KBDFILE, *PKBDFILE; -typedef struct _KL +typedef struct tagKL { - LIST_ENTRY List; - DWORD Flags; - WCHAR Name[KL_NAMELENGTH]; // used w GetKeyboardLayoutName same as wszKLID. - struct _KBDTABLES *KBTables; // KBDTABLES in ndk/kbd.h - HANDLE hModule; - ULONG RefCount; - HKL hkl; - DWORD klid; // Low word - language id. High word - device id. + HEAD head; + struct tagKL *pklNext; + struct tagKL *pklPrev; + DWORD dwKL_Flags; + HKL hkl; + PKBDFILE spkf; + DWORD dwFontSigs; + UINT iBaseCharset; + USHORT CodePage; + WCHAR wchDiacritic; + //PIMEINFOEX piiex; } KL, *PKL; typedef struct _ATTACHINFO { - struct _ATTACHINFO* paiNext; + struct _ATTACHINFO *paiNext; PTHREADINFO pti1; PTHREADINFO pti2; } ATTACHINFO, *PATTACHINFO; extern PATTACHINFO gpai; -#define KBL_UNLOAD 1 -#define KBL_PRELOAD 2 -#define KBL_RESET 4 +/* Keyboard layout undocumented flags */ +#define KLF_UNLOAD 0x20000000 /* Key States */ #define KS_DOWN_BIT 0x80 Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ma…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -286,6 +286,8 @@ } ptiCurrent->MessageQueue = MsqCreateMessageQueue(Thread); ptiCurrent->KeyboardLayout = W32kGetDefaultKeyLayout(); + if (ptiCurrent->KeyboardLayout) + UserReferenceObject(ptiCurrent->KeyboardLayout); ptiCurrent->pEThread = Thread; /* HAAAAAAAACK! This should go to Win32kProcessCallback */ @@ -421,6 +423,8 @@ IntBlockInput(ptiCurrent, FALSE); MsqDestroyMessageQueue(ptiCurrent->MessageQueue); IntCleanupThreadCallbacks(ptiCurrent); + if (ptiCurrent->KeyboardLayout) + UserDereferenceObject(ptiCurrent->KeyboardLayout); /* cleanup user object references stack */ psle = PopEntryList(&ptiCurrent->ReferencesList); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -328,12 +328,6 @@ return STATUS_UNSUCCESSFUL; } KeInitializeTimer(MasterTimer); - - /* Initialize the default keyboard layout */ - if (!UserInitDefaultKeyboardLayout()) - { - ERR("Failed to initialize default keyboard layout!\n"); - } return STATUS_SUCCESS; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -11,66 +11,46 @@ #include <win32k.h> DBG_DEFAULT_CHANNEL(UserKbdLayout); -PKL gpklFirst = NULL; // Keyboard layout list. - -typedef PVOID (*PFNKBDLAYERDESCRIPTOR)(VOID); +PKL gspklBaseLayout = NULL; +PKBDFILE gpkfList = NULL; + +typedef PVOID (*PFN_KBDLAYERDESCRIPTOR)(VOID); /* PRIVATE FUNCTIONS ******************************************************/ +/* + * UserLoadKbdDll + * + * Loads keyboard layout DLL and gets address to KbdTables + */ static BOOL -UserLoadKbdDll(CONST WCHAR *wszKLID, +UserLoadKbdDll(WCHAR *pwszLayoutPath, HANDLE *phModule, PKBDTABLES *pKbdTables) { - NTSTATUS Status; - HKEY hKey; - ULONG cbSize; - PFNKBDLAYERDESCRIPTOR pfnKbdLayerDescriptor; - WCHAR wszLayoutRegKey[256] = L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet\\" - L"Control\\Keyboard Layouts\\"; - WCHAR wszLayoutPath[MAX_PATH] = L"\\SystemRoot\\System32\\"; - - /* Open layout registry key */ - RtlStringCbCatW(wszLayoutRegKey, sizeof(wszLayoutRegKey), wszKLID); - Status = RegOpenKey(wszLayoutRegKey, &hKey); - if (!NT_SUCCESS(Status)) - { - ERR("Failed to open keyboard layouts registry key %ws (%lx)\n", wszKLID, Status); + PFN_KBDLAYERDESCRIPTOR pfnKbdLayerDescriptor; + + /* Load keyboard layout DLL */ + TRACE("Loading Keyboard DLL %ws\n", pwszLayoutPath); + *phModule = EngLoadImage(pwszLayoutPath); + if (!(*phModule)) + { + ERR("Failed to load dll %ws\n", pwszLayoutPath); return FALSE; } - /* Read filename of layout DLL and close the key */ - cbSize = sizeof(wszLayoutPath) - (wcslen(wszLayoutPath) + 1)*sizeof(WCHAR); - Status = RegQueryValue(hKey, - L"Layout File", - REG_SZ, - wszLayoutPath + wcslen(wszLayoutPath), - &cbSize); - ZwClose(hKey); - if (!NT_SUCCESS(Status)) - { - TRACE("Can't get layout filename for %ws (%lx)\n", wszKLID, Status); - return FALSE; - } - - /* Load keyboard layout DLL */ - TRACE("Loading Keyboard DLL %ws\n", wszLayoutPath); - *phModule = EngLoadImage(wszLayoutPath); - if (!(*phModule)) - { - ERR("Failed to load dll %ws\n", wszLayoutPath); - return FALSE; - } - /* Find KbdLayerDescriptor function and get layout tables */ - TRACE("Loaded %ws\n", wszLayoutPath); + TRACE("Loaded %ws\n", pwszLayoutPath); pfnKbdLayerDescriptor = EngFindImageProcAddress(*phModule, "KbdLayerDescriptor"); + + /* FIXME: Windows reads file instead of executing! + It's not safe to kbdlayout DLL in kernel mode! */ if (pfnKbdLayerDescriptor) *pKbdTables = pfnKbdLayerDescriptor(); else - ERR("Error: %ws has no KbdLayerDescriptor()\n", wszLayoutPath); + ERR("Error: %ws has no KbdLayerDescriptor()\n", pwszLayoutPath); if (!pfnKbdLayerDescriptor || !*pKbdTables) { @@ -79,7 +59,7 @@ return FALSE; } -#if 0 // Dump keyboard layout +#if 0 /* Dump keyboard layout */ { unsigned i; PVK_TO_BIT pVkToBit = (*pKbdTables)->pCharModifiers->pVkToBit; @@ -134,300 +114,333 @@ return TRUE; } +/* + * UserLoadKbdFile + * + * Loads keyboard layout DLL and creates KBDFILE object + */ +static PKBDFILE +UserLoadKbdFile(PUNICODE_STRING pwszKLID) +{ + PKBDFILE pkf, pRet = NULL; + NTSTATUS Status; + ULONG cbSize; + HKEY hKey = NULL; + WCHAR wszLayoutPath[MAX_PATH] = L"\\SystemRoot\\System32\\"; + WCHAR wszLayoutRegKey[256] = L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet\\" + L"Control\\Keyboard Layouts\\"; + + /* Create keyboard layout file object */ + pkf = UserCreateObject(gHandleTable, NULL, NULL, otKBDfile, sizeof(KBDFILE)); + if (!pkf) + { + ERR("Failed to create object!\n"); + return NULL; + } + + /* Set keyboard layout name */ + swprintf(pkf->awchKF, L"%wZ", pwszKLID); + + /* Open layout registry key */ + RtlStringCbCatW(wszLayoutRegKey, sizeof(wszLayoutRegKey), pkf->awchKF); + Status = RegOpenKey(wszLayoutRegKey, &hKey); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to open keyboard layouts registry key %ws (%lx)\n", wszLayoutRegKey, Status); + goto cleanup; + } + + /* Read filename of layout DLL */ + cbSize = sizeof(wszLayoutPath) - wcslen(wszLayoutPath)*sizeof(WCHAR); + Status = RegQueryValue(hKey, + L"Layout File", + REG_SZ, + wszLayoutPath + wcslen(wszLayoutPath), + &cbSize); + + if (!NT_SUCCESS(Status)) + { + ERR("Can't get layout filename for %wZ (%lx)\n", pwszKLID, Status); + goto cleanup; + } + + /* Load keyboard file now */ + if (!UserLoadKbdDll(wszLayoutPath, &pkf->hBase, &pkf->pKbdTbl)) + { + ERR("Failed to load %ws dll!\n", wszLayoutPath); + goto cleanup; + } + + /* Update next field */ + pkf->pkfNext = gpkfList; + gpkfList = pkf; + + /* Return keyboard file */ + pRet = pkf; + +cleanup: + if (hKey) + ZwClose(hKey); + if (pkf) + UserDereferenceObject(pkf); // we dont need ptr anymore + if (!pRet) + { + /* We have failed - destroy created object */ + if (pkf) + UserDeleteObject(pkf->head.h, otKBDfile); + } + + return pRet; +} + +/* + * UserLoadKbdLayout + * + * Loads keyboard layout and creates KL object + */ static PKL -UserLoadDllAndCreateKbl(DWORD LocaleId) -{ - PKL pNewKbl; - ULONG hKl; - LANGID langid; - - pNewKbl = ExAllocatePoolWithTag(PagedPool, sizeof(KL), USERTAG_KBDLAYOUT); - - if (!pNewKbl) - { - ERR("Can't allocate memory!\n"); +UserLoadKbdLayout(PUNICODE_STRING pwszKLID, HKL hKL) +{ + PKL pKl; + + /* Create keyboard layout object */ + pKl = UserCreateObject(gHandleTable, NULL, NULL, otKBDlayout, sizeof(KL)); + if (!pKl) + { + ERR("Failed to create object!\n"); return NULL; } - swprintf(pNewKbl->Name, L"%08lx", LocaleId); - - if (!UserLoadKbdDll(pNewKbl->Name, &pNewKbl->hModule, &pNewKbl->KBTables)) - { - ERR("Failed to load %x dll!\n", LocaleId); - ExFreePoolWithTag(pNewKbl, USERTAG_KBDLAYOUT); + pKl->hkl = hKL; + pKl->spkf = UserLoadKbdFile(pwszKLID); + + /* Dereference keyboard layout */ + UserDereferenceObject(pKl); + + /* If we failed, remove KL object */ + if (!pKl->spkf) + { + ERR("UserLoadKbdFile(%wZ) failed!\n", pwszKLID); + UserDeleteObject(pKl->head.h, otKBDlayout); return NULL; } - /* Microsoft Office expects this value to be something specific - * for Japanese and Korean Windows with an IME the value is 0xe001 - * We should probably check to see if an IME exists and if so then - * set this word properly. - */ - langid = PRIMARYLANGID(LANGIDFROMLCID(LocaleId)); - hKl = LocaleId; - - if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) - hKl |= 0xe001 << 16; /* FIXME */ - else hKl |= hKl << 16; - - pNewKbl->hkl = (HKL)(ULONG_PTR) hKl; - pNewKbl->klid = LocaleId; - pNewKbl->Flags = 0; - pNewKbl->RefCount = 0; - - return pNewKbl; -} - + return pKl; +} + +/* + * UnloadKbdFile + * + * Destroys specified Keyboard File object + */ +static +VOID +UnloadKbdFile(PKBDFILE pkf) +{ + PKBDFILE *ppkfLink = &gpkfList; + + /* Find previous object */ + while (*ppkfLink) + { + if (*ppkfLink == pkf) + break; + + ppkfLink = &(*ppkfLink)->pkfNext; + } + + if (*ppkfLink == pkf) + *ppkfLink = pkf->pkfNext; + + EngUnloadImage(pkf->hBase); + UserDeleteObject(pkf->head.h, otKBDfile); +} + +/* + * UserUnloadKbl + * + * Unloads specified Keyboard Layout if possible + */ BOOL -UserInitDefaultKeyboardLayout() -{ - LCID LocaleId; - NTSTATUS Status; - - /* Load keyboard layout for default locale */ - Status = ZwQueryDefaultLocale(FALSE, &LocaleId); - if (NT_SUCCESS(Status)) - { - TRACE("DefaultLocale = %08lx\n", LocaleId); - gpklFirst = UserLoadDllAndCreateKbl(LocaleId); - } - else - ERR("Could not get default locale (%08lx).\n", Status); - - if (!NT_SUCCESS(Status) || !gpklFirst) - { - /* If failed load US keyboard layout */ - ERR("Trying to load US Keyboard Layout.\n"); - LocaleId = 0x409; - - if (!(gpklFirst = UserLoadDllAndCreateKbl(LocaleId))) - { - ERR("Failed to load any Keyboard Layout\n"); +UserUnloadKbl(PKL pKl) +{ + /* According to msdn, UnloadKeyboardLayout can fail + if the keyboard layout identifier was preloaded. */ + if (pKl == gspklBaseLayout) + { + if (pKl->pklNext == pKl->pklPrev) + { + /* There is only one layout */ return FALSE; } - } - - /* Add layout to the list */ - gpklFirst->Flags |= KBL_PRELOAD; - InitializeListHead(&gpklFirst->List); - + + /* Set next layout as default */ + gspklBaseLayout = pKl->pklNext; + } + + if (pKl->head.cLockObj > 1) + { + /* Layout is used by other threads */ + pKl->dwKL_Flags |= KLF_UNLOAD; + return FALSE; + } + + /* Unload the layout */ + pKl->pklPrev->pklNext = pKl->pklNext; + pKl->pklNext->pklPrev = pKl->pklPrev; + UnloadKbdFile(pKl->spkf); + UserDeleteObject(pKl->head.h, otKBDlayout); return TRUE; } +/* + * W32kGetDefaultKeyLayout + * + * Returns default layout for new threads + */ PKL W32kGetDefaultKeyLayout(VOID) { - CONST WCHAR wszDefaultUserPath[] = L"\\REGISTRY\\USER\\.DEFAULT"; - CONST WCHAR wszKeyboardLayoutPath[] = L"\\Keyboard Layout\\Preload"; - WCHAR wszKbdLayoutKey[256], *pwsz; - size_t cbRemaining; - HKEY hKey; - ULONG cbValue; - LCID LayoutLocaleId = 0; - NTSTATUS Status; - PKL pKbl; - UNICODE_STRING CurrentUserPath; - WCHAR wszBuffer[MAX_PATH]; - - /* Try to get default alayout from HKCU\Keyboard Layout\Preload first */ - Status = RtlFormatCurrentUserKeyPath(&CurrentUserPath); - if (NT_SUCCESS(Status)) - { - /* FIXME: We're called very early, so HKEY_CURRENT_USER might not be - available yet. Check this first. */ - RtlStringCbCopyNExW(wszKbdLayoutKey, sizeof(wszKbdLayoutKey), - CurrentUserPath.Buffer, CurrentUserPath.Length, - &pwsz, &cbRemaining, 0); - RtlStringCbCopyW(pwsz, cbRemaining, wszKeyboardLayoutPath); - Status = RegOpenKey(wszKbdLayoutKey, &hKey); - - /* Free CurrentUserPath - we dont need it anymore */ - RtlFreeUnicodeString(&CurrentUserPath); - } - - /* If failed try HKU\.DEFAULT\Keyboard Layout\Preload */ - if (!NT_SUCCESS(Status)) - { - RtlStringCbCopyNExW(wszKbdLayoutKey, sizeof(wszKbdLayoutKey), - wszDefaultUserPath, sizeof(wszDefaultUserPath), - &pwsz, &cbRemaining, 0); - RtlStringCbCopyW(pwsz, cbRemaining, wszKeyboardLayoutPath); - Status = RegOpenKey(wszKbdLayoutKey, &hKey); - } - - if (NT_SUCCESS(Status)) - { - /* Return the first keyboard layout listed there */ - cbValue = sizeof(wszBuffer); - Status = RegQueryValue(hKey, L"1", REG_SZ, wszBuffer, &cbValue); - if (NT_SUCCESS(Status)) - LayoutLocaleId = (LCID)wcstol(wszBuffer, NULL, 16); - else - ERR("RegQueryValue failed (%08lx)\n", Status); - - /* Close the key */ - ZwClose(hKey); - } - else - ERR("Failed to open keyboard layout preload key (%08lx)\n", Status); - - /* If we failed loading settings from registry use US layout */ - if (!LayoutLocaleId) - { - ERR("Assuming default locale for the keyboard layout (0x409 - US)\n"); - LayoutLocaleId = 0x409; - } - - /* Check if layout is already loaded */ - pKbl = gpklFirst; + PKL pKl = gspklBaseLayout; + + if (!pKl) + return NULL; + + /* Return not unloaded layout */ do { - if (pKbl->klid == LayoutLocaleId) - return pKbl; - - pKbl = CONTAINING_RECORD(pKbl->List.Flink, KL, List); - } while (pKbl != gpklFirst); - - /* Load the keyboard layout */ - TRACE("Loading new default keyboard layout.\n"); - pKbl = UserLoadDllAndCreateKbl(LayoutLocaleId); - if (!pKbl) - { - ERR("Failed to load %x!!! Returning any available KL.\n", LayoutLocaleId); - return gpklFirst; - } - - /* Add loaded layout to the list */ - InsertTailList(&gpklFirst->List, &pKbl->List); - return pKbl; -} - + if (!(pKl->dwKL_Flags & KLF_UNLOAD)) + return pKl; + + pKl = pKl->pklPrev; /* Confirmed on Win2k */ + } while(pKl != gspklBaseLayout); + + /* We have not found proper KL */ + return NULL; +} + +/* + * UserHklToKbl + * + * Gets KL object from hkl value + */ PKL UserHklToKbl(HKL hKl) { - PKL pKbl = gpklFirst; + PKL pKl = gspklBaseLayout; + + if (!gspklBaseLayout) + return NULL; + do { - if (pKbl->hkl == hKl) - return pKbl; - - pKbl = CONTAINING_RECORD(pKbl->List.Flink, KL, List); - } while (pKbl != gpklFirst); + if (pKl->hkl == hKl) + return pKl; + + pKl = pKl->pklNext; + } while (pKl != gspklBaseLayout); return NULL; } -BOOL -UserUnloadKbl(PKL pKbl) -{ - /* According to msdn, UnloadKeyboardLayout can fail - if the keyboard layout identifier was preloaded. */ - - if (pKbl->Flags & KBL_PRELOAD) - { - ERR("Attempted to unload preloaded keyboard layout.\n"); - return FALSE; - } - - if (pKbl->RefCount > 0) - { - /* Layout is used by other threads. - Mark it as unloaded and don't do anything else. */ - pKbl->Flags |= KBL_UNLOAD; - } - else - { - //Unload the layout - EngUnloadImage(pKbl->hModule); - RemoveEntryList(&pKbl->List); - ExFreePoolWithTag(pKbl, USERTAG_KBDLAYOUT); - } - - return TRUE; -} - +/* + * co_UserActivateKbl + * + * Activates given layout in specified thread + */ static PKL -co_UserActivateKbl(PTHREADINFO pti, PKL pKbl, UINT Flags) +co_UserActivateKbl(PTHREADINFO pti, PKL pKl, UINT Flags) { PKL pklPrev; pklPrev = pti->KeyboardLayout; - pklPrev->RefCount--; - pti->KeyboardLayout = pKbl; - pKbl->RefCount++; + if (pklPrev) + UserDereferenceObject(pklPrev); + + pti->KeyboardLayout = pKl; + UserReferenceObject(pKl); if (Flags & KLF_SETFORPROCESS) { //FIXME - - } - - if (pklPrev->Flags & KBL_UNLOAD && pklPrev->RefCount == 0) - { - UserUnloadKbl(pklPrev); } // Send WM_INPUTLANGCHANGE to thread's focus window co_IntSendMessage(pti->MessageQueue->FocusWindow, WM_INPUTLANGCHANGE, - 0, // FIXME: put charset here (what is this?) - (LPARAM)pKbl->hkl); //klid + (WPARAM)pKl->iBaseCharset, // FIXME: how to set it? + (LPARAM)pKl->hkl); //hkl return pklPrev; } /* EXPORTS *******************************************************************/ +/* + * UserGetKeyboardLayout + * + * Returns hkl of given thread keyboard layout + */ HKL FASTCALL UserGetKeyboardLayout( DWORD dwThreadId) { NTSTATUS Status; - PETHREAD Thread; + PETHREAD pThread; PTHREADINFO pti; - HKL Ret; + PKL pKl; + HKL hKl; if (!dwThreadId) { pti = PsGetCurrentThreadWin32Thread(); - return pti->KeyboardLayout->hkl; - } - - Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread); + pKl = pti->KeyboardLayout; + return pKl ? pKl->hkl : NULL; + } + + Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &pThread); if (!NT_SUCCESS(Status)) { EngSetLastError(ERROR_INVALID_PARAMETER); return NULL; } - pti = PsGetThreadWin32Thread(Thread); - Ret = pti->KeyboardLayout->hkl; - ObDereferenceObject(Thread); - return Ret; -} - + pti = PsGetThreadWin32Thread(pThread); + pKl = pti->KeyboardLayout; + hKl = pKl ? pKl->hkl : NULL;; + ObDereferenceObject(pThread); + return hKl; +} + +/* + * NtUserGetKeyboardLayoutList + * + * Returns list of loaded keyboard layouts in system + */ UINT APIENTRY NtUserGetKeyboardLayoutList( INT nBuff, - HKL* pHklBuff) + HKL *pHklBuff) { UINT uRet = 0; - PKL pKbl; - - UserEnterShared(); - pKbl = gpklFirst; + PKL pKl; if (!pHklBuff) nBuff = 0; + UserEnterShared(); + + if (!gspklBaseLayout) + return 0; + pKl = gspklBaseLayout; + if (nBuff == 0) { do { uRet++; - pKbl = CONTAINING_RECORD(pKbl->List.Flink, KL, List); - } while (pKbl != gpklFirst); + pKl = pKl->pklNext; + } while (pKl != gspklBaseLayout); } else { @@ -437,16 +450,12 @@ while (uRet < nBuff) { - if (!(pKbl->Flags & KBL_UNLOAD)) - { - pHklBuff[uRet] = pKbl->hkl; - uRet++; - pKbl = CONTAINING_RECORD(pKbl->List.Flink, KL, List); - if (pKbl == gpklFirst) - break; - } + pHklBuff[uRet] = pKl->hkl; + uRet++; + pKl = pKl->pklNext; + if (pKl == gspklBaseLayout) + break; } - } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -460,23 +469,32 @@ return uRet; } +/* + * NtUserGetKeyboardLayoutName + * + * Returns KLID of current thread keyboard layout + */ BOOL APIENTRY NtUserGetKeyboardLayoutName( - LPWSTR lpszName) + LPWSTR pwszName) { BOOL bRet = FALSE; - PKL pKbl; + PKL pKl; PTHREADINFO pti; UserEnterShared(); + pti = PsGetCurrentThreadWin32Thread(); + pKl = pti->KeyboardLayout; + + if (!pKl) + goto cleanup; + _SEH2_TRY { - ProbeForWrite(lpszName, KL_NAMELENGTH*sizeof(WCHAR), 1); - pti = PsGetCurrentThreadWin32Thread(); - pKbl = pti->KeyboardLayout; - RtlCopyMemory(lpszName, pKbl->Name, KL_NAMELENGTH*sizeof(WCHAR)); + ProbeForWrite(pwszName, KL_NAMELENGTH*sizeof(WCHAR), 1); + wcscpy(pwszName, pKl->spkf->awchKF); bRet = TRUE; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -485,155 +503,207 @@ } _SEH2_END; +cleanup: UserLeave(); return bRet; } +/* + * NtUserLoadKeyboardLayoutEx + * + * Loads keyboard layout with given locale id + */ HKL APIENTRY NtUserLoadKeyboardLayoutEx( - IN HANDLE Handle, - IN DWORD offTable, - IN PUNICODE_STRING puszKeyboardName, - IN HKL hKL, - IN PUNICODE_STRING puszKLID, - IN DWORD dwKLID, + IN HANDLE Handle, // hFile (See
downloads.securityfocus.com/vulnerabilities/exploits/43774.c
) + IN DWORD offTable, // offset to KbdTables + IN PUNICODE_STRING puszKeyboardName, // not used? + IN HKL hklUnload, + IN PUNICODE_STRING pustrKLID, + IN DWORD hkl, IN UINT Flags) { HKL hklRet = NULL; - PKL pKbl = NULL, pklCur; + PKL pKl = NULL, pklLast; + WCHAR Buffer[9]; + UNICODE_STRING ustrSafeKLID; if (Flags & ~(KLF_ACTIVATE|KLF_NOTELLSHELL|KLF_REORDER|KLF_REPLACELANG| - KLF_SUBSTITUTE_OK|KLF_SETFORPROCESS|KLF_UNLOADPREVIOUS)) + KLF_SUBSTITUTE_OK|KLF_SETFORPROCESS|KLF_UNLOADPREVIOUS| + KLF_RESET|KLF_SETFORPROCESS|KLF_SHIFTLOCK)) { ERR("Invalid flags: %x\n", Flags); EngSetLastError(ERROR_INVALID_FLAGS); - return 0; - } + return NULL; + } + + /* FIXME: it seems KLF_RESET is only supported for WINLOGON */ + + RtlInitEmptyUnicodeString(&ustrSafeKLID, Buffer, sizeof(Buffer)); + _SEH2_TRY + { + ProbeForRead(pustrKLID, sizeof(*pustrKLID), 1); + ProbeForRead(pustrKLID->Buffer, sizeof(pustrKLID->Length), 1); + RtlCopyUnicodeString(&ustrSafeKLID, pustrKLID); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + _SEH2_YIELD(return NULL); + } + _SEH2_END; UserEnterExclusive(); - //Let's see if layout was already loaded. - pklCur = gpklFirst; - do - { - if (pklCur->klid == dwKLID) - { - pKbl = pklCur; - pKbl->Flags &= ~KBL_UNLOAD; - break; - } - - pklCur = CONTAINING_RECORD(pKbl->List.Flink, KL, List); - } while (pklCur != gpklFirst); - - //It wasn't, so load it. - if (!pKbl) - { - pKbl = UserLoadDllAndCreateKbl(dwKLID); - - if (!pKbl) - { + /* If hklUnload is specified, unload it and load new layput as default */ + if (hklUnload && hklUnload != (HKL)hkl) + { + pKl = UserHklToKbl(hklUnload); + if (pKl) + UserUnloadKbl(pKl); + } + + /* Let's see if layout was already loaded. */ + pKl = UserHklToKbl((HKL)hkl); + if (!pKl) + { + /* It wasn't, so load it. */ + pKl = UserLoadKbdLayout(&ustrSafeKLID, (HKL)hkl); + if (!pKl) goto cleanup; - } - - InsertTailList(&gpklFirst->List, &pKbl->List); - } - - if (Flags & KLF_REORDER) gpklFirst = pKbl; - + + if (gspklBaseLayout) + { + /* Find last not unloaded layout */ + pklLast = gspklBaseLayout->pklPrev; + while (pklLast != gspklBaseLayout && pklLast->dwKL_Flags & KLF_UNLOAD) + pklLast = pklLast->pklPrev; + + /* Add new layout to the list */ + pKl->pklNext = pklLast->pklNext; + pKl->pklPrev = pklLast; + pKl->pklNext->pklPrev = pKl; + pKl->pklPrev->pklNext = pKl; + } + else + { + /* This is the first layout */ + pKl->pklNext = pKl; + pKl->pklPrev = pKl; + gspklBaseLayout = pKl; + } + } + + /* If this layout was prepared to unload, undo it */ + pKl->dwKL_Flags &= ~KLF_UNLOAD; + + /* Loaded keyboard layout became the default */ + gspklBaseLayout = pKl; + + /* Activate this layout in current thread */ if (Flags & KLF_ACTIVATE) - { - co_UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKbl, Flags); - } - - hklRet = pKbl->hkl; - - //FIXME: KLF_NOTELLSHELL - // KLF_REPLACELANG - // KLF_SUBSTITUTE_OK + co_UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKl, Flags); + + /* Send shell message */ + if (!(Flags & KLF_NOTELLSHELL)) + co_IntShellHookNotify(HSHELL_LANGUAGE, (LPARAM)hkl); + + /* Return hkl on success */ + hklRet = (HKL)hkl; + + /* FIXME: KLF_REPLACELANG + KLF_REORDER */ cleanup: UserLeave(); return hklRet; } +/* + * NtUserActivateKeyboardLayout + * + * Activates specified layout for thread or process + */ HKL APIENTRY NtUserActivateKeyboardLayout( HKL hKl, ULONG Flags) { - PKL pKbl; - HKL hklRet = NULL; + PKL pKl = NULL; + HKL hkl = NULL; PTHREADINFO pti; UserEnterExclusive(); pti = PsGetCurrentThreadWin32Thread(); - if (pti->KeyboardLayout->hkl == hKl) - { - hklRet = hKl; + /* hKl can have special value HKL_NEXT or HKL_PREV */ + if (hKl == (HKL)HKL_NEXT) + { + /* Get next keyboard layout starting with current */ + if (pti->KeyboardLayout) + pKl = pti->KeyboardLayout->pklNext; + } + else if (hKl == (HKL)HKL_PREV) + { + /* Get previous keyboard layout starting with current */ + if (pti->KeyboardLayout) + pKl = pti->KeyboardLayout->pklNext; + } + else + pKl = UserHklToKbl(hKl); + + if (!pKl) + { + ERR("Invalid HKL %x!\n", hKl); goto cleanup; } - if (hKl == (HKL)HKL_NEXT) - { - pKbl = CONTAINING_RECORD(pti->KeyboardLayout->List.Flink, KL, List); - } - else if (hKl == (HKL)HKL_PREV) - { - pKbl = CONTAINING_RECORD(pti->KeyboardLayout->List.Blink, KL, List); - } - else pKbl = UserHklToKbl(hKl); - - //FIXME: KLF_RESET, KLF_SHIFTLOCK - - if (pKbl) - { - if (Flags & KLF_REORDER) - gpklFirst = pKbl; - - if (pKbl == pti->KeyboardLayout) - { - hklRet = pKbl->hkl; - } - else - { - pKbl = co_UserActivateKbl(pti, pKbl, Flags); - hklRet = pKbl->hkl; - } - } - else - { - ERR("Invalid HKL %x!\n", hKl); + hkl = pKl->hkl; + + /* FIXME: KLF_RESET + KLF_SHIFTLOCK */ + + if (Flags & KLF_REORDER) + gspklBaseLayout = pKl; + + if (pKl != pti->KeyboardLayout) + { + /* Activate layout for current thread */ + pKl = co_UserActivateKbl(pti, pKl, Flags); + + /* Send shell message */ + if (!(Flags & KLF_NOTELLSHELL)) + co_IntShellHookNotify(HSHELL_LANGUAGE, (LPARAM)hkl); } cleanup: UserLeave(); - return hklRet; -} - + return hkl; +} + +/* + * NtUserUnloadKeyboardLayout + * + * Unloads keyboard layout with specified hkl value + */ BOOL APIENTRY NtUserUnloadKeyboardLayout( HKL hKl) { - PKL pKbl; + PKL pKl; BOOL bRet = FALSE; UserEnterExclusive(); - pKbl = UserHklToKbl(hKl); - if (pKbl) - { - bRet = UserUnloadKbl(pKbl); - } + pKl = UserHklToKbl(hKl); + if (pKl) + bRet = UserUnloadKbl(pKl); else - { ERR("Invalid HKL %x!\n", hKl); - } UserLeave(); return bRet; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Wed Oct 19 20:03:50 2011 @@ -891,7 +891,7 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected) { WORD wScanCode, wVk; - PKL pKbl = NULL; + PKL pKl = NULL; PKBDTABLES pKbdTbl; PUSER_MESSAGE_QUEUE pFocusQueue; struct _ETHREAD *pFocusThread; @@ -906,18 +906,18 @@ { pFocusThread = pFocusQueue->Thread; if (pFocusThread && pFocusThread->Tcb.Win32Thread) - pKbl = ((PTHREADINFO)pFocusThread->Tcb.Win32Thread)->KeyboardLayout; - } - - if (!pKbl) - pKbl = W32kGetDefaultKeyLayout(); - if (!pKbl) + pKl = ((PTHREADINFO)pFocusThread->Tcb.Win32Thread)->KeyboardLayout; + } + + if (!pKl) + pKl = W32kGetDefaultKeyLayout(); + if (!pKl) { ERR("No keyboard layout!\n"); return FALSE; } - pKbdTbl = pKbl->KBTables; + pKbdTbl = pKl->spkf->pKbdTbl; /* Note: wScan field is always used */ wScanCode = pKbdInput->wScan; @@ -973,7 +973,7 @@ PKEYBOARD_INPUT_DATA pKbdInputData) { WORD wScanCode, wVk; - PKL pKbl = NULL; + PKL pKl = NULL; PKBDTABLES pKbdTbl; PUSER_MESSAGE_QUEUE pFocusQueue; struct _ETHREAD *pFocusThread; @@ -992,15 +992,15 @@ { pFocusThread = pFocusQueue->Thread; if (pFocusThread && pFocusThread->Tcb.Win32Thread) - pKbl = ((PTHREADINFO)pFocusThread->Tcb.Win32Thread)->KeyboardLayout; - } - - if (!pKbl) - pKbl = W32kGetDefaultKeyLayout(); - if (!pKbl) + pKl = ((PTHREADINFO)pFocusThread->Tcb.Win32Thread)->KeyboardLayout; + } + + if (!pKl) + pKl = W32kGetDefaultKeyLayout(); + if (!pKl) return; - pKbdTbl = pKbl->KBTables; + pKbdTbl = pKl->spkf->pKbdTbl; /* Convert scan code to virtual key. Note: we could call UserSendKeyboardInput using scan code, @@ -1068,7 +1068,7 @@ } pti = pWnd->head.pti; - pKbdTbl = pti->KeyboardLayout->KBTables; + pKbdTbl = pti->KeyboardLayout->spkf->pKbdTbl; if (!pKbdTbl) return FALSE; @@ -1207,15 +1207,15 @@ pti = PsGetCurrentThreadWin32Thread(); if (pti && pti->KeyboardLayout) - pKbdTbl = pti->KeyboardLayout->KBTables; + pKbdTbl = pti->KeyboardLayout->spkf->pKbdTbl; } else { - PKL pKbl; - - pKbl = UserHklToKbl(dwhkl); - if (pKbl) - pKbdTbl = pKbl->KBTables; + PKL pKl; + + pKl = UserHklToKbl(dwhkl); + if (pKl) + pKbdTbl = pKl->spkf->pKbdTbl; } if (pKbdTbl) @@ -1246,7 +1246,7 @@ BYTE afKeyState[256 * 2 / 8] = {0}; PWCHAR pwszBuff = NULL; INT i, iRet = 0; - PKL pKbl = NULL; + PKL pKl = NULL; TRACE("Enter NtUserSetKeyboardState\n"); @@ -1288,12 +1288,12 @@ UserEnterExclusive(); // Note: we modify wchDead static variable if (dwhkl) - pKbl = UserHklToKbl(dwhkl); - - if (!pKbl) + pKl = UserHklToKbl(dwhkl); + + if (!pKl) { pti = PsGetCurrentThreadWin32Thread(); - pKbl = pti->KeyboardLayout; + pKl = pti->KeyboardLayout; } iRet = IntToUnicodeEx(wVirtKey, @@ -1302,7 +1302,7 @@ pwszBuff, cchBuff, wFlags, - pKbl ? pKbl->KBTables : NULL); + pKl ? pKl->spkf->pKbdTbl : NULL); MmCopyToCaller(pwszBuffUnsafe, pwszBuff, cchBuff * sizeof(WCHAR)); ExFreePoolWithTag(pwszBuff, TAG_STRING); @@ -1336,7 +1336,7 @@ /* Get current keyboard layout */ pti = PsGetCurrentThreadWin32Thread(); - pKbdTbl = pti ? pti->KeyboardLayout->KBTables : 0; + pKbdTbl = pti ? pti->KeyboardLayout->spkf->pKbdTbl : 0; if (!pKbdTbl || cchSize < 1) { @@ -1451,7 +1451,7 @@ PKBDTABLES pKbdTbl; PVK_TO_WCHAR_TABLE pVkToWchTbl; PVK_TO_WCHARS10 pVkToWch; - PKL pKbl = NULL; + PKL pKl = NULL; DWORD i, dwModBits = 0, dwModNumber = 0, Ret = (DWORD)-1; TRACE("NtUserVkKeyScanEx() wch %d, KbdLayout 0x%p\n", wch, dwhkl); @@ -1461,18 +1461,18 @@ { // Use given keyboard layout if (dwhkl) - pKbl = UserHklToKbl(dwhkl); + pKl = UserHklToKbl(dwhkl); } else { // Use thread keyboard layout - pKbl = ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->KeyboardLayout; - } - - if (!pKbl) + pKl = ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->KeyboardLayout; + } + + if (!pKl) goto Exit; - pKbdTbl = pKbl->KBTables; + pKbdTbl = pKl->spkf->pKbdTbl; // Interate through all VkToWchar tables while pVkToWchars is not NULL for (i = 0; pKbdTbl->pVkToWcharTable[i].pVkToWchars; i++)
13 years
1
0
0
0
[rharabien] 54202: [WIN32K] - Don't define things from PSDK in source code
by rharabien@svn.reactos.org
Author: rharabien Date: Wed Oct 19 19:25:45 2011 New Revision: 54202 URL:
http://svn.reactos.org/svn/reactos?rev=54202&view=rev
Log: [WIN32K] - Don't define things from PSDK in source code Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] Wed Oct 19 19:25:45 2011 @@ -9,12 +9,6 @@ #include <win32k.h> DBG_DEFAULT_CHANNEL(UserMonitor); - -/* FIXME: find include file for these */ -#define MONITORINFOF_PRIMARY 1 -#define MONITOR_DEFAULTTONULL 0 -#define MONITOR_DEFAULTTOPRIMARY 1 -#define MONITOR_DEFAULTTONEAREST 2 #define NDEBUG #include <debug.h>
13 years
1
0
0
0
[gadamopoulos] 54201: [user32] - When themes are active and the text of a window changes, we should send the WM_NCUAHDRAWCAPTION message instead of drawing the window directly ( which will result p...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Oct 19 19:21:59 2011 New Revision: 54201 URL:
http://svn.reactos.org/svn/reactos?rev=54201&view=rev
Log: [user32] - When themes are active and the text of a window changes, we should send the WM_NCUAHDRAWCAPTION message instead of drawing the window directly ( which will result painting a classic caption on the themed window) - Fixes explorer window that is repainted with a classic style when a subfolder is opened Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/uxtheme/nonclient.c Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Wed Oct 19 19:21:59 2011 @@ -1984,7 +1984,15 @@ if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) { - DefWndNCPaint(hWnd, HRGN_WINDOW, -1); + /* FIXME: this is not 100% correct */ + if(gpsi->dwSRVIFlags & SRVINFO_APIHOOK) + { + SendMessage(hWnd, WM_NCUAHDRAWCAPTION,0,0); + } + else + { + DefWndNCPaint(hWnd, HRGN_WINDOW, -1); + } } Result = 1; break; @@ -2130,7 +2138,15 @@ if ((GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) { - DefWndNCPaint(hWnd, HRGN_WINDOW, -1); + /* FIXME: this is not 100% correct */ + if(gpsi->dwSRVIFlags & SRVINFO_APIHOOK) + { + SendMessage(hWnd, WM_NCUAHDRAWCAPTION,0,0); + } + else + { + DefWndNCPaint(hWnd, HRGN_WINDOW, -1); + } } Result = 1; break; Modified: trunk/reactos/dll/win32/uxtheme/nonclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/nonclien…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] Wed Oct 19 19:21:59 2011 @@ -1024,6 +1024,8 @@ { case WM_NCPAINT: return ThemeHandleNCPaint(hWnd, (HRGN)wParam); + case WM_NCUAHDRAWCAPTION: + case WM_NCUAHDRAWFRAME: case WM_NCACTIVATE: ThemeHandleNCPaint(hWnd, (HRGN)1); return TRUE; @@ -1065,16 +1067,13 @@ Pt.x = (short)LOWORD(lParam); Pt.y = (short)HIWORD(lParam); NC_TrackScrollBar(hWnd, wParam, Pt); + return 0; } else { return DefWndProc(hWnd, Msg, wParam, lParam); } } - case WM_NCUAHDRAWCAPTION: - case WM_NCUAHDRAWFRAME: - /* FIXME: how should these be handled? */ - return 0; default: return DefWndProc(hWnd, Msg, wParam, lParam); }
13 years
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
37
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Results per page:
10
25
50
100
200