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 2015
----- 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
610 discussions
Start a n
N
ew thread
Piotr Caban : msvcrt: Remove no longer needed global lock from functions using fd critical sections.
by Alexandre Julliard
11 Jun '15
11 Jun '15
Module: wine Branch: master Commit: 725e4733cf83305ac3b4ae3cb949a68f5a75e773 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=725e4733cf83305ac3b4ae3cb…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Jun 10 17:48:42 2015 +0200 msvcrt: Remove no longer needed global lock from functions using fd critical sections. --- dlls/msvcrt/file.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 802834c..1069cf7 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1009,7 +1009,6 @@ int CDECL MSVCRT__close(int fd) ioinfo *info = get_ioinfo(fd); int ret; - LOCK_FILES(); TRACE(":fd (%d) handle (%p)\n", fd, info->handle); if (!(info->wxflag & WX_OPEN)) { ret = -1; @@ -1021,7 +1020,6 @@ int CDECL MSVCRT__close(int fd) msvcrt_set_errno(GetLastError()); } } - UNLOCK_FILES(); release_ioinfo(info); return ret; } @@ -1039,7 +1037,6 @@ int CDECL MSVCRT__dup2(int od, int nd) int ret; TRACE("(od=%d, nd=%d)\n", od, nd); - LOCK_FILES(); if (od < nd) { @@ -1086,7 +1083,6 @@ int CDECL MSVCRT__dup2(int od, int nd) release_ioinfo(info_od); release_ioinfo(info_nd); - UNLOCK_FILES(); return ret; } @@ -2065,7 +2061,6 @@ int CDECL MSVCRT__pipe(int *pfds, unsigned int psize, int textmode) unsigned int wxflags = split_oflags(textmode); int fd; - LOCK_FILES(); fd = msvcrt_alloc_fd(readHandle, wxflags|WX_PIPE); if (fd != -1) { @@ -2089,7 +2084,6 @@ int CDECL MSVCRT__pipe(int *pfds, unsigned int psize, int textmode) CloseHandle(writeHandle); *MSVCRT__errno() = MSVCRT_EMFILE; } - UNLOCK_FILES(); } else msvcrt_set_errno(GetLastError());
1
0
0
0
Piotr Caban : msvcrt: Avoid using global critical section while allocating new file descriptors.
by Alexandre Julliard
11 Jun '15
11 Jun '15
Module: wine Branch: master Commit: 6ed69c107f82d127f6e87f654fbfcd023498ec52 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6ed69c107f82d127f6e87f654…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Jun 10 18:12:53 2015 +0200 msvcrt: Avoid using global critical section while allocating new file descriptors. --- dlls/msvcrt/file.c | 146 +++++++++++++++++------------------------------------ 1 file changed, 47 insertions(+), 99 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 36887fc..802834c 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -114,9 +114,6 @@ ioinfo * MSVCRT___pioinfo[MSVCRT_MAX_FILES/MSVCRT_FD_BLOCK_SIZE] = { 0 }; */ ioinfo MSVCRT___badioinfo = { INVALID_HANDLE_VALUE, WX_TEXT }; -static int MSVCRT_fdstart = 3; /* first unallocated fd */ -static int MSVCRT_fdend = 3; /* highest allocated fd */ - typedef struct { MSVCRT_FILE file; CRITICAL_SECTION crit; @@ -143,12 +140,9 @@ static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t'); static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d'); static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m'); -/* This critical section protects the tables MSVCRT___pioinfo and MSVCRT_fstreams, - * and their related indexes, MSVCRT_fdstart, MSVCRT_fdend, - * and MSVCRT_stream_idx, from race conditions. - * It doesn't protect against race conditions manipulating the underlying files - * or flags; doing so would probably be better accomplished with per-file - * protection, rather than locking the whole table for every change. +/* This critical section protects the MSVCRT_fstreams table + * and MSVCRT_stream_idx from race conditions. It also + * protects fd critical sections creation code. */ static CRITICAL_SECTION MSVCRT_file_cs; static CRITICAL_SECTION_DEBUG MSVCRT_file_cs_debug = @@ -257,19 +251,24 @@ static inline ioinfo* get_ioinfo_nolock(int fd) return ret + (fd%MSVCRT_FD_BLOCK_SIZE); } -static inline ioinfo* get_ioinfo(int fd) +static inline void init_ioinfo_cs(ioinfo *info) { - ioinfo *ret = get_ioinfo_nolock(fd); - if(ret == &MSVCRT___badioinfo) - return ret; - if(!(ret->exflag & EF_CRIT_INIT)) { + if(!(info->exflag & EF_CRIT_INIT)) { LOCK_FILES(); - if(!(ret->exflag & EF_CRIT_INIT)) { - InitializeCriticalSection(&ret->crit); - ret->exflag |= EF_CRIT_INIT; + if(!(info->exflag & EF_CRIT_INIT)) { + InitializeCriticalSection(&info->crit); + info->exflag |= EF_CRIT_INIT; } UNLOCK_FILES(); } +} + +static inline ioinfo* get_ioinfo(int fd) +{ + ioinfo *ret = get_ioinfo_nolock(fd); + if(ret == &MSVCRT___badioinfo) + return ret; + init_ioinfo_cs(ret); EnterCriticalSection(&ret->crit); return ret; } @@ -301,77 +300,49 @@ static inline BOOL alloc_pioinfo_block(int fd) static inline ioinfo* get_ioinfo_alloc_fd(int fd) { - ioinfo *ret, *info; + ioinfo *ret; ret = get_ioinfo(fd); if(ret != &MSVCRT___badioinfo) - { - LOCK_FILES(); - /* locate next free slot */ - if (fd == MSVCRT_fdstart && fd == MSVCRT_fdend) - MSVCRT_fdstart = MSVCRT_fdend + 1; - else if (fd == MSVCRT_fdstart) - { - MSVCRT_fdstart++; - while (MSVCRT_fdstart < MSVCRT_fdend && - ((info = get_ioinfo_nolock(MSVCRT_fdstart))->exflag & EF_CRIT_INIT)) - { - if (TryEnterCriticalSection(&info->crit)) - { - if (info->handle == INVALID_HANDLE_VALUE) - { - LeaveCriticalSection(&info->crit); - break; - } - LeaveCriticalSection(&info->crit); - } - MSVCRT_fdstart++; - } - } - /* update last fd in use */ - if (fd >= MSVCRT_fdend) - MSVCRT_fdend = fd + 1; - TRACE("fdstart is %d, fdend is %d\n", MSVCRT_fdstart, MSVCRT_fdend); - UNLOCK_FILES(); return ret; - } if(!alloc_pioinfo_block(fd)) return &MSVCRT___badioinfo; - ret = get_ioinfo(fd); - if(ret == &MSVCRT___badioinfo) - return ret; + return get_ioinfo(fd); +} - LOCK_FILES(); - /* locate next free slot */ - if (fd == MSVCRT_fdstart && fd == MSVCRT_fdend) - MSVCRT_fdstart = MSVCRT_fdend + 1; - else if (fd == MSVCRT_fdstart) +static inline ioinfo* get_ioinfo_alloc(int *fd) +{ + int i; + + *fd = -1; + for(i=0; i<MSVCRT_MAX_FILES; i++) { - MSVCRT_fdstart++; - while (MSVCRT_fdstart < MSVCRT_fdend && - ((info = get_ioinfo_nolock(MSVCRT_fdstart))->exflag & EF_CRIT_INIT)) + ioinfo *info = get_ioinfo_nolock(i); + + if(info == &MSVCRT___badioinfo) + { + if(!alloc_pioinfo_block(i)) + return &MSVCRT___badioinfo; + info = get_ioinfo_nolock(i); + } + + init_ioinfo_cs(info); + if(TryEnterCriticalSection(&info->crit)) { - if (TryEnterCriticalSection(&info->crit)) + if(info->handle == INVALID_HANDLE_VALUE) { - if (info->handle == INVALID_HANDLE_VALUE) - { - LeaveCriticalSection(&info->crit); - break; - } - LeaveCriticalSection(&info->crit); + *fd = i; + return info; } - MSVCRT_fdstart++; + LeaveCriticalSection(&info->crit); } } - /* update last fd in use */ - if (fd >= MSVCRT_fdend) - MSVCRT_fdend = fd + 1; - TRACE("fdstart is %d, fdend is %d\n", MSVCRT_fdstart, MSVCRT_fdend); - UNLOCK_FILES(); - return ret; + WARN(":files exhausted!\n"); + *MSVCRT__errno() = MSVCRT_ENFILE; + return &MSVCRT___badioinfo; } static inline void release_ioinfo(ioinfo *info) @@ -434,13 +405,6 @@ static void msvcrt_free_fd(int fd) } } release_ioinfo(fdinfo); - - LOCK_FILES(); - if (fd == MSVCRT_fdend - 1) - MSVCRT_fdend--; - if (fd < MSVCRT_fdstart) - MSVCRT_fdstart = fd; - UNLOCK_FILES(); } static void msvcrt_set_fd(ioinfo *fdinfo, HANDLE hand, int flag) @@ -463,23 +427,11 @@ static void msvcrt_set_fd(ioinfo *fdinfo, HANDLE hand, int flag) /* INTERNAL: Allocate an fd slot from a Win32 HANDLE */ static int msvcrt_alloc_fd(HANDLE hand, int flag) { - ioinfo *info; int fd; + ioinfo *info = get_ioinfo_alloc(&fd); - LOCK_FILES(); - fd = MSVCRT_fdstart; TRACE(":handle (%p) allocating fd (%d)\n", hand, fd); - if (fd >= MSVCRT_MAX_FILES) - { - UNLOCK_FILES(); - WARN(":files exhausted!\n"); - *MSVCRT__errno() = MSVCRT_ENFILE; - return -1; - } - - info = get_ioinfo_alloc_fd(fd); - UNLOCK_FILES(); if(info == &MSVCRT___badioinfo) return -1; @@ -623,9 +575,6 @@ void msvcrt_init_io(void) wxflag_ptr++; handle_ptr++; } - MSVCRT_fdend = max( 3, count ); - for (MSVCRT_fdstart = 3; MSVCRT_fdstart < MSVCRT_fdend; MSVCRT_fdstart++) - if (get_ioinfo_nolock(MSVCRT_fdstart)->handle == INVALID_HANDLE_VALUE) break; } fdinfo = get_ioinfo_alloc_fd(MSVCRT_STDIN_FILENO); @@ -1147,14 +1096,13 @@ int CDECL MSVCRT__dup2(int od, int nd) int CDECL MSVCRT__dup(int od) { int fd, ret; + ioinfo *info = get_ioinfo_alloc(&fd); - LOCK_FILES(); - fd = MSVCRT_fdstart; if (MSVCRT__dup2(od, fd) == 0) ret = fd; else ret = -1; - UNLOCK_FILES(); + release_ioinfo(info); return ret; } @@ -4377,7 +4325,7 @@ MSVCRT_FILE* CDECL MSVCRT__wfreopen(const MSVCRT_wchar_t *path, const MSVCRT_wch TRACE(":path (%s) mode (%s) file (%p) fd (%d)\n", debugstr_w(path), debugstr_w(mode), file, file ? file->_file : -1); LOCK_FILES(); - if (!file || ((fd = file->_file) < 0) || fd > MSVCRT_fdend) + if (!file || ((fd = file->_file) < 0)) file = NULL; else {
1
0
0
0
Piotr Caban : msvcrt: Don' t use MSVCRT_fdend in msvcrt_create_io_inherit_block.
by Alexandre Julliard
11 Jun '15
11 Jun '15
Module: wine Branch: master Commit: e7fc237088552965169dbd573b8dd895bac1d82a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e7fc237088552965169dbd573…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Jun 10 17:48:33 2015 +0200 msvcrt: Don't use MSVCRT_fdend in msvcrt_create_io_inherit_block. --- dlls/msvcrt/file.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 161219b..36887fc 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -548,12 +548,17 @@ static int msvcrt_init_fp(MSVCRT_FILE* file, int fd, unsigned stream_flags) */ unsigned msvcrt_create_io_inherit_block(WORD *size, BYTE **block) { - int fd; + int fd, last_fd; char* wxflag_ptr; HANDLE* handle_ptr; ioinfo* fdinfo; - *size = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * MSVCRT_fdend; + for (last_fd=MSVCRT_MAX_FILES-1; last_fd>=0; last_fd--) + if (get_ioinfo_nolock(last_fd)->handle != INVALID_HANDLE_VALUE) + break; + last_fd++; + + *size = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * last_fd; *block = MSVCRT_calloc(*size, 1); if (!*block) { @@ -561,10 +566,10 @@ unsigned msvcrt_create_io_inherit_block(WORD *size, BYTE **block) return FALSE; } wxflag_ptr = (char*)*block + sizeof(unsigned); - handle_ptr = (HANDLE*)(wxflag_ptr + MSVCRT_fdend * sizeof(char)); + handle_ptr = (HANDLE*)(wxflag_ptr + last_fd); - *(unsigned*)*block = MSVCRT_fdend; - for (fd = 0; fd < MSVCRT_fdend; fd++) + *(unsigned*)*block = last_fd; + for (fd = 0; fd < last_fd; fd++) { /* to be inherited, we need it to be open, and that DONTINHERIT isn't set */ fdinfo = get_ioinfo(fd);
1
0
0
0
Piotr Caban : msvcrt: Fix possible deadlock in dup2 function.
by Alexandre Julliard
11 Jun '15
11 Jun '15
Module: wine Branch: master Commit: 417b60568778e8916066c1de76ef73a977171d7c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=417b60568778e8916066c1de7…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Jun 10 17:48:23 2015 +0200 msvcrt: Fix possible deadlock in dup2 function. --- dlls/msvcrt/file.c | 231 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 154 insertions(+), 77 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 0d4a6f4..161219b 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -274,6 +274,106 @@ static inline ioinfo* get_ioinfo(int fd) return ret; } +static inline BOOL alloc_pioinfo_block(int fd) +{ + ioinfo *block; + int i; + + if(fd<0 || fd>=MSVCRT_MAX_FILES) + { + *MSVCRT__errno() = MSVCRT_ENFILE; + return FALSE; + } + + block = MSVCRT_calloc(MSVCRT_FD_BLOCK_SIZE, sizeof(ioinfo)); + if(!block) + { + WARN(":out of memory!\n"); + *MSVCRT__errno() = MSVCRT_ENOMEM; + return FALSE; + } + for(i=0; i<MSVCRT_FD_BLOCK_SIZE; i++) + block[i].handle = INVALID_HANDLE_VALUE; + if(InterlockedCompareExchangePointer((void**)&MSVCRT___pioinfo[fd/MSVCRT_FD_BLOCK_SIZE], block, NULL)) + MSVCRT_free(block); + return TRUE; +} + +static inline ioinfo* get_ioinfo_alloc_fd(int fd) +{ + ioinfo *ret, *info; + + ret = get_ioinfo(fd); + if(ret != &MSVCRT___badioinfo) + { + LOCK_FILES(); + /* locate next free slot */ + if (fd == MSVCRT_fdstart && fd == MSVCRT_fdend) + MSVCRT_fdstart = MSVCRT_fdend + 1; + else if (fd == MSVCRT_fdstart) + { + MSVCRT_fdstart++; + while (MSVCRT_fdstart < MSVCRT_fdend && + ((info = get_ioinfo_nolock(MSVCRT_fdstart))->exflag & EF_CRIT_INIT)) + { + if (TryEnterCriticalSection(&info->crit)) + { + if (info->handle == INVALID_HANDLE_VALUE) + { + LeaveCriticalSection(&info->crit); + break; + } + LeaveCriticalSection(&info->crit); + } + MSVCRT_fdstart++; + } + } + /* update last fd in use */ + if (fd >= MSVCRT_fdend) + MSVCRT_fdend = fd + 1; + TRACE("fdstart is %d, fdend is %d\n", MSVCRT_fdstart, MSVCRT_fdend); + UNLOCK_FILES(); + return ret; + } + + if(!alloc_pioinfo_block(fd)) + return &MSVCRT___badioinfo; + + ret = get_ioinfo(fd); + if(ret == &MSVCRT___badioinfo) + return ret; + + LOCK_FILES(); + /* locate next free slot */ + if (fd == MSVCRT_fdstart && fd == MSVCRT_fdend) + MSVCRT_fdstart = MSVCRT_fdend + 1; + else if (fd == MSVCRT_fdstart) + { + MSVCRT_fdstart++; + while (MSVCRT_fdstart < MSVCRT_fdend && + ((info = get_ioinfo_nolock(MSVCRT_fdstart))->exflag & EF_CRIT_INIT)) + { + if (TryEnterCriticalSection(&info->crit)) + { + if (info->handle == INVALID_HANDLE_VALUE) + { + LeaveCriticalSection(&info->crit); + break; + } + LeaveCriticalSection(&info->crit); + } + MSVCRT_fdstart++; + } + } + /* update last fd in use */ + if (fd >= MSVCRT_fdend) + MSVCRT_fdend = fd + 1; + TRACE("fdstart is %d, fdend is %d\n", MSVCRT_fdstart, MSVCRT_fdend); + UNLOCK_FILES(); + + return ret; +} + static inline void release_ioinfo(ioinfo *info) { if(info!=&MSVCRT___badioinfo && info->exflag & EF_CRIT_INIT) @@ -343,77 +443,49 @@ static void msvcrt_free_fd(int fd) UNLOCK_FILES(); } -/* INTERNAL: Allocate an fd slot from a Win32 HANDLE, starting from fd */ -/* caller must hold the files lock */ -static int msvcrt_set_fd(HANDLE hand, int flag, int fd) +static void msvcrt_set_fd(ioinfo *fdinfo, HANDLE hand, int flag) { - ioinfo *fdinfo; - - if (fd >= MSVCRT_MAX_FILES) - { - WARN(":files exhausted!\n"); - *MSVCRT__errno() = MSVCRT_ENFILE; - return -1; - } - - fdinfo = get_ioinfo_nolock(fd); - if(fdinfo == &MSVCRT___badioinfo) { - int i; - - MSVCRT___pioinfo[fd/MSVCRT_FD_BLOCK_SIZE] = MSVCRT_calloc(MSVCRT_FD_BLOCK_SIZE, sizeof(ioinfo)); - if(!MSVCRT___pioinfo[fd/MSVCRT_FD_BLOCK_SIZE]) { - WARN(":out of memory!\n"); - *MSVCRT__errno() = MSVCRT_ENOMEM; - return -1; - } - - for(i=0; i<MSVCRT_FD_BLOCK_SIZE; i++) - MSVCRT___pioinfo[fd/MSVCRT_FD_BLOCK_SIZE][i].handle = INVALID_HANDLE_VALUE; - - fdinfo = get_ioinfo_nolock(fd); - } - fdinfo->handle = hand; fdinfo->wxflag = WX_OPEN | (flag & (WX_DONTINHERIT | WX_APPEND | WX_TEXT | WX_PIPE | WX_TTY)); fdinfo->lookahead[0] = '\n'; fdinfo->lookahead[1] = '\n'; fdinfo->lookahead[2] = '\n'; - if(!(fdinfo->exflag & EF_CRIT_INIT)) - InitializeCriticalSection(&fdinfo->crit); - fdinfo->exflag = EF_CRIT_INIT; + fdinfo->exflag &= EF_CRIT_INIT; - /* locate next free slot */ - if (fd == MSVCRT_fdstart && fd == MSVCRT_fdend) - MSVCRT_fdstart = MSVCRT_fdend + 1; - else - while (MSVCRT_fdstart < MSVCRT_fdend && - get_ioinfo_nolock(MSVCRT_fdstart)->handle != INVALID_HANDLE_VALUE) - MSVCRT_fdstart++; - /* update last fd in use */ - if (fd >= MSVCRT_fdend) - MSVCRT_fdend = fd + 1; - TRACE("fdstart is %d, fdend is %d\n", MSVCRT_fdstart, MSVCRT_fdend); - - switch (fd) + switch (fdinfo-MSVCRT___pioinfo[0]) { case 0: SetStdHandle(STD_INPUT_HANDLE, hand); break; case 1: SetStdHandle(STD_OUTPUT_HANDLE, hand); break; case 2: SetStdHandle(STD_ERROR_HANDLE, hand); break; } - - return fd; } /* INTERNAL: Allocate an fd slot from a Win32 HANDLE */ static int msvcrt_alloc_fd(HANDLE hand, int flag) { - int ret; + ioinfo *info; + int fd; - LOCK_FILES(); - TRACE(":handle (%p) allocating fd (%d)\n",hand,MSVCRT_fdstart); - ret = msvcrt_set_fd(hand, flag, MSVCRT_fdstart); - UNLOCK_FILES(); - return ret; + LOCK_FILES(); + fd = MSVCRT_fdstart; + TRACE(":handle (%p) allocating fd (%d)\n", hand, fd); + + if (fd >= MSVCRT_MAX_FILES) + { + UNLOCK_FILES(); + WARN(":files exhausted!\n"); + *MSVCRT__errno() = MSVCRT_ENFILE; + return -1; + } + + info = get_ioinfo_alloc_fd(fd); + UNLOCK_FILES(); + if(info == &MSVCRT___badioinfo) + return -1; + + msvcrt_set_fd(info, hand, flag); + release_ioinfo(info); + return fd; } /* INTERNAL: Allocate a FILE* for an fd slot */ @@ -537,7 +609,12 @@ void msvcrt_init_io(void) for (i = 0; i < count; i++) { if ((*wxflag_ptr & WX_OPEN) && *handle_ptr != INVALID_HANDLE_VALUE) - msvcrt_set_fd(*handle_ptr, *wxflag_ptr, i); + { + fdinfo = get_ioinfo_alloc_fd(i); + if(fdinfo != &MSVCRT___badioinfo) + msvcrt_set_fd(fdinfo, *handle_ptr, *wxflag_ptr); + release_ioinfo(fdinfo); + } wxflag_ptr++; handle_ptr++; } @@ -546,32 +623,35 @@ void msvcrt_init_io(void) if (get_ioinfo_nolock(MSVCRT_fdstart)->handle == INVALID_HANDLE_VALUE) break; } - fdinfo = get_ioinfo_nolock(MSVCRT_STDIN_FILENO); + fdinfo = get_ioinfo_alloc_fd(MSVCRT_STDIN_FILENO); if (!(fdinfo->wxflag & WX_OPEN) || fdinfo->handle == INVALID_HANDLE_VALUE) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD type = GetFileType(h); - msvcrt_set_fd(h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) - |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0), MSVCRT_STDIN_FILENO); + msvcrt_set_fd(fdinfo, h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) + |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0)); } + release_ioinfo(fdinfo); - fdinfo = get_ioinfo_nolock(MSVCRT_STDOUT_FILENO); + fdinfo = get_ioinfo_alloc_fd(MSVCRT_STDOUT_FILENO); if (!(fdinfo->wxflag & WX_OPEN) || fdinfo->handle == INVALID_HANDLE_VALUE) { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); DWORD type = GetFileType(h); - msvcrt_set_fd(h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) - |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0), MSVCRT_STDOUT_FILENO); + msvcrt_set_fd(fdinfo, h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) + |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0)); } + release_ioinfo(fdinfo); - fdinfo = get_ioinfo_nolock(MSVCRT_STDERR_FILENO); + fdinfo = get_ioinfo_alloc_fd(MSVCRT_STDERR_FILENO); if (!(fdinfo->wxflag & WX_OPEN) || fdinfo->handle == INVALID_HANDLE_VALUE) { HANDLE h = GetStdHandle(STD_ERROR_HANDLE); DWORD type = GetFileType(h); - msvcrt_set_fd(h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) - |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0), MSVCRT_STDERR_FILENO); + msvcrt_set_fd(fdinfo, h, WX_OPEN|WX_TEXT|((type&0xf)==FILE_TYPE_CHAR ? WX_TTY : 0) + |((type&0xf)==FILE_TYPE_PIPE ? WX_PIPE : 0)); } + release_ioinfo(fdinfo); TRACE(":handles (%p)(%p)(%p)\n", get_ioinfo_nolock(MSVCRT_STDIN_FILENO)->handle, get_ioinfo_nolock(MSVCRT_STDOUT_FILENO)->handle, @@ -1010,15 +1090,19 @@ int CDECL MSVCRT__dup2(int od, int nd) if (od < nd) { info_od = get_ioinfo(od); - info_nd = get_ioinfo(nd); + info_nd = get_ioinfo_alloc_fd(nd); } else { - info_nd = get_ioinfo(nd); + info_nd = get_ioinfo_alloc_fd(nd); info_od = get_ioinfo(od); } - if (nd < MSVCRT_MAX_FILES && nd >= 0 && (info_od->wxflag & WX_OPEN)) + if (info_nd == &MSVCRT___badioinfo) + { + ret = -1; + } + else if (info_od->wxflag & WX_OPEN) { HANDLE handle; @@ -1029,17 +1113,10 @@ int CDECL MSVCRT__dup2(int od, int nd) if (info_nd->wxflag & WX_OPEN) MSVCRT__close(nd); - ret = msvcrt_set_fd(handle, wxflag, nd); - if (ret == -1) - { - CloseHandle(handle); - *MSVCRT__errno() = MSVCRT_EMFILE; - } - else - { - /* _dup2 returns 0, not nd, on success */ - ret = 0; - } + + msvcrt_set_fd(info_nd, handle, wxflag); + /* _dup2 returns 0, not nd, on success */ + ret = 0; } else {
1
0
0
0
Huw Davies : wshom/tests: Use RegQueryValueEx so that the tests run on Win 2k and XP.
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: 714abcb7cdd8cab7d9383bded5b5426e55d98791 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=714abcb7cdd8cab7d9383bded…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jun 10 15:14:21 2015 +0100 wshom/tests: Use RegQueryValueEx so that the tests run on Win 2k and XP. --- dlls/wshom.ocx/tests/wshom.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/wshom.ocx/tests/wshom.c b/dlls/wshom.ocx/tests/wshom.c index 46ffc58..a3d398e 100644 --- a/dlls/wshom.ocx/tests/wshom.c +++ b/dlls/wshom.ocx/tests/wshom.c @@ -223,7 +223,8 @@ if (0) /* crashes on native */ SysFreeString(str); hr = IWshShell3_put_CurrentDirectory(sh3, NULL); - ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + ok(hr == E_INVALIDARG || + broken(hr == HRESULT_FROM_WIN32(ERROR_NOACCESS)), "got 0x%08x\n", hr); str = SysAllocString(emptyW); hr = IWshShell3_put_CurrentDirectory(sh3, str); @@ -490,7 +491,7 @@ static void test_registry(void) ok(hr == S_OK, "got 0x%08x\n", hr); type = REG_NONE; - ret = RegGetValueA(root, NULL, "regsz", RRF_RT_ANY, &type, NULL, NULL); + ret = RegQueryValueExA(root, "regsz", 0, &type, NULL, NULL); ok(ret == ERROR_SUCCESS, "got %d\n", ret); ok(type == REG_SZ, "got %d\n", type); @@ -503,7 +504,7 @@ static void test_registry(void) VariantClear(&value); type = REG_NONE; - ret = RegGetValueA(root, NULL, "regsz", RRF_RT_ANY, &type, NULL, NULL); + ret = RegQueryValueExA(root, "regsz", 0, &type, NULL, NULL); ok(ret == ERROR_SUCCESS, "got %d\n", ret); ok(type == REG_SZ, "got %d\n", type); @@ -516,7 +517,7 @@ static void test_registry(void) VariantClear(&value); type = REG_NONE; - ret = RegGetValueA(root, NULL, "regsz", RRF_RT_ANY, &type, NULL, NULL); + ret = RegQueryValueExA(root, "regsz", 0, &type, NULL, NULL); ok(ret == ERROR_SUCCESS, "got %d\n", ret); ok(type == REG_SZ, "got %d\n", type);
1
0
0
0
Huw Davies : shlwapi/tests: Fix failing tests on Vista and Win 2008.
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: 9327e476d4c7721dd01317d22b0479c8da0c0de5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9327e476d4c7721dd01317d22…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Jun 10 13:10:50 2015 +0100 shlwapi/tests: Fix failing tests on Vista and Win 2008. SHMapHandle fails with a variety of errors on these platforms. --- dlls/shlwapi/tests/ordinal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c index 9225219..17edf65 100644 --- a/dlls/shlwapi/tests/ordinal.c +++ b/dlls/shlwapi/tests/ordinal.c @@ -548,10 +548,10 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem) hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0); /* It seems like Windows Vista/2008 uses a different internal implementation - * for shared memory, and calling SHMapHandle fails with ERROR_INVALID_HANDLE. */ - ok(hmem2 != NULL || broken(hmem2 == NULL && GetLastError() == ERROR_INVALID_HANDLE), + * for shared memory, and calling SHMapHandle fails. */ + ok(hmem2 != NULL || broken(hmem2 == NULL), "SHMapHandle failed: %u\n", GetLastError()); - if (hmem2 == NULL && GetLastError() == ERROR_INVALID_HANDLE) + if (hmem2 == NULL) { win_skip("Subprocess failed to map shared memory, skipping test\n"); return;
1
0
0
0
Nikolay Sivov : oledb32: Support provider-specific properties in GetDataSource().
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: 795845ff3d1247f0d81628c0ce7d7e46ebc08b87 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=795845ff3d1247f0d81628c0c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Jun 10 10:41:28 2015 +0300 oledb32: Support provider-specific properties in GetDataSource(). --- dlls/oledb32/datainit.c | 259 +++++++++++++++++++++++++++++------------- dlls/oledb32/tests/database.c | 2 - 2 files changed, 181 insertions(+), 80 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=795845ff3d1247f0d8162…
1
0
0
0
Zhenbo Li : mshtml: Implement IHTMLXMLHttpRequestFactory as a stub.
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: 0036b8bf2e401806efda411ae5ac570ba3fccab7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0036b8bf2e401806efda411ae…
Author: Zhenbo Li <litimetal(a)gmail.com> Date: Tue Jun 9 23:21:02 2015 +0800 mshtml: Implement IHTMLXMLHttpRequestFactory as a stub. --- dlls/mshtml/Makefile.in | 3 +- dlls/mshtml/htmlwindow.c | 23 +++++- dlls/mshtml/mshtml_private.h | 10 +++ dlls/mshtml/tests/dom.c | 57 +++++++++++++++ dlls/mshtml/xmlhttprequest.c | 166 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 256 insertions(+), 3 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=0036b8bf2e401806efda4…
1
0
0
0
Joachim Priesner : ieframe: shellbrowser: Strip 'file://' from file URLs in BEFORENAVIGATE2 callbacks.
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: ba2274c8bae67e9510ab24ca1caa6576874c8c6d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ba2274c8bae67e9510ab24ca1…
Author: Joachim Priesner <joachim.priesner(a)web.de> Date: Tue Jun 9 16:42:42 2015 +0200 ieframe: shellbrowser: Strip 'file://' from file URLs in BEFORENAVIGATE2 callbacks. This is a straightforward port of commit 8eb70459a18f6d8a80c9570875e2c664e6afbb56 which does the same thing for the matching method in navigate.c. --- dlls/ieframe/shellbrowser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ieframe/shellbrowser.c b/dlls/ieframe/shellbrowser.c index 4d5a818..8145536 100644 --- a/dlls/ieframe/shellbrowser.c +++ b/dlls/ieframe/shellbrowser.c @@ -23,6 +23,7 @@ #include "ieframe.h" #include "exdispid.h" +#include "shlwapi.h" #include "wine/debug.h" @@ -656,6 +657,8 @@ static HRESULT WINAPI DocObjectService_FireBeforeNavigate2( DISPPARAMS dp = {params, NULL, 7, 0}; VARIANT_BOOL cancel = VARIANT_FALSE; SAFEARRAY *post_data; + WCHAR file_path[MAX_PATH]; + DWORD file_path_len = sizeof(file_path) / sizeof(*file_path); TRACE("%p %p %s %x %s %p %d %s %d %p\n", This, pDispatch, debugstr_w(lpszUrl), dwFlags, debugstr_w(lpszFrameName), pPostData, cbPostData, @@ -703,7 +706,10 @@ static HRESULT WINAPI DocObjectService_FireBeforeNavigate2( V_VT(params+5) = (VT_BYREF|VT_VARIANT); V_VARIANTREF(params+5) = &var_url; V_VT(&var_url) = VT_BSTR; - V_BSTR(&var_url) = SysAllocString(lpszUrl); + if(PathCreateFromUrlW(lpszUrl, file_path, &file_path_len, 0) == S_OK) + V_BSTR(&var_url) = SysAllocString(file_path); + else + V_BSTR(&var_url) = SysAllocString(lpszUrl); V_VT(params+6) = (VT_DISPATCH); V_DISPATCH(params+6) = (IDispatch*)This->doc_host->wb;
1
0
0
0
Stefan Dösinger : d3d8: Reject FBs with mismatching multisample settings.
by Alexandre Julliard
10 Jun '15
10 Jun '15
Module: wine Branch: master Commit: e09f980c8367ddc90852f12a008b07ed6687ec16 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e09f980c8367ddc90852f12a0…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Tue Jun 9 22:48:16 2015 +0200 d3d8: Reject FBs with mismatching multisample settings. --- dlls/d3d8/device.c | 8 ++++++++ dlls/d3d8/tests/visual.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 10c2103..26cc9ac 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1185,6 +1185,14 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, wined3d_mutex_unlock(); return D3DERR_INVALIDCALL; } + if (ds_desc.multisample_type != rt_desc.multisample_type + || ds_desc.multisample_quality != rt_desc.multisample_quality) + { + WARN("Multisample settings do not match, returing D3DERR_INVALIDCALL\n"); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; + + } } original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device); diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 41165a7..c180dfe 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -6855,6 +6855,52 @@ done: DestroyWindow(window); } +static void test_multisample_mismatch(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + HWND window; + HRESULT hr; + ULONG refcount; + IDirect3DSurface8 *rt_multi, *ds; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES))) + { + skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisample mismatch test.\n"); + IDirect3D8_Release(d3d); + return; + } + + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice8_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, + D3DMULTISAMPLE_2_SAMPLES, FALSE, &rt_multi); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + hr = IDirect3DDevice8_GetDepthStencilSurface(device, &ds); + ok(SUCCEEDED(hr), "Failed to get original depth/stencil, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetRenderTarget(device, rt_multi, ds); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + IDirect3DSurface8_Release(ds); + IDirect3DSurface8_Release(rt_multi); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -6911,4 +6957,5 @@ START_TEST(visual) test_table_fog_zw(); test_signed_formats(); test_pointsize(); + test_multisample_mismatch(); }
1
0
0
0
← Newer
1
...
38
39
40
41
42
43
44
...
61
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
Results per page:
10
25
50
100
200