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
July
June
May
April
March
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 2016
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 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
430 discussions
Start a n
N
ew thread
Alexandre Julliard : user32: Use GetDIBits to retrieve the bitmap header when synthesizing a DIB.
by Alexandre Julliard
15 Sep '16
15 Sep '16
Module: wine Branch: master Commit: fe04dd2a4b5313f74f9e6c01d62d9e133576f2c4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fe04dd2a4b5313f74f9e6c01d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 15 21:01:57 2016 +0900 user32: Use GetDIBits to retrieve the bitmap header when synthesizing a DIB. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/clipboard.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index dc94794..1693aae 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -290,33 +290,33 @@ static HANDLE render_synthesized_dib( HANDLE data, UINT format, UINT from ) if (from == CF_BITMAP) { - BITMAP bmp; + BITMAPV5HEADER header; - if (!GetObjectW( data, sizeof(bmp), &bmp )) goto done; + memset( &header, 0, sizeof(header) ); + header.bV5Size = (format == CF_DIBV5) ? sizeof(BITMAPV5HEADER) : sizeof(BITMAPINFOHEADER); + if (!GetDIBits( hdc, data, 0, 0, NULL, (BITMAPINFO *)&header, DIB_RGB_COLORS )) goto done; - bits_size = abs( bmp.bmHeight ) * (((bmp.bmWidth * bmp.bmBitsPixel + 31) / 8) & ~3); - if (bmp.bmBitsPixel <= 8) - header_size = offsetof( BITMAPINFO, bmiColors[1 << bmp.bmBitsPixel] ); - else - header_size = (format == CF_DIBV5) ? sizeof(BITMAPV5HEADER) : sizeof(BITMAPINFOHEADER); - - if (!(ret = GlobalAlloc( GMEM_FIXED, header_size + bits_size ))) goto done; + header_size = bitmap_info_size( (BITMAPINFO *)&header, DIB_RGB_COLORS ); + if (!(ret = GlobalAlloc( GMEM_FIXED, header_size + header.bV5SizeImage ))) goto done; bmi = (BITMAPINFO *)ret; memset( bmi, 0, header_size ); - bmi->bmiHeader.biSize = header_size; - bmi->bmiHeader.biWidth = bmp.bmWidth; - bmi->bmiHeader.biHeight = bmp.bmHeight; - bmi->bmiHeader.biPlanes = 1; - bmi->bmiHeader.biBitCount = bmp.bmBitsPixel; - bmi->bmiHeader.biCompression = BI_RGB; - GetDIBits( hdc, data, 0, bmp.bmHeight, (char *)bmi + header_size, bmi, DIB_RGB_COLORS ); + memcpy( bmi, &header, header.bV5Size ); + GetDIBits( hdc, data, 0, abs(header.bV5Height), (char *)bmi + header_size, bmi, DIB_RGB_COLORS ); } else { + SIZE_T size = GlobalSize( data ); + + if (size < sizeof(*bmi)) goto done; if (!(src = GlobalLock( data ))) goto done; src_size = bitmap_info_size( src, DIB_RGB_COLORS ); - bits_size = GlobalSize( data ) - src_size; + if (size <= src_size) + { + GlobalUnlock( data ); + goto done; + } + bits_size = size - src_size; header_size = (format == CF_DIBV5) ? sizeof(BITMAPV5HEADER) : offsetof( BITMAPINFO, bmiColors[src->bmiHeader.biCompression == BI_BITFIELDS ? 3 : 0] );
1
0
0
0
Alexandre Julliard : user32/tests: Add some tests for the contents of the clipboard data.
by Alexandre Julliard
15 Sep '16
15 Sep '16
Module: wine Branch: master Commit: 08aa64e38ea06d95f6997ac9ab66e6abb276fc57 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=08aa64e38ea06d95f6997ac9a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 15 16:39:52 2016 +0900 user32/tests: Add some tests for the contents of the clipboard data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/clipboard.c | 107 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 61b0d2c..9f54818 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -1600,7 +1600,7 @@ static BOOL is_freed( HANDLE handle ) static UINT format_id; static HBITMAP bitmap, bitmap2; static HPALETTE palette; -static const LOGPALETTE logpalette = { 0x300, 1 }; +static const LOGPALETTE logpalette = { 0x300, 1, {{ 0x12, 0x34, 0x56, 0x78 }}}; static void test_handles( HWND hwnd ) { @@ -1609,6 +1609,7 @@ static void test_handles( HWND hwnd ) UINT format_id2 = RegisterClipboardFormatA( "another format" ); BOOL r; HANDLE data; + HBITMAP bitmap_temp; DWORD process; BOOL is_owner = (GetWindowThreadProcessId( hwnd, &process ) && process == GetCurrentProcessId()); @@ -1648,9 +1649,14 @@ static void test_handles( HWND hwnd ) h = SetClipboardData( format_id, htext2 ); ok( h == htext2, "got %p\n", h ); ok( is_moveable( h ), "expected moveable mem %p\n", h ); + bitmap_temp = CreateBitmap( 10, 10, 1, 1, NULL ); + h = SetClipboardData( CF_BITMAP, bitmap_temp ); + ok( h == bitmap_temp, "got %p\n", h ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); h = SetClipboardData( CF_BITMAP, bitmap ); ok( h == bitmap, "got %p\n", h ); ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + ok( !GetObjectType( bitmap_temp ), "expected free object %p\n", bitmap_temp ); h = SetClipboardData( CF_DSPBITMAP, bitmap2 ); ok( h == bitmap2, "got %p\n", h ); ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); @@ -1923,6 +1929,9 @@ static void test_handles_process( const char *str ) BOOL r; HANDLE h; char *ptr; + BITMAP bm; + PALETTEENTRY entry; + BYTE buffer[1024]; format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" ); r = OpenClipboard( 0 ); @@ -1951,13 +1960,44 @@ static void test_handles_process( const char *str ) trace( "private %p\n", h ); h = GetClipboardData( CF_BITMAP ); todo_wine ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + todo_wine ok( GetObjectW( h, sizeof(bm), &bm ) == sizeof(bm), "GetObject %p failed\n", h ); + todo_wine ok( bm.bmWidth == 13 && bm.bmHeight == 17, "wrong bitmap %ux%u\n", bm.bmWidth, bm.bmHeight ); trace( "bitmap %p\n", h ); h = GetClipboardData( CF_DSPBITMAP ); ok( !GetObjectType( h ), "expected invalid object %p\n", h ); trace( "bitmap2 %p\n", h ); h = GetClipboardData( CF_PALETTE ); todo_wine ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h ); + todo_wine ok( GetPaletteEntries( h, 0, 1, &entry ) == 1, "GetPaletteEntries %p failed\n", h ); + todo_wine ok( entry.peRed == 0x12 && entry.peGreen == 0x34 && entry.peBlue == 0x56, + "wrong color %02x,%02x,%02x\n", entry.peRed, entry.peGreen, entry.peBlue ); trace( "palette %p\n", h ); + h = GetClipboardData( CF_METAFILEPICT ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + if (h) + ok( GetObjectType( ((METAFILEPICT *)h)->hMF ) == OBJ_METAFILE, + "wrong object %p\n", ((METAFILEPICT *)h)->hMF ); + trace( "metafile %p\n", h ); + h = GetClipboardData( CF_DSPMETAFILEPICT ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + if (h) + ok( GetObjectType( ((METAFILEPICT *)h)->hMF ) == OBJ_METAFILE, + "wrong object %p\n", ((METAFILEPICT *)h)->hMF ); + trace( "metafile2 %p\n", h ); + h = GetClipboardData( CF_ENHMETAFILE ); + todo_wine ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h ); + todo_wine ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER), + "GetEnhMetaFileBits failed on %p\n", h ); + todo_wine ok( ((ENHMETAHEADER *)buffer)->nRecords == 3, + "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords ); + trace( "enhmetafile %p\n", h ); + h = GetClipboardData( CF_DSPENHMETAFILE ); + todo_wine ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h ); + todo_wine ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER), + "GetEnhMetaFileBits failed on %p\n", h ); + todo_wine ok( ((ENHMETAHEADER *)buffer)->nRecords == 3, + "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords ); + trace( "enhmetafile2 %p\n", h ); h = GetClipboardData( CF_DIB ); todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); h = GetClipboardData( CF_DIBV5 ); @@ -1980,12 +2020,28 @@ static void test_handles_process_open( const char *str ) ok( is_moveable( h ), "expected moveable mem %p\n", h ); } +static void test_handles_process_dib( const char *str ) +{ + BOOL r; + HANDLE h; + + r = OpenClipboard( 0 ); + ok( r, "gle %d\n", GetLastError() ); + h = GetClipboardData( CF_BITMAP ); + ok( !GetObjectType( h ), "expected invalid object %p\n", h ); + trace( "dibsection %p\n", h ); + r = CloseClipboard(); + ok( r, "gle %d\n", GetLastError() ); +} + static void test_data_handles(void) { BOOL r; char *ptr; HANDLE h, text; HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL ); + BITMAPINFO bmi; + void *bits; ok( hwnd != 0, "window creation failed\n" ); format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" ); @@ -1994,7 +2050,7 @@ static void test_data_handles(void) test_handles( hwnd ); run_thread( test_handles_thread, hwnd, __LINE__ ); - bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); + bitmap = CreateBitmap( 13, 17, 1, 1, NULL ); bitmap2 = CreateBitmap( 10, 10, 1, 1, NULL ); palette = CreatePalette( &logpalette ); @@ -2012,6 +2068,18 @@ static void test_data_handles(void) ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); h = SetClipboardData( CF_PALETTE, palette ); ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h ); + h = SetClipboardData( CF_METAFILEPICT, create_metafile() ); + ok( is_moveable( h ), "expected moveable mem %p\n", h ); + trace( "metafile %p\n", h ); + h = SetClipboardData( CF_DSPMETAFILEPICT, create_metafile() ); + ok( is_moveable( h ), "expected moveable mem %p\n", h ); + trace( "metafile2 %p\n", h ); + h = SetClipboardData( CF_ENHMETAFILE, create_emf() ); + ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h ); + trace( "enhmetafile %p\n", h ); + h = SetClipboardData( CF_DSPENHMETAFILE, create_emf() ); + ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h ); + trace( "enhmetafile2 %p\n", h ); h = SetClipboardData( CF_GDIOBJFIRST + 3, create_textA() ); ok( is_moveable( h ), "expected moveable mem %p\n", h ); h = SetClipboardData( CF_PRIVATEFIRST + 7, create_textA() ); @@ -2057,6 +2125,36 @@ static void test_data_handles(void) r = CloseClipboard(); ok( r, "gle %d\n", GetLastError() ); + /* test CF_BITMAP with a DIB section */ + memset( &bmi, 0, sizeof(bmi) ); + bmi.bmiHeader.biSize = sizeof( bmi.bmiHeader ); + bmi.bmiHeader.biWidth = 29; + bmi.bmiHeader.biHeight = 13; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bitmap = CreateDIBSection( 0, &bmi, DIB_RGB_COLORS, &bits, 0, 0 ); + + r = OpenClipboard( hwnd ); + ok( r, "gle %d\n", GetLastError() ); + r = EmptyClipboard(); + ok( r, "gle %d\n", GetLastError() ); + h = SetClipboardData( CF_BITMAP, bitmap ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + trace( "dibsection %p\n", h ); + r = CloseClipboard(); + ok( r, "gle %d\n", GetLastError() ); + + run_process( "handles_dib dummy" ); + + r = OpenClipboard( hwnd ); + ok( r, "gle %d\n", GetLastError() ); + ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap ); + r = EmptyClipboard(); + ok( r, "gle %d\n", GetLastError() ); + ok( !GetObjectType( bitmap ), "expected deleted %p\n", bitmap ); + r = CloseClipboard(); + ok( r, "gle %d\n", GetLastError() ); + DestroyWindow( hwnd ); } @@ -2202,6 +2300,11 @@ START_TEST(clipboard) test_handles_process_open( argv[3] ); return; } + if (argc == 4 && !strcmp( argv[2], "handles_dib" )) + { + test_handles_process_dib( argv[3] ); + return; + } test_RegisterClipboardFormatA(); test_ClipboardOwner();
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetMetafileHeaderFromFile.
by Alexandre Julliard
15 Sep '16
15 Sep '16
Module: wine Branch: master Commit: b7956a89bd938bcab348ee533fde97ad90fb26b8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b7956a89bd938bcab348ee533…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Sep 14 14:57:02 2016 -0500 gdiplus: Implement GdipGetMetafileHeaderFromFile. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/metafile.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index adad4f9..c0e799c 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -1799,19 +1799,21 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf(HMETAFILE hwmf, GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, MetafileHeader *header) { - static int calls; + GpStatus status; + GpMetafile *metafile; TRACE("(%s,%p)\n", debugstr_w(filename), header); - if(!filename || !header) + if (!filename || !header) return InvalidParameter; - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; + status = GdipCreateMetafileFromFile(filename, &metafile); + if (status == Ok) + { + status = GdipGetMetafileHeaderFromMetafile(metafile, header); + GdipDisposeImage(&metafile->image); + } + return status; } GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream,
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetMetafileHeaderFromStream.
by Alexandre Julliard
15 Sep '16
15 Sep '16
Module: wine Branch: master Commit: 368b4c47bbbc525f7479bdf8a861d84c3284711e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=368b4c47bbbc525f7479bdf8a…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Sep 14 14:57:01 2016 -0500 gdiplus: Implement GdipGetMetafileHeaderFromStream. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/metafile.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 88717e4..adad4f9 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -1817,19 +1817,21 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream, MetafileHeader *header) { - static int calls; + GpStatus status; + GpMetafile *metafile; TRACE("(%p,%p)\n", stream, header); - if(!stream || !header) + if (!stream || !header) return InvalidParameter; - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; + status = GdipCreateMetafileFromStream(stream, &metafile); + if (status == Ok) + { + status = GdipGetMetafileHeaderFromMetafile(metafile, header); + GdipDisposeImage(&metafile->image); + } + return status; } GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
1
0
0
0
Dmitry Timoshkov : gdiplus: Implement GdipGetMetafileHeaderFromWmf.
by Alexandre Julliard
15 Sep '16
15 Sep '16
Module: wine Branch: master Commit: 8c1ded6164ca6d98a0d7010f154cc01e9fc76371 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8c1ded6164ca6d98a0d7010f1…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Sep 14 14:57:00 2016 -0500 gdiplus: Implement GdipGetMetafileHeaderFromWmf. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/metafile.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index c163ef9..db0a49a 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -303,7 +303,7 @@ 303 stdcall GdipGetMetafileHeaderFromFile(wstr ptr) 304 stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr) 305 stdcall GdipGetMetafileHeaderFromStream(ptr ptr) -306 stub GdipGetMetafileHeaderFromWmf +306 stdcall GdipGetMetafileHeaderFromWmf(ptr ptr ptr) 307 stdcall GdipGetNearestColor(ptr ptr) 308 stdcall GdipGetPageScale(ptr ptr) 309 stdcall GdipGetPageUnit(ptr ptr) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 6d58170..88717e4 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -1779,6 +1779,23 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, return Ok; } +GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf(HMETAFILE hwmf, + GDIPCONST WmfPlaceableFileHeader *placeable, MetafileHeader *header) +{ + GpStatus status; + GpMetafile *metafile; + + TRACE("(%p,%p,%p)\n", hwmf, placeable, header); + + status = GdipCreateMetafileFromWmf(hwmf, FALSE, placeable, &metafile); + if (status == Ok) + { + status = GdipGetMetafileHeaderFromMetafile(metafile, header); + GdipDisposeImage(&metafile->image); + } + return status; +} + GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, MetafileHeader *header) {
1
0
0
0
Piotr Caban : ucrtbase: Add __std_type_info_hash implementation.
by Alexandre Julliard
14 Sep '16
14 Sep '16
Module: wine Branch: master Commit: 4931e6f92bc7e0c229a057ebf2e000f8f5aa1edd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4931e6f92bc7e0c229a057ebf…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Sep 14 15:34:02 2016 +0200 ucrtbase: Add __std_type_info_hash implementation. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-crt-private-l1-1-0.spec | 2 +- dlls/msvcrt/cpp.c | 19 ++++++++++++++ dlls/ucrtbase/tests/cpp.c | 30 ++++++++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- dlls/vcruntime140/vcruntime140.spec | 2 +- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec index a007823..e52b904 100644 --- a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec +++ b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec @@ -46,7 +46,7 @@ @ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy @ cdecl __std_type_info_compare(ptr ptr) ucrtbase.__std_type_info_compare @ cdecl __std_type_info_destroy_list(ptr) ucrtbase.__std_type_info_destroy_list -@ stub __std_type_info_hash +@ cdecl __std_type_info_hash(ptr) ucrtbase.__std_type_info_hash @ cdecl __std_type_info_name(ptr ptr) ucrtbase.__std_type_info_name @ cdecl __unDName(ptr str long ptr ptr long) ucrtbase.__unDName @ cdecl __unDNameEx(ptr str long ptr ptr ptr long) ucrtbase.__unDNameEx diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index 3621f12..0ffe61e 100644 --- a/dlls/msvcrt/cpp.c +++ b/dlls/msvcrt/cpp.c @@ -1588,4 +1588,23 @@ void CDECL MSVCRT_type_info_destroy_list(SLIST_HEADER *header) MSVCRT_free(cur); } } + +/****************************************************************** + * __std_type_info_hash (UCRTBASE.@) + * + * TODO: 64-bit version of the function uses different constants + */ +MSVCRT_size_t CDECL MSVCRT_type_info_hash(const type_info140 *ti) +{ + MSVCRT_size_t hash = 0x811c9dc5; + const char *p; + + TRACE("(%p)->%s\n", ti, ti->mangled); + + for(p = ti->mangled+1; *p; p++) { + hash ^= *p; + hash *= 0x1000193; + } + return hash; +} #endif diff --git a/dlls/ucrtbase/tests/cpp.c b/dlls/ucrtbase/tests/cpp.c index 168cd21..1a01fea 100644 --- a/dlls/ucrtbase/tests/cpp.c +++ b/dlls/ucrtbase/tests/cpp.c @@ -51,6 +51,7 @@ static void (CDECL *p___std_exception_destroy)(__std_exception_data*); static int (CDECL *p___std_type_info_compare)(const type_info140*, const type_info140*); static const char* (CDECL *p___std_type_info_name)(type_info140*, SLIST_HEADER*); static void (CDECL *p___std_type_info_destroy_list)(SLIST_HEADER*); +static size_t (CDECL *p___std_type_info_hash)(type_info140*); static BOOL init(void) @@ -70,6 +71,7 @@ static BOOL init(void) p___std_type_info_compare = (void*)GetProcAddress(module, "__std_type_info_compare"); p___std_type_info_name = (void*)GetProcAddress(module, "__std_type_info_name"); p___std_type_info_destroy_list = (void*)GetProcAddress(module, "__std_type_info_destroy_list"); + p___std_type_info_hash = (void*)GetProcAddress(module, "__std_type_info_hash"); return TRUE; } @@ -125,6 +127,7 @@ static void test___std_type_info(void) SLIST_HEADER header; type_info_list *elem; const char *ret; + size_t hash1, hash2; int eq; @@ -154,6 +157,33 @@ static void test___std_type_info(void) eq = p___std_type_info_compare(&ti1, &ti3); ok(eq == 0, "__std_type_info_compare(&ti1, &ti3) = %d\n", eq); + + ti1.mangled[0] = 0; + ti1.mangled[1] = 0; + ti1.mangled[2] = 0; + hash1 = p___std_type_info_hash(&ti1); +#ifdef _WIN64 + todo_wine ok(hash1 == 0xcbf29ce44fd0bfc1, "hash = %p\n", (void*)hash1); +#else + ok(hash1 == 0x811c9dc5, "hash = %p\n", (void*)hash1); +#endif + + ti1.mangled[0] = 1; + hash2 = p___std_type_info_hash(&ti1); + ok(hash1 == hash2, "hash1 != hash2 (first char not ignorred)\n"); + + ti1.mangled[1] = 1; + hash1 = p___std_type_info_hash(&ti1); + if(sizeof(void*) == sizeof(int)) + ok(hash1 == 0x40c5b8c, "hash = %p\n", (void*)hash1); + ok(hash1 != hash2, "hash1 == hash2 for different strings\n"); + + ti1.mangled[1] = 2; + hash2 = p___std_type_info_hash(&ti1); + ok(hash1 != hash2, "hash1 == hash2 for different strings\n"); + + hash1 = p___std_type_info_hash(&ti2); + ok(hash1 != hash2, "hash1 == hash2 for different strings\n"); } START_TEST(cpp) diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 07eb7e1..f0598ce 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -144,7 +144,7 @@ @ cdecl __std_exception_destroy(ptr) MSVCRT___std_exception_destroy @ cdecl __std_type_info_compare(ptr ptr) MSVCRT_type_info_compare @ cdecl __std_type_info_destroy_list(ptr) MSVCRT_type_info_destroy_list -@ stub __std_type_info_hash +@ cdecl __std_type_info_hash(ptr) MSVCRT_type_info_hash @ cdecl __std_type_info_name(ptr ptr) MSVCRT_type_info_name_list @ cdecl __stdio_common_vfprintf(int64 ptr str ptr ptr) MSVCRT__stdio_common_vfprintf @ stub __stdio_common_vfprintf_p diff --git a/dlls/vcruntime140/vcruntime140.spec b/dlls/vcruntime140/vcruntime140.spec index 8d6c060..ca9368c 100644 --- a/dlls/vcruntime140/vcruntime140.spec +++ b/dlls/vcruntime140/vcruntime140.spec @@ -41,7 +41,7 @@ @ stub __std_terminate @ cdecl __std_type_info_compare(ptr ptr) ucrtbase.__std_type_info_compare @ cdecl __std_type_info_destroy_list(ptr) ucrtbase.__std_type_info_destroy_list -@ stub __std_type_info_hash +@ cdecl __std_type_info_hash(ptr) ucrtbase.__std_type_info_hash @ cdecl __std_type_info_name(ptr ptr) ucrtbase.__std_type_info_name @ cdecl __telemetry_main_invoke_trigger(ptr) @ cdecl __telemetry_main_return_trigger(ptr)
1
0
0
0
Austin English : api-ms-win-core-threadpool-l1-1-0: Add dll.
by Alexandre Julliard
14 Sep '16
14 Sep '16
Module: wine Branch: master Commit: 631fd7ffcc6a575d2fcc75afb158a3cdf9740cc2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=631fd7ffcc6a575d2fcc75afb…
Author: Austin English <austinenglish(a)gmail.com> Date: Tue Sep 13 23:59:14 2016 -0500 api-ms-win-core-threadpool-l1-1-0: Add dll. Signed-off-by: Austin English <austinenglish(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 2 ++ configure.ac | 1 + dlls/api-ms-win-core-threadpool-l1-1-0/Makefile.in | 1 + .../api-ms-win-core-threadpool-l1-1-0.spec | 42 ++++++++++++++++++++++ tools/make_specfiles | 1 + 5 files changed, 47 insertions(+) diff --git a/configure b/configure index 8f58dd1..6727ea5 100755 --- a/configure +++ b/configure @@ -949,6 +949,7 @@ enable_api_ms_win_core_synch_l1_2_0 enable_api_ms_win_core_sysinfo_l1_1_0 enable_api_ms_win_core_sysinfo_l1_2_0 enable_api_ms_win_core_sysinfo_l1_2_1 +enable_api_ms_win_core_threadpool_l1_1_0 enable_api_ms_win_core_threadpool_l1_2_0 enable_api_ms_win_core_threadpool_legacy_l1_1_0 enable_api_ms_win_core_timezone_l1_1_0 @@ -17610,6 +17611,7 @@ wine_fn_config_dll api-ms-win-core-synch-l1-2-0 enable_api_ms_win_core_synch_l1_ wine_fn_config_dll api-ms-win-core-sysinfo-l1-1-0 enable_api_ms_win_core_sysinfo_l1_1_0 wine_fn_config_dll api-ms-win-core-sysinfo-l1-2-0 enable_api_ms_win_core_sysinfo_l1_2_0 wine_fn_config_dll api-ms-win-core-sysinfo-l1-2-1 enable_api_ms_win_core_sysinfo_l1_2_1 +wine_fn_config_dll api-ms-win-core-threadpool-l1-1-0 enable_api_ms_win_core_threadpool_l1_1_0 wine_fn_config_dll api-ms-win-core-threadpool-l1-2-0 enable_api_ms_win_core_threadpool_l1_2_0 wine_fn_config_dll api-ms-win-core-threadpool-legacy-l1-1-0 enable_api_ms_win_core_threadpool_legacy_l1_1_0 wine_fn_config_dll api-ms-win-core-timezone-l1-1-0 enable_api_ms_win_core_timezone_l1_1_0 diff --git a/configure.ac b/configure.ac index 59e7b7c..35c931a 100644 --- a/configure.ac +++ b/configure.ac @@ -2725,6 +2725,7 @@ WINE_CONFIG_DLL(api-ms-win-core-synch-l1-2-0) WINE_CONFIG_DLL(api-ms-win-core-sysinfo-l1-1-0) WINE_CONFIG_DLL(api-ms-win-core-sysinfo-l1-2-0) WINE_CONFIG_DLL(api-ms-win-core-sysinfo-l1-2-1) +WINE_CONFIG_DLL(api-ms-win-core-threadpool-l1-1-0) WINE_CONFIG_DLL(api-ms-win-core-threadpool-l1-2-0) WINE_CONFIG_DLL(api-ms-win-core-threadpool-legacy-l1-1-0) WINE_CONFIG_DLL(api-ms-win-core-timezone-l1-1-0) diff --git a/dlls/api-ms-win-core-threadpool-l1-1-0/Makefile.in b/dlls/api-ms-win-core-threadpool-l1-1-0/Makefile.in new file mode 100644 index 0000000..2d41aed --- /dev/null +++ b/dlls/api-ms-win-core-threadpool-l1-1-0/Makefile.in @@ -0,0 +1 @@ +MODULE = api-ms-win-core-threadpool-l1-1-0.dll diff --git a/dlls/api-ms-win-core-threadpool-l1-1-0/api-ms-win-core-threadpool-l1-1-0.spec b/dlls/api-ms-win-core-threadpool-l1-1-0/api-ms-win-core-threadpool-l1-1-0.spec new file mode 100644 index 0000000..dcf954a --- /dev/null +++ b/dlls/api-ms-win-core-threadpool-l1-1-0/api-ms-win-core-threadpool-l1-1-0.spec @@ -0,0 +1,42 @@ +@ stdcall CallbackMayRunLong(ptr) kernel32.CallbackMayRunLong +@ stub CancelThreadpoolIo +@ stdcall ChangeTimerQueueTimer(ptr ptr long long) kernel32.ChangeTimerQueueTimer +@ stdcall CloseThreadpool(ptr) kernel32.CloseThreadpool +@ stdcall CloseThreadpoolCleanupGroup(ptr) kernel32.CloseThreadpoolCleanupGroup +@ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) kernel32.CloseThreadpoolCleanupGroupMembers +@ stub CloseThreadpoolIo +@ stdcall CloseThreadpoolTimer(ptr) kernel32.CloseThreadpoolTimer +@ stdcall CloseThreadpoolWait(ptr) kernel32.CloseThreadpoolWait +@ stdcall CloseThreadpoolWork(ptr) kernel32.CloseThreadpoolWork +@ stdcall CreateThreadpool(ptr) kernel32.CreateThreadpool +@ stdcall CreateThreadpoolCleanupGroup() kernel32.CreateThreadpoolCleanupGroup +@ stub CreateThreadpoolIo +@ stdcall CreateThreadpoolTimer(ptr ptr ptr) kernel32.CreateThreadpoolTimer +@ stdcall CreateThreadpoolWait(ptr ptr ptr) kernel32.CreateThreadpoolWait +@ stdcall CreateThreadpoolWork(ptr ptr ptr) kernel32.CreateThreadpoolWork +@ stdcall CreateTimerQueue() kernel32.CreateTimerQueue +@ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long) kernel32.CreateTimerQueueTimer +@ stdcall DeleteTimerQueueEx(long long) kernel32.DeleteTimerQueueEx +@ stdcall DeleteTimerQueueTimer(long long long) kernel32.DeleteTimerQueueTimer +@ stdcall DisassociateCurrentThreadFromCallback(ptr) kernel32.DisassociateCurrentThreadFromCallback +@ stdcall FreeLibraryWhenCallbackReturns(ptr ptr) kernel32.FreeLibraryWhenCallbackReturns +@ stdcall IsThreadpoolTimerSet(ptr) kernel32.IsThreadpoolTimerSet +@ stdcall LeaveCriticalSectionWhenCallbackReturns(ptr ptr) kernel32.LeaveCriticalSectionWhenCallbackReturns +@ stub QueryThreadpoolStackInformation +@ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) kernel32.RegisterWaitForSingleObjectEx +@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) kernel32.ReleaseMutexWhenCallbackReturns +@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) kernel32.ReleaseSemaphoreWhenCallbackReturns +@ stdcall SetEventWhenCallbackReturns(ptr long) kernel32.SetEventWhenCallbackReturns +@ stub SetThreadpoolStackInformation +@ stdcall SetThreadpoolThreadMaximum(ptr long) kernel32.SetThreadpoolThreadMaximum +@ stdcall SetThreadpoolThreadMinimum(ptr long) kernel32.SetThreadpoolThreadMinimum +@ stdcall SetThreadpoolTimer(ptr ptr long long) kernel32.SetThreadpoolTimer +@ stdcall SetThreadpoolWait(ptr long ptr) kernel32.SetThreadpoolWait +@ stub StartThreadpoolIo +@ stdcall SubmitThreadpoolWork(ptr) kernel32.SubmitThreadpoolWork +@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr) kernel32.TrySubmitThreadpoolCallback +@ stdcall UnregisterWaitEx(long long) kernel32.UnregisterWaitEx +@ stub WaitForThreadpoolIoCallbacks +@ stdcall WaitForThreadpoolTimerCallbacks(ptr long) kernel32.WaitForThreadpoolTimerCallbacks +@ stdcall WaitForThreadpoolWaitCallbacks(ptr long) kernel32.WaitForThreadpoolWaitCallbacks +@ stdcall WaitForThreadpoolWorkCallbacks(ptr long) kernel32.WaitForThreadpoolWorkCallbacks diff --git a/tools/make_specfiles b/tools/make_specfiles index 554956c..eff126c 100755 --- a/tools/make_specfiles +++ b/tools/make_specfiles @@ -175,6 +175,7 @@ my @dll_groups = "api-ms-win-core-processenvironment-l1-1-0", "api-ms-win-core-processenvironment-l1-2-0", "api-ms-win-core-psapi-l1-1-0", + "api-ms-win-core-threadpool-l1-1-0", "api-ms-win-core-threadpool-l1-2-0", "api-ms-win-core-threadpool-legacy-l1-1-0", "api-ms-win-core-timezone-l1-1-0",
1
0
0
0
Aric Stewart : ntoskrnl.exe: Implement loading plug and play devices.
by Alexandre Julliard
14 Sep '16
14 Sep '16
Module: wine Branch: master Commit: e4496a976bb5d7217bfabcd91e8f111d1a90ac1b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e4496a976bb5d7217bfabcd91…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Sep 14 09:30:43 2016 +0200 ntoskrnl.exe: Implement loading plug and play devices. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/ntoskrnl.c | 187 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 186 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index d5236e6..aebb3de 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -48,6 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl); WINE_DECLARE_DEBUG_CHANNEL(relay); +WINE_DECLARE_DEBUG_CHANNEL(plugplay); BOOLEAN KdDebuggerEnabled = FALSE; ULONG InitSafeBootMode = 0; @@ -76,6 +77,8 @@ static const WCHAR servicesW[] = {'\\','R','e','g','i','s','t','r','y', '\\','S','e','r','v','i','c','e','s', '\\',0}; +#define MAX_SERVICE_NAME 260 + /* tid of the thread running client request */ static DWORD request_thread; @@ -2819,10 +2822,192 @@ done: } +static NTSTATUS WINAPI internal_complete( DEVICE_OBJECT *device, IRP *irp, void *context ) +{ + SetEvent( irp->UserEvent ); + return STATUS_MORE_PROCESSING_REQUIRED; +} + + +static NTSTATUS send_device_irp( DEVICE_OBJECT *device, IRP *irp, ULONG_PTR *info ) +{ + NTSTATUS status; + IO_STACK_LOCATION *irpsp; + HANDLE event = CreateEventA( NULL, FALSE, FALSE, NULL ); + DEVICE_OBJECT *toplevel_device; + + irp->UserEvent = event; + irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; + irpsp = IoGetNextIrpStackLocation( irp ); + irpsp->CompletionRoutine = internal_complete; + irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR | SL_INVOKE_ON_CANCEL; + + toplevel_device = IoGetAttachedDeviceReference( device ); + status = IoCallDriver( toplevel_device, irp ); + + if (status == STATUS_PENDING) + WaitForSingleObject( event, INFINITE ); + + status = irp->IoStatus.u.Status; + if (info) + *info = irp->IoStatus.Information; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + ObDereferenceObject( toplevel_device ); + CloseHandle( event ); + return status; +} + + +static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR **id ) +{ + IO_STACK_LOCATION *irpsp; + IO_STATUS_BLOCK irp_status; + IRP *irp; + + if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status ))) + return STATUS_NO_MEMORY; + + irpsp = IoGetNextIrpStackLocation( irp ); + irpsp->MinorFunction = IRP_MN_QUERY_ID; + irpsp->Parameters.QueryId.IdType = type; + + return send_device_irp( device, irp, (ULONG_PTR *)id ); +} + + +static BOOL get_driver_for_id( const WCHAR *id, WCHAR *driver ) +{ + static const WCHAR serviceW[] = {'S','e','r','v','i','c','e',0}; + static const UNICODE_STRING service_str = { sizeof(serviceW) - sizeof(WCHAR), sizeof(serviceW), (WCHAR *)serviceW }; + static const WCHAR critical_fmtW[] = + {'\\','R','e','g','i','s','t','r','y', + '\\','M','a','c','h','i','n','e', + '\\','S','y','s','t','e','m', + '\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t', + '\\','C','o','n','t','r','o','l', + '\\','C','r','i','t','i','c','a','l','D','e','v','i','c','e','D','a','t','a','b','a','s','e', + '\\','%','s',0}; + WCHAR buffer[FIELD_OFFSET( KEY_VALUE_PARTIAL_INFORMATION, Data[MAX_SERVICE_NAME * sizeof(WCHAR)] )]; + KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING key; + NTSTATUS status; + HANDLE hkey; + WCHAR *keyW; + DWORD len; + + if (!(keyW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(critical_fmtW) + strlenW(id) * sizeof(WCHAR) ))) + return STATUS_NO_MEMORY; + + sprintfW( keyW, critical_fmtW, id ); + RtlInitUnicodeString( &key, keyW ); + InitializeObjectAttributes( &attr, &key, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL ); + + status = NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ); + RtlFreeUnicodeString( &key ); + if (status != STATUS_SUCCESS) + { + TRACE_(plugplay)( "no driver found for %s\n", debugstr_w(id) ); + return FALSE; + } + + status = NtQueryValueKey( hkey, &service_str, KeyValuePartialInformation, + info, sizeof(buffer) - sizeof(WCHAR), &len ); + NtClose( hkey ); + if (status != STATUS_SUCCESS || info->Type != REG_SZ) + { + TRACE_(plugplay)( "no driver found for %s\n", debugstr_w(id) ); + return FALSE; + } + + memcpy( driver, info->Data, info->DataLength ); + driver[ info->DataLength / sizeof(WCHAR) ] = 0; + TRACE_(plugplay)( "found driver %s for %s\n", debugstr_w(driver), debugstr_w(id) ); + return TRUE; +} + + +static void handle_bus_relations( DEVICE_OBJECT *device ) +{ + static const WCHAR driverW[] = {'\\','D','r','i','v','e','r','\\',0}; + WCHAR buffer[MAX_SERVICE_NAME + sizeof(servicesW)/sizeof(WCHAR)]; + WCHAR driver[MAX_SERVICE_NAME] = {0}; + DRIVER_OBJECT *driver_obj; + UNICODE_STRING string; + WCHAR *ids, *ptr; + NTSTATUS status; + + TRACE_(plugplay)( "(%p)\n", device ); + + /* We could (should?) do a full IRP_MN_QUERY_DEVICE_RELATIONS query, + * but we don't have to, we have the DEVICE_OBJECT of the new device + * so we can simply handle the process here */ + + status = get_device_id( device, BusQueryCompatibleIDs, &ids ); + if (status != STATUS_SUCCESS || !ids) + { + ERR_(plugplay)( "Failed to get device IDs\n" ); + return; + } + + for (ptr = ids; *ptr; ptr += strlenW(ptr) + 1) + { + if (get_driver_for_id( ptr, driver )) + break; + } + RtlFreeHeap( GetProcessHeap(), 0, ids ); + + if (!driver[0]) + { + ERR_(plugplay)( "No matching driver found for device\n" ); + return; + } + + strcpyW( buffer, servicesW ); + strcatW( buffer, driver ); + RtlInitUnicodeString( &string, buffer ); + if (ZwLoadDriver( &string ) != STATUS_SUCCESS) + { + ERR_(plugplay)( "Failed to load driver %s\n", debugstr_w(driver) ); + return; + } + + strcpyW( buffer, driverW ); + strcatW( buffer, driver ); + RtlInitUnicodeString( &string, buffer ); + if (ObReferenceObjectByName( &string, OBJ_CASE_INSENSITIVE, NULL, + 0, NULL, KernelMode, NULL, (void **)&driver_obj ) != STATUS_SUCCESS) + { + ERR_(plugplay)( "Failed to locate loaded driver %s\n", debugstr_w(driver) ); + return; + } + + if (driver_obj->DriverExtension->AddDevice) + status = driver_obj->DriverExtension->AddDevice( driver_obj, device ); + else + status = STATUS_NOT_IMPLEMENTED; + + ObDereferenceObject( driver_obj ); + + if (status != STATUS_SUCCESS) + ERR_(plugplay)( "AddDevice failed for driver %s\n", debugstr_w(driver) ); +} + + /*********************************************************************** * IoInvalidateDeviceRelations (NTOSKRNL.EXE.@) */ void WINAPI IoInvalidateDeviceRelations( DEVICE_OBJECT *device_object, DEVICE_RELATION_TYPE type ) { - FIXME( "(%p, %i): stub\n", device_object, type ); + TRACE( "(%p, %i)\n", device_object, type ); + + switch (type) + { + case BusRelations: + handle_bus_relations( device_object ); + break; + default: + FIXME( "unhandled relation %i\n", type ); + break; + } }
1
0
0
0
Aric Stewart : winebus.sys: Implement IRP_MN_QUERY_ID.
by Alexandre Julliard
14 Sep '16
14 Sep '16
Module: wine Branch: master Commit: 903e0032ff62aaa2c12386837614a83a0ed662f0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=903e0032ff62aaa2c12386837…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Sep 14 09:29:50 2016 +0200 winebus.sys: Implement IRP_MN_QUERY_ID. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/main.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 9c0f5aa..1364eab 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -111,6 +111,52 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device) return dst; } +static WCHAR *get_device_id(DEVICE_OBJECT *device) +{ + static const WCHAR formatW[] = {'%','s','\\','V','i','d','_','%','0','4','x','&','P','i','d','_','%','0','4','x',0}; + struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + DWORD len = strlenW(ext->busid) + 19; + WCHAR *dst; + + if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid); + + return dst; +} + +static WCHAR *get_compatible_ids(DEVICE_OBJECT *device) +{ + struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + WCHAR *iid, *did, *dst, *ptr; + DWORD len; + + if (!(iid = get_instance_id(device))) + return NULL; + + if (!(did = get_device_id(device))) + { + HeapFree(GetProcessHeap(), 0, iid); + return NULL; + } + + len = strlenW(iid) + strlenW(did) + strlenW(ext->busid) + 4; + if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + { + ptr = dst; + strcpyW(ptr, iid); + ptr += strlenW(iid) + 1; + strcpyW(ptr, did); + ptr += strlenW(did) + 1; + strcpyW(ptr, ext->busid); + ptr += strlenW(ext->busid) + 1; + *ptr = 0; + } + + HeapFree(GetProcessHeap(), 0, iid); + HeapFree(GetProcessHeap(), 0, did); + return dst; +} + DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, void *native, WORD vid, WORD pid, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, const GUID *class) @@ -184,6 +230,41 @@ DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, return device; } +static NTSTATUS handle_IRP_MN_QUERY_ID(DEVICE_OBJECT *device, IRP *irp) +{ + NTSTATUS status = irp->IoStatus.u.Status; + IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); + BUS_QUERY_ID_TYPE type = irpsp->Parameters.QueryId.IdType; + + TRACE("(%p, %p)\n", device, irp); + + switch (type) + { + case BusQueryHardwareIDs: + TRACE("BusQueryHardwareIDs\n"); + irp->IoStatus.Information = (ULONG_PTR)get_compatible_ids(device); + break; + case BusQueryCompatibleIDs: + TRACE("BusQueryCompatibleIDs\n"); + irp->IoStatus.Information = (ULONG_PTR)get_compatible_ids(device); + break; + case BusQueryDeviceID: + TRACE("BusQueryDeviceID\n"); + irp->IoStatus.Information = (ULONG_PTR)get_device_id(device); + break; + case BusQueryInstanceID: + TRACE("BusQueryInstanceID\n"); + irp->IoStatus.Information = (ULONG_PTR)get_instance_id(device); + break; + default: + FIXME("Unhandled type %08x\n", type); + return status; + } + + status = irp->IoStatus.Information ? STATUS_SUCCESS : STATUS_NO_MEMORY; + return status; +} + NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) { NTSTATUS status = irp->IoStatus.u.Status; @@ -196,6 +277,8 @@ NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) break; case IRP_MN_QUERY_ID: TRACE("IRP_MN_QUERY_ID\n"); + status = handle_IRP_MN_QUERY_ID(device, irp); + irp->IoStatus.u.Status = status; break; case IRP_MN_QUERY_CAPABILITIES: TRACE("IRP_MN_QUERY_CAPABILITIES\n");
1
0
0
0
Aric Stewart : winebus.sys: Create bus devices.
by Alexandre Julliard
14 Sep '16
14 Sep '16
Module: wine Branch: master Commit: 159c2eb16e5238d6ca4537c4d01d9d8798b46951 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=159c2eb16e5238d6ca4537c4d…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Sep 14 09:28:51 2016 +0200 winebus.sys: Create bus devices. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/Makefile.in | 2 +- dlls/winebus.sys/bus.h | 3 + dlls/winebus.sys/bus_udev.c | 19 ++++++ dlls/winebus.sys/main.c | 150 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/Makefile.in b/dlls/winebus.sys/Makefile.in index b24416b..9d3a0c2 100644 --- a/dlls/winebus.sys/Makefile.in +++ b/dlls/winebus.sys/Makefile.in @@ -1,5 +1,5 @@ MODULE = winebus.sys -IMPORTS = ntoskrnl +IMPORTS = ntoskrnl setupapi EXTRALIBS = $(UDEV_LIBS) EXTRAINCL = $(UDEV_CFLAGS) EXTRADLLFLAGS = -Wb,--subsystem,native diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 3d53a46..dcb50f2 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -21,3 +21,6 @@ NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry /* HID Plug and Play Bus */ NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN; +DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, void *native, WORD vid, + WORD pid, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, + const GUID *class) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index d47a556..1525861 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -50,6 +50,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); static struct udev *udev_context = NULL; static DRIVER_OBJECT *udev_driver_obj = NULL; +static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0}; + +#include "initguid.h" +DEFINE_GUID(GUID_DEVCLASS_HIDRAW, 0x3def44ad,0x242e,0x46e5,0x82,0x6d,0x70,0x72,0x13,0xf3,0xaa,0x81); + static DWORD get_sysattr_dword(struct udev_device *dev, const char *sysattr, int base) { const char *attr = udev_device_get_sysattr_value(dev, sysattr); @@ -81,6 +86,8 @@ static void try_add_device(struct udev_device *dev) { DWORD vid = 0, pid = 0, version = 0; struct udev_device *usbdev; + DEVICE_OBJECT *device = NULL; + const char *subsystem; const char *devnode; WCHAR *serial = NULL; int fd; @@ -107,6 +114,18 @@ static void try_add_device(struct udev_device *dev) TRACE("Found udev device %s (vid %04x, pid %04x, version %u, serial %s)\n", debugstr_a(devnode), vid, pid, version, debugstr_w(serial)); + subsystem = udev_device_get_subsystem(dev); + if (strcmp(subsystem, "hidraw") == 0) + { + device = bus_create_hid_device(udev_driver_obj, hidraw_busidW, dev, vid, pid, + version, 0, serial, FALSE, &GUID_DEVCLASS_HIDRAW); + } + + if (device) + udev_device_ref(dev); + else + WARN("Ignoring device %s with subsystem %s\n", debugstr_a(devnode), subsystem); + HeapFree(GetProcessHeap(), 0, serial); } diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 43de25a..9c0f5aa 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -26,14 +26,164 @@ #define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" +#include "winuser.h" #include "winternl.h" +#include "winreg.h" +#include "setupapi.h" #include "ddk/wdm.h" #include "wine/debug.h" +#include "wine/unicode.h" +#include "wine/list.h" #include "bus.h" WINE_DEFAULT_DEBUG_CHANNEL(plugplay); +struct pnp_device +{ + struct list entry; + DEVICE_OBJECT *device; +}; + +struct device_extension +{ + void *native; /* Must be the first member of the structure */ + + WORD vid, pid; + DWORD uid, version, index; + BOOL is_gamepad; + WCHAR *serial; + const WCHAR *busid; /* Expected to be a static constant */ +}; + +static CRITICAL_SECTION device_list_cs; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &device_list_cs, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": device_list_cs") } +}; +static CRITICAL_SECTION device_list_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; + +static struct list pnp_devset = LIST_INIT(pnp_devset); + +static const WCHAR zero_serialW[]= {'0','0','0','0',0}; +static const WCHAR imW[] = {'I','M',0}; +static const WCHAR igW[] = {'I','G',0}; + +static inline WCHAR *strdupW(const WCHAR *src) +{ + WCHAR *dst; + if (!src) return NULL; + dst = HeapAlloc(GetProcessHeap(), 0, (strlenW(src) + 1)*sizeof(WCHAR)); + if (dst) strcpyW(dst, src); + return dst; +} + +static DWORD get_vidpid_index(WORD vid, WORD pid) +{ + struct pnp_device *ptr; + DWORD index = 1; + + LIST_FOR_EACH_ENTRY(ptr, &pnp_devset, struct pnp_device, entry) + { + struct device_extension *ext = (struct device_extension *)ptr->device->DeviceExtension; + if (ext->vid == vid && ext->pid == pid) + index = max(ext->index + 1, index); + } + + return index; +} + +static WCHAR *get_instance_id(DEVICE_OBJECT *device) +{ + static const WCHAR formatW[] = {'%','s','\\','V','i','d','_','%','0','4','x','&', 'P','i','d','_','%','0','4','x','&', + '%','s','_','%','i','\\','%','i','&','%','s','&','%','x',0}; + struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + const WCHAR *serial = ext->serial ? ext->serial : zero_serialW; + DWORD len = strlenW(ext->busid) + strlenW(serial) + 64; + WCHAR *dst; + + if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid, ext->is_gamepad ? igW : imW, + ext->index, ext->version, serial, ext->uid); + + return dst; +} + +DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW, void *native, WORD vid, + WORD pid, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, + const GUID *class) +{ + static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e','\\','%','s','#','%','p',0}; + struct device_extension *ext; + struct pnp_device *pnp_dev; + DEVICE_OBJECT *device; + UNICODE_STRING nameW; + WCHAR dev_name[256]; + HDEVINFO devinfo; + NTSTATUS status; + + TRACE("(%p, %s, %p, %04x, %04x, %u, %u, %s, %u, %s)\n", driver, debugstr_w(busidW), native, + vid, pid, version, uid, debugstr_w(serialW), is_gamepad, debugstr_guid(class)); + + if (!(pnp_dev = HeapAlloc(GetProcessHeap(), 0, sizeof(*pnp_dev)))) + return NULL; + + sprintfW(dev_name, device_name_fmtW, busidW, native); + RtlInitUnicodeString(&nameW, dev_name); + status = IoCreateDevice(driver, sizeof(*ext), &nameW, 0, 0, FALSE, &device); + if (status) + { + FIXME("failed to create device error %x\n", status); + HeapFree(GetProcessHeap(), 0, pnp_dev); + return NULL; + } + + EnterCriticalSection(&device_list_cs); + + /* fill out device_extension struct */ + ext = (struct device_extension *)device->DeviceExtension; + ext->native = native; + ext->vid = vid; + ext->pid = pid; + ext->uid = uid; + ext->version = version; + ext->index = get_vidpid_index(vid, pid); + ext->is_gamepad = is_gamepad; + ext->serial = strdupW(serialW); + ext->busid = busidW; + + /* add to list of pnp devices */ + pnp_dev->device = device; + list_add_tail(&pnp_devset, &pnp_dev->entry); + + LeaveCriticalSection(&device_list_cs); + + devinfo = SetupDiGetClassDevsW(class, NULL, NULL, DIGCF_DEVICEINTERFACE); + if (devinfo) + { + SP_DEVINFO_DATA data; + WCHAR *instance; + + data.cbSize = sizeof(data); + if (!(instance = get_instance_id(device))) + ERR("failed to generate instance id\n"); + else if (!SetupDiCreateDeviceInfoW(devinfo, instance, class, NULL, NULL, DICD_INHERIT_CLASSDRVS, &data)) + ERR("failed to create device info: %x\n", GetLastError()); + else if (!SetupDiRegisterDeviceInfo(devinfo, &data, 0, NULL, NULL, NULL)) + ERR("failed to register device info: %x\n", GetLastError()); + + HeapFree(GetProcessHeap(), 0, instance); + SetupDiDestroyDeviceInfoList(devinfo); + } + else + ERR("failed to get ClassDevs: %x\n", GetLastError()); + + IoInvalidateDeviceRelations(device, BusRelations); + return device; +} + NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) { NTSTATUS status = irp->IoStatus.u.Status;
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
43
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
Results per page:
10
25
50
100
200