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
July 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
1 participants
728 discussions
Start a n
N
ew thread
Jacek Caban : gdi32: Introduce NtGdiCreatePen.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: f5c117fb78b8530a31fb15eff7936b1b37aef7de URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f5c117fb78b8530a31fb15ef…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jul 5 13:40:15 2021 +0200 gdi32: Introduce NtGdiCreatePen. 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/objects.c | 9 +++++++++ dlls/gdi32/pen.c | 33 ++++++++++++++------------------- include/ntgdi.h | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 7fbb0419ec8..0e8453f4af2 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -177,3 +177,12 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN *pen ) { return CreatePen( pen->lopnStyle, pen->lopnWidth.x, pen->lopnColor ); } + +/*********************************************************************** + * CreatePen (GDI32.@) + */ +HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) +{ + if (style < 0 || style > PS_INSIDEFRAME) style = PS_SOLID; + return NtGdiCreatePen( style, width, color, NULL ); +} diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 1fbd467d105..7790278fca6 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -52,27 +52,15 @@ static const struct gdi_obj_funcs pen_funcs = /*********************************************************************** - * CreatePen (GDI32.@) + * NtGdiCreatePen (win32u.@) */ -HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) +HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ) { PENOBJ *penPtr; HPEN hpen; TRACE( "%d %d %06x\n", style, width, color ); - - if (style == PS_NULL) - { - hpen = GetStockObject(NULL_PEN); - if (hpen) return hpen; - } - - if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0; - - penPtr->logpen.elpPenStyle = style; - penPtr->logpen.elpWidth = abs(width); - penPtr->logpen.elpColor = color; - penPtr->logpen.elpBrushStyle = BS_SOLID; + if (brush) FIXME( "brush not supported\n" ); switch (style) { @@ -84,14 +72,21 @@ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) case PS_INSIDEFRAME: break; case PS_NULL: - penPtr->logpen.elpWidth = 1; - penPtr->logpen.elpColor = 0; + if ((hpen = GetStockObject( NULL_PEN ))) return hpen; + width = 1; + color = 0; break; default: - penPtr->logpen.elpPenStyle = PS_SOLID; - break; + return 0; } + if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0; + + penPtr->logpen.elpPenStyle = style; + penPtr->logpen.elpWidth = abs(width); + penPtr->logpen.elpColor = color; + penPtr->logpen.elpBrushStyle = BS_SOLID; + if (!(hpen = alloc_gdi_handle( &penPtr->obj, OBJ_PEN, &pen_funcs ))) HeapFree( GetProcessHeap(), 0, penPtr ); return hpen; diff --git a/include/ntgdi.h b/include/ntgdi.h index b4501c46b4e..778f589f550 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -68,7 +68,7 @@ HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *enumex, ULONG unk2, UL ULONG unk4, void *data ); HBRUSH WINAPI NtGdiCreateDIBBrush( const void* data, UINT coloruse ); HBRUSH WINAPI NtGdiCreatePatternBrushInternal( HBITMAP hbitmap, BOOL pen ); -HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color ); +HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush ); HRGN WINAPI NtGdiCreateRectRgn( INT left, INT top, INT right, INT bottom ); HRGN WINAPI NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom, INT ellipse_width, INT ellipse_height );
1
0
0
0
Jacek Caban : gdi32: Implement CreatePenIndirect on top of CreatePen.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 4590f6fb4f87e738afd1de147e740555c4fdbd3a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4590f6fb4f87e738afd1de14…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jul 5 13:40:07 2021 +0200 gdi32: Implement CreatePenIndirect on top of CreatePen. Instead of the other way around. 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/objects.c | 8 ++++++++ dlls/gdi32/pen.c | 32 ++++++++------------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 664dcf4f043..7fbb0419ec8 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -169,3 +169,11 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, void *buffer ) return GetObjectW( handle, count, buffer ); } + +/*********************************************************************** + * CreatePenIndirect (GDI32.@) + */ +HPEN WINAPI CreatePenIndirect( const LOGPEN *pen ) +{ + return CreatePen( pen->lopnStyle, pen->lopnWidth.x, pen->lopnColor ); +} diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 8a01125b390..1fbd467d105 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -56,28 +56,12 @@ static const struct gdi_obj_funcs pen_funcs = */ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) { - LOGPEN logpen; - - TRACE("%d %d %06x\n", style, width, color ); - - logpen.lopnStyle = style; - logpen.lopnWidth.x = width; - logpen.lopnWidth.y = 0; - logpen.lopnColor = color; - - return CreatePenIndirect( &logpen ); -} - - -/*********************************************************************** - * CreatePenIndirect (GDI32.@) - */ -HPEN WINAPI CreatePenIndirect( const LOGPEN * pen ) -{ - PENOBJ * penPtr; + PENOBJ *penPtr; HPEN hpen; - if (pen->lopnStyle == PS_NULL) + TRACE( "%d %d %06x\n", style, width, color ); + + if (style == PS_NULL) { hpen = GetStockObject(NULL_PEN); if (hpen) return hpen; @@ -85,12 +69,12 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen ) if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0; - penPtr->logpen.elpPenStyle = pen->lopnStyle; - penPtr->logpen.elpWidth = abs(pen->lopnWidth.x); - penPtr->logpen.elpColor = pen->lopnColor; + penPtr->logpen.elpPenStyle = style; + penPtr->logpen.elpWidth = abs(width); + penPtr->logpen.elpColor = color; penPtr->logpen.elpBrushStyle = BS_SOLID; - switch (pen->lopnStyle) + switch (style) { case PS_SOLID: case PS_DASH:
1
0
0
0
Jacek Caban : gdi32: Reimplement GetObjectA on top of GetObjectW.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 3dcb5db47f6f5b35443386cbd64bb614b672eb1a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3dcb5db47f6f5b35443386cb…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jul 5 13:40:00 2021 +0200 gdi32: Reimplement GetObjectA on top of GetObjectW. 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/bitmap.c | 1 - dlls/gdi32/brush.c | 1 - dlls/gdi32/dc.c | 1 - dlls/gdi32/dib.c | 1 - dlls/gdi32/font.c | 22 ---------------------- dlls/gdi32/gdi_private.h | 1 - dlls/gdi32/gdiobj.c | 31 ------------------------------- dlls/gdi32/objects.c | 29 +++++++++++++++++++++++++++++ dlls/gdi32/palette.c | 1 - dlls/gdi32/pen.c | 1 - dlls/gdi32/region.c | 1 - 11 files changed, 29 insertions(+), 61 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index d1805beb99c..aaad76dce36 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -37,7 +37,6 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs bitmap_funcs = { - BITMAP_GetObject, /* pGetObjectA */ BITMAP_GetObject, /* pGetObjectW */ NULL, /* pUnrealizeObject */ BITMAP_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/brush.c b/dlls/gdi32/brush.c index c7b80479594..1d4e45952c9 100644 --- a/dlls/gdi32/brush.c +++ b/dlls/gdi32/brush.c @@ -44,7 +44,6 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs brush_funcs = { - BRUSH_GetObject, /* pGetObjectA */ BRUSH_GetObject, /* pGetObjectW */ NULL, /* pUnrealizeObject */ BRUSH_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index d96285c6520..861bc97a78e 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -38,7 +38,6 @@ static BOOL DC_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs dc_funcs = { - NULL, /* pGetObjectA */ NULL, /* pGetObjectW */ NULL, /* pUnrealizeObject */ DC_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 069b9e77a28..e8d99ac415d 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -83,7 +83,6 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs dib_funcs = { - DIB_GetObject, /* pGetObjectA */ DIB_GetObject, /* pGetObjectW */ NULL, /* pUnrealizeObject */ DIB_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 2a51e3f7411..39f2a76255a 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -180,13 +180,11 @@ static inline WCHAR *strdupW( const WCHAR *p ) return ret; } -static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer ); static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer ); static BOOL FONT_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs fontobj_funcs = { - FONT_GetObjectA, /* pGetObjectA */ FONT_GetObjectW, /* pGetObjectW */ NULL, /* pUnrealizeObject */ FONT_DeleteObject /* pDeleteObject */ @@ -4567,26 +4565,6 @@ HGDIOBJ WINAPI NtGdiSelectFont( HDC hdc, HGDIOBJ handle ) } -/*********************************************************************** - * FONT_GetObjectA - */ -static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer ) -{ - FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT ); - LOGFONTA lfA; - - if (!font) return 0; - if (buffer) - { - FONT_LogFontWToA( &font->logfont, &lfA ); - if (count > sizeof(lfA)) count = sizeof(lfA); - memcpy( buffer, &lfA, count ); - } - else count = sizeof(lfA); - GDI_ReleaseObj( handle ); - return count; -} - /*********************************************************************** * FONT_GetObjectW */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index a4bc141811f..02e4c9d26b0 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -50,7 +50,6 @@ typedef struct { struct gdi_obj_funcs { - INT (*pGetObjectA)( HGDIOBJ handle, INT count, LPVOID buffer ); INT (*pGetObjectW)( HGDIOBJ handle, INT count, LPVOID buffer ); BOOL (*pUnrealizeObject)( HGDIOBJ handle ); BOOL (*pDeleteObject)( HGDIOBJ handle ); diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 67c2ddc19e6..af74071aa6d 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1028,37 +1028,6 @@ HGDIOBJ WINAPI GetStockObject( INT obj ) } -/*********************************************************************** - * GetObjectA (GDI32.@) - */ -INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer ) -{ - GDI_HANDLE_ENTRY *entry; - const struct gdi_obj_funcs *funcs = NULL; - INT result = 0; - - TRACE("%p %d %p\n", handle, count, buffer ); - - EnterCriticalSection( &gdi_section ); - if ((entry = handle_entry( handle ))) - { - funcs = entry_obj( entry )->funcs; - handle = entry_to_handle( entry ); /* make it a full handle */ - } - LeaveCriticalSection( &gdi_section ); - - if (funcs) - { - if (!funcs->pGetObjectA) - SetLastError( ERROR_INVALID_HANDLE ); - else if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */ - SetLastError( ERROR_NOACCESS ); - else - result = funcs->pGetObjectA( handle, count, buffer ); - } - return result; -} - /*********************************************************************** * NtGdiExtGetObjectW (win32u.@) */ diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index af1e2a19f06..664dcf4f043 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -23,6 +23,7 @@ #include "windef.h" #include "winbase.h" +#include "winnls.h" #include "ntgdi.h" #include "winternl.h" @@ -140,3 +141,31 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer ) } return result; } + +/*********************************************************************** + * GetObjectA (GDI32.@) + */ +INT WINAPI GetObjectA( HGDIOBJ handle, INT count, void *buffer ) +{ + TRACE("%p %d %p\n", handle, count, buffer ); + + if (get_object_type( handle ) == OBJ_FONT) + { + LOGFONTA *lfA = buffer; + LOGFONTW lf; + + if (!buffer) return sizeof(*lfA); + if (!GetObjectW( handle, sizeof(lf), &lf )) return 0; + if (count > sizeof(*lfA)) count = sizeof(*lfA); + memcpy( lfA, &lf, min( count, FIELD_OFFSET(LOGFONTA, lfFaceName) )); + if (count > FIELD_OFFSET(LOGFONTA, lfFaceName)) + { + WideCharToMultiByte( CP_ACP, 0, lf.lfFaceName, -1, lfA->lfFaceName, + count - FIELD_OFFSET(LOGFONTA, lfFaceName), NULL, NULL ); + if (count == sizeof(*lfA)) lfA->lfFaceName[LF_FACESIZE - 1] = 0; + } + return count; + } + + return GetObjectW( handle, count, buffer ); +} diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index f9d5851d20e..8584011bda8 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -55,7 +55,6 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs palette_funcs = { - PALETTE_GetObject, /* pGetObjectA */ PALETTE_GetObject, /* pGetObjectW */ PALETTE_UnrealizeObject, /* pUnrealizeObject */ PALETTE_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 0cc242ead5a..8a01125b390 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -45,7 +45,6 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs pen_funcs = { - PEN_GetObject, /* pGetObjectA */ PEN_GetObject, /* pGetObjectW */ NULL, /* pUnrealizeObject */ PEN_DeleteObject /* pDeleteObject */ diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c index 3d0f9cfc211..2e90e82180e 100644 --- a/dlls/gdi32/region.c +++ b/dlls/gdi32/region.c @@ -111,7 +111,6 @@ static BOOL REGION_DeleteObject( HGDIOBJ handle ); static const struct gdi_obj_funcs region_funcs = { - NULL, /* pGetObjectA */ NULL, /* pGetObjectW */ NULL, /* pUnrealizeObject */ REGION_DeleteObject /* pDeleteObject */
1
0
0
0
Jacek Caban : gdi32: Introduce NtGdiExtGetObjectW.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 14a39fcfe785cf2a35204912bc399cc309af7cd1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=14a39fcfe785cf2a35204912…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jul 5 13:39:05 2021 +0200 gdi32: Introduce NtGdiExtGetObjectW. 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 | 10 ++++------ dlls/gdi32/objects.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 2f795a3f12f..67c2ddc19e6 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1060,9 +1060,9 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer ) } /*********************************************************************** - * GetObjectW (GDI32.@) + * NtGdiExtGetObjectW (win32u.@) */ -INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer ) +INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer ) { GDI_HANDLE_ENTRY *entry; const struct gdi_obj_funcs *funcs = NULL; @@ -1078,11 +1078,9 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer ) } LeaveCriticalSection( &gdi_section ); - if (funcs) + if (funcs && funcs->pGetObjectW) { - if (!funcs->pGetObjectW) - SetLastError( ERROR_INVALID_HANDLE ); - else if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */ + if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */ SetLastError( ERROR_NOACCESS ); else result = funcs->pGetObjectW( handle, count, buffer ); diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 854f4783f5b..af1e2a19f06 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -111,3 +111,32 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ obj ) if (!ret) SetLastError( ERROR_INVALID_HANDLE ); return ret; } + +/*********************************************************************** + * GetObjectW (GDI32.@) + */ +INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer ) +{ + int result; + + TRACE( "%p %d %p\n", handle, count, buffer ); + + result = NtGdiExtGetObjectW( handle, count, buffer ); + if (!result && count) + { + switch(get_object_type( handle )) + { + case 0: + case OBJ_BITMAP: + case OBJ_BRUSH: + case OBJ_FONT: + case OBJ_PAL: + case OBJ_PEN: + case OBJ_EXTPEN: + break; + default: + SetLastError( ERROR_INVALID_HANDLE ); + } + } + return result; +}
1
0
0
0
Alexandre Julliard : ntdll: Get rid of the almost empty virtual.c.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 5d9586a60b5585fdfac294be73b8fa06ceb9c21b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5d9586a60b5585fdfac294be…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:23:58 2021 +0200 ntdll: Get rid of the almost empty virtual.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/thread.c | 71 ++++++++++++++++++++++++++++++++- dlls/ntdll/virtual.c | 106 ------------------------------------------------- 3 files changed, 70 insertions(+), 108 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index eb125c07722..da849d55b4d 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -62,7 +62,6 @@ C_SRCS = \ unix/thread.c \ unix/virtual.c \ version.c \ - virtual.c \ wcstring.c RC_SRCS = version.rc diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index d0c2a89d4bb..37dc7c8ab37 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -32,8 +32,8 @@ #include "ddk/wdm.h" #include "wine/exception.h" +WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(relay); -WINE_DECLARE_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); @@ -303,6 +303,75 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr, } +/********************************************************************** + * RtlCreateUserStack (NTDLL.@) + */ +NTSTATUS WINAPI RtlCreateUserStack( SIZE_T commit, SIZE_T reserve, ULONG zero_bits, + SIZE_T commit_align, SIZE_T reserve_align, INITIAL_TEB *stack ) +{ + PROCESS_STACK_ALLOCATION_INFORMATION alloc; + NTSTATUS status; + + TRACE("commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p\n", + commit, reserve, zero_bits, commit_align, reserve_align, stack); + + if (!commit_align || !reserve_align) + return STATUS_INVALID_PARAMETER; + + if (!commit || !reserve) + { + IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress ); + if (!reserve) reserve = nt->OptionalHeader.SizeOfStackReserve; + if (!commit) commit = nt->OptionalHeader.SizeOfStackCommit; + } + + reserve = (reserve + reserve_align - 1) & ~(reserve_align - 1); + commit = (commit + commit_align - 1) & ~(commit_align - 1); + + if (reserve < commit) reserve = commit; + if (reserve < 0x100000) reserve = 0x100000; + reserve = (reserve + 0xffff) & ~0xffff; /* round to 64K boundary */ + + alloc.ReserveSize = reserve; + alloc.ZeroBits = zero_bits; + status = NtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation, + &alloc, sizeof(alloc) ); + if (!status) + { + void *addr = alloc.StackBase; + SIZE_T size = page_size; + + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_NOACCESS ); + addr = (char *)alloc.StackBase + page_size; + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD ); + addr = (char *)alloc.StackBase + 2 * page_size; + size = reserve - 2 * page_size; + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE ); + + /* note: limit is lower than base since the stack grows down */ + stack->OldStackBase = 0; + stack->OldStackLimit = 0; + stack->DeallocationStack = alloc.StackBase; + stack->StackBase = (char *)alloc.StackBase + reserve; + stack->StackLimit = (char *)alloc.StackBase + 2 * page_size; + } + return status; +} + + +/********************************************************************** + * RtlFreeUserStack (NTDLL.@) + */ +void WINAPI RtlFreeUserStack( void *stack ) +{ + SIZE_T size = 0; + + TRACE("stack %p\n", stack); + + NtFreeVirtualMemory( NtCurrentProcess(), &stack, &size, MEM_RELEASE ); +} + + /****************************************************************************** * RtlGetNtGlobalFlags (NTDLL.@) */ diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c deleted file mode 100644 index 8e512c5d85a..00000000000 --- a/dlls/ntdll/virtual.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Win32 virtual memory functions - * - * Copyright 1997, 2002 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <assert.h> -#include <errno.h> -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#define NONAMELESSUNION -#include "windef.h" -#include "winternl.h" -#include "wine/debug.h" -#include "ntdll_misc.h" - -WINE_DEFAULT_DEBUG_CHANNEL(virtual); - - -/********************************************************************** - * RtlCreateUserStack (NTDLL.@) - */ -NTSTATUS WINAPI RtlCreateUserStack( SIZE_T commit, SIZE_T reserve, ULONG zero_bits, - SIZE_T commit_align, SIZE_T reserve_align, INITIAL_TEB *stack ) -{ - PROCESS_STACK_ALLOCATION_INFORMATION alloc; - NTSTATUS status; - - TRACE("commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p\n", - commit, reserve, zero_bits, commit_align, reserve_align, stack); - - if (!commit_align || !reserve_align) - return STATUS_INVALID_PARAMETER; - - if (!commit || !reserve) - { - IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress ); - if (!reserve) reserve = nt->OptionalHeader.SizeOfStackReserve; - if (!commit) commit = nt->OptionalHeader.SizeOfStackCommit; - } - - reserve = (reserve + reserve_align - 1) & ~(reserve_align - 1); - commit = (commit + commit_align - 1) & ~(commit_align - 1); - - if (reserve < commit) reserve = commit; - if (reserve < 0x100000) reserve = 0x100000; - reserve = (reserve + 0xffff) & ~0xffff; /* round to 64K boundary */ - - alloc.ReserveSize = reserve; - alloc.ZeroBits = zero_bits; - status = NtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation, - &alloc, sizeof(alloc) ); - if (!status) - { - void *addr = alloc.StackBase; - SIZE_T size = page_size; - - NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_NOACCESS ); - addr = (char *)alloc.StackBase + page_size; - NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD ); - addr = (char *)alloc.StackBase + 2 * page_size; - size = reserve - 2 * page_size; - NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE ); - - /* note: limit is lower than base since the stack grows down */ - stack->OldStackBase = 0; - stack->OldStackLimit = 0; - stack->DeallocationStack = alloc.StackBase; - stack->StackBase = (char *)alloc.StackBase + reserve; - stack->StackLimit = (char *)alloc.StackBase + 2 * page_size; - } - return status; -} - - -/********************************************************************** - * RtlFreeUserStack (NTDLL.@) - */ -void WINAPI RtlFreeUserStack( void *stack ) -{ - SIZE_T size = 0; - - TRACE("stack %p\n", stack); - - NtFreeVirtualMemory( NtCurrentProcess(), &stack, &size, MEM_RELEASE ); -}
1
0
0
0
Alexandre Julliard : ntdll: Get rid of the almost empty directory.c.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 73a281104bd2df7d5dcd1106724d81f82b38b160 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=73a281104bd2df7d5dcd1106…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:22:32 2021 +0200 ntdll: Get rid of the almost empty directory.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/directory.c | 100 ------------------------------------------------- dlls/ntdll/path.c | 19 ++++++++++ dlls/ntdll/process.c | 33 ++++++++++++++++ 4 files changed, 52 insertions(+), 101 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index b0607952431..eb125c07722 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -12,7 +12,6 @@ C_SRCS = \ critsection.c \ crypt.c \ debugbuffer.c \ - directory.c \ env.c \ error.c \ exception.c \ diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c deleted file mode 100644 index 3c601fe016a..00000000000 --- a/dlls/ntdll/directory.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * NTDLL directory functions - * - * Copyright 1993 Erik Bos - * Copyright 2003 Eric Pouech - * Copyright 1996, 2004 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <assert.h> -#include <sys/types.h> -#include <fcntl.h> -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#define NONAMELESSUNION -#include "windef.h" -#include "winnt.h" -#include "winternl.h" -#include "ddk/wdm.h" -#include "ntdll_misc.h" -#include "wine/list.h" -#include "wine/debug.h" -#include "wine/exception.h" - - -/****************************************************************** - * RtlWow64EnableFsRedirection (NTDLL.@) - */ -NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable ) -{ - if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; - NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = !enable; - return STATUS_SUCCESS; -} - - -/****************************************************************** - * RtlWow64EnableFsRedirectionEx (NTDLL.@) - */ -NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value ) -{ - if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; - - __TRY - { - *old_value = NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]; - } - __EXCEPT_PAGE_FAULT - { - return STATUS_ACCESS_VIOLATION; - } - __ENDTRY - - NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = disable; - return STATUS_SUCCESS; -} - - -/****************************************************************** - * RtlDoesFileExists_U (NTDLL.@) - */ -BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name) -{ - UNICODE_STRING nt_name; - FILE_BASIC_INFORMATION basic_info; - OBJECT_ATTRIBUTES attr; - BOOLEAN ret; - - if (!RtlDosPathNameToNtPathName_U( file_name, &nt_name, NULL, NULL )) return FALSE; - - attr.Length = sizeof(attr); - attr.RootDirectory = 0; - attr.ObjectName = &nt_name; - attr.Attributes = OBJ_CASE_INSENSITIVE; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - - ret = NtQueryAttributesFile(&attr, &basic_info) == STATUS_SUCCESS; - - RtlFreeUnicodeString( &nt_name ); - return ret; -} diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 58983aca194..53be23fe4ec 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -768,6 +768,25 @@ DWORD WINAPI RtlGetLongestNtPathLength(void) return MAX_NT_PATH_LENGTH; } + +/****************************************************************** + * RtlDoesFileExists_U (NTDLL.@) + */ +BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name) +{ + UNICODE_STRING nt_name; + FILE_BASIC_INFORMATION basic_info; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!RtlDosPathNameToNtPathName_U( file_name, &nt_name, NULL, NULL )) return FALSE; + InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL ); + status = NtQueryAttributesFile(&attr, &basic_info); + RtlFreeUnicodeString( &nt_name ); + return !status; +} + + /****************************************************************** * RtlIsNameLegalDOS8Dot3 (NTDLL.@) * diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index d10d731e3ef..160b1f549c9 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -49,6 +49,39 @@ PEB * WINAPI RtlGetCurrentPeb(void) } +/****************************************************************** + * RtlWow64EnableFsRedirection (NTDLL.@) + */ +NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable ) +{ + if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; + NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = !enable; + return STATUS_SUCCESS; +} + + +/****************************************************************** + * RtlWow64EnableFsRedirectionEx (NTDLL.@) + */ +NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG disable, ULONG *old_value ) +{ + if (!NtCurrentTeb64()) return STATUS_NOT_IMPLEMENTED; + + __TRY + { + *old_value = NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]; + } + __EXCEPT_PAGE_FAULT + { + return STATUS_ACCESS_VIOLATION; + } + __ENDTRY + + NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR] = disable; + return STATUS_SUCCESS; +} + + /********************************************************************** * RtlWow64GetCurrentMachine (NTDLL.@) */
1
0
0
0
Alexandre Julliard : ntdll: Get rid of the almost empty nt.c.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: d4509765a69a34a47fafa5178d4b5eb2cbf0415a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d4509765a69a34a47fafa517…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:18:29 2021 +0200 ntdll: Get rid of the almost empty nt.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/nt.c | 76 -------------------------------------------------- dlls/ntdll/rtl.c | 8 ++++++ dlls/ntdll/version.c | 18 ++++++++++++ 4 files changed, 26 insertions(+), 77 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 6dfe2eb12f9..b0607952431 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -22,7 +22,6 @@ C_SRCS = \ loader.c \ locale.c \ misc.c \ - nt.c \ path.c \ printf.c \ process.c \ diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c deleted file mode 100644 index b9f747570f4..00000000000 --- a/dlls/ntdll/nt.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * NT basis DLL - * - * This file contains the Nt* API functions of NTDLL.DLL. - * In the original ntdll.dll they all seem to just call int 0x2e (down to the NTOSKRNL) - * - * Copyright 1996-1998 Marcus Meissner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <string.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> - -#define NONAMELESSUNION -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "wine/debug.h" -#include "windef.h" -#include "winternl.h" -#include "ntdll_misc.h" -#include "ddk/wdm.h" - - -/*********************************************************************** - * RtlIsProcessorFeaturePresent [NTDLL.@] - */ -BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature ) -{ - return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; -} - -/****************************************************************************** - * VerSetConditionMask (NTDLL.@) - */ -ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, - BYTE dwConditionMask) -{ - if(dwTypeBitMask == 0) - return dwlConditionMask; - dwConditionMask &= 0x07; - if(dwConditionMask == 0) - return dwlConditionMask; - - if(dwTypeBitMask & VER_PRODUCT_TYPE) - dwlConditionMask |= dwConditionMask << 7*3; - else if (dwTypeBitMask & VER_SUITENAME) - dwlConditionMask |= dwConditionMask << 6*3; - else if (dwTypeBitMask & VER_SERVICEPACKMAJOR) - dwlConditionMask |= dwConditionMask << 5*3; - else if (dwTypeBitMask & VER_SERVICEPACKMINOR) - dwlConditionMask |= dwConditionMask << 4*3; - else if (dwTypeBitMask & VER_PLATFORMID) - dwlConditionMask |= dwConditionMask << 3*3; - else if (dwTypeBitMask & VER_BUILDNUMBER) - dwlConditionMask |= dwConditionMask << 2*3; - else if (dwTypeBitMask & VER_MAJORVERSION) - dwlConditionMask |= dwConditionMask << 1*3; - else if (dwTypeBitMask & VER_MINORVERSION) - dwlConditionMask |= dwConditionMask << 0*3; - return dwlConditionMask; -} diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index d7740a7a044..bb005d60807 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -2140,6 +2140,14 @@ void WINAPI RtlGetCurrentProcessorNumberEx(PROCESSOR_NUMBER *processor) processor->Reserved = 0; } +/*********************************************************************** + * RtlIsProcessorFeaturePresent [NTDLL.@] + */ +BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature ) +{ + return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; +} + /*********************************************************************** * RtlInitializeGenericTableAvl (NTDLL.@) */ diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c index cde340cca1d..5f956d9d2e6 100644 --- a/dlls/ntdll/version.c +++ b/dlls/ntdll/version.c @@ -759,3 +759,21 @@ NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info, return STATUS_SUCCESS; } + + +/****************************************************************************** + * VerSetConditionMask (NTDLL.@) + */ +ULONGLONG WINAPI VerSetConditionMask( ULONGLONG condition_mask, DWORD type_mask, BYTE condition ) +{ + condition &= 0x07; + if (type_mask & VER_PRODUCT_TYPE) condition_mask |= condition << 7*3; + else if (type_mask & VER_SUITENAME) condition_mask |= condition << 6*3; + else if (type_mask & VER_SERVICEPACKMAJOR) condition_mask |= condition << 5*3; + else if (type_mask & VER_SERVICEPACKMINOR) condition_mask |= condition << 4*3; + else if (type_mask & VER_PLATFORMID) condition_mask |= condition << 3*3; + else if (type_mask & VER_BUILDNUMBER) condition_mask |= condition << 2*3; + else if (type_mask & VER_MAJORVERSION) condition_mask |= condition << 1*3; + else if (type_mask & VER_MINORVERSION) condition_mask |= condition << 0*3; + return condition_mask; +}
1
0
0
0
Alexandre Julliard : ntdll: Forward RtlGetNativeSystemInformation() to NtWow64GetNativeSystemInformation() on 32-bit.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 9a224788b7ed09a1e1936ed1d9e12e4d115e7e58 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9a224788b7ed09a1e1936ed1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:13:30 2021 +0200 ntdll: Forward RtlGetNativeSystemInformation() to NtWow64GetNativeSystemInformation() on 32-bit. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/nt.c | 28 ---------------------------- dlls/ntdll/ntdll.spec | 3 ++- dlls/ntdll/tests/info.c | 2 +- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 3d7063caa1d..b9f747570f4 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -35,15 +35,6 @@ #include "ntdll_misc.h" #include "ddk/wdm.h" -WINE_DEFAULT_DEBUG_CHANNEL(ntdll); - -/* - * Token - */ - -/* - * Misc - */ /*********************************************************************** * RtlIsProcessorFeaturePresent [NTDLL.@] @@ -53,25 +44,6 @@ BOOLEAN WINAPI RtlIsProcessorFeaturePresent( UINT feature ) return feature < PROCESSOR_FEATURE_MAX && user_shared_data->ProcessorFeatures[feature]; } -/****************************************************************************** - * RtlGetNativeSystemInformation [NTDLL.@] - */ -NTSTATUS WINAPI /* DECLSPEC_HOTPATCH */ RtlGetNativeSystemInformation( - IN SYSTEM_INFORMATION_CLASS SystemInformationClass, - OUT PVOID SystemInformation, - IN ULONG Length, - OUT PULONG ResultLength) -{ - FIXME( "semi-stub, SystemInformationClass %#x, SystemInformation %p, Length %#x, ResultLength %p.\n", - SystemInformationClass, SystemInformation, Length, ResultLength ); - - /* RtlGetNativeSystemInformation function is the same as NtQuerySystemInformation on some Win7 - * versions but there are differences for earlier and newer versions, at least: - * - HighestUserAddress field for SystemBasicInformation; - * - Some information classes are not supported by RtlGetNativeSystemInformation. */ - return NtQuerySystemInformation( SystemInformationClass, SystemInformation, Length, ResultLength ); -} - /****************************************************************************** * VerSetConditionMask (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 85fa37fddb3..3924458f5f2 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -721,7 +721,8 @@ # Yes, Microsoft really misspelled this one! # @ stub RtlGetLengthWithoutTrailingPathSeperators @ stdcall RtlGetLongestNtPathLength() -@ stdcall RtlGetNativeSystemInformation(long ptr long ptr) +@ stdcall -syscall -arch=win32 RtlGetNativeSystemInformation(long ptr long ptr) NtWow64GetNativeSystemInformation +@ stdcall -syscall -arch=win64 RtlGetNativeSystemInformation(long ptr long ptr) NtQuerySystemInformation # @ stub RtlGetNextRange @ stdcall RtlGetNtGlobalFlags() @ stdcall RtlGetNtProductType(ptr) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index df08ef19b5e..c873a224a7c 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -200,11 +200,11 @@ static void test_query_basic(void) ok( status == STATUS_INVALID_INFO_CLASS || broken(STATUS_NOT_IMPLEMENTED), /* vista */ "got %08x\n", status); status = pRtlGetNativeSystemInformation( SystemNativeBasicInformation, &sbi3, sizeof(sbi3), &ReturnLength ); - todo_wine ok( !status || status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INVALID_INFO_CLASS) || broken(status == STATUS_NOT_IMPLEMENTED), "failed %x\n", status ); if (!status || status == STATUS_INFO_LENGTH_MISMATCH) + todo_wine_if( is_wow64 ) ok( !status == !is_wow64, "got wrong status %x wow64 %u\n", status, is_wow64 ); if (!status) {
1
0
0
0
Alexandre Julliard : ntdll: Implement NtWow64GetNativeSystemInformation().
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 04264305633ce75b8a1aadd1401cc646cfd872df URL:
https://source.winehq.org/git/wine.git/?a=commit;h=04264305633ce75b8a1aadd1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:09:54 2021 +0200 ntdll: Implement NtWow64GetNativeSystemInformation(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/ntdll.spec | 2 ++ dlls/ntdll/tests/wow64.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/virtual.c | 23 ++++++++++++++++ include/winternl.h | 1 + 4 files changed, 95 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 1067bbca96f..85fa37fddb3 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -431,6 +431,7 @@ @ stub NtWaitHighEventPair @ stub NtWaitLowEventPair @ stdcall -syscall -arch=win32 NtWow64AllocateVirtualMemory64(long ptr int64 ptr long long) +@ stdcall -syscall -arch=win32 NtWow64GetNativeSystemInformation(long ptr long ptr) @ stdcall -syscall -arch=win32 NtWow64ReadVirtualMemory64(long int64 ptr int64 ptr) @ stdcall -syscall -arch=win32 NtWow64WriteVirtualMemory64(long int64 ptr int64 ptr) @ stdcall -syscall NtWriteFile(long long ptr ptr ptr ptr long ptr ptr) @@ -1450,6 +1451,7 @@ @ stub ZwWaitHighEventPair @ stub ZwWaitLowEventPair @ stdcall -syscall -arch=win32 ZwWow64AllocateVirtualMemory64(long ptr int64 ptr long long) NtWow64AllocateVirtualMemory64 +@ stdcall -syscall -arch=win32 ZwWow64GetNativeSystemInformation(long ptr long ptr) NtWow64GetNativeSystemInformation @ stdcall -syscall -arch=win32 ZwWow64ReadVirtualMemory64(long int64 ptr int64 ptr) NtWow64ReadVirtualMemory64 @ stdcall -syscall -arch=win32 ZwWow64WriteVirtualMemory64(long int64 ptr int64 ptr) NtWow64WriteVirtualMemory64 @ stdcall -private -syscall ZwWriteFile(long long ptr ptr ptr ptr long ptr ptr) NtWriteFile diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 82543c250af..807d5486a15 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -21,7 +21,9 @@ #include "ntdll_test.h" +static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); static NTSTATUS (WINAPI *pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS,void*,ULONG,void*,ULONG,ULONG*); +static NTSTATUS (WINAPI *pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); static USHORT (WINAPI *pRtlWow64GetCurrentMachine)(void); static NTSTATUS (WINAPI *pRtlWow64GetProcessMachines)(HANDLE,WORD*,WORD*); static NTSTATUS (WINAPI *pRtlWow64GetThreadContext)(HANDLE,WOW64_CONTEXT*); @@ -31,6 +33,7 @@ static NTSTATUS (WINAPI *pRtlWow64GetCpuAreaInfo)(WOW64_CPURESERVED*,ULONG,WOW64 static NTSTATUS (WINAPI *pRtlWow64GetThreadSelectorEntry)(HANDLE,THREAD_DESCRIPTOR_INFORMATION*,ULONG,ULONG*); #else static NTSTATUS (WINAPI *pNtWow64AllocateVirtualMemory64)(HANDLE,ULONG64*,ULONG64,ULONG64*,ULONG,ULONG); +static NTSTATUS (WINAPI *pNtWow64GetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); static NTSTATUS (WINAPI *pNtWow64ReadVirtualMemory64)(HANDLE,ULONG64,void*,ULONG64,ULONG64*); static NTSTATUS (WINAPI *pNtWow64WriteVirtualMemory64)(HANDLE,ULONG64,const void *,ULONG64,ULONG64*); #endif @@ -45,7 +48,9 @@ static void init(void) if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; #define GET_PROC(func) p##func = (void *)GetProcAddress( ntdll, #func ) + GET_PROC( NtQuerySystemInformation ); GET_PROC( NtQuerySystemInformationEx ); + GET_PROC( RtlGetNativeSystemInformation ); GET_PROC( RtlWow64GetCurrentMachine ); GET_PROC( RtlWow64GetProcessMachines ); GET_PROC( RtlWow64GetThreadContext ); @@ -55,6 +60,7 @@ static void init(void) GET_PROC( RtlWow64GetThreadSelectorEntry ); #else GET_PROC( NtWow64AllocateVirtualMemory64 ); + GET_PROC( NtWow64GetNativeSystemInformation ); GET_PROC( NtWow64ReadVirtualMemory64 ); GET_PROC( NtWow64WriteVirtualMemory64 ); #endif @@ -884,6 +890,69 @@ static void test_nt_wow64(void) } else win_skip( "NtWow64AllocateVirtualMemory64 not supported\n" ); + if (pNtWow64GetNativeSystemInformation) + { + ULONG i, len; + SYSTEM_BASIC_INFORMATION sbi, sbi2, sbi3; + + memset( &sbi, 0xcc, sizeof(sbi) ); + status = pNtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), &len ); + ok( status == STATUS_SUCCESS, "failed %x\n", status ); + ok( len == sizeof(sbi), "wrong length %d\n", len ); + + memset( &sbi2, 0xcc, sizeof(sbi2) ); + status = pRtlGetNativeSystemInformation( SystemBasicInformation, &sbi2, sizeof(sbi2), &len ); + ok( status == STATUS_SUCCESS, "failed %x\n", status ); + ok( len == sizeof(sbi2), "wrong length %d\n", len ); + + ok( sbi.HighestUserAddress == (void *)0x7ffeffff, "wrong limit %p\n", sbi.HighestUserAddress); + todo_wine_if( is_wow64 ) + ok( sbi2.HighestUserAddress == (is_wow64 ? (void *)0xfffeffff : (void *)0x7ffeffff), + "wrong limit %p\n", sbi.HighestUserAddress); + + memset( &sbi3, 0xcc, sizeof(sbi3) ); + status = pNtWow64GetNativeSystemInformation( SystemBasicInformation, &sbi3, sizeof(sbi3), &len ); + ok( status == STATUS_SUCCESS, "failed %x\n", status ); + ok( len == sizeof(sbi3), "wrong length %d\n", len ); + ok( !memcmp( &sbi2, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ), + "info is different\n" ); + + memset( &sbi3, 0xcc, sizeof(sbi3) ); + status = pNtWow64GetNativeSystemInformation( SystemEmulationBasicInformation, &sbi3, sizeof(sbi3), &len ); + ok( status == STATUS_SUCCESS, "failed %x\n", status ); + ok( len == sizeof(sbi3), "wrong length %d\n", len ); + ok( !memcmp( &sbi, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ), + "info is different\n" ); + + for (i = 0; i < 256; i++) + { + NTSTATUS expect = pNtQuerySystemInformation( i, NULL, 0, &len ); + status = pNtWow64GetNativeSystemInformation( i, NULL, 0, &len ); + switch (i) + { + case SystemNativeBasicInformation: + ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_INFO_LENGTH_MISMATCH || + broken(status == STATUS_NOT_IMPLEMENTED) /* vista */, "%u: %x / %x\n", i, status, expect ); + break; + case SystemBasicInformation: + case SystemCpuInformation: + case SystemEmulationBasicInformation: + case SystemEmulationProcessorInformation: + ok( status == expect, "%u: %x / %x\n", i, status, expect ); + break; + default: + if (is_wow64) /* only a few info classes are supported on Wow64 */ + ok( status == STATUS_INVALID_INFO_CLASS || + broken(status == STATUS_NOT_IMPLEMENTED), /* vista */ + "%u: %x\n", i, status ); + else + ok( status == expect, "%u: %x / %x\n", i, status, expect ); + break; + } + } + } + else win_skip( "NtWow64GetNativeSystemInformation not supported\n" ); + NtClose( process ); } diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index c99cb424b57..1838e9d9791 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4988,4 +4988,27 @@ NTSTATUS WINAPI NtWow64WriteVirtualMemory64( HANDLE process, ULONG64 addr, const return status; } + +/*********************************************************************** + * NtWow64GetNativeSystemInformation (NTDLL.@) + * ZwWow64GetNativeSystemInformation (NTDLL.@) + */ +NTSTATUS WINAPI NtWow64GetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class, void *info, + ULONG len, ULONG *retlen ) +{ + switch (class) + { + case SystemBasicInformation: + case SystemCpuInformation: + case SystemEmulationBasicInformation: + case SystemEmulationProcessorInformation: + return NtQuerySystemInformation( class, info, len, retlen ); + case SystemNativeBasicInformation: + return NtQuerySystemInformation( SystemBasicInformation, info, len, retlen ); + default: + if (is_wow64) return STATUS_INVALID_INFO_CLASS; + return NtQuerySystemInformation( class, info, len, retlen ); + } +} + #endif /* _WIN64 */ diff --git a/include/winternl.h b/include/winternl.h index 6716b5fe699..6dc88fee343 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4410,6 +4410,7 @@ NTSYSAPI NTSTATUS WINAPI RtlWow64GetThreadSelectorEntry(HANDLE,THREAD_DESCRIPTO NTSYSAPI NTSTATUS WINAPI RtlWow64SetThreadContext(HANDLE,const WOW64_CONTEXT*); #else NTSYSAPI NTSTATUS WINAPI NtWow64AllocateVirtualMemory64(HANDLE,ULONG64*,ULONG64,ULONG64*,ULONG,ULONG); +NTSYSAPI NTSTATUS WINAPI NtWow64GetNativeSystemInformation(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*); NTSYSAPI NTSTATUS WINAPI NtWow64ReadVirtualMemory64(HANDLE,ULONG64,void*,ULONG64,ULONG64*); NTSYSAPI NTSTATUS WINAPI NtWow64WriteVirtualMemory64(HANDLE,ULONG64,const void*,ULONG64,ULONG64*); NTSYSAPI LONGLONG WINAPI RtlConvertLongToLargeInteger(LONG);
1
0
0
0
Alexandre Julliard : ntdll: Implement SystemEmulation* information classes.
by Alexandre Julliard
05 Jul '21
05 Jul '21
Module: wine Branch: master Commit: 5071a287437e624d2318a71218cb247522ac0d43 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5071a287437e624d2318a712…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jul 5 12:02:39 2021 +0200 ntdll: Implement SystemEmulation* information classes. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/info.c | 186 +++++++++++++++++++++++++++++++++++++++-- dlls/ntdll/unix/system.c | 36 +++++++- dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 14 +++- 4 files changed, 225 insertions(+), 13 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=5071a287437e624d2318…
1
0
0
0
← Newer
1
...
58
59
60
61
62
63
64
...
73
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
Results per page:
10
25
50
100
200