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
June 2010
----- 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
3 participants
663 discussions
Start a n
N
ew thread
Andrew Nguyen : setupapi: Validate the cabinet filename parameter in SetupIterateCabinetW.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: debe525f3fa8a5e80994dc9fca46d88f6db49e79 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=debe525f3fa8a5e80994dc9fc…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 16 07:35:57 2010 -0500 setupapi: Validate the cabinet filename parameter in SetupIterateCabinetW. --- dlls/setupapi/setupcab.c | 8 ++- dlls/setupapi/tests/setupcab.c | 112 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c index 185fe17..4a54ae4 100644 --- a/dlls/setupapi/setupcab.c +++ b/dlls/setupapi/setupcab.c @@ -622,7 +622,7 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, UINT len; SC_HSC_W my_hsc; ERF erf; - WCHAR pszCabPathW[MAX_PATH], *p; + WCHAR pszCabPathW[MAX_PATH], *p = NULL; DWORD fpnsize; BOOL ret; @@ -632,7 +632,11 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, if (!LoadCABINETDll()) return FALSE; - if (!CabinetFile) return FALSE; + if (!CabinetFile) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } fpnsize = GetFullPathNameW(CabinetFile, MAX_PATH, pszCabPathW, &p); if (fpnsize > MAX_PATH) { diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c index 6e211ce..3c126c9 100644 --- a/dlls/setupapi/tests/setupcab.c +++ b/dlls/setupapi/tests/setupcab.c @@ -40,6 +40,17 @@ static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size) CloseHandle(handle); } +static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size) +{ + HANDLE handle; + DWORD written; + + handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + WriteFile(handle, data, size, &written, NULL); + CloseHandle(handle); +} + static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2) { @@ -48,6 +59,14 @@ static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification, return 0; } +static UINT CALLBACK dummy_callbackW(PVOID Context, UINT Notification, + UINT_PTR Param1, UINT_PTR Param2) +{ + ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context, + Notification, Param1, Param2); + return 0; +} + static void test_invalid_parametersA(void) { BOOL ret; @@ -115,7 +134,100 @@ static void test_invalid_parametersA(void) DeleteFileA(source); } +static void test_invalid_parametersW(void) +{ + static const WCHAR nonexistentW[] = {'c',':','\\','n','o','n','e','x','i','s','t','e','n','t','.','c','a','b',0}; + static const WCHAR docW[] = {'d','o','c',0}; + static const WCHAR emptyW[] = {0}; + + BOOL ret; + WCHAR source[MAX_PATH], temp[MAX_PATH]; + int i; + + const struct + { + PCWSTR CabinetFile; + PSP_FILE_CALLBACK MsgHandler; + DWORD expected_lasterror; + int todo_lasterror; + } invalid_parameters[] = + { + {nonexistentW, NULL, ERROR_FILE_NOT_FOUND}, + {nonexistentW, dummy_callbackW, ERROR_FILE_NOT_FOUND}, + {source, NULL, ERROR_INVALID_DATA, 1}, + {source, dummy_callbackW, ERROR_INVALID_DATA, 1}, + }; + + ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("SetupIterateCabinetW is not available\n"); + return; + } + + GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp); + GetTempFileNameW(temp, docW, 0, source); + + create_source_fileW(source, NULL, 0); + + for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++) + { + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetW(invalid_parameters[i].CabinetFile, 0, + invalid_parameters[i].MsgHandler, NULL); + ok(!ret, "[%d] Expected SetupIterateCabinetW to return 0, got %d\n", i, ret); + if (invalid_parameters[i].todo_lasterror) + { + todo_wine + ok(GetLastError() == invalid_parameters[i].expected_lasterror, + "[%d] Expected GetLastError() to return %u, got %u\n", + i, invalid_parameters[i].expected_lasterror, GetLastError()); + } + else + { + ok(GetLastError() == invalid_parameters[i].expected_lasterror, + "[%d] Expected GetLastError() to return %u, got %u\n", + i, invalid_parameters[i].expected_lasterror, GetLastError()); + } + } + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); + ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */ + "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetW(NULL, 0, dummy_callbackW, NULL); + ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */ + "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetW(emptyW, 0, NULL, NULL); + ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY || + GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */ + "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetW(emptyW, 0, dummy_callbackW, NULL); + ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY || + GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */ + "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n", + GetLastError()); + + DeleteFileW(source); +} + START_TEST(setupcab) { test_invalid_parametersA(); + test_invalid_parametersW(); }
1
0
0
0
Andrew Nguyen : setupapi: Validate the cabinet filename parameter in SetupIterateCabinetA.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: bc21be89ab01f56fb9cd337759f45173ab73b28c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc21be89ab01f56fb9cd33775…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 16 07:34:51 2010 -0500 setupapi: Validate the cabinet filename parameter in SetupIterateCabinetA. --- dlls/setupapi/setupcab.c | 9 ++- dlls/setupapi/tests/Makefile.in | 1 + dlls/setupapi/tests/setupcab.c | 121 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c index 0dd2d86..185fe17 100644 --- a/dlls/setupapi/setupcab.c +++ b/dlls/setupapi/setupcab.c @@ -555,17 +555,22 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, SC_HSC_A my_hsc; ERF erf; - CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p; + CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p = NULL; DWORD fpnsize; BOOL ret; - TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n", debugstr_a(CabinetFile), Reserved, MsgHandler, Context); if (!LoadCABINETDll()) return FALSE; + if (!CabinetFile) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + fpnsize = strlen(CabinetFile); if (fpnsize >= MAX_PATH) { SetLastError(ERROR_BAD_PATHNAME); diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in index ed3a4c0..332d8a0 100644 --- a/dlls/setupapi/tests/Makefile.in +++ b/dlls/setupapi/tests/Makefile.in @@ -11,6 +11,7 @@ C_SRCS = \ misc.c \ parser.c \ query.c \ + setupcab.c \ stringtable.c @MAKE_TEST_RULES@ diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c new file mode 100644 index 0000000..6e211ce --- /dev/null +++ b/dlls/setupapi/tests/setupcab.c @@ -0,0 +1,121 @@ +/* + * Unit tests for SetupIterateCabinet + * + * Copyright 2007 Hans Leidekker + * Copyright 2010 Andrew Nguyen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "setupapi.h" +#include "wine/test.h" + +static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size) +{ + HANDLE handle; + DWORD written; + + handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + WriteFile(handle, data, size, &written, NULL); + CloseHandle(handle); +} + +static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification, + UINT_PTR Param1, UINT_PTR Param2) +{ + ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context, + Notification, Param1, Param2); + return 0; +} + +static void test_invalid_parametersA(void) +{ + BOOL ret; + char source[MAX_PATH], temp[MAX_PATH]; + int i; + + const struct + { + PCSTR CabinetFile; + PSP_FILE_CALLBACK MsgHandler; + DWORD expected_lasterror; + int todo_lasterror; + } invalid_parameters[] = + { + {NULL, NULL, ERROR_INVALID_PARAMETER}, + {NULL, dummy_callbackA, ERROR_INVALID_PARAMETER}, + {"c:\\nonexistent.cab", NULL, ERROR_FILE_NOT_FOUND}, + {"c:\\nonexistent.cab", dummy_callbackA, ERROR_FILE_NOT_FOUND}, + {source, NULL, ERROR_INVALID_DATA, 1}, + {source, dummy_callbackA, ERROR_INVALID_DATA, 1}, + }; + + GetTempPathA(sizeof(temp), temp); + GetTempFileNameA(temp, "doc", 0, source); + + create_source_fileA(source, NULL, 0); + + for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++) + { + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetA(invalid_parameters[i].CabinetFile, 0, + invalid_parameters[i].MsgHandler, NULL); + ok(!ret, "[%d] Expected SetupIterateCabinetA to return 0, got %d\n", i, ret); + if (invalid_parameters[i].todo_lasterror) + { + todo_wine + ok(GetLastError() == invalid_parameters[i].expected_lasterror, + "[%d] Expected GetLastError() to return %u, got %u\n", + i, invalid_parameters[i].expected_lasterror, GetLastError()); + } + else + { + ok(GetLastError() == invalid_parameters[i].expected_lasterror, + "[%d] Expected GetLastError() to return %u, got %u\n", + i, invalid_parameters[i].expected_lasterror, GetLastError()); + } + } + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetA("", 0, NULL, NULL); + ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY || + GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */ + "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = SetupIterateCabinetA("", 0, dummy_callbackA, NULL); + ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret); + ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY || + GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */ + "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n", + GetLastError()); + + DeleteFileA(source); +} + +START_TEST(setupcab) +{ + test_invalid_parametersA(); +}
1
0
0
0
Andrew Nguyen : setupapi: Avoid useless initializations in SetupIterateCabinetA/W.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: 7057637ff060d423259d109fd42760bfcb8d8b7b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7057637ff060d423259d109fd…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Tue Jun 15 05:20:08 2010 -0500 setupapi: Avoid useless initializations in SetupIterateCabinetA/W. --- dlls/setupapi/setupcab.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c index d879f9d..0dd2d86 100644 --- a/dlls/setupapi/setupcab.c +++ b/dlls/setupapi/setupcab.c @@ -563,13 +563,9 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, TRACE("(CabinetFile == %s, Reserved == %u, MsgHandler == ^%p, Context == ^%p)\n", debugstr_a(CabinetFile), Reserved, MsgHandler, Context); - if (! LoadCABINETDll()) + if (!LoadCABINETDll()) return FALSE; - memset(&my_hsc, 0, sizeof(SC_HSC_A)); - pszCabinet[0] = '\0'; - pszCabPath[0] = '\0'; - fpnsize = strlen(CabinetFile); if (fpnsize >= MAX_PATH) { SetLastError(ERROR_BAD_PATHNAME); @@ -633,8 +629,6 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, if (!CabinetFile) return FALSE; - memset(&my_hsc, 0, sizeof(SC_HSC_W)); - fpnsize = GetFullPathNameW(CabinetFile, MAX_PATH, pszCabPathW, &p); if (fpnsize > MAX_PATH) { SetLastError(ERROR_BAD_PATHNAME);
1
0
0
0
Alexandre Julliard : ntdll: Print a warning when failing to set execute permissions on a section.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: b9a13d6d819ac265b1a75005045b42edfecfb704 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b9a13d6d819ac265b1a750050…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 16 20:06:47 2010 +0200 ntdll: Print a warning when failing to set execute permissions on a section. --- dlls/ntdll/virtual.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 23a5d4c..84427fb 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1285,7 +1285,9 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz (nt->OptionalHeader.AddressOfEntryPoint < sec->VirtualAddress + size)) vprot |= VPROT_EXEC; - VIRTUAL_SetProt( view, ptr + sec->VirtualAddress, size, vprot ); + if (!VIRTUAL_SetProt( view, ptr + sec->VirtualAddress, size, vprot ) && (vprot & VPROT_EXEC)) + ERR( "failed to set %08x protection on section %.8s, noexec filesystem?\n", + sec->Characteristics, sec->Name ); } done:
1
0
0
0
Damjan Jovanovic : kernel32: Stop CopyFile from overwriting a file with itself.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: 06de0195d0ac02aabd03beaaffb29cb5b438791e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=06de0195d0ac02aabd03beaaf…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Wed Jun 16 12:00:59 2010 +0200 kernel32: Stop CopyFile from overwriting a file with itself. --- dlls/kernel32/path.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/kernel32/tests/file.c | 2 +- 2 files changed, 38 insertions(+), 1 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index c319cb5..f0da96c 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -869,6 +869,24 @@ DWORD WINAPI SearchPathA( LPCSTR path, LPCSTR name, LPCSTR ext, return ret; } +static BOOL is_same_file(HANDLE h1, HANDLE h2) +{ + int fd1; + BOOL ret = FALSE; + if (wine_server_handle_to_fd(h1, 0, &fd1, NULL) == STATUS_SUCCESS) + { + int fd2; + if (wine_server_handle_to_fd(h2, 0, &fd2, NULL) == STATUS_SUCCESS) + { + struct stat stat1, stat2; + if (fstat(fd1, &stat1) == 0 && fstat(fd2, &stat2) == 0) + ret = (stat1.st_dev == stat2.st_dev && stat1.st_ino == stat2.st_ino); + wine_server_release_fd(h2, fd2); + } + wine_server_release_fd(h1, fd1); + } + return ret; +} /************************************************************************** * CopyFileW (KERNEL32.@) @@ -911,6 +929,25 @@ BOOL WINAPI CopyFileW( LPCWSTR source, LPCWSTR dest, BOOL fail_if_exists ) return FALSE; } + if (!fail_if_exists) + { + BOOL same_file = FALSE; + h2 = CreateFileW( dest, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, 0, 0); + if (h2 != INVALID_HANDLE_VALUE) + { + same_file = is_same_file( h1, h2 ); + CloseHandle( h2 ); + } + if (same_file) + { + HeapFree( GetProcessHeap(), 0, buffer ); + CloseHandle( h1 ); + SetLastError( ERROR_SHARING_VIOLATION ); + return FALSE; + } + } + if ((h2 = CreateFileW( dest, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, fail_if_exists ? CREATE_NEW : CREATE_ALWAYS, info.dwFileAttributes, h1 )) == INVALID_HANDLE_VALUE) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 7e6b3de..c0a36c7 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -593,7 +593,7 @@ static void test_CopyFileA(void) /* copying a file to itself must fail */ retok = CopyFileA(source, source, FALSE); - todo_wine ok( !retok && (GetLastError() == ERROR_SHARING_VIOLATION || broken(GetLastError() == ERROR_FILE_EXISTS) /* Win 9x */), + ok( !retok && (GetLastError() == ERROR_SHARING_VIOLATION || broken(GetLastError() == ERROR_FILE_EXISTS) /* Win 9x */), "copying a file to itself didn't fail (ret=%d, err=%d)\n", retok, GetLastError()); /* make the source have not zero size */
1
0
0
0
Alexandre Julliard : user32: Don' t try to alpha blend icons when drawing to a monochrome device.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: d87715c831de95cd4ba572db275ac2f0e856dfac URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d87715c831de95cd4ba572db2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 16 14:54:37 2010 +0200 user32: Don't try to alpha blend icons when drawing to a monochrome device. --- dlls/user32/cursoricon.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 0f8d7da..9a1810e 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -2054,11 +2054,21 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, if (ptr->alpha && (flags & DI_IMAGE)) { - BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + BOOL is_mono = FALSE; - SelectObject( hMemDC, ptr->alpha ); - if (GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC, - 0, 0, ptr->width, ptr->height, pixelblend )) goto done; + if (GetObjectType( hdc_dest ) == OBJ_MEMDC) + { + BITMAP bm; + HBITMAP bmp = GetCurrentObject( hdc_dest, OBJ_BITMAP ); + is_mono = GetObjectW( bmp, sizeof(bm), &bm ) && bm.bmBitsPixel == 1; + } + if (!is_mono) + { + BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + SelectObject( hMemDC, ptr->alpha ); + if (GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC, + 0, 0, ptr->width, ptr->height, pixelblend )) goto done; + } } if (flags & DI_MASK)
1
0
0
0
Alexandre Julliard : wrc: Avoid use of toupper/isupper on signed chars.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: cdf6947080695a288fec566506cb3dac99e915fd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cdf6947080695a288fec56650…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 16 12:02:34 2010 +0200 wrc: Avoid use of toupper/isupper on signed chars. --- tools/wrc/parser.l | 9 ++++++--- tools/wrc/parser.y | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l index e048665..834c568 100644 --- a/tools/wrc/parser.l +++ b/tools/wrc/parser.l @@ -397,9 +397,12 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) \{ return tBEGIN; \} return tEND; -[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } -0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; } +[0-9]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 10); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } +0[xX][0-9A-Fa-f]+[lL]? { parser_lval.num = xstrtoul(yytext, 0, 16); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } +0[oO][0-7]+[lL]? { parser_lval.num = xstrtoul(yytext+2, 0, 8); + return (yytext[yyleng-1] == 'L' || yytext[yyleng-1] == 'l') ? tLNUMBER : tNUMBER; } /* * The next two rules scan identifiers and filenames. diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y index a62bccf..cfc02f9 100644 --- a/tools/wrc/parser.y +++ b/tools/wrc/parser.y @@ -2172,7 +2172,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev if(key->type == str_char) { - if((flags & WRC_AF_VIRTKEY) && (!isupper(key->str.cstr[0] & 0xff) && !isdigit(key->str.cstr[0] & 0xff))) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.cstr[0] >= 'A' && key->str.cstr[0] <= 'Z') || + (key->str.cstr[0] >= '0' && key->str.cstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.cstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0) @@ -2181,7 +2183,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else if(key->str.cstr[0] == '^') { - keycode = toupper(key->str.cstr[1]) - '@'; + keycode = toupper((unsigned char)key->str.cstr[1]) - '@'; if(keycode >= ' ') yyerror("Control-code out of range"); } @@ -2190,7 +2192,9 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev } else { - if((flags & WRC_AF_VIRTKEY) && !isupperW(key->str.wstr[0]) && !isdigitW(key->str.wstr[0])) + if((flags & WRC_AF_VIRTKEY) && + !((key->str.wstr[0] >= 'A' && key->str.wstr[0] <= 'Z') || + (key->str.wstr[0] >= '0' && key->str.wstr[0] <= '9'))) yyerror("VIRTKEY code is not equal to ascii value"); if(key->str.wstr[0] == '^' && (flags & WRC_AF_CONTROL) != 0)
1
0
0
0
Paul Chitescu : winex11.drv: Post a WM_SYSCOMMAND SC_CLOSE when the window manager asks to close a window .
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: 02674b2b95a4a9125af44470c14ccbcef9608c8d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=02674b2b95a4a9125af44470c…
Author: Paul Chitescu <paulc(a)voip.null.ro> Date: Wed Jun 16 11:06:15 2010 +0300 winex11.drv: Post a WM_SYSCOMMAND SC_CLOSE when the window manager asks to close a window. --- dlls/winex11.drv/event.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 5bb1ecf..64d1992 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -553,11 +553,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) } } - /* Simulate pressing Alt+F4 */ - keybd_event(VK_MENU, 0, 0, 0); - keybd_event(VK_F4, 0, 0, 0); - keybd_event(VK_F4, 0, KEYEVENTF_KEYUP, 0); - keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); + PostMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 ); } } else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
1
0
0
0
Henri Verbeet : winealsa.drv: Add some missing newlines.
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: 555e21307e9634c7259734ba70dba965407e8b30 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=555e21307e9634c7259734ba7…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Wed Jun 16 10:56:54 2010 +0200 winealsa.drv: Add some missing newlines. --- dlls/winealsa.drv/alsa.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 4f0f1ce..5ebb8b7 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -575,10 +575,10 @@ int wine_snd_pcm_recover(snd_pcm_t *pcm, int err, int silent) else s = "overrun"; if (!silent) - ERR("%s occurred", s); + ERR("%s occurred\n", s); err = snd_pcm_prepare(pcm); if (err < 0) { - ERR("cannot recover from %s, prepare failed: %s", s, snd_strerror(err)); + ERR("cannot recover from %s, prepare failed: %s\n", s, snd_strerror(err)); return err; } return 0; @@ -590,7 +590,7 @@ int wine_snd_pcm_recover(snd_pcm_t *pcm, int err, int silent) if (err < 0) { err = snd_pcm_prepare(pcm); if (err < 0) { - ERR("cannot recover from suspend, prepare failed: %s", snd_strerror(err)); + ERR("cannot recover from suspend, prepare failed: %s\n", snd_strerror(err)); return err; } }
1
0
0
0
Jörg Höhle : mmsystem: Log MCI command name again .
by Alexandre Julliard
16 Jun '10
16 Jun '10
Module: wine Branch: master Commit: 8f5ec326e11362d73a27af4b6c098c14af38cd0c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8f5ec326e11362d73a27af4b6…
Author: Jörg Höhle <hoehle(a)users.sourceforge.net> Date: Mon Jun 14 20:21:22 2010 +0200 mmsystem: Log MCI command name again. --- dlls/mmsystem.dll16/mci16.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/mmsystem.dll16/mci16.c b/dlls/mmsystem.dll16/mci16.c index f09923a..914636d 100644 --- a/dlls/mmsystem.dll16/mci16.c +++ b/dlls/mmsystem.dll16/mci16.c @@ -627,7 +627,7 @@ DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD BOOL to32; DWORD_PTR dwParam2 = p2; - TRACE("(%04X, %u, %08X, %08lX)\n", wDevID, wMsg, dwParam1, dwParam2); + TRACE("(%04X, %s, %08X, %08lX)\n", wDevID, MCI_MessageToString(wMsg), dwParam1, dwParam2); switch (wMsg) { case MCI_CLOSE: @@ -651,11 +651,11 @@ DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD switch (res = MCI_MapMsg16To32W(wMsg, dwParam1, &dwParam2)) { case MMSYSTEM_MAP_MSGERROR: - TRACE("Not handled yet (%u)\n", wMsg); + TRACE("%s not handled yet\n", MCI_MessageToString(wMsg)); dwRet = MCIERR_DRIVER_INTERNAL; break; case MMSYSTEM_MAP_NOMEM: - TRACE("Problem mapping msg=%u from 16 to 32a\n", wMsg); + TRACE("Problem mapping %s from 16 to 32a\n", MCI_MessageToString(wMsg)); dwRet = MCIERR_OUT_OF_MEMORY; break; case MMSYSTEM_MAP_OK:
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
67
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
Results per page:
10
25
50
100
200