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
August 2016
----- 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
777 discussions
Start a n
N
ew thread
Hugh McMaster : reg: Simplify help handling by removing an if-else if-else block.
by Alexandre Julliard
19 Aug '16
19 Aug '16
Module: wine Branch: master Commit: 68c1765a5d281bb51e0eff6bea2d97286176c122 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=68c1765a5d281bb51e0eff6be…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Aug 18 11:54:27 2016 +0000 reg: Simplify help handling by removing an if-else if-else block. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/reg.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 6522fe6..0975acd 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -902,23 +902,32 @@ static const WCHAR addW[] = {'a','d','d',0}; static const WCHAR deleteW[] = {'d','e','l','e','t','e',0}; static const WCHAR queryW[] = {'q','u','e','r','y',0}; -static enum operations get_operation(const WCHAR *str) +static enum operations get_operation(const WCHAR *str, int *op_help) { if (!lstrcmpiW(str, addW)) + { + *op_help = STRING_ADD_USAGE; return REG_ADD; + } if (!lstrcmpiW(str, deleteW)) + { + *op_help = STRING_DELETE_USAGE; return REG_DELETE; + } if (!lstrcmpiW(str, queryW)) + { + *op_help = STRING_QUERY_USAGE; return REG_QUERY; + } return REG_INVALID; } int wmain(int argc, WCHAR *argvW[]) { - int i, op, ret; + int i, op, op_help, ret; BOOL show_op_help = FALSE; static const WCHAR switchVAW[] = {'v','a',0}; static const WCHAR switchVEW[] = {'v','e',0}; @@ -939,7 +948,7 @@ int wmain(int argc, WCHAR *argvW[]) return 0; } - op = get_operation(argvW[1]); + op = get_operation(argvW[1], &op_help); if (op == REG_INVALID) { @@ -959,12 +968,7 @@ int wmain(int argc, WCHAR *argvW[]) } else if (show_op_help) { - if (op == REG_ADD) - output_message(STRING_ADD_USAGE); - else if (op == REG_DELETE) - output_message(STRING_DELETE_USAGE); - else - output_message(STRING_QUERY_USAGE); + output_message(op_help); return 0; }
1
0
0
0
Hugh McMaster : reg: Fix dword conversion on 64-bit operating systems.
by Alexandre Julliard
19 Aug '16
19 Aug '16
Module: wine Branch: master Commit: 8a8a753cfac54f20bf3cd768dbb0fcbfc2eb6abb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8a8a753cfac54f20bf3cd768d…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Aug 18 09:59:53 2016 +0000 reg: Fix dword conversion on 64-bit operating systems. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 6fcf129..6522fe6 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -249,9 +249,9 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW case REG_DWORD_BIG_ENDIAN: /* Yes, this is correct! */ { LPWSTR rest; - DWORD val; + unsigned long val; val = strtoulW(data, &rest, (tolowerW(data[1]) == 'x') ? 16 : 10); - if (*rest || data[0] == '-' || (val == ~0u && errno == ERANGE)) { + if (*rest || data[0] == '-' || (val == ~0u && errno == ERANGE) || val > ~0u) { output_message(STRING_MISSING_INTEGER); break; }
1
0
0
0
Alexandre Julliard : winex11: Allocate clipboard data as GMEM_FIXED.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 60f8b516e2a6233eaee8ae58cd2eccce998dd81f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=60f8b516e2a6233eaee8ae58c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 18 20:57:51 2016 +0900 winex11: Allocate clipboard data as GMEM_FIXED. Based on a patch by Rafał Harabień. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/clipboard.c | 10 +++++----- dlls/winex11.drv/clipboard.c | 24 ++++++++++-------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 2e9cd24..4fac7c6 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -846,9 +846,9 @@ static void test_handles( HWND hwnd ) } data = GetClipboardData( CF_OEMTEXT ); - todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + ok( is_fixed( data ), "expected fixed mem %p\n", data ); data = GetClipboardData( CF_UNICODETEXT ); - todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + ok( is_fixed( data ), "expected fixed mem %p\n", data ); data = GetClipboardData( CF_BITMAP ); ok( data == bitmap, "expected bitmap %p\n", data ); data = GetClipboardData( CF_PALETTE ); @@ -858,7 +858,7 @@ static void test_handles( HWND hwnd ) data = GetClipboardData( CF_GDIOBJFIRST + 2 ); ok( data == pen, "expected pen %p\n", data ); data = GetClipboardData( CF_DIB ); - todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + ok( is_fixed( data ), "expected fixed mem %p\n", data ); data = GetClipboardData( CF_DIBV5 ); todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); @@ -924,7 +924,7 @@ static DWORD WINAPI test_handles_thread2( void *arg ) ok( h == pen, "different pen %p / %p\n", h, pen ); trace( "pen %p\n", h ); h = GetClipboardData( CF_DIB ); - todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + ok( is_fixed( h ), "expected fixed mem %p\n", h ); h = GetClipboardData( CF_DIBV5 ); todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); r = CloseClipboard(); @@ -942,7 +942,7 @@ static void test_handles_process( const char *str ) r = OpenClipboard( 0 ); ok( r, "gle %d\n", GetLastError() ); h = GetClipboardData( CF_TEXT ); - todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + ok( is_fixed( h ), "expected fixed mem %p\n", h ); ptr = GlobalLock( h ); if (ptr) todo_wine ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr ); GlobalUnlock( h ); diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 460440d..9b8ff65 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -863,8 +863,7 @@ static BOOL X11DRV_CLIPBOARD_RenderSynthesizedText(Display *display, UINT wForma else alloc_size = dst_chars; - hData = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | - GMEM_DDESHARE, alloc_size); + hData = GlobalAlloc(GMEM_ZEROINIT | GMEM_FIXED, alloc_size); lpstrT = GlobalLock(hData); @@ -941,8 +940,7 @@ static HGLOBAL create_dib_from_bitmap(HBITMAP hBmp) /* Allocate the packed DIB */ TRACE("\tAllocating packed DIB of size %d\n", cPackedSize); - hPackedDIB = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE /*| GMEM_ZEROINIT*/, - cPackedSize ); + hPackedDIB = GlobalAlloc( GMEM_FIXED, cPackedSize ); if ( !hPackedDIB ) { WARN("Could not allocate packed DIB!\n"); @@ -1233,7 +1231,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAString(Display *display, Window w, Atom p inlcount++; } - if ((hText = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbytes + inlcount + 1))) + if ((hText = GlobalAlloc(GMEM_FIXED, cbytes + inlcount + 1))) { lpstr = GlobalLock(hText); @@ -1290,7 +1288,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportUTF8(Display *display, Window w, Atom prop) } count = MultiByteToWideChar(CP_UTF8, 0, lpstr, -1, NULL, 0); - hUnicodeText = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, count * sizeof(WCHAR)); + hUnicodeText = GlobalAlloc(GMEM_FIXED, count * sizeof(WCHAR)); if (hUnicodeText) { @@ -1348,7 +1346,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At TRACE("lcount = %d, destlen=%d, srcstr %s\n", lcount, destlen, srcstr[0]); - if ((hUnicodeText = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (destlen + lcount + 1) * sizeof(WCHAR)))) + if ((hUnicodeText = GlobalAlloc(GMEM_FIXED, (destlen + lcount + 1) * sizeof(WCHAR)))) { WCHAR *deststr = GlobalLock(hUnicodeText); MultiByteToWideChar(CP_UNIXCP, 0, srcstr[0], -1, deststr, destlen); @@ -1432,8 +1430,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(Display *display, Window w, Atom p DWORD info_size = bitmap_info_size( info, DIB_RGB_COLORS ); BYTE *ptr; - hClipData = GlobalAlloc( GMEM_MOVEABLE | GMEM_DDESHARE, - info_size + info->bmiHeader.biSizeImage ); + hClipData = GlobalAlloc( GMEM_FIXED, info_size + info->bmiHeader.biSizeImage ); if (hClipData) { ptr = GlobalLock( hClipData ); @@ -1614,7 +1611,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportTextUriList(Display *display, Window w, Ato if (out && end >= len) { DROPFILES *dropFiles; - handle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, sizeof(DROPFILES) + (size + 1)*sizeof(WCHAR)); + handle = GlobalAlloc(GMEM_FIXED, sizeof(DROPFILES) + (size + 1)*sizeof(WCHAR)); if (handle) { dropFiles = (DROPFILES*) GlobalLock(handle); @@ -1650,8 +1647,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportClipboardData(Display *display, Window w, A { if (cbytes) { - /* Turn on the DDESHARE flag to enable shared 32 bit memory */ - hClipData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cbytes); + hClipData = GlobalAlloc(GMEM_FIXED, cbytes); if (hClipData == 0) { HeapFree(GetProcessHeap(), 0, lpdata); @@ -1716,7 +1712,7 @@ static HANDLE X11DRV_CLIPBOARD_ExportClipboardData(Display *display, Window requ { datasize = GlobalSize(lpData->hData); - hClipData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, datasize); + hClipData = GlobalAlloc(GMEM_FIXED, datasize); if (hClipData == 0) return NULL; if ((lpClipData = GlobalLock(hClipData))) @@ -2182,7 +2178,7 @@ static HANDLE X11DRV_CLIPBOARD_ExportHDROP(Display *display, Window requestor, A ERR("Failed to export %04x format\n", lpdata->wFormatID); return 0; } - hClipData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, textUriListSize); + hClipData = GlobalAlloc(GMEM_FIXED, textUriListSize); if (hClipData == NULL) return 0; hDrop = (HDROP) lpdata->hData;
1
0
0
0
Alexandre Julliard : user32/tests: Add some tests for GDI clipboard formats.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: a96b01707039aa0427ed12698b298f3df26328bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a96b01707039aa0427ed12698…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 18 20:51:16 2016 +0900 user32/tests: Add some tests for GDI clipboard formats. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/clipboard.c | 107 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 7 deletions(-) diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index d218941..2e9cd24 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -754,6 +754,10 @@ static BOOL is_freed( HANDLE handle ) } static UINT format_id; +static HBITMAP bitmap, bitmap2; +static HPALETTE palette; +static HPEN pen; +static const LOGPALETTE logpalette = { 0x300, 1 }; static void test_handles( HWND hwnd ) { @@ -766,6 +770,10 @@ static void test_handles( HWND hwnd ) trace( "hwnd %p\n", hwnd ); htext = create_text(); htext2 = create_text(); + bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); + bitmap2 = CreateBitmap( 10, 10, 1, 1, NULL ); + palette = CreatePalette( &logpalette ); + pen = CreatePen( PS_SOLID, 1, 0 ); r = OpenClipboard( hwnd ); ok( r, "gle %d\n", GetLastError() ); @@ -778,6 +786,18 @@ 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 ); + h = SetClipboardData( CF_BITMAP, bitmap ); + ok( h == bitmap, "got %p\n", h ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + h = SetClipboardData( CF_PALETTE, palette ); + ok( h == palette, "got %p\n", h ); + ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h ); + h = SetClipboardData( CF_GDIOBJFIRST + 1, bitmap2 ); + ok( h == bitmap2, "got %p\n", h ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + h = SetClipboardData( CF_GDIOBJFIRST + 2, pen ); + ok( h == pen, "got %p\n", h ); + ok( GetObjectType( h ) == OBJ_PEN, "expected pen %p\n", h ); data = GetClipboardData( CF_TEXT ); ok( data == htext, "wrong data %p\n", data ); @@ -793,6 +813,10 @@ static void test_handles( HWND hwnd ) /* data handles are still valid */ ok( is_moveable( htext ), "expected moveable mem %p\n", htext ); ok( is_moveable( htext2 ), "expected moveable mem %p\n", htext ); + ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap ); + ok( GetObjectType( bitmap2 ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap2 ); + ok( GetObjectType( palette ) == OBJ_PAL, "expected palette %p\n", palette ); + ok( GetObjectType( pen ) == OBJ_PEN, "expected pen %p\n", pen ); r = OpenClipboard( hwnd ); ok( r, "gle %d\n", GetLastError() ); @@ -806,12 +830,6 @@ static void test_handles( HWND hwnd ) data = GetClipboardData( CF_TEXT ); todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); - data = GetClipboardData( CF_OEMTEXT ); - todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); - - data = GetClipboardData( CF_UNICODETEXT ); - todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); - data = GetClipboardData( format_id ); todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); } @@ -827,12 +845,38 @@ static void test_handles( HWND hwnd ) ok( data == htext2, "wrong data %p, cf %08x\n", data, format_id ); } + data = GetClipboardData( CF_OEMTEXT ); + todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + data = GetClipboardData( CF_UNICODETEXT ); + todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + data = GetClipboardData( CF_BITMAP ); + ok( data == bitmap, "expected bitmap %p\n", data ); + data = GetClipboardData( CF_PALETTE ); + ok( data == palette, "expected palette %p\n", data ); + data = GetClipboardData( CF_GDIOBJFIRST + 1 ); + ok( data == bitmap2, "expected bitmap2 %p\n", data ); + data = GetClipboardData( CF_GDIOBJFIRST + 2 ); + ok( data == pen, "expected pen %p\n", data ); + data = GetClipboardData( CF_DIB ); + todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + data = GetClipboardData( CF_DIBV5 ); + todo_wine ok( is_fixed( data ), "expected fixed mem %p\n", data ); + + ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap ); + ok( GetObjectType( bitmap2 ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap2 ); + ok( GetObjectType( palette ) == OBJ_PAL, "expected palette %p\n", palette ); + ok( GetObjectType( pen ) == OBJ_PEN, "expected pen %p\n", pen ); + r = EmptyClipboard(); ok( r, "gle %d\n", GetLastError() ); /* w2003, w2008 don't seem to free the data here */ ok( is_freed( htext ) || broken( !is_freed( htext )), "expected freed mem %p\n", htext ); ok( is_freed( htext2 ) || broken( !is_freed( htext2 )), "expected freed mem %p\n", htext ); + ok( !GetObjectType( bitmap ), "expected freed handle %p\n", bitmap ); + ok( !GetObjectType( palette ), "expected freed handle %p\n", palette ); + ok( GetObjectType( bitmap2 ) == OBJ_BITMAP, "expected bitmap2 %p\n", bitmap2 ); + ok( GetObjectType( pen ) == OBJ_PEN, "expected pen %p\n", pen ); r = CloseClipboard(); ok( r, "gle %d\n", GetLastError() ); @@ -863,6 +907,26 @@ static DWORD WINAPI test_handles_thread2( void *arg ) ptr = GlobalLock( h ); if (ptr) ok( !strcmp( "test", ptr ), "wrong data '%.5s'\n", ptr ); GlobalUnlock( h ); + h = GetClipboardData( CF_BITMAP ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + ok( h == bitmap, "different bitmap %p / %p\n", h, bitmap ); + trace( "bitmap %p\n", h ); + h = GetClipboardData( CF_PALETTE ); + ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h ); + ok( h == palette, "different palette %p / %p\n", h, palette ); + trace( "palette %p\n", h ); + h = GetClipboardData( CF_GDIOBJFIRST + 1 ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + ok( h == bitmap2, "different bitmap %p / %p\n", h, bitmap2 ); + trace( "bitmap2 %p\n", h ); + h = GetClipboardData( CF_GDIOBJFIRST + 2 ); + ok( GetObjectType( h ) == OBJ_PEN, "expected pen %p\n", h ); + ok( h == pen, "different pen %p / %p\n", h, pen ); + trace( "pen %p\n", h ); + h = GetClipboardData( CF_DIB ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + h = GetClipboardData( CF_DIBV5 ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); r = CloseClipboard(); ok( r, "gle %d\n", GetLastError() ); return 0; @@ -887,6 +951,22 @@ static void test_handles_process( const char *str ) ptr = GlobalLock( h ); if (ptr) ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr ); GlobalUnlock( h ); + h = GetClipboardData( CF_BITMAP ); + todo_wine ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + trace( "bitmap %p\n", h ); + h = GetClipboardData( CF_PALETTE ); + todo_wine ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h ); + trace( "palette %p\n", h ); + h = GetClipboardData( CF_GDIOBJFIRST + 1 ); + ok( !GetObjectType( h ), "expected invalid %p\n", h ); + trace( "bitmap2 %p\n", h ); + h = GetClipboardData( CF_GDIOBJFIRST + 2 ); + ok( !GetObjectType( h ), "expected invalid %p\n", h ); + trace( "pen %p\n", h ); + h = GetClipboardData( CF_DIB ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); + h = GetClipboardData( CF_DIBV5 ); + todo_wine ok( is_fixed( h ), "expected fixed mem %p\n", h ); r = CloseClipboard(); ok( r, "gle %d\n", GetLastError() ); } @@ -897,13 +977,18 @@ static void test_data_handles(void) HANDLE h; HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL ); - format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" ); ok( hwnd != 0, "window creation failed\n" ); + format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" ); test_handles( 0 ); test_handles( GetDesktopWindow() ); test_handles( hwnd ); run_thread( test_handles_thread, hwnd, __LINE__ ); + bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); + bitmap2 = CreateBitmap( 10, 10, 1, 1, NULL ); + palette = CreatePalette( &logpalette ); + pen = CreatePen( PS_SOLID, 1, 0 ); + r = OpenClipboard( hwnd ); ok( r, "gle %d\n", GetLastError() ); r = EmptyClipboard(); @@ -912,6 +997,14 @@ static void test_data_handles(void) ok( is_moveable( h ), "expected moveable mem %p\n", h ); h = SetClipboardData( format_id, create_text() ); ok( is_moveable( h ), "expected moveable mem %p\n", h ); + h = SetClipboardData( CF_BITMAP, bitmap ); + 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_GDIOBJFIRST + 1, bitmap2 ); + ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h ); + h = SetClipboardData( CF_GDIOBJFIRST + 2, pen ); + ok( GetObjectType( h ) == OBJ_PEN, "expected pen %p\n", h ); r = CloseClipboard(); ok( r, "gle %d\n", GetLastError() );
1
0
0
0
Alexandre Julliard : winex11: Correctly free CF_DIB format, and don' t free unknown GDI formats.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 228d855907e8b26b186413a4175c185405cb2e8d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=228d855907e8b26b186413a41…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 18 18:24:28 2016 +0900 winex11: Correctly free CF_DIB format, and don't free unknown GDI formats. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/clipboard.c | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 9b6c749..460440d 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -577,38 +577,30 @@ static void X11DRV_CLIPBOARD_FreeData(LPWINE_CLIPDATA lpData) { TRACE("%04x\n", lpData->wFormatID); - if ((lpData->wFormatID >= CF_GDIOBJFIRST && - lpData->wFormatID <= CF_GDIOBJLAST) || - lpData->wFormatID == CF_BITMAP || - lpData->wFormatID == CF_DIB || - lpData->wFormatID == CF_PALETTE) - { - if (lpData->hData) - DeleteObject(lpData->hData); + if (!lpData->hData) return; - if ((lpData->wFormatID == CF_DIB) && lpData->drvData) - XFreePixmap(gdi_display, lpData->drvData); - } - else if (lpData->wFormatID == CF_METAFILEPICT) + switch (lpData->wFormatID) { - if (lpData->hData) - { + case CF_BITMAP: + case CF_PALETTE: + DeleteObject(lpData->hData); + break; + case CF_DIB: + if (lpData->drvData) XFreePixmap(gdi_display, lpData->drvData); + GlobalFree(lpData->hData); + break; + case CF_METAFILEPICT: DeleteMetaFile(((METAFILEPICT *)GlobalLock( lpData->hData ))->hMF ); GlobalFree(lpData->hData); - } - } - else if (lpData->wFormatID == CF_ENHMETAFILE) - { - if (lpData->hData) - DeleteEnhMetaFile(lpData->hData); - } - else if (lpData->wFormatID < CF_PRIVATEFIRST || - lpData->wFormatID > CF_PRIVATELAST) - { - if (lpData->hData) + break; + case CF_ENHMETAFILE: + DeleteEnhMetaFile(lpData->hData); + break; + default: + if (lpData->wFormatID >= CF_PRIVATEFIRST && lpData->wFormatID <= CF_PRIVATELAST) break; GlobalFree(lpData->hData); + break; } - lpData->hData = 0; lpData->drvData = 0; }
1
0
0
0
Bernhard Übelacker : msvcrt: Fix strtok_s and _mbstok_s for empty strings.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 4fa616c37cbaafdb4c9d973de81689c215601229 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4fa616c37cbaafdb4c9d973de…
Author: Bernhard Übelacker <bernhardu(a)mailbox.org> Date: Thu Aug 18 11:49:04 2016 +0200 msvcrt: Fix strtok_s and _mbstok_s for empty strings. Signed-off-by: Bernhard Übelacker <bernhardu(a)mailbox.org> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr90/tests/msvcr90.c | 88 ++++++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/mbcs.c | 3 ++ dlls/msvcrt/string.c | 3 ++ 3 files changed, 94 insertions(+) diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c index ecf25ec..a4bcdc5 100644 --- a/dlls/msvcr90/tests/msvcr90.c +++ b/dlls/msvcr90/tests/msvcr90.c @@ -92,8 +92,10 @@ static int* (__cdecl *p_errno)(void); static __msvcrt_ulong* (__cdecl *p_doserrno)(void); static void (__cdecl *p_srand)(unsigned int); static char* (__cdecl *p_strtok)(char*, const char*); +static char* (__cdecl *p_strtok_s)(char*, const char*, char**); static wchar_t* (__cdecl *p_wcstok)(wchar_t*, const wchar_t*); static unsigned char* (__cdecl *p__mbstok)(unsigned char*, const unsigned char*); +static unsigned char* (__cdecl *p__mbstok_s)(unsigned char*, const unsigned char*, unsigned char**); static char* (__cdecl *p_strerror)(int); static wchar_t* (__cdecl *p_wcserror)(int); static char* (__cdecl *p_tmpnam)(char*); @@ -355,8 +357,10 @@ static BOOL init(void) SET(p_doserrno, "__doserrno"); SET(p_srand, "srand"); SET(p_strtok, "strtok"); + SET(p_strtok_s, "strtok_s"); SET(p_wcstok, "wcstok"); SET(p__mbstok, "_mbstok"); + SET(p__mbstok_s, "_mbstok_s"); SET(p_strerror, "strerror"); SET(p_wcserror, "_wcserror"); SET(p_tmpnam, "tmpnam"); @@ -1547,6 +1551,88 @@ static void test_mbstowcs(void) p_setlocale(LC_ALL, "C"); } +static void test_strtok_s(void) +{ + char test[] = "a/b"; + char empty[] = ""; + char space[] = " "; + char delim[] = "/"; + char *strret; + char *context; + + context = (char*)0xdeadbeef; + strret = p_strtok_s( test, delim, &context); + ok(strret == test, "Expected test, got %p.\n", strret); + ok(context == test+2, "Expected test+2, got %p.\n", context); + + strret = p_strtok_s( NULL, delim, &context); + ok(strret == test+2, "Expected test+2, got %p.\n", strret); + ok(context == test+3, "Expected test+3, got %p.\n", context); + + strret = p_strtok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == test+3, "Expected test+3, got %p.\n", context); + + context = NULL; + strret = p_strtok_s( empty, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == empty, "Expected empty, got %p.\n", context); + + strret = p_strtok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == empty, "Expected empty, got %p.\n", context); + + context = NULL; + strret = p_strtok_s( space, delim, &context); + ok(strret == space, "Expected space, got %p.\n", strret); + ok(context == space+1, "Expected space+1, got %p.\n", context); + + strret = p_strtok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == space+1, "Expected space+1, got %p.\n", context); +} + +static void test__mbstok_s(void) +{ + unsigned char test[] = "a/b"; + unsigned char empty[] = ""; + unsigned char space[] = " "; + unsigned char delim[] = "/"; + unsigned char *strret; + unsigned char *context; + + context = (unsigned char*)0xdeadbeef; + strret = p__mbstok_s( test, delim, &context); + ok(strret == test, "Expected test, got %p.\n", strret); + ok(context == test+2, "Expected test+2, got %p.\n", context); + + strret = p__mbstok_s( NULL, delim, &context); + ok(strret == test+2, "Expected test+2, got %p.\n", strret); + ok(context == test+3, "Expected test+3, got %p.\n", context); + + strret = p__mbstok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == test+3, "Expected test+3, got %p.\n", context); + + context = NULL; + strret = p__mbstok_s( empty, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == empty, "Expected empty, got %p.\n", context); + + strret = p__mbstok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == empty, "Expected empty, got %p.\n", context); + + context = NULL; + strret = p__mbstok_s( space, delim, &context); + ok(strret == space, "Expected space, got %p.\n", strret); + ok(context == space+1, "Expected space+1, got %p.\n", context); + + strret = p__mbstok_s( NULL, delim, &context); + ok(strret == NULL, "Expected NULL, got %p.\n", strret); + ok(context == space+1, "Expected space+1, got %p.\n", context); +} + START_TEST(msvcr90) { if(!init()) @@ -1576,4 +1662,6 @@ START_TEST(msvcr90) test_is_exception_typeof(); test__AdjustPointer(); test_mbstowcs(); + test_strtok_s(); + test__mbstok_s(); } diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index fe88cc7..93bb1a7 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -1205,7 +1205,10 @@ unsigned char* CDECL _mbstok_s_l(unsigned char *str, const unsigned char *delim, while((c=_mbsnextc(str)) && _mbschr(delim, c)) str += c>255 ? 2 : 1; if(!*str) + { + *ctx = str; return NULL; + } *ctx = str + (c>255 ? 2 : 1); while((c=_mbsnextc(*ctx)) && !_mbschr(delim, c)) diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 85f09ad..3e765d0 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -274,7 +274,10 @@ char * CDECL MSVCRT_strtok_s(char *str, const char *delim, char **ctx) while(*str && strchr(delim, *str)) str++; if(!*str) + { + *ctx = str; return NULL; + } *ctx = str+1; while(**ctx && !strchr(delim, **ctx))
1
0
0
0
Huw Davies : ntdll/tests: Skip broken SYSTEM_HANDLE_INFORMATION behaviour.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 92fe612acb65b81b0038ef0c0555356cfcba7f41 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=92fe612acb65b81b0038ef0c0…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Aug 18 09:22:58 2016 +0100 ntdll/tests: Skip broken SYSTEM_HANDLE_INFORMATION behaviour. Vista and 2008 only copy the first handle's information into the buffer. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/info.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index ea1f3ef..448bc64 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -504,6 +504,7 @@ static void test_query_handle(void) SystemInformationLength = ReturnLength; shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength); + memset(shi, 0x55, SystemInformationLength); ReturnLength = 0xdeadbeef; status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength); @@ -511,6 +512,7 @@ static void test_query_handle(void) { SystemInformationLength *= 2; shi = HeapReAlloc(GetProcessHeap(), 0, shi, SystemInformationLength); + memset(shi, 0x55, SystemInformationLength); status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength); } ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status ); @@ -518,6 +520,15 @@ static void test_query_handle(void) ok( ReturnLength == ExpectedLength || broken(ReturnLength == ExpectedLength - sizeof(DWORD)), /* Vista / 2008 */ "Expected length %u, got %u\n", ExpectedLength, ReturnLength ); ok( shi->Count > 1, "Expected more than 1 handle, got %u\n", shi->Count ); + ok( shi->Handle[1].HandleValue != 0x5555 || broken( shi->Handle[1].HandleValue == 0x5555 ), /* Vista / 2008 */ + "Uninitialized second handle\n" ); + if (shi->Handle[1].HandleValue == 0x5555) + { + win_skip("Skipping broken SYSTEM_HANDLE_INFORMATION\n"); + CloseHandle(EventHandle); + goto done; + } + for (i = 0, found = FALSE; i < shi->Count && !found; i++) found = (shi->Handle[i].OwnerPid == GetCurrentProcessId()) && ((HANDLE)(ULONG_PTR)shi->Handle[i].HandleValue == EventHandle); @@ -546,6 +557,7 @@ static void test_query_handle(void) status = pNtQuerySystemInformation(SystemHandleInformation, NULL, SystemInformationLength, &ReturnLength); ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08x\n", status ); +done: HeapFree( GetProcessHeap(), 0, shi); }
1
0
0
0
Sebastian Lackner : services: Use threadpool API instead of custom wait implementation.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 9dfa1022e9fd9f31ffbe3cfc61cc75dd1e2954a4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9dfa1022e9fd9f31ffbe3cfc6…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Aug 18 09:38:24 2016 +0200 services: Use threadpool API instead of custom wait implementation. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winbase.h | 6 ++ programs/services/rpc.c | 177 +++++++++++++------------------------------ programs/services/services.c | 9 ++- programs/services/services.h | 5 +- 4 files changed, 66 insertions(+), 131 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=9dfa1022e9fd9f31ffbe3…
1
0
0
0
Sebastian Lackner : services: Sort autostart services by dwTagId config value.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 6fc42341ecdf71d80e3b7ac46961f29beb660c7a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6fc42341ecdf71d80e3b7ac46…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Aug 18 09:31:35 2016 +0200 services: Sort autostart services by dwTagId config value. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/services/services.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/programs/services/services.c b/programs/services/services.c index 9156dbc..1092a25 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -318,6 +318,13 @@ static void scmdatabase_remove_service(struct scmdatabase *db, struct service_en service->entry.next = service->entry.prev = NULL; } +static int compare_tags(const void *a, const void *b) +{ + struct service_entry *service_a = *(struct service_entry **)a; + struct service_entry *service_b = *(struct service_entry **)b; + return service_a->config.dwTagId - service_b->config.dwTagId; +} + static void scmdatabase_autostart_services(struct scmdatabase *db) { struct service_entry **services_list; @@ -352,6 +359,7 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) size = i; scmdatabase_unlock(db); + qsort(services_list, size, sizeof(services_list[0]), compare_tags); while (!scmdatabase_lock_startup(db)) Sleep(10); for (i = 0; i < size; i++)
1
0
0
0
Sebastian Lackner : services: Hold startup lock before calling service_start.
by Alexandre Julliard
18 Aug '16
18 Aug '16
Module: wine Branch: master Commit: 4c01feb7146a47df41eedd1da0bb540a37d7d7de URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4c01feb7146a47df41eedd1da…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Aug 18 09:30:33 2016 +0200 services: Hold startup lock before calling service_start. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/services/rpc.c | 9 ++++++--- programs/services/services.c | 15 ++++----------- programs/services/services.h | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/programs/services/rpc.c b/programs/services/rpc.c index 977ddb6..4cab79e 100644 --- a/programs/services/rpc.c +++ b/programs/services/rpc.c @@ -1071,8 +1071,12 @@ DWORD __cdecl svcctl_StartServiceW( if (service->service_entry->config.dwStartType == SERVICE_DISABLED) return ERROR_SERVICE_DISABLED; + if (!scmdatabase_lock_startup(service->service_entry->db)) + return ERROR_SERVICE_DATABASE_LOCKED; + err = service_start(service->service_entry, dwNumServiceArgs, lpServiceArgVectors); + scmdatabase_unlock_startup(service->service_entry->db); return err; } @@ -1226,9 +1230,8 @@ DWORD __cdecl svcctl_LockServiceDatabase( if ((err = validate_scm_handle(hSCManager, SC_MANAGER_LOCK, &manager)) != ERROR_SUCCESS) return err; - err = scmdatabase_lock_startup(manager->db); - if (err != ERROR_SUCCESS) - return err; + if (!scmdatabase_lock_startup(manager->db)) + return ERROR_SERVICE_DATABASE_LOCKED; lock = HeapAlloc(GetProcessHeap(), 0, sizeof(struct sc_lock)); if (!lock) diff --git a/programs/services/services.c b/programs/services/services.c index 177acf1..9156dbc 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -352,6 +352,7 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) size = i; scmdatabase_unlock(db); + while (!scmdatabase_lock_startup(db)) Sleep(10); for (i = 0; i < size; i++) { @@ -364,6 +365,7 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) release_service(service); } + scmdatabase_unlock_startup(db); HeapFree(GetProcessHeap(), 0, services_list); } @@ -608,11 +610,9 @@ static DWORD scmdatabase_load_services(struct scmdatabase *db) return ERROR_SUCCESS; } -DWORD scmdatabase_lock_startup(struct scmdatabase *db) +BOOL scmdatabase_lock_startup(struct scmdatabase *db) { - if (InterlockedCompareExchange(&db->service_start_lock, TRUE, FALSE)) - return ERROR_SERVICE_DATABASE_LOCKED; - return ERROR_SUCCESS; + return !InterlockedCompareExchange(&db->service_start_lock, TRUE, FALSE); } void scmdatabase_unlock_startup(struct scmdatabase *db) @@ -904,10 +904,6 @@ DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR * struct process_entry *process = NULL; DWORD err; - err = scmdatabase_lock_startup(service->db); - if (err != ERROR_SUCCESS) - return err; - err = service_start_process(service, &process); if (err == ERROR_SUCCESS) { @@ -928,10 +924,7 @@ DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR * release_process(process); } - scmdatabase_unlock_startup(service->db); - WINE_TRACE("returning %d\n", err); - return err; } diff --git a/programs/services/services.h b/programs/services/services.h index a3ecdf2..fb1374e 100644 --- a/programs/services/services.h +++ b/programs/services/services.h @@ -72,7 +72,7 @@ struct service_entry *scmdatabase_find_service(struct scmdatabase *db, LPCWSTR n struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase *db, LPCWSTR name); DWORD scmdatabase_add_service(struct scmdatabase *db, struct service_entry *entry); -DWORD scmdatabase_lock_startup(struct scmdatabase *db); +BOOL scmdatabase_lock_startup(struct scmdatabase *db); void scmdatabase_unlock_startup(struct scmdatabase *db); void scmdatabase_lock(struct scmdatabase *db);
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200