From: Jacek Caban jacek@codeweavers.com
--- dlls/gdi32/dc.c | 6 +- dlls/gdi32/emfdc.c | 218 ++++++++++++++++++++++++--------------------- dlls/win32u/dc.c | 3 +- include/ntgdi.h | 6 +- 4 files changed, 125 insertions(+), 108 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index c193a62aed8..cece9625739 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -2154,6 +2154,7 @@ BOOL WINAPI CancelDC(HDC hdc) INT WINAPI StartDocW( HDC hdc, const DOCINFOW *doc ) { DC_ATTR *dc_attr; + ABORTPROC proc;
TRACE("DocName %s, Output %s, Datatype %s, fwType %#lx\n", debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput), @@ -2161,7 +2162,8 @@ INT WINAPI StartDocW( HDC hdc, const DOCINFOW *doc )
if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
- if (dc_attr->abort_proc && !dc_attr->abort_proc( hdc, 0 )) return 0; + proc = (ABORTPROC)(UINT_PTR)dc_attr->abort_proc; + if (proc && !proc( hdc, 0 )) return 0; return NtGdiStartDoc( hdc, doc, NULL, 0 ); }
@@ -2247,7 +2249,7 @@ INT WINAPI SetAbortProc( HDC hdc, ABORTPROC abrtprc ) DC_ATTR *dc_attr;
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; - dc_attr->abort_proc = abrtprc; + dc_attr->abort_proc = (UINT_PTR)abrtprc; return TRUE; }
diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c index 56327abff8a..45587503330 100644 --- a/dlls/gdi32/emfdc.c +++ b/dlls/gdi32/emfdc.c @@ -46,6 +46,16 @@ struct emf #define HANDLE_LIST_INC 20 static const RECTL empty_bounds = { 0, 0, -1, -1 };
+static struct emf *get_dc_emf( DC_ATTR *dc_attr ) +{ + return (struct emf *)(UINT_PTR)dc_attr->emf; +} + +static HDC dc_attr_handle( DC_ATTR *dc_attr ) +{ + return UlongToHandle( dc_attr->hdc ); +} + static BOOL emfdc_record( struct emf *emf, EMR *emr ) { DWORD len, size; @@ -76,7 +86,7 @@ static void emfdc_update_bounds( struct emf *emf, RECTL *rect ) RECTL *bounds = &emf->dc_attr->emf_bounds; RECTL vport_rect = *rect;
- LPtoDP( emf->dc_attr->hdc, (POINT *)&vport_rect, 2 ); + LPtoDP( dc_attr_handle( emf->dc_attr ), (POINT *)&vport_rect, 2 );
/* The coordinate systems may be mirrored (LPtoDP handles points, not rectangles) */ @@ -368,7 +378,7 @@ static UINT emfdc_find_object( struct emf *emf, HGDIOBJ obj ) static void emfdc_delete_object( HDC hdc, HGDIOBJ obj ) { DC_ATTR *dc_attr = get_dc_attr( hdc ); - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRDELETEOBJECT emr; UINT index;
@@ -475,7 +485,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush )
static BOOL emfdc_select_brush( DC_ATTR *dc_attr, HBRUSH brush ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRSELECTOBJECT emr; DWORD index = 0; int i; @@ -497,7 +507,7 @@ static BOOL emfdc_select_brush( DC_ATTR *dc_attr, HBRUSH brush ) if (!index && !(index = emfdc_find_object( emf, brush ))) { if (!(index = emfdc_create_brush( emf, brush ))) return 0; - GDI_hdc_using_object( brush, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( brush, dc_attr_handle( dc_attr ), emfdc_delete_object ); }
emr.emr.iType = EMR_SELECTOBJECT; @@ -542,7 +552,7 @@ static BOOL emfdc_create_font( struct emf *emf, HFONT font )
static BOOL emfdc_select_font( DC_ATTR *dc_attr, HFONT font ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRSELECTOBJECT emr; DWORD index; int i; @@ -565,7 +575,7 @@ static BOOL emfdc_select_font( DC_ATTR *dc_attr, HFONT font ) if (!(index = emfdc_find_object( emf, font ))) { if (!(index = emfdc_create_font( emf, font ))) return FALSE; - GDI_hdc_using_object( font, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( font, dc_attr_handle( dc_attr ), emfdc_delete_object ); }
found: @@ -608,7 +618,7 @@ static DWORD emfdc_create_pen( struct emf *emf, HPEN hPen )
static BOOL emfdc_select_pen( DC_ATTR *dc_attr, HPEN pen ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRSELECTOBJECT emr; DWORD index = 0; int i; @@ -630,7 +640,7 @@ static BOOL emfdc_select_pen( DC_ATTR *dc_attr, HPEN pen ) if (!index && !(index = emfdc_find_object( emf, pen ))) { if (!(index = emfdc_create_pen( emf, pen ))) return FALSE; - GDI_hdc_using_object( pen, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( pen, dc_attr_handle( dc_attr ), emfdc_delete_object ); }
emr.emr.iType = EMR_SELECTOBJECT; @@ -666,7 +676,7 @@ static DWORD emfdc_create_palette( struct emf *emf, HPALETTE hPal )
BOOL EMFDC_SelectPalette( DC_ATTR *dc_attr, HPALETTE palette ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRSELECTPALETTE emr; DWORD index = 0;
@@ -677,7 +687,7 @@ BOOL EMFDC_SelectPalette( DC_ATTR *dc_attr, HPALETTE palette ) else if (!(index = emfdc_find_object( emf, palette ))) { if (!(index = emfdc_create_palette( emf, palette ))) return 0; - GDI_hdc_using_object( palette, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( palette, dc_attr_handle( dc_attr ), emfdc_delete_object ); }
emr.emr.iType = EMR_SELECTPALETTE; @@ -771,7 +781,7 @@ static BOOL emfdrv_stroke_and_fill_path( struct emf *emf, INT type ) emr.emr.nSize = sizeof(emr); emr.rclBounds = empty_bounds;
- if ((region = NtGdiPathToRegion( emf->dc_attr->hdc ))) + if ((region = NtGdiPathToRegion( dc_attr_handle( emf->dc_attr )))) { NtGdiGetRgnBox( region, (RECT *)&emr.rclBounds ); DeleteObject( region ); @@ -785,7 +795,7 @@ static BOOL emfdrv_stroke_and_fill_path( struct emf *emf, INT type )
BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRMOVETOEX emr;
emr.emr.iType = EMR_MOVETOEX; @@ -803,13 +813,13 @@ BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) emr.emr.nSize = sizeof(emr); emr.ptl.x = x; emr.ptl.y = y; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRARC emr; INT temp;
@@ -848,12 +858,12 @@ BOOL EMFDC_AngleArc( DC_ATTR *dc_attr, INT x, INT y, DWORD radius, FLOAT start, emr.nRadius = radius; emr.eStartAngle = start; emr.eSweepAngle = sweep; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRELLIPSE emr;
if (left == right || top == bottom) return FALSE; @@ -874,7 +884,7 @@ BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom )
BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRRECTANGLE emr;
if(left == right || top == bottom) return FALSE; @@ -896,7 +906,7 @@ BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRROUNDRECT emr;
if (left == right || top == bottom) return FALSE; @@ -926,12 +936,12 @@ BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) emr.ptlPixel.x = x; emr.ptlPixel.y = y; emr.crColor = color; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
static BOOL emfdc_polylinegon( DC_ATTR *dc_attr, const POINT *points, INT count, DWORD type ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRPOLYLINE *emr; DWORD size; BOOL ret, use_small_emr = can_use_short_points( points, count ); @@ -1036,17 +1046,17 @@ static BOOL emfdc_poly_polylinegon( struct emf *emf, const POINT *pt, const INT
BOOL EMFDC_PolyPolyline( DC_ATTR *dc_attr, const POINT *pt, const DWORD *counts, DWORD polys) { - return emfdc_poly_polylinegon( dc_attr->emf, pt, (const INT *)counts, polys, EMR_POLYPOLYLINE ); + return emfdc_poly_polylinegon( get_dc_emf( dc_attr ), pt, (const INT *)counts, polys, EMR_POLYPOLYLINE ); }
BOOL EMFDC_PolyPolygon( DC_ATTR *dc_attr, const POINT *pt, const INT *counts, UINT polys ) { - return emfdc_poly_polylinegon( dc_attr->emf, pt, counts, polys, EMR_POLYPOLYGON ); + return emfdc_poly_polylinegon( get_dc_emf( dc_attr ), pt, counts, polys, EMR_POLYPOLYGON ); }
BOOL EMFDC_PolyDraw( DC_ATTR *dc_attr, const POINT *pts, const BYTE *types, DWORD count ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRPOLYDRAW *emr; BOOL ret; BYTE *types_dest; @@ -1088,12 +1098,12 @@ BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color, UINT fi emr.ptlStart.y = y; emr.crColor = color; emr.iMode = fill_type; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRFILLRGN *emr; DWORD size, rgnsize, index; BOOL ret; @@ -1123,7 +1133,7 @@ BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush )
BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width, INT height ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRFRAMERGN *emr; DWORD size, rgnsize, index; BOOL ret; @@ -1182,18 +1192,19 @@ static BOOL emfdc_paint_invert_region( struct emf *emf, HRGN hrgn, DWORD iType )
BOOL EMFDC_PaintRgn( DC_ATTR *dc_attr, HRGN hrgn ) { - return emfdc_paint_invert_region( dc_attr->emf, hrgn, EMR_PAINTRGN ); + return emfdc_paint_invert_region( get_dc_emf( dc_attr ), hrgn, EMR_PAINTRGN ); }
BOOL EMFDC_InvertRgn( DC_ATTR *dc_attr, HRGN hrgn ) { - return emfdc_paint_invert_region( dc_attr->emf, hrgn, EMR_INVERTRGN ); + return emfdc_paint_invert_region( get_dc_emf( dc_attr ), hrgn, EMR_INVERTRGN ); }
BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *rect, const WCHAR *str, UINT count, const INT *dx ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); + HDC hdc = dc_attr_handle( dc_attr ); FLOAT ex_scale, ey_scale; EMREXTTEXTOUTW *emr; int text_height = 0; @@ -1210,14 +1221,15 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *r
if (dc_attr->graphics_mode == GM_COMPATIBLE) { - const INT horzSize = GetDeviceCaps( dc_attr->hdc, HORZSIZE ); - const INT horzRes = GetDeviceCaps( dc_attr->hdc, HORZRES ); - const INT vertSize = GetDeviceCaps( dc_attr->hdc, VERTSIZE ); - const INT vertRes = GetDeviceCaps( dc_attr->hdc, VERTRES ); + HDC hdc = dc_attr_handle( dc_attr ); + const INT horzSize = GetDeviceCaps( hdc, HORZSIZE ); + const INT horzRes = GetDeviceCaps( hdc, HORZRES ); + const INT vertSize = GetDeviceCaps( hdc, VERTSIZE ); + const INT vertRes = GetDeviceCaps( hdc, VERTRES ); SIZE wndext, vportext;
- GetViewportExtEx( dc_attr->hdc, &vportext ); - GetWindowExtEx( dc_attr->hdc, &wndext ); + GetViewportExtEx( hdc, &vportext ); + GetWindowExtEx( hdc, &wndext ); ex_scale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) / ((FLOAT)wndext.cx / (FLOAT)vportext.cx); ey_scale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) / @@ -1260,7 +1272,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *r SIZE str_size; memcpy( (char*)emr + emr->emrtext.offDx, dx, count * sizeof(INT) ); for (i = 0; i < count; i++) text_width += dx[i]; - if (GetTextExtentPoint32W( dc_attr->hdc, str, count, &str_size )) + if (GetTextExtentPoint32W( hdc, str, count, &str_size )) text_height = str_size.cy; } else @@ -1270,7 +1282,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *r SIZE charSize; for (i = 0; i < count; i++) { - if (GetTextExtentPoint32W( dc_attr->hdc, str + i, 1, &charSize )) + if (GetTextExtentPoint32W( hdc, str + i, 1, &charSize )) { emf_dx[i] = charSize.cx; text_width += charSize.cx; @@ -1307,7 +1319,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *r switch (dc_attr->text_align & (TA_TOP | TA_BOTTOM | TA_BASELINE)) { case TA_BASELINE: - if (!GetTextMetricsW( dc_attr->hdc, &tm )) tm.tmDescent = 0; + if (!GetTextMetricsW( hdc, &tm )) tm.tmDescent = 0; /* Play safe here... it's better to have a bounding box */ /* that is too big than too small. */ emr->rclBounds.top = y - text_height - 1; @@ -1376,25 +1388,25 @@ BOOL EMFDC_GradientFill( DC_ATTR *dc_attr, TRIVERTEX *vert_array, ULONG nvert, memcpy( emr->Ver, vert_array, nvert * sizeof(vert_array[0]) ); memcpy( emr->Ver + nvert, pts, num_pts * sizeof(pts[0]) );
- emfdc_update_bounds( dc_attr->emf, &emr->rclBounds ); - ret = emfdc_record( dc_attr->emf, &emr->emr ); + emfdc_update_bounds( get_dc_emf( dc_attr ), &emr->rclBounds ); + ret = emfdc_record( get_dc_emf( dc_attr ), &emr->emr ); HeapFree( GetProcessHeap(), 0, emr ); return ret; }
BOOL EMFDC_FillPath( DC_ATTR *dc_attr ) { - return emfdrv_stroke_and_fill_path( dc_attr->emf, EMR_FILLPATH ); + return emfdrv_stroke_and_fill_path( get_dc_emf( dc_attr ), EMR_FILLPATH ); }
BOOL EMFDC_StrokeAndFillPath( DC_ATTR *dc_attr ) { - return emfdrv_stroke_and_fill_path( dc_attr->emf, EMR_STROKEANDFILLPATH ); + return emfdrv_stroke_and_fill_path( get_dc_emf( dc_attr ), EMR_STROKEANDFILLPATH ); }
BOOL EMFDC_StrokePath( DC_ATTR *dc_attr ) { - return emfdrv_stroke_and_fill_path( dc_attr->emf, EMR_STROKEPATH ); + return emfdrv_stroke_and_fill_path( get_dc_emf( dc_attr ), EMR_STROKEPATH ); }
/* Generate an EMRBITBLT, EMRSTRETCHBLT or EMRALPHABLEND record depending on the type parameter */ @@ -1470,14 +1482,14 @@ BOOL EMFDC_AlphaBlend( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, IN HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, BLENDFUNCTION blend_function ) { - return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst, hdc_src, + return emfdrv_stretchblt( get_dc_emf( dc_attr ), x_dst, y_dst, width_dst, height_dst, hdc_src, x_src, y_src, width_src, height_src, *(DWORD *)&blend_function, EMR_ALPHABLEND ); }
BOOL EMFDC_PatBlt( DC_ATTR *dc_attr, INT left, INT top, INT width, INT height, DWORD rop ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRBITBLT emr; BOOL ret;
@@ -1521,7 +1533,7 @@ BOOL EMFDC_BitBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width, INT height HDC hdc_src, INT x_src, INT y_src, DWORD rop ) { if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width, height, rop ); - return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width, height, + return emfdrv_stretchblt( get_dc_emf( dc_attr ), x_dst, y_dst, width, height, hdc_src, x_src, y_src, width, height, rop, EMR_BITBLT ); }
@@ -1530,7 +1542,7 @@ BOOL EMFDC_StretchBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, IN DWORD rop ) { if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, rop ); - return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst, + return emfdrv_stretchblt( get_dc_emf( dc_attr ), x_dst, y_dst, width_dst, height_dst, hdc_src, x_src, y_src, width_src, height_src, rop, EMR_STRETCHBLT ); } @@ -1539,7 +1551,7 @@ BOOL EMFDC_TransparentBlt( DC_ATTR *dc_attr, int x_dst, int y_dst, int width_dst HDC hdc_src, int x_src, int y_src, int width_src, int height_src, UINT color ) { - return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst, + return emfdrv_stretchblt( get_dc_emf( dc_attr ), x_dst, y_dst, width_dst, height_dst, hdc_src, x_src, y_src, width_src, height_src, color, EMR_TRANSPARENTBLT ); } @@ -1550,7 +1562,7 @@ BOOL EMFDC_MaskBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT h { unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer; - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }}; BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }}; HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL; @@ -1645,7 +1657,7 @@ BOOL EMFDC_PlgBlt( DC_ATTR *dc_attr, const POINT *points, HDC hdc_src, INT x_src { unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer; - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }}; BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }}; HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL; @@ -1802,8 +1814,8 @@ BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, emr->rclBounds.bottom = y_dst + height_dst - 1;
/* save the record we just created */ - ret = emfdc_record( dc_attr->emf, &emr->emr ); - if (ret) emfdc_update_bounds( dc_attr->emf, &emr->rclBounds ); + ret = emfdc_record( get_dc_emf( dc_attr ), &emr->emr ); + if (ret) emfdc_update_bounds( get_dc_emf( dc_attr ), &emr->rclBounds ); HeapFree( GetProcessHeap(), 0, emr ); return ret; } @@ -1880,8 +1892,8 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt emr->iStartScan = startscan; emr->cScans = lines;
- if ((ret = emfdc_record( dc_attr->emf, (EMR*)emr ))) - emfdc_update_bounds( dc_attr->emf, &emr->rclBounds ); + if ((ret = emfdc_record( get_dc_emf( dc_attr ), (EMR*)emr ))) + emfdc_update_bounds( get_dc_emf( dc_attr ), &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); return ret; @@ -1889,16 +1901,17 @@ BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD widt
BOOL EMFDC_SetDCBrushColor( DC_ATTR *dc_attr, COLORREF color ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); + HDC hdc = dc_attr_handle( dc_attr ); EMRSELECTOBJECT emr; DWORD index;
- if (GetCurrentObject( dc_attr->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return TRUE; + if (GetCurrentObject( hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return TRUE;
if (emf->dc_brush) DeleteObject( emf->dc_brush ); if (!(emf->dc_brush = CreateSolidBrush( color ))) return FALSE; if (!(index = emfdc_create_brush( emf, emf->dc_brush ))) return FALSE; - GDI_hdc_using_object( emf->dc_brush, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( emf->dc_brush, hdc, emfdc_delete_object ); emr.emr.iType = EMR_SELECTOBJECT; emr.emr.nSize = sizeof(emr); emr.ihObject = index; @@ -1907,17 +1920,18 @@ BOOL EMFDC_SetDCBrushColor( DC_ATTR *dc_attr, COLORREF color )
BOOL EMFDC_SetDCPenColor( DC_ATTR *dc_attr, COLORREF color ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); + HDC hdc = dc_attr_handle( dc_attr ); EMRSELECTOBJECT emr; DWORD index; LOGPEN logpen = { PS_SOLID, { 0, 0 }, color };
- if (GetCurrentObject( dc_attr->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return TRUE; + if (GetCurrentObject( hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return TRUE;
if (emf->dc_pen) DeleteObject( emf->dc_pen ); if (!(emf->dc_pen = CreatePenIndirect( &logpen ))) return FALSE; if (!(index = emfdc_create_pen( emf, emf->dc_pen ))) return FALSE; - GDI_hdc_using_object( emf->dc_pen, dc_attr->hdc, emfdc_delete_object ); + GDI_hdc_using_object( emf->dc_pen, hdc, emfdc_delete_object ); emr.emr.iType = EMR_SELECTOBJECT; emr.emr.nSize = sizeof(emr); emr.ihObject = index; @@ -1930,7 +1944,7 @@ BOOL EMFDC_SaveDC( DC_ATTR *dc_attr )
emr.emr.iType = EMR_SAVEDC; emr.emr.nSize = sizeof(emr); - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_RestoreDC( DC_ATTR *dc_attr, INT level ) @@ -1945,7 +1959,7 @@ BOOL EMFDC_RestoreDC( DC_ATTR *dc_attr, INT level ) emr.iRelative = level; else emr.iRelative = level - dc_attr->save_level - 1; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align ) @@ -1955,7 +1969,7 @@ BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align ) emr.emr.iType = EMR_SETTEXTALIGN; emr.emr.nSize = sizeof(emr); emr.iMode = align; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetTextJustification( DC_ATTR *dc_attr, INT extra, INT breaks ) @@ -1966,7 +1980,7 @@ BOOL EMFDC_SetTextJustification( DC_ATTR *dc_attr, INT extra, INT breaks ) emr.emr.nSize = sizeof(emr); emr.nBreakExtra = extra; emr.nBreakCount = breaks; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) @@ -1976,7 +1990,7 @@ BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) emr.emr.iType = EMR_SETBKMODE; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetBkColor( DC_ATTR *dc_attr, COLORREF color ) @@ -1986,7 +2000,7 @@ BOOL EMFDC_SetBkColor( DC_ATTR *dc_attr, COLORREF color ) emr.emr.iType = EMR_SETBKCOLOR; emr.emr.nSize = sizeof(emr); emr.crColor = color; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
@@ -1997,7 +2011,7 @@ BOOL EMFDC_SetTextColor( DC_ATTR *dc_attr, COLORREF color ) emr.emr.iType = EMR_SETTEXTCOLOR; emr.emr.nSize = sizeof(emr); emr.crColor = color; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) @@ -2007,7 +2021,7 @@ BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) emr.emr.iType = EMR_SETROP2; emr.emr.nSize = sizeof(emr); emr.iMode = rop; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) @@ -2017,7 +2031,7 @@ BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) emr.emr.iType = EMR_SETPOLYFILLMODE; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode ) @@ -2027,7 +2041,7 @@ BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode ) emr.emr.iType = EMR_SETSTRETCHBLTMODE; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) @@ -2037,7 +2051,7 @@ BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) emr.emr.iType = EMR_SETARCDIRECTION; emr.emr.nSize = sizeof(emr); emr.iArcDirection = dir; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
INT EMFDC_ExcludeClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom ) @@ -2050,7 +2064,7 @@ INT EMFDC_ExcludeClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT b emr.rclClip.top = top; emr.rclClip.right = right; emr.rclClip.bottom = bottom; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom) @@ -2063,7 +2077,7 @@ BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, IN emr.rclClip.top = top; emr.rclClip.right = right; emr.rclClip.bottom = bottom; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y ) @@ -2074,7 +2088,7 @@ BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y ) emr.emr.nSize = sizeof(emr); emr.ptlOffset.x = x; emr.ptlOffset.y = y; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode ) @@ -2099,7 +2113,7 @@ BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode ) emr->cbRgnData = rgnsize; emr->iMode = mode;
- ret = emfdc_record( dc_attr->emf, &emr->emr ); + ret = emfdc_record( get_dc_emf( dc_attr ), &emr->emr ); HeapFree( GetProcessHeap(), 0, emr ); return ret; } @@ -2111,7 +2125,7 @@ BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) emr.emr.iType = EMR_SETMAPMODE; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT cx, INT cy ) @@ -2122,7 +2136,7 @@ BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT cx, INT cy ) emr.emr.nSize = sizeof(emr); emr.szlExtent.cx = cx; emr.szlExtent.cy = cy; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT cx, INT cy ) @@ -2133,7 +2147,7 @@ BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT cx, INT cy ) emr.emr.nSize = sizeof(emr); emr.szlExtent.cx = cx; emr.szlExtent.cy = cy; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y ) @@ -2144,7 +2158,7 @@ BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y ) emr.emr.nSize = sizeof(emr); emr.ptlOrigin.x = x; emr.ptlOrigin.y = y; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetWindowOrgEx( DC_ATTR *dc_attr, INT x, INT y ) @@ -2155,7 +2169,7 @@ BOOL EMFDC_SetWindowOrgEx( DC_ATTR *dc_attr, INT x, INT y ) emr.emr.nSize = sizeof(emr); emr.ptlOrigin.x = x; emr.ptlOrigin.y = y; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom ) @@ -2168,7 +2182,7 @@ BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_n emr.xDenom = x_denom; emr.yNum = y_num; emr.yDenom = y_denom; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_ScaleWindowExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom ) @@ -2181,7 +2195,7 @@ BOOL EMFDC_ScaleWindowExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num emr.xDenom = x_denom; emr.yNum = y_num; emr.yDenom = y_denom; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) @@ -2191,7 +2205,7 @@ BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) emr.emr.iType = EMR_SETLAYOUT; emr.emr.nSize = sizeof(emr); emr.iMode = layout; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetWorldTransform( DC_ATTR *dc_attr, const XFORM *xform ) @@ -2201,7 +2215,7 @@ BOOL EMFDC_SetWorldTransform( DC_ATTR *dc_attr, const XFORM *xform ) emr.emr.iType = EMR_SETWORLDTRANSFORM; emr.emr.nSize = sizeof(emr); emr.xform = *xform; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_ModifyWorldTransform( DC_ATTR *dc_attr, const XFORM *xform, DWORD mode ) @@ -2224,7 +2238,7 @@ BOOL EMFDC_ModifyWorldTransform( DC_ATTR *dc_attr, const XFORM *xform, DWORD mod emr.xform = *xform; } emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) @@ -2234,24 +2248,24 @@ BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) emr.emr.iType = EMR_SETMAPPERFLAGS; emr.emr.nSize = sizeof(emr); emr.dwFlags = flags; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_AbortPath( DC_ATTR *dc_attr ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRABORTPATH emr;
emr.emr.iType = EMR_ABORTPATH; emr.emr.nSize = sizeof(emr);
emf->path = FALSE; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_BeginPath( DC_ATTR *dc_attr ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRBEGINPATH emr;
emr.emr.iType = EMR_BEGINPATH; @@ -2268,12 +2282,12 @@ BOOL EMFDC_CloseFigure( DC_ATTR *dc_attr )
emr.emr.iType = EMR_CLOSEFIGURE; emr.emr.nSize = sizeof(emr); - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_EndPath( DC_ATTR *dc_attr ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); EMRENDPATH emr;
emf->path = FALSE; @@ -2289,7 +2303,7 @@ BOOL EMFDC_FlattenPath( DC_ATTR *dc_attr )
emr.emr.iType = EMR_FLATTENPATH; emr.emr.nSize = sizeof(emr); - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_SelectClipPath( DC_ATTR *dc_attr, INT mode ) @@ -2299,7 +2313,7 @@ BOOL EMFDC_SelectClipPath( DC_ATTR *dc_attr, INT mode ) emr.emr.iType = EMR_SELECTCLIPPATH; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
BOOL EMFDC_WidenPath( DC_ATTR *dc_attr ) @@ -2308,21 +2322,21 @@ BOOL EMFDC_WidenPath( DC_ATTR *dc_attr )
emr.emr.iType = EMR_WIDENPATH; emr.emr.nSize = sizeof(emr); - return emfdc_record( dc_attr->emf, &emr.emr ); + return emfdc_record( get_dc_emf( dc_attr ), &emr.emr ); }
void EMFDC_DeleteDC( DC_ATTR *dc_attr ) { - struct emf *emf = dc_attr->emf; + struct emf *emf = get_dc_emf( dc_attr ); UINT index;
HeapFree( GetProcessHeap(), 0, emf->emh ); for (index = 0; index < emf->handles_size; index++) if (emf->handles[index]) - GDI_hdc_not_using_object( emf->handles[index], emf->dc_attr->hdc ); + GDI_hdc_not_using_object( emf->handles[index], dc_attr_handle( emf->dc_attr )); HeapFree( GetProcessHeap(), 0, emf->handles ); HeapFree( GetProcessHeap(), 0, emf ); - dc_attr->emf = NULL; + dc_attr->emf = 0; }
/******************************************************************* @@ -2335,7 +2349,7 @@ BOOL WINAPI GdiComment( HDC hdc, UINT bytes, const BYTE *buffer ) UINT total, rounded_size; BOOL ret;
- if (!(dc_attr = get_dc_attr( hdc )) || !dc_attr->emf) return FALSE; + if (!(dc_attr = get_dc_attr( hdc )) || !get_dc_emf( dc_attr )) return FALSE;
rounded_size = (bytes+3) & ~3; total = offsetof(EMRGDICOMMENT,Data) + rounded_size; @@ -2347,7 +2361,7 @@ BOOL WINAPI GdiComment( HDC hdc, UINT bytes, const BYTE *buffer ) memset(&emr->Data[bytes], 0, rounded_size - bytes); memcpy(&emr->Data[0], buffer, bytes);
- ret = emfdc_record( dc_attr->emf, &emr->emr ); + ret = emfdc_record( get_dc_emf( dc_attr ), &emr->emr );
HeapFree(GetProcessHeap(), 0, emr);
@@ -2412,7 +2426,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect, }
emf->dc_attr = dc_attr; - dc_attr->emf = emf; + dc_attr->emf = (UINT_PTR)emf;
if (description) /* App name\0Title\0\0 */ { @@ -2513,8 +2527,8 @@ HENHMETAFILE WINAPI CloseEnhMetaFile( HDC hdc )
TRACE("(%p)\n", hdc );
- if (!(dc_attr = get_dc_attr( hdc )) || !dc_attr->emf) return 0; - emf = dc_attr->emf; + if (!(dc_attr = get_dc_attr( hdc )) || !get_dc_emf( dc_attr )) return 0; + emf = get_dc_emf( dc_attr );
if (dc_attr->save_level) RestoreDC( hdc, 1 ); diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index d43be1c20be..131927a4707 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -230,7 +230,8 @@ DC *alloc_dc_ptr( DWORD magic ) free( dc ); return NULL; } - dc->attr->hdc = dc->nulldrv.hdc = dc->hSelf; + dc->nulldrv.hdc = dc->hSelf; + dc->attr->hdc = HandleToUlong( dc->hSelf ); set_gdi_client_ptr( dc->hSelf, dc->attr );
if (!font_driver.pCreateDC( &dc->physDev, NULL, NULL, NULL )) diff --git a/include/ntgdi.h b/include/ntgdi.h index 8fd4c5b1214..24db499c404 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -165,7 +165,7 @@ enum
typedef struct DC_ATTR { - HDC hdc; /* handle to self */ + UINT hdc; /* handle to self */ LONG disabled; /* disabled flag, controlled by DCHF_(DISABLE|ENABLE)DC */ int save_level; COLORREF background_color; @@ -196,8 +196,8 @@ typedef struct DC_ATTR SIZE virtual_size; UINT font_code_page; RECTL emf_bounds; - void *emf; - ABORTPROC abort_proc; /* AbortProc for printing */ + UINT64 emf; /* client EMF record pointer */ + UINT64 abort_proc; /* AbortProc for printing */ } DC_ATTR;
struct font_enum_entry
From: Jacek Caban jacek@codeweavers.com
--- dlls/win32u/dc.c | 4 ++-- dlls/win32u/dib.c | 4 ++-- dlls/win32u/gdiobj.c | 4 ++-- dlls/win32u/win32u_private.h | 9 +++++++++ 4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 131927a4707..a8c651dd28f 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -112,8 +112,8 @@ static DC_ATTR *alloc_dc_attr(void) { SIZE_T size = system_info.AllocationGranularity; bucket->entries = NULL; - if (!NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&bucket->entries, 0, &size, - MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE )) + if (!NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&bucket->entries, zero_bits(), + &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )) { bucket->next_free = NULL; bucket->next_unused = bucket->entries + 1; diff --git a/dlls/win32u/dib.c b/dlls/win32u/dib.c index 7a6df3da7cc..e7a5a50e201 100644 --- a/dlls/win32u/dib.c +++ b/dlls/win32u/dib.c @@ -1548,8 +1548,8 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con { SIZE_T size = bmp->dib.dsBmih.biSizeImage; offset = 0; - if (NtAllocateVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, 0, &size, - MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE )) + if (NtAllocateVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, zero_bits(), + &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )) goto error; } bmp->dib.dshSection = section; diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index aaeed2ba676..e42d076bc5b 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -566,8 +566,8 @@ static void init_gdi_shared(void) { SIZE_T size = sizeof(*gdi_shared);
- if (NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&gdi_shared, 0, &size, - MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )) + if (NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&gdi_shared, zero_bits(), + &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )) return; next_unused = gdi_shared->Handles + FIRST_GDI_HANDLE;
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d4b86d1e6a9..6d492f2e73b 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -494,6 +494,15 @@ static inline BOOL is_win9x(void) return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s; }
+static inline ULONG_PTR zero_bits(void) +{ +#ifdef _WIN64 + return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff; +#else + return 0; +#endif +} + static inline const char *debugstr_us( const UNICODE_STRING *us ) { if (!us) return "<null>";
From: Jacek Caban jacek@codeweavers.com
--- dlls/imm32/imm.c | 8 ++++---- dlls/user32/message.c | 15 ++++++++++----- dlls/user32/user_main.c | 2 +- dlls/user32/win.c | 8 ++++---- dlls/win32u/driver.c | 2 +- dlls/win32u/imm.c | 7 ++++--- dlls/win32u/window.c | 17 ++++++++++------- dlls/win32u/winstation.c | 15 ++++++++------- dlls/wineandroid.drv/device.c | 4 ++-- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/macdrv_main.c | 2 +- dlls/winex11.drv/x11drv.h | 2 +- dlls/winex11.drv/x11drv_main.c | 4 ++-- include/ntuser.h | 14 +++++++------- 14 files changed, 56 insertions(+), 46 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index bfbf3b2ad78..780d544c0e9 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -235,7 +235,7 @@ static DWORD convert_candidatelist_AtoW(
static struct coinit_spy *get_thread_coinit_spy(void) { - return NtUserGetThreadInfo()->client_imm; + return (struct coinit_spy *)(UINT_PTR)NtUserGetThreadInfo()->client_imm; }
static void imm_couninit_thread(BOOL cleanup) @@ -299,7 +299,7 @@ static ULONG WINAPI InitializeSpy_Release(IInitializeSpy *iface) if (!ref) { HeapFree(GetProcessHeap(), 0, spy); - NtUserGetThreadInfo()->client_imm = NULL; + NtUserGetThreadInfo()->client_imm = 0; } return ref; } @@ -373,7 +373,7 @@ static void imm_coinit_thread(void) spy->ref = 1; spy->cookie.QuadPart = 0; spy->apt_flags = 0; - NtUserGetThreadInfo()->client_imm = spy; + NtUserGetThreadInfo()->client_imm = (UINT_PTR)spy;
}
@@ -440,7 +440,7 @@ static void IMM_FreeThreadData(void) { struct coinit_spy *spy;
- free_input_context_data(NtUserGetThreadInfo()->default_imc); + free_input_context_data(UlongToHandle(NtUserGetThreadInfo()->default_imc)); if ((spy = get_thread_coinit_spy())) IInitializeSpy_Release(&spy->IInitializeSpy_iface); } diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 097e8fd4391..2cbdd761fe9 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -60,10 +60,15 @@ static inline void *unpack_ptr( ULONGLONG ptr64 ) return (void *)(ULONG_PTR)ptr64; }
+static struct wm_char_mapping_data *get_wmchar_data(void) +{ + return (struct wm_char_mapping_data *)(UINT_PTR)NtUserGetThreadInfo()->wmchar_data; +} + /* check for pending WM_CHAR message with DBCS trailing byte */ static inline BOOL get_pending_wmchar( MSG *msg, UINT first, UINT last, BOOL remove ) { - struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data; + struct wm_char_mapping_data *data = get_wmchar_data();
if (!data || !data->get_msg.message) return FALSE; if ((first || last) && (first > WM_CHAR || last < WM_CHAR)) return FALSE; @@ -119,7 +124,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping */ if (mapping != WMCHAR_MAP_NOMAPPING) { - struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data; + struct wm_char_mapping_data *data = get_wmchar_data(); BYTE low = LOBYTE(*wparam); cp = get_input_codepage();
@@ -152,7 +157,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping { if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return FALSE; - NtUserGetThreadInfo()->wmchar_data = data; + NtUserGetThreadInfo()->wmchar_data = (UINT_PTR)data; } TRACE( "storing lead byte %02x mapping %u\n", low, mapping ); data->lead_byte[mapping] = low; @@ -210,11 +215,11 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove ) len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL ); if (len == 2) /* DBCS char */ { - struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data; + struct wm_char_mapping_data *data = get_wmchar_data(); if (!data) { if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return; - NtUserGetThreadInfo()->wmchar_data = data; + NtUserGetThreadInfo()->wmchar_data = (UINT_PTR)data; } if (remove) { diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 139d9b5f46e..df3e6b27b81 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -240,7 +240,7 @@ static void thread_detach(void) WDML_NotifyThreadDetach();
NtUserCallNoParam( NtUserThreadDetach ); - HeapFree( GetProcessHeap(), 0, thread_info->wmchar_data ); + HeapFree( GetProcessHeap(), 0, (void *)(UINT_PTR)thread_info->wmchar_data ); }
diff --git a/dlls/user32/win.c b/dlls/user32/win.c index fa2ae2e9da4..e246d112383 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -95,7 +95,7 @@ HWND get_hwnd_message_parent(void) struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!thread_info->msg_window) GetDesktopWindow(); /* trigger creation */ - return thread_info->msg_window; + return UlongToHandle( thread_info->msg_window ); }
@@ -109,8 +109,8 @@ BOOL is_desktop_window( HWND hwnd ) struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!hwnd) return FALSE; - if (hwnd == thread_info->top_window) return TRUE; - if (hwnd == thread_info->msg_window) return TRUE; + if (hwnd == UlongToHandle( thread_info->top_window )) return TRUE; + if (hwnd == UlongToHandle( thread_info->msg_window )) return TRUE;
if (!HIWORD(hwnd) || HIWORD(hwnd) == 0xffff) { @@ -582,7 +582,7 @@ HWND WINAPI GetDesktopWindow(void) { struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
- if (thread_info->top_window) return thread_info->top_window; + if (thread_info->top_window) return UlongToHandle( thread_info->top_window ); return NtUserGetDesktopWindow(); }
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index e8f410b7f4c..f70d4a7b455 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -785,7 +785,7 @@ static BOOL nodrv_CreateWindow( HWND hwnd ) HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
/* HWND_MESSAGE windows don't need a graphics driver */ - if (!parent || parent == NtUserGetThreadInfo()->msg_window) return TRUE; + if (!parent || parent == UlongToHandle( NtUserGetThreadInfo()->msg_window )) return TRUE; if (warned++) return FALSE;
ERR_(winediag)( "Application tried to create a window, but no driver could be loaded.\n" ); diff --git a/dlls/win32u/imm.c b/dlls/win32u/imm.c index 5adfe3704aa..1b78a12a803 100644 --- a/dlls/win32u/imm.c +++ b/dlls/win32u/imm.c @@ -212,8 +212,9 @@ UINT WINAPI NtUserAssociateInputContext( HWND hwnd, HIMC ctx, ULONG flags ) HIMC get_default_input_context(void) { struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); - if (!thread_info->default_imc) thread_info->default_imc = NtUserCreateInputContext( 0 ); - return thread_info->default_imc; + if (!thread_info->default_imc) + thread_info->default_imc = HandleToUlong( NtUserCreateInputContext( 0 )); + return UlongToHandle( thread_info->default_imc ); }
HIMC get_window_input_context( HWND hwnd ) @@ -390,7 +391,7 @@ void cleanup_imm_thread(void) thread_info->imm_thread_data = NULL; }
- NtUserDestroyInputContext( thread_info->client_info.default_imc ); + NtUserDestroyInputContext( UlongToHandle( thread_info->client_info.default_imc )); }
BOOL WINAPI ImmProcessKey( HWND hwnd, HKL hkl, UINT vkey, LPARAM key_data, DWORD unknown ) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 61de6ad1c33..c4e14381cf5 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -173,7 +173,7 @@ HWND get_hwnd_message_parent(void) struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!thread_info->msg_window) get_desktop_window(); /* trigger creation */ - return thread_info->msg_window; + return UlongToHandle( thread_info->msg_window ); }
/*********************************************************************** @@ -225,8 +225,8 @@ BOOL is_desktop_window( HWND hwnd ) struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
if (!hwnd) return FALSE; - if (hwnd == thread_info->top_window) return TRUE; - if (hwnd == thread_info->msg_window) return TRUE; + if (hwnd == UlongToHandle( thread_info->top_window )) return TRUE; + if (hwnd == UlongToHandle( thread_info->msg_window )) return TRUE;
if (!HIWORD(hwnd) || HIWORD(hwnd) == 0xffff) { @@ -4930,15 +4930,18 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name,
if (name->Buffer == (const WCHAR *)DESKTOP_CLASS_ATOM) { - if (!thread_info->top_window) thread_info->top_window = full_parent ? full_parent : handle; - else assert( full_parent == thread_info->top_window ); - if (full_parent && !user_driver->pCreateDesktopWindow( thread_info->top_window )) + if (!thread_info->top_window) + thread_info->top_window = HandleToUlong( full_parent ? full_parent : handle ); + else assert( full_parent == UlongToHandle( thread_info->top_window )); + if (full_parent && + !user_driver->pCreateDesktopWindow( UlongToHandle( thread_info->top_window ))) ERR( "failed to create desktop window\n" ); register_builtin_classes(); } else /* HWND_MESSAGE parent */ { - if (!thread_info->msg_window && !full_parent) thread_info->msg_window = handle; + if (!thread_info->msg_window && !full_parent) + thread_info->msg_window = HandleToUlong( handle ); } }
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 0f6fb66a2b2..d3eb145b7c5 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -399,7 +399,7 @@ HWND get_desktop_window(void) { struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
- if (thread_info->top_window) return thread_info->top_window; + if (thread_info->top_window) return UlongToHandle( thread_info->top_window );
SERVER_START_REQ( get_desktop_window ) @@ -407,8 +407,8 @@ HWND get_desktop_window(void) req->force = 0; if (!wine_server_call( req )) { - thread_info->top_window = wine_server_ptr_handle( reply->top_window ); - thread_info->msg_window = wine_server_ptr_handle( reply->msg_window ); + thread_info->top_window = reply->top_window; + thread_info->msg_window = reply->msg_window; } } SERVER_END_REQ; @@ -489,18 +489,19 @@ HWND get_desktop_window(void) req->force = 1; if (!wine_server_call( req )) { - thread_info->top_window = wine_server_ptr_handle( reply->top_window ); - thread_info->msg_window = wine_server_ptr_handle( reply->msg_window ); + thread_info->top_window = reply->top_window; + thread_info->msg_window = reply->msg_window; } } SERVER_END_REQ; }
- if (!thread_info->top_window || !user_driver->pCreateDesktopWindow( thread_info->top_window )) + if (!thread_info->top_window || + !user_driver->pCreateDesktopWindow( UlongToHandle( thread_info->top_window ))) ERR_(win)( "failed to create desktop window\n" );
register_builtin_classes(); - return thread_info->top_window; + return UlongToHandle( thread_info->top_window ); }
static HANDLE get_winstations_dir_handle(void) diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index 62bcbae72f3..b7292b5faf1 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -245,7 +245,7 @@ static inline BOOL is_in_desktop_process(void)
static inline DWORD current_client_id(void) { - DWORD client_id = PtrToUlong( NtUserGetThreadInfo()->driver_data ); + DWORD client_id = NtUserGetThreadInfo()->driver_data; return client_id ? client_id : GetCurrentProcessId(); }
@@ -1137,7 +1137,7 @@ NTSTATUS android_dispatch_ioctl( void *arg ) if (in_size >= sizeof(*header)) { irp->IoStatus.Information = 0; - NtUserGetThreadInfo()->driver_data = UlongToHandle( params->client_id ); + NtUserGetThreadInfo()->driver_data = params->client_id; irp->IoStatus.u.Status = func( irp->AssociatedIrp.SystemBuffer, in_size, irpsp->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus.Information ); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 2e44206dc92..b5524517a7e 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -117,7 +117,7 @@ extern struct macdrv_thread_data *macdrv_init_thread_data(void) DECLSPEC_HIDDEN;
static inline struct macdrv_thread_data *macdrv_thread_data(void) { - return NtUserGetThreadInfo()->driver_data; + return (struct macdrv_thread_data *)(UINT_PTR)NtUserGetThreadInfo()->driver_data; }
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 7cca25cf302..1f8ea268f45 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -536,7 +536,7 @@ struct macdrv_thread_data *macdrv_init_thread_data(void) macdrv_compute_keyboard_layout(data);
set_queue_display_fd(macdrv_get_event_queue_fd(data->queue)); - NtUserGetThreadInfo()->driver_data = data; + NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
NtUserActivateKeyboardLayout(data->active_keyboard_layout, 0); return data; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 31a94d1632a..ad4a520af13 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -393,7 +393,7 @@ extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
static inline struct x11drv_thread_data *x11drv_thread_data(void) { - return NtUserGetThreadInfo()->driver_data; + return (struct x11drv_thread_data *)(UINT_PTR)NtUserGetThreadInfo()->driver_data; }
/* retrieve the thread display, or NULL if not created yet */ diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 20e07679635..e94977f8caf 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -734,7 +734,7 @@ void X11DRV_ThreadDetach(void) XCloseDisplay( data->display ); free( data ); /* clear data in case we get re-entered from user32 before the thread is truly dead */ - NtUserGetThreadInfo()->driver_data = NULL; + NtUserGetThreadInfo()->driver_data = 0; } }
@@ -795,7 +795,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (TRACE_ON(synchronous)) XSynchronize( data->display, True );
set_queue_display_fd( data->display ); - NtUserGetThreadInfo()->driver_data = data; + NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
if (use_xim) X11DRV_SetupXIM();
diff --git a/include/ntuser.h b/include/ntuser.h index e3694bde779..84cb7fdb9b8 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -61,19 +61,19 @@ enum /* TEB thread info, not compatible with Windows */ struct ntuser_thread_info { - void *driver_data; /* driver-specific data */ + UINT64 driver_data; /* driver-specific data */ DWORD message_time; /* value for GetMessageTime */ DWORD message_pos; /* value for GetMessagePos */ - ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ + UINT64 message_extra; /* value for GetMessageExtraInfo */ INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ WORD recursion_count; /* SendMessage recursion counter */ UINT receive_flags; /* currently received message flags */ - HWND top_window; /* desktop window */ - HWND msg_window; /* HWND_MESSAGE parent window */ + UINT top_window; /* desktop window */ + UINT msg_window; /* HWND_MESSAGE parent window */ DPI_AWARENESS dpi_awareness; /* DPI awareness */ - HIMC default_imc; /* default input context */ - void *client_imm; /* client IMM thread info */ - struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */ + UINT default_imc; /* default input context */ + UINT64 client_imm; /* client IMM thread info */ + UINT64 wmchar_data; /* client data for WM_CHAR mappings */ };
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)
From: Jacek Caban jacek@codeweavers.com
--- dlls/win32u/ntuser_private.h | 5 +++++ dlls/win32u/win32u_private.h | 5 ----- include/ntuser.h | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 3b74a2ae83a..1be8eed3020 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -138,6 +138,11 @@ struct user_thread_info
C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
+static inline struct user_thread_info *get_user_thread_info(void) +{ + return CONTAINING_RECORD( NtUserGetThreadInfo(), struct user_thread_info, client_info ); +} + struct user_key_state_info { UINT time; /* Time of last key state refresh */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 6d492f2e73b..eb215519643 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -432,11 +432,6 @@ extern void reg_delete_value( HKEY hkey, const WCHAR *name ) DECLSPEC_HIDDEN;
extern HKEY hkcu_key DECLSPEC_HIDDEN;
-static inline struct user_thread_info *get_user_thread_info(void) -{ - return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo; -} - extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
static inline BOOL set_ntstatus( NTSTATUS status ) diff --git a/include/ntuser.h b/include/ntuser.h index 84cb7fdb9b8..f15ba1f135e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -78,6 +78,13 @@ struct ntuser_thread_info
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void) { +#ifndef _WIN64 + if (NtCurrentTeb()->GdiBatchCount) + { + TEB64 *teb64 = (TEB64 *)(UINT_PTR)NtCurrentTeb()->GdiBatchCount; + return (struct ntuser_thread_info *)teb64->Win32ClientInfo; + } +#endif return (struct ntuser_thread_info *)NtCurrentTeb()->Win32ClientInfo; }
From: Jacek Caban jacek@codeweavers.com
Instead of leaking a kernel pointer. --- dlls/user32/user_main.c | 4 +++- dlls/win32u/message.c | 6 +++++- dlls/win32u/window.c | 3 --- include/ntuser.h | 6 +++--- 4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index df3e6b27b81..bc817089e46 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -352,7 +352,9 @@ BOOL WINAPI ShutdownBlockReasonDestroy(HWND hwnd)
const char *SPY_GetMsgName( UINT msg, HWND hwnd ) { - return (const char *)NtUserCallHwndParam( hwnd, msg, NtUserSpyGetMsgName ); + char buf[128]; + NtUserMessageCall( hwnd, msg, ARRAYSIZE(buf), 0, buf, NtUserSpyGetMsgName, FALSE ); + return wine_dbg_sprintf( "%s", buf ); }
void SPY_EnterMessage( INT flag, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 5fb065e1208..33170147aa9 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2960,7 +2960,7 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa return send_notify_message( hwnd, msg, wparam, lparam, ansi );
case NtUserSendMessageCallback: - return send_message_callback( hwnd, msg, wparam, lparam, (void *)result_info, ansi ); + return send_message_callback( hwnd, msg, wparam, lparam, result_info, ansi );
case NtUserClipboardWindowProc: return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam ); @@ -2978,6 +2978,10 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa spy_enter_message( ansi, hwnd, msg, wparam, lparam ); return 0;
+ case NtUserSpyGetMsgName: + lstrcpynA( result_info, debugstr_msg_name( msg, hwnd ), wparam ); + return 0; + case NtUserSpyExit: spy_exit_message( ansi, hwnd, msg, (LPARAM)result_info, wparam, lparam ); return 0; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index c4e14381cf5..2a4edeee656 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5578,9 +5578,6 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return set_window_style( hwnd, style->styleNew, style->styleOld ); }
- case NtUserSpyGetMsgName: - return (UINT_PTR)debugstr_msg_name( param, hwnd ); - default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index f15ba1f135e..5b7d66a2a4e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -297,8 +297,9 @@ enum /* Wine-specific exports */ NtUserClipboardWindowProc = 0x0300, NtUserGetDispatchParams = 0x3001, - NtUserSpyEnter = 0x0302, - NtUserSpyExit = 0x0303, + NtUserSpyGetMsgName = 0x3002, + NtUserSpyEnter = 0x0303, + NtUserSpyExit = 0x0304, };
/* NtUserThunkedMenuItemInfo codes */ @@ -1261,7 +1262,6 @@ enum NtUserCallHwndParam_ShowOwnedPopups, /* temporary exports */ NtUserSetWindowStyle, - NtUserSpyGetMsgName, };
static inline BOOL NtUserClientToScreen( HWND hwnd, POINT *pt )
This merge request was approved by Huw Davies.
Brendan Shanks (@bshanks) commented about dlls/win32u/win32u_private.h:
return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s;
}
+static inline ULONG_PTR zero_bits(void) +{ +#ifdef _WIN64
- return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff;
It would be nice if this was large-address-aware, likely based on the `SystemEmulationBasicInformation` `HighestUserAddress` the same way it's done in `wow64`.