winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1030 discussions
Start a n
N
ew thread
Jacek Caban : gdi32: Get stock objects directly from GDI_SHARED_MEMORY in GetStockObject.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 951d8ace18c5677d7bc577a08c69a1c1af8bf2d1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=951d8ace18c5677d7bc577a0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 3 13:59:50 2021 +0100 gdi32: Get stock objects directly from GDI_SHARED_MEMORY in GetStockObject. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/gdiobj.c | 131 +++++++++++++++++++++------------------------------ dlls/gdi32/objects.c | 52 ++++++++++++++++++++ 2 files changed, 107 insertions(+), 76 deletions(-) diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index ffb42ab88e2..50c337cd6c4 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -82,13 +82,6 @@ static const LOGBRUSH DkGrayBrush = { BS_SOLID, RGB(64,64,64), 0 }; static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 }; -/* reserve one extra entry for the stock default bitmap */ -/* this is what Windows does too */ -#define NB_STOCK_OBJECTS (STOCK_LAST+2) - -static HGDIOBJ stock_objects[NB_STOCK_OBJECTS]; -static HGDIOBJ scaled_stock_objects[NB_STOCK_OBJECTS]; - static CRITICAL_SECTION gdi_section; static CRITICAL_SECTION_DEBUG critsect_debug = { @@ -617,14 +610,62 @@ static void set_gdi_shared(void) NtCurrentTeb()->Peb->GdiSharedHandleTable = &gdi_shared; } -static HGDIOBJ make_stock_object( HGDIOBJ obj ) +static void init_stock_objects(void) { - GDI_HANDLE_ENTRY *entry; + const struct DefaultFontInfo *deffonts; + unsigned int i; + HGDIOBJ obj; + + /* Create stock objects in order matching stock object macros, + * so that they use predictable handle slots. Our GetStockObject + * depends on it. */ + create_brush( &WhiteBrush ); + create_brush( &LtGrayBrush ); + create_brush( &GrayBrush ); + create_brush( &DkGrayBrush ); + create_brush( &BlackBrush ); + create_brush( &NullBrush ); + + create_pen( PS_SOLID, 0, RGB(255,255,255) ); + create_pen( PS_SOLID, 0, RGB(0,0,0) ); + create_pen( PS_NULL, 0, RGB(0,0,0) ); + + /* slot 9 is not used for non-scaled stock objects */ + create_scaled_font( &OEMFixedFont ); + + /* language-independent stock fonts */ + create_font( &OEMFixedFont ); + create_font( &AnsiFixedFont ); + create_font( &AnsiVarFont ); + + /* language-dependent stock fonts */ + deffonts = get_default_fonts(get_default_charset()); + create_font( &deffonts->SystemFont ); + create_font( &deffonts->DeviceDefaultFont ); + + PALETTE_Init(); + + create_font( &deffonts->SystemFixedFont ); + create_font( &deffonts->DefaultGuiFont ); - if (!(entry = handle_entry( obj ))) return 0; - entry_obj( entry )->system = TRUE; - entry->StockFlag = 1; - return entry_to_handle( entry ); + create_brush( &DCBrush ); + NtGdiCreatePen( PS_SOLID, 0, RGB(0,0,0), NULL ); + + obj = NtGdiCreateBitmap( 1, 1, 1, 1, NULL ); + + assert( (HandleToULong( obj ) & 0xffff) == FIRST_GDI_HANDLE + DEFAULT_BITMAP ); + + create_scaled_font( &deffonts->SystemFont ); + create_scaled_font( &deffonts->SystemFixedFont ); + create_scaled_font( &deffonts->DefaultGuiFont ); + + /* clear the NOSYSTEM bit on all stock objects*/ + for (i = 0; i < STOCK_LAST + 5; i++) + { + GDI_HANDLE_ENTRY *entry = &gdi_shared.Handles[FIRST_GDI_HANDLE + i]; + entry_obj( entry )->system = TRUE; + entry->StockFlag = 1; + } } /*********************************************************************** @@ -634,57 +675,13 @@ static HGDIOBJ make_stock_object( HGDIOBJ obj ) */ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { - const struct DefaultFontInfo* deffonts; - int i; - if (reason != DLL_PROCESS_ATTACH) return TRUE; gdi32_module = inst; DisableThreadLibraryCalls( inst ); set_gdi_shared(); font_init(); - - /* create stock objects */ - stock_objects[WHITE_BRUSH] = create_brush( &WhiteBrush ); - stock_objects[LTGRAY_BRUSH] = create_brush( &LtGrayBrush ); - stock_objects[GRAY_BRUSH] = create_brush( &GrayBrush ); - stock_objects[DKGRAY_BRUSH] = create_brush( &DkGrayBrush ); - stock_objects[BLACK_BRUSH] = create_brush( &BlackBrush ); - stock_objects[NULL_BRUSH] = create_brush( &NullBrush ); - - stock_objects[WHITE_PEN] = create_pen( PS_SOLID, 0, RGB(255,255,255) ); - stock_objects[BLACK_PEN] = create_pen( PS_SOLID, 0, RGB(0,0,0) ); - stock_objects[NULL_PEN] = create_pen( PS_NULL, 0, RGB(0,0,0) ); - - stock_objects[DEFAULT_PALETTE] = PALETTE_Init(); - stock_objects[DEFAULT_BITMAP] = NtGdiCreateBitmap( 1, 1, 1, 1, NULL ); - - /* language-independent stock fonts */ - stock_objects[OEM_FIXED_FONT] = create_font( &OEMFixedFont ); - stock_objects[ANSI_FIXED_FONT] = create_font( &AnsiFixedFont ); - stock_objects[ANSI_VAR_FONT] = create_font( &AnsiVarFont ); - - /* language-dependent stock fonts */ - deffonts = get_default_fonts(get_default_charset()); - stock_objects[SYSTEM_FONT] = create_font( &deffonts->SystemFont ); - stock_objects[DEVICE_DEFAULT_FONT] = create_font( &deffonts->DeviceDefaultFont ); - stock_objects[SYSTEM_FIXED_FONT] = create_font( &deffonts->SystemFixedFont ); - stock_objects[DEFAULT_GUI_FONT] = create_font( &deffonts->DefaultGuiFont ); - - scaled_stock_objects[OEM_FIXED_FONT] = create_scaled_font( &OEMFixedFont ); - scaled_stock_objects[SYSTEM_FONT] = create_scaled_font( &deffonts->SystemFont ); - scaled_stock_objects[SYSTEM_FIXED_FONT] = create_scaled_font( &deffonts->SystemFixedFont ); - scaled_stock_objects[DEFAULT_GUI_FONT] = create_scaled_font( &deffonts->DefaultGuiFont ); - - stock_objects[DC_BRUSH] = create_brush( &DCBrush ); - stock_objects[DC_PEN] = create_pen( PS_SOLID, 0, RGB(0,0,0) ); - - /* clear the NOSYSTEM bit on all stock objects*/ - for (i = 0; i < NB_STOCK_OBJECTS; i++) - { - stock_objects[i] = make_stock_object( stock_objects[i] ); - scaled_stock_objects[i] = make_stock_object( scaled_stock_objects[i] ); - } + init_stock_objects(); return TRUE; } @@ -960,24 +957,6 @@ BOOL WINAPI NtGdiDeleteClientObj( HGDIOBJ handle ) return TRUE; } -/*********************************************************************** - * GetStockObject (GDI32.@) - */ -HGDIOBJ WINAPI GetStockObject( INT obj ) -{ - if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0; - switch (obj) - { - case OEM_FIXED_FONT: - case SYSTEM_FONT: - case SYSTEM_FIXED_FONT: - case DEFAULT_GUI_FONT: - if (get_system_dpi() != 96) return scaled_stock_objects[obj]; - break; - } - return stock_objects[obj]; -} - /*********************************************************************** * NtGdiExtGetObjectW (win32u.@) diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index b656c2a3f1e..5b1145c52a2 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi); DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2); +#define FIRST_GDI_HANDLE 32 + struct hdc_list { HDC hdc; @@ -95,6 +97,12 @@ static inline GDI_HANDLE_ENTRY *handle_entry( HGDIOBJ handle ) return NULL; } +static HGDIOBJ entry_to_handle( GDI_HANDLE_ENTRY *entry ) +{ + unsigned int idx = entry - get_gdi_shared()->Handles; + return LongToHandle( idx | (entry->Unique << NTGDI_HANDLE_TYPE_SHIFT) ); +} + static DWORD get_object_type( HGDIOBJ obj ) { GDI_HANDLE_ENTRY *entry = handle_entry( obj ); @@ -379,6 +387,50 @@ HGDIOBJ WINAPI GetCurrentObject( HDC hdc, UINT type ) return NtGdiGetDCObject( hdc, obj_type ); } +/****************************************************************************** + * get_system_dpi + * + * Get the system DPI, based on the DPI awareness mode. + */ +static DWORD get_system_dpi(void) +{ + static UINT (WINAPI *pGetDpiForSystem)(void); + + if (!pGetDpiForSystem) + { + HMODULE user = GetModuleHandleW( L"user32.dll" ); + if (user) pGetDpiForSystem = (void *)GetProcAddress( user, "GetDpiForSystem" ); + } + return pGetDpiForSystem ? pGetDpiForSystem() : 96; +} + +/*********************************************************************** + * GetStockObject (GDI32.@) + */ +HGDIOBJ WINAPI GetStockObject( INT obj ) +{ + if (obj < 0 || obj > STOCK_LAST + 1 || obj == 9) return 0; + + /* Wine stores stock objects in predictable order, see init_stock_objects */ + switch (obj) + { + case OEM_FIXED_FONT: + if (get_system_dpi() != 96) obj = 9; + break; + case SYSTEM_FONT: + if (get_system_dpi() != 96) obj = STOCK_LAST + 2; + break; + case SYSTEM_FIXED_FONT: + if (get_system_dpi() != 96) obj = STOCK_LAST + 3; + break; + case DEFAULT_GUI_FONT: + if (get_system_dpi() != 96) obj = STOCK_LAST + 4; + break; + } + + return entry_to_handle( handle_entry( ULongToHandle( obj + FIRST_GDI_HANDLE ))); +} + /*********************************************************************** * GetObjectA (GDI32.@) */
1
0
0
0
Jacek Caban : gdi32: Use ntgdi functions to create stock objects.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: c33b7b583b4067639ce8e4bbea2965cb2bf091de URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c33b7b583b4067639ce8e4bb…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 3 13:59:49 2021 +0100 gdi32: Use ntgdi functions to create stock objects. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/gdiobj.c | 40 ++++++++++++++++++++++------------------ dlls/gdi32/ntgdi_private.h | 3 +++ dlls/gdi32/palette.c | 2 +- dlls/gdi32/pen.c | 18 +++++++++++------- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 14b65429d4a..ffb42ab88e2 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -80,12 +80,7 @@ static const LOGBRUSH LtGrayBrush = { BS_SOLID, RGB(192,192,192), 0 }; static const LOGBRUSH GrayBrush = { BS_SOLID, RGB(128,128,128), 0 }; static const LOGBRUSH DkGrayBrush = { BS_SOLID, RGB(64,64,64), 0 }; -static const LOGPEN WhitePen = { PS_SOLID, { 0, 0 }, RGB(255,255,255) }; -static const LOGPEN BlackPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) }; -static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 }; - static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 }; -static const LOGPEN DCPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) }; /* reserve one extra entry for the stock default bitmap */ /* this is what Windows does too */ @@ -582,6 +577,15 @@ DWORD get_system_dpi(void) return pGetDpiForSystem ? pGetDpiForSystem() : 96; } +static HFONT create_font( const LOGFONTW *deffont ) +{ + ENUMLOGFONTEXDVW lf; + + memset( &lf, 0, sizeof(lf) ); + lf.elfEnumLogfontEx.elfLogFont = *deffont; + return NtGdiHfontCreate( &lf, sizeof(lf), 0, 0, NULL ); +} + static HFONT create_scaled_font( const LOGFONTW *deffont ) { LOGFONTW lf; @@ -595,7 +599,7 @@ static HFONT create_scaled_font( const LOGFONTW *deffont ) lf = *deffont; lf.lfHeight = MulDiv( lf.lfHeight, dpi, 96 ); - return CreateFontIndirectW( &lf ); + return create_font( &lf ); } static void set_gdi_shared(void) @@ -648,24 +652,24 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) stock_objects[BLACK_BRUSH] = create_brush( &BlackBrush ); stock_objects[NULL_BRUSH] = create_brush( &NullBrush ); - stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen ); - stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen ); - stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen ); + stock_objects[WHITE_PEN] = create_pen( PS_SOLID, 0, RGB(255,255,255) ); + stock_objects[BLACK_PEN] = create_pen( PS_SOLID, 0, RGB(0,0,0) ); + stock_objects[NULL_PEN] = create_pen( PS_NULL, 0, RGB(0,0,0) ); stock_objects[DEFAULT_PALETTE] = PALETTE_Init(); - stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL ); + stock_objects[DEFAULT_BITMAP] = NtGdiCreateBitmap( 1, 1, 1, 1, NULL ); /* language-independent stock fonts */ - stock_objects[OEM_FIXED_FONT] = CreateFontIndirectW( &OEMFixedFont ); - stock_objects[ANSI_FIXED_FONT] = CreateFontIndirectW( &AnsiFixedFont ); - stock_objects[ANSI_VAR_FONT] = CreateFontIndirectW( &AnsiVarFont ); + stock_objects[OEM_FIXED_FONT] = create_font( &OEMFixedFont ); + stock_objects[ANSI_FIXED_FONT] = create_font( &AnsiFixedFont ); + stock_objects[ANSI_VAR_FONT] = create_font( &AnsiVarFont ); /* language-dependent stock fonts */ deffonts = get_default_fonts(get_default_charset()); - stock_objects[SYSTEM_FONT] = CreateFontIndirectW( &deffonts->SystemFont ); - stock_objects[DEVICE_DEFAULT_FONT] = CreateFontIndirectW( &deffonts->DeviceDefaultFont ); - stock_objects[SYSTEM_FIXED_FONT] = CreateFontIndirectW( &deffonts->SystemFixedFont ); - stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &deffonts->DefaultGuiFont ); + stock_objects[SYSTEM_FONT] = create_font( &deffonts->SystemFont ); + stock_objects[DEVICE_DEFAULT_FONT] = create_font( &deffonts->DeviceDefaultFont ); + stock_objects[SYSTEM_FIXED_FONT] = create_font( &deffonts->SystemFixedFont ); + stock_objects[DEFAULT_GUI_FONT] = create_font( &deffonts->DefaultGuiFont ); scaled_stock_objects[OEM_FIXED_FONT] = create_scaled_font( &OEMFixedFont ); scaled_stock_objects[SYSTEM_FONT] = create_scaled_font( &deffonts->SystemFont ); @@ -673,7 +677,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) scaled_stock_objects[DEFAULT_GUI_FONT] = create_scaled_font( &deffonts->DefaultGuiFont ); stock_objects[DC_BRUSH] = create_brush( &DCBrush ); - stock_objects[DC_PEN] = CreatePenIndirect( &DCPen ); + stock_objects[DC_PEN] = create_pen( PS_SOLID, 0, RGB(0,0,0) ); /* clear the NOSYSTEM bit on all stock objects*/ for (i = 0; i < NB_STOCK_OBJECTS; i++) diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h index a438a3f93ae..73870fcd2f8 100644 --- a/dlls/gdi32/ntgdi_private.h +++ b/dlls/gdi32/ntgdi_private.h @@ -453,6 +453,9 @@ extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN; extern UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count, PALETTEENTRY *entries ) DECLSPEC_HIDDEN; +/* pen.c */ +extern HPEN create_pen( INT style, INT width, COLORREF color ) DECLSPEC_HIDDEN; + /* region.c */ extern BOOL add_rect_to_region( HRGN rgn, const RECT *rect ) DECLSPEC_HIDDEN; extern INT mirror_region( HRGN dst, HRGN src, INT width ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index aa7745dc65f..0451adbdf80 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -89,7 +89,7 @@ HPALETTE PALETTE_Init(void) palPtr->palPalEntry[i].peBlue = entries[i < 10 ? i : 236 + i].rgbBlue; palPtr->palPalEntry[i].peFlags = 0; } - return CreatePalette( palPtr ); + return NtGdiCreatePaletteInternal( palPtr, palPtr->palNumEntries ); } diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index ff2a766d40c..f79eaca4185 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -50,17 +50,12 @@ static const struct gdi_obj_funcs pen_funcs = PEN_DeleteObject /* pDeleteObject */ }; - -/*********************************************************************** - * NtGdiCreatePen (win32u.@) - */ -HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) +HPEN create_pen( INT style, INT width, COLORREF color ) { PENOBJ *penPtr; HPEN hpen; TRACE( "%d %d %06x\n", style, width, color ); - if (brush) FIXME( "brush not supported\n" ); switch (style) { @@ -72,7 +67,6 @@ HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) case PS_INSIDEFRAME: break; case PS_NULL: - if ((hpen = GetStockObject( NULL_PEN ))) return hpen; width = 1; color = 0; break; @@ -92,6 +86,16 @@ HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) return hpen; } +/*********************************************************************** + * NtGdiCreatePen (win32u.@) + */ +HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) +{ + if (brush) FIXME( "brush not supported\n" ); + if (style == PS_NULL) return GetStockObject( NULL_PEN ); + return create_pen( style, width, color ); +} + /*********************************************************************** * NtGdiExtCreatePen (win32u.@) */
1
0
0
0
Jacek Caban : gdi32: Use NtGdiGetDCObject for GetCurrentObject.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 05a3384ca8186404280085da1d1744da474a60d7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=05a3384ca8186404280085da…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 3 13:59:48 2021 +0100 gdi32: Use NtGdiGetDCObject for GetCurrentObject. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/bitblt.c | 3 ++- dlls/gdi32/bitmap.c | 3 ++- dlls/gdi32/dib.c | 5 +++-- dlls/gdi32/dibdrv/dc.c | 2 +- dlls/gdi32/gdiobj.c | 53 ++++++++++++++++---------------------------------- dlls/gdi32/objects.c | 26 +++++++++++++++++++++++++ include/ntgdi.h | 2 ++ 7 files changed, 53 insertions(+), 41 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index c10b9d37199..e6a846c3d74 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -866,7 +866,8 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest, SetStretchBltMode(hdcSrc, COLORONCOLOR); hdcWork = NtGdiCreateCompatibleDC( hdcDest ); if ((GetObjectType( hdcDest ) != OBJ_MEMDC || - GetObjectW( GetCurrentObject( hdcDest, OBJ_BITMAP ), sizeof(dib), &dib ) == sizeof(BITMAP)) && + GetObjectW( NtGdiGetDCObject( hdcDest, NTGDI_OBJ_SURF ), + sizeof(dib), &dib ) == sizeof(BITMAP)) && GetDeviceCaps( hdcDest, BITSPIXEL ) == 32) { /* screen DCs or DDBs are not supposed to have an alpha channel, so use a 24-bpp bitmap as copy */ diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index db6a4c44c84..1ce0e940235 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -63,7 +63,8 @@ HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height ) NtGdiGetDeviceCaps( hdc, PLANES ), NtGdiGetDeviceCaps( hdc, BITSPIXEL ), NULL ); - switch (NtGdiExtGetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(dib), &dib )) + switch (NtGdiExtGetObjectW( NtGdiGetDCObject( hdc, NTGDI_OBJ_SURF ), + sizeof(dib), &dib )) { case sizeof(BITMAP): /* A device-dependent bitmap is selected in the DC */ return NtGdiCreateBitmap( width, height, dib.dsBm.bmPlanes, dib.dsBm.bmBitsPixel, NULL ); diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 68ca1c31664..f00d5cf13e2 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -253,7 +253,7 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO * static int fill_color_table_from_palette( BITMAPINFO *info, HDC hdc ) { PALETTEENTRY palEntry[256]; - HPALETTE palette = GetCurrentObject( hdc, OBJ_PAL ); + HPALETTE palette = NtGdiGetDCObject( hdc, NTGDI_OBJ_PAL ); int i, colors = 1 << info->bmiHeader.biBitCount; info->bmiHeader.biClrUsed = colors; @@ -284,7 +284,8 @@ BOOL fill_color_table_from_pal_colors( BITMAPINFO *info, HDC hdc ) int i, count, colors = info->bmiHeader.biClrUsed; if (!colors) return TRUE; - if (!(palette = GetCurrentObject( hdc, OBJ_PAL ))) return FALSE; + if (!(palette = NtGdiGetDCObject( hdc, NTGDI_OBJ_PAL ))) + return FALSE; if (!(count = get_palette_entries( palette, 0, colors, entries ))) return FALSE; for (i = 0; i < colors; i++, index++) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index c31845d30a9..6336e3f23fe 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -534,7 +534,7 @@ static BOOL WINAPI dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context ) if (!osmesa_funcs) return FALSE; if (!context) return osmesa_funcs->make_current( NULL, NULL, 0, 0, 0, 0 ); - bitmap = GetCurrentObject( hdc, OBJ_BITMAP ); + bitmap = NtGdiGetDCObject( hdc, NTGDI_OBJ_SURF ); bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP ); if (!bmp) return FALSE; diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index cc68070674a..14b65429d4a 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1005,47 +1005,28 @@ INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer ) } /*********************************************************************** - * GetCurrentObject (GDI32.@) + * NtGdiGetDCObject (win32u.@) * * Get the currently selected object of a given type in a device context. - * - * PARAMS - * hdc [I] Device context to get the current object from - * type [I] Type of current object to get (OBJ_* defines from "wingdi.h") - * - * RETURNS - * Success: The current object of the given type selected in hdc. - * Failure: A NULL handle. - * - * NOTES - * - only the following object types are supported: - *| OBJ_PEN - *| OBJ_BRUSH - *| OBJ_PAL - *| OBJ_FONT - *| OBJ_BITMAP */ -HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type) +HANDLE WINAPI NtGdiGetDCObject( HDC hdc, UINT type ) { HGDIOBJ ret = 0; - DC * dc = get_dc_ptr( hdc ); - - if (!dc) return 0; - - switch (type) { - case OBJ_EXTPEN: /* fall through */ - case OBJ_PEN: ret = dc->hPen; break; - case OBJ_BRUSH: ret = dc->hBrush; break; - case OBJ_PAL: ret = dc->hPalette; break; - case OBJ_FONT: ret = dc->hFont; break; - case OBJ_BITMAP: ret = dc->hBitmap; break; - - /* tests show that OBJ_REGION is explicitly ignored */ - case OBJ_REGION: break; - default: - /* the SDK only mentions those above */ - FIXME("(%p,%d): unknown type.\n",hdc,type); - break; + DC *dc; + + if (!(dc = get_dc_ptr( hdc ))) return 0; + + switch (type) + { + case NTGDI_OBJ_EXTPEN: /* fall through */ + case NTGDI_OBJ_PEN: ret = dc->hPen; break; + case NTGDI_OBJ_BRUSH: ret = dc->hBrush; break; + case NTGDI_OBJ_PAL: ret = dc->hPalette; break; + case NTGDI_OBJ_FONT: ret = dc->hFont; break; + case NTGDI_OBJ_SURF: ret = dc->hBitmap; break; + default: + FIXME( "(%p, %d): unknown type.\n", hdc, type ); + break; } release_dc_ptr( dc ); return ret; diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index b989a83daa1..b656c2a3f1e 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -353,6 +353,32 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer ) return result; } +/*********************************************************************** + * GetCurrentObject (GDI32.@) + */ +HGDIOBJ WINAPI GetCurrentObject( HDC hdc, UINT type ) +{ + unsigned int obj_type; + + switch (type) + { + case OBJ_EXTPEN: obj_type = NTGDI_OBJ_EXTPEN; break; + case OBJ_PEN: obj_type = NTGDI_OBJ_PEN; break; + case OBJ_BRUSH: obj_type = NTGDI_OBJ_BRUSH; break; + case OBJ_PAL: obj_type = NTGDI_OBJ_PAL; break; + case OBJ_FONT: obj_type = NTGDI_OBJ_FONT; break; + case OBJ_BITMAP: obj_type = NTGDI_OBJ_SURF; break; + case OBJ_REGION: + /* tests show that OBJ_REGION is explicitly ignored */ + return 0; + default: + FIXME( "(%p,%d): unknown type.\n", hdc, type ); + return 0; + } + + return NtGdiGetDCObject( hdc, obj_type ); +} + /*********************************************************************** * GetObjectA (GDI32.@) */ diff --git a/include/ntgdi.h b/include/ntgdi.h index 2ee70cf3971..9e07268a307 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -57,6 +57,7 @@ typedef struct _GDI_HANDLE_ENTRY #define NTGDI_OBJ_DC 0x010000 #define NTGDI_OBJ_ENHMETADC 0x210000 #define NTGDI_OBJ_REGION 0x040000 +#define NTGDI_OBJ_SURF 0x050000 #define NTGDI_OBJ_METAFILE 0x260000 #define NTGDI_OBJ_ENHMETAFILE 0x460000 #define NTGDI_OBJ_METADC 0x660000 @@ -296,6 +297,7 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first_char, UINT last_char, WC ULONG flags, void *buffer ); BOOL WINAPI NtGdiGetColorAdjustment( HDC hdc, COLORADJUSTMENT *ca ); BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result ); +HANDLE WINAPI NtGdiGetDCObject( HDC hdc, UINT type ); BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result ); INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, void *bits, BITMAPINFO *info, UINT coloruse,
1
0
0
0
Jacek Caban : gdi32: Use shifted values for NTGDI_OBJ_* constants.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 5794b2da18328ea22464b70cd243d279a236df7d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5794b2da18328ea22464b70c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 3 13:59:47 2021 +0100 gdi32: Use shifted values for NTGDI_OBJ_* constants. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dc.c | 4 ++-- dlls/gdi32/gdi_private.h | 6 +++--- dlls/gdi32/gdidc.c | 4 ++-- dlls/gdi32/gdiobj.c | 24 ++++++++++++------------ dlls/gdi32/ntgdi_private.h | 8 ++++---- dlls/gdi32/objects.c | 8 ++++---- dlls/gdi32/pen.c | 4 ++-- dlls/gdi32/tests/gdiobj.c | 9 ++++++--- include/ntgdi.h | 26 +++++++++++++------------- 9 files changed, 48 insertions(+), 45 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=5794b2da18328ea22464…
1
0
0
0
Alexandre Julliard : configure: Remove some no longer needed configure checks.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 21cec48570d4f358312409c778675c2d8502f272 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=21cec48570d4f358312409c7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 3 14:54:16 2021 +0200 configure: Remove some no longer needed configure checks. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 19 ++-------- configure.ac | 12 +----- include/config.h.in | 24 ------------ include/wine/port.h | 24 ------------ libs/port/Makefile.in | 3 -- libs/port/poll.c | 101 -------------------------------------------------- libs/port/pread.c | 50 ------------------------- libs/port/pwrite.c | 50 ------------------------- 8 files changed, 5 insertions(+), 278 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=21cec48570d4f3583124…
1
0
0
0
Francois Gouget : mf: Remove WINAPI on static functions where not needed.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: bc20705c296e97dd9ac790b6f3bf95f4693b2430 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bc20705c296e97dd9ac790b6…
Author: Francois Gouget <fgouget(a)free.fr> Date: Wed Sep 1 09:51:47 2021 +0200 mf: Remove WINAPI on static functions where not needed. Signed-off-by: Francois Gouget <fgouget(a)free.fr> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/evr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 5730a6e769f..a5545c157de 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -638,7 +638,7 @@ static ULONG WINAPI video_stream_get_service_Release(IMFGetService *iface) return IMFStreamSink_Release(&stream->IMFStreamSink_iface); } -static HRESULT WINAPI video_stream_get_service(struct video_stream *stream, REFGUID service, REFIID riid, void **obj) +static HRESULT video_stream_get_service(struct video_stream *stream, REFGUID service, REFIID riid, void **obj) { HRESULT hr = S_OK;
1
0
0
0
Zebediah Figura : d3dcompiler/tests: Test including an absolute path.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 93a4c5889753264dc91257e657d819710853d220 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93a4c5889753264dc91257e6…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Wed Sep 1 12:12:48 2021 -0500 d3dcompiler/tests: Test including an absolute path. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index a950fa83d89..ad27084dce0 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -1523,7 +1523,7 @@ struct test_d3dinclude static void test_d3dcompile(void) { struct test_d3dinclude include = {{&test_d3dinclude_vtbl}}; - WCHAR filename[MAX_PATH], directory[MAX_PATH]; + WCHAR filename[MAX_PATH], directory[MAX_PATH], include_filename[MAX_PATH]; ID3D10Blob *blob = NULL, *errors = NULL; CHAR filename_a[MAX_PATH]; HRESULT hr; @@ -1542,12 +1542,20 @@ static void test_d3dcompile(void) static const char include2[] = "#include \"include1.h\"\n" "float4 light_color = LIGHT;\n"; + static const char ps_absolute_template[] = + "#include \"%ls\"\n" + "\n" + "float4 main() : COLOR\n" + "{\n" + " return light_color;\n" + "}"; + char ps_absolute_buffer[sizeof(ps_absolute_template) + MAX_PATH]; create_file(L"source.ps", ps_code, strlen(ps_code), filename); create_directory(L"include"); create_file(L"include\\include1.h", include1_wrong, strlen(include1_wrong), NULL); create_file(L"include1.h", include1, strlen(include1), NULL); - create_file(L"include\\include2.h", include2, strlen(include2), NULL); + create_file(L"include\\include2.h", include2, strlen(include2), include_filename); len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); @@ -1650,6 +1658,18 @@ static void test_d3dcompile(void) blob = NULL; } + sprintf(ps_absolute_buffer, ps_absolute_template, include_filename); + hr = ppD3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL, + D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!!blob, "Got unexpected blob.\n"); + todo_wine ok(!errors, "Got unexpected errors.\n"); + if (blob) + { + ID3D10Blob_Release(blob); + blob = NULL; + } + GetCurrentDirectoryW(MAX_PATH, directory); SetCurrentDirectoryW(temp_dir);
1
0
0
0
Francois Gouget : wininet/tests: Remove some unnecessary traces from the http test.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: ab227d2eca1cd182dd4beead716e5c48d596feee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ab227d2eca1cd182dd4beead…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Fri Sep 3 11:42:12 2021 +0200 wininet/tests: Remove some unnecessary traces from the http test. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/tests/http.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index d4845188d39..bf4dce80bef 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -596,11 +596,9 @@ static void InternetReadFile_test(int flags, const test_data_t *test) trace("Starting InternetReadFile test with flags 0x%x on url %s\n",flags,test->url); reset_events(); - trace("InternetOpenA <--\n"); hi = InternetOpenA((test->flags & TESTF_COMPRESSED) ? "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" : "", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags); ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError()); - trace("InternetOpenA -->\n"); if (hi == 0x0) goto abort; @@ -608,18 +606,15 @@ static void InternetReadFile_test(int flags, const test_data_t *test) SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); - trace("InternetConnectA <--\n"); hic=InternetConnectA(hi, test->host, INTERNET_INVALID_PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef); ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError()); - trace("InternetConnectA -->\n"); if (hic == 0x0) goto abort; CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED); SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); - trace("HttpOpenRequestA <--\n"); hor = HttpOpenRequestA(hic, test->post_data ? "POST" : "GET", test->path, NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RELOAD, 0xdeadbead); @@ -633,7 +628,6 @@ static void InternetReadFile_test(int flags, const test_data_t *test) } else { ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError()); } - trace("HttpOpenRequestA -->\n"); if (hor == 0x0) goto abort; @@ -684,7 +678,6 @@ static void InternetReadFile_test(int flags, const test_data_t *test) test_status_code(hor, 0); - trace("HttpSendRequestA -->\n"); if(test->post_data) { post_len = strlen(test->post_data); post_data = HeapAlloc(GetProcessHeap(), 0, post_len); @@ -698,7 +691,6 @@ static void InternetReadFile_test(int flags, const test_data_t *test) else ok(res || (GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED), "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError()); - trace("HttpSendRequestA <--\n"); if (flags & INTERNET_FLAG_ASYNC) { WaitForSingleObject(complete_event, INFINITE); @@ -968,22 +960,17 @@ static void InternetReadFile_chunked_test(void) trace("Starting InternetReadFile chunked test\n"); - trace("InternetOpenA <--\n"); hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError()); - trace("InternetOpenA -->\n"); if (hi == 0x0) goto abort; - trace("InternetConnectA <--\n"); hic=InternetConnectA(hi, "
test.winehq.org
", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef); ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError()); - trace("InternetConnectA -->\n"); if (hic == 0x0) goto abort; - trace("HttpOpenRequestA <--\n"); hor = HttpOpenRequestA(hic, "GET", "/tests/chunked", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RELOAD, 0xdeadbead); @@ -997,16 +984,13 @@ static void InternetReadFile_chunked_test(void) } else { ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError()); } - trace("HttpOpenRequestA -->\n"); if (hor == 0x0) goto abort; - trace("HttpSendRequestA -->\n"); SetLastError(0xdeadbeef); res = HttpSendRequestA(hor, "", -1, NULL, 0); ok(res || (GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED), "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError()); - trace("HttpSendRequestA <--\n"); test_request_flags(hor, 0); @@ -1092,10 +1076,8 @@ static void InternetReadFileExA_test(int flags) trace("Starting InternetReadFileExA test with flags 0x%x\n",flags); reset_events(); - trace("InternetOpenA <--\n"); hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags); ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError()); - trace("InternetOpenA -->\n"); if (hi == 0x0) goto abort; @@ -1103,18 +1085,15 @@ static void InternetReadFileExA_test(int flags) SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); - trace("InternetConnectA <--\n"); hic=InternetConnectA(hi, "
test.winehq.org
", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef); ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError()); - trace("InternetConnectA -->\n"); if (hic == 0x0) goto abort; CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED); SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); - trace("HttpOpenRequestA <--\n"); hor = HttpOpenRequestA(hic, "GET", "/tests/redirect", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RELOAD, 0xdeadbead); @@ -1128,7 +1107,6 @@ static void InternetReadFileExA_test(int flags) } else { ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError()); } - trace("HttpOpenRequestA -->\n"); if (hor == 0x0) goto abort; @@ -1157,7 +1135,6 @@ static void InternetReadFileExA_test(int flags) else SET_WINE_ALLOW(INTERNET_STATUS_REQUEST_COMPLETE); - trace("HttpSendRequestA -->\n"); SetLastError(0xdeadbeef); rc = HttpSendRequestA(hor, "", -1, NULL, 0); if (flags & INTERNET_FLAG_ASYNC) @@ -1166,7 +1143,6 @@ static void InternetReadFileExA_test(int flags) else ok((rc != 0) || GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED, "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError()); - trace("HttpSendRequestA <--\n"); if (!rc && (GetLastError() == ERROR_IO_PENDING)) { WaitForSingleObject(complete_event, INFINITE);
1
0
0
0
Francois Gouget : nsi/tests: Improve the error messages.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: d5dd1920278ac0e9f36151828e41141a9e762c33 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d5dd1920278ac0e9f3615182…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Fri Sep 3 11:41:53 2021 +0200 nsi/tests: Improve the error messages. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/nsi/tests/nsi.c | 132 +++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 72 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d5dd1920278ac0e9f361…
1
0
0
0
Eric Pouech : dbghelp: Handle the case where loader isn't what WINELOADER reports.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: a4b206b384c9367d0add95d5a0c0bd84374f6cb9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a4b206b384c9367d0add95d5…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Fri Sep 3 08:57:12 2021 +0200 dbghelp: Handle the case where loader isn't what WINELOADER reports. use case, in a WoW setup: wine programs/winedbg/winedbg.exe.so notepad.exe where both winedbg and notepad are 64bit exec:s in this case, dbghelp (loaded from winedbg) reads '<...>/wine' from WINELOADER windows env block inside notepad (but the unix env block is correctly set to wine64 by the tweak in ntdll/unix/loader.c) as a consequence dbghelp doesn't get the ELF information (it tries to read 32bit ELF entities, and fails); hence misses all the loaded ELF libraries winedbg's command 'info share' only reports the PE modules note: the 'dual' case wine64 programs/winedbg/winedbg.exe.so c:\\windows\\syswow64\\notepad.exe where winedbg is a 64bit exec and notepad a 32bit shows the same failures workaround this in dbghelp by tweaking the value of WINELOADER whether the debuggee is 32 or 64bit Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/elf_module.c | 10 ++++++++-- dlls/dbghelp/macho_module.c | 10 +++++++++- dlls/dbghelp/module.c | 30 ++++++++++++++++++++++++++---- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index eb2b53e947a..d6280a5189b 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -644,7 +644,7 @@ extern void module_reset_debug_info(struct module* module) DECLSPEC_HIDD extern BOOL module_remove(struct process* pcs, struct module* module) DECLSPEC_HIDDEN; extern void module_set_module(struct module* module, const WCHAR* name) DECLSPEC_HIDDEN; -extern const WCHAR *get_wine_loader_name(struct process *pcs) DECLSPEC_HIDDEN; +extern WCHAR* get_wine_loader_name(struct process *pcs) DECLSPEC_HIDDEN; /* msc.c */ extern BOOL pe_load_debug_directory(const struct process* pcs, diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index d1a4454e043..7be7e8efce6 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -1752,10 +1752,16 @@ static const struct loader_ops elf_loader_ops = BOOL elf_read_wine_loader_dbg_info(struct process* pcs, ULONG_PTR addr) { struct elf_info elf_info; - BOOL ret; + BOOL ret = FALSE; + WCHAR* loader; elf_info.flags = ELF_INFO_DEBUG_HEADER | ELF_INFO_MODULE; - ret = elf_search_and_load_file(pcs, get_wine_loader_name(pcs), addr, 0, &elf_info); + loader = get_wine_loader_name(pcs); + if (loader) + { + ret = elf_search_and_load_file(pcs, loader, addr, 0, &elf_info); + HeapFree(GetProcessHeap(), 0, loader); + } if (!ret || !elf_info.dbg_hdr_addr) return FALSE; TRACE("Found ELF debug header %#lx\n", elf_info.dbg_hdr_addr); diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c index 602f7e45c14..7b0b80c4900 100644 --- a/dlls/dbghelp/macho_module.c +++ b/dlls/dbghelp/macho_module.c @@ -1885,7 +1885,15 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in } } - if (!ret) ret = macho_search_and_load_file(pcs, get_wine_loader_name(pcs), 0, macho_info); + if (!ret) + { + WCHAR* loader = get_wine_loader_name(pcs); + if (loader) + { + ret = macho_search_and_load_file(pcs, loader, 0, macho_info); + HeapFree(GetProcessHeap(), 0, loader); + } + } return ret; } diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index c278a627d37..3bc2a9e143a 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -138,12 +138,34 @@ void module_set_module(struct module* module, const WCHAR* name) } /* Returned string must be freed by caller */ -const WCHAR *get_wine_loader_name(struct process *pcs) +WCHAR *get_wine_loader_name(struct process *pcs) { - const WCHAR *name = process_getenv(pcs, L"WINELOADER"); + const WCHAR *name; + WCHAR* altname; + unsigned len; + + name = process_getenv(pcs, L"WINELOADER"); if (!name) name = pcs->is_64bit ? L"wine64" : L"wine"; - TRACE("returning %s\n", debugstr_w(name)); - return name; + len = lstrlenW(name); + + /* WINELOADER isn't properly updated in Wow64 process calling inside Windows env block + * (it's updated in ELF env block though) + * So do the adaptation ourselves. + */ + altname = HeapAlloc(GetProcessHeap(), 0, (len + 2 + 1) * sizeof(WCHAR)); + if (altname) + { + memcpy(altname, name, len * sizeof(WCHAR)); + if (pcs->is_64bit && len >= 2 && memcmp(name + len - 2, L"64", 2 * sizeof(WCHAR)) != 0) + lstrcpyW(altname + len, L"64"); + else if (!pcs->is_64bit && len >= 2 && !memcmp(name + len - 2, L"64", 2 * sizeof(WCHAR))) + altname[len - 2] = '\0'; + else + altname[len] = '\0'; + } + + TRACE("returning %s\n", debugstr_w(altname)); + return altname; } static const char* get_module_type(enum module_type type, BOOL virtual)
1
0
0
0
← Newer
1
...
90
91
92
93
94
95
96
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200