ReactOS.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
2024
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
List overview
Download
Ros-diffs
March 2018
----- 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
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
01/01: [LOADPERF] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=af65c9d3441f94e0973f7…
commit af65c9d3441f94e0973f7575d837dd8c995197f9 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:13:56 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:13:56 2018 +0100 [LOADPERF] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/loadperf/loadperf_main.c | 16 +++++++--------- media/doc/README.WINE | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dll/win32/loadperf/loadperf_main.c b/dll/win32/loadperf/loadperf_main.c index 17ecc1b0ee..8f0da112ec 100644 --- a/dll/win32/loadperf/loadperf_main.c +++ b/dll/win32/loadperf/loadperf_main.c @@ -18,19 +18,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS - -#include <config.h> +#include "config.h" #include <stdarg.h> -#include <windef.h> -#include <winbase.h> -//#include "winerror.h" -#include <winnls.h> -#include <wine/debug.h> +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winnls.h" +#include "wine/debug.h" -#include <loadperf.h> +#include "loadperf.h" WINE_DEFAULT_DEBUG_CHANNEL(loadperf); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 4c50bcfc6d..54d25488e8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -87,7 +87,7 @@ reactos/dll/win32/itircl # Synced to WineStaging-3.3 reactos/dll/win32/itss # Synced to WineStaging-3.3 reactos/dll/win32/jscript # Synced to WineStaging-3.3 reactos/dll/win32/jsproxy # Synced to WineStaging-3.3 -reactos/dll/win32/loadperf # Synced to WineStaging-2.9 +reactos/dll/win32/loadperf # Synced to WineStaging-3.3 reactos/dll/win32/lz32 # Synced to WineStaging-2.9 reactos/dll/win32/mapi32 # Synced to WineStaging-2.16 reactos/dll/win32/mciavi32 # Synced to WineStaging-2.9
6 years, 7 months
1
0
0
0
01/01: [JSPROXY] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7d1b509fa0b1885e4bb21…
commit 7d1b509fa0b1885e4bb21aa3553481ed86a3ace1 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:13:02 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:13:02 2018 +0100 [JSPROXY] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/jsproxy/main.c | 50 +++++++++++++++++++++--------------------------- media/doc/README.WINE | 2 +- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/dll/win32/jsproxy/main.c b/dll/win32/jsproxy/main.c index 9a3a196717..e6a35d5ff2 100644 --- a/dll/win32/jsproxy/main.c +++ b/dll/win32/jsproxy/main.c @@ -16,25 +16,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <wine/config.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#define COBJMACROS - -#include <windef.h> -#include <winbase.h> -#include <objbase.h> -#include <oleauto.h> -#include <dispex.h> -#include <activscp.h> -#include <wininet.h> - -#include <wine/debug.h> -#include <wine/unicode.h> +#include "config.h" +#include "wine/port.h" +#include <stdarg.h> +#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif @@ -44,6 +30,9 @@ #ifdef HAVE_NETDB_H # include <netdb.h> #endif +#ifdef __REACTOS__ +#define COBJMACROS +#endif #if defined(__MINGW32__) || defined (_MSC_VER) # include <ws2tcpip.h> #else @@ -51,9 +40,24 @@ # define ioctlsocket ioctl #endif +#include "windef.h" +#include "winbase.h" #ifndef __MINGW32__ #define USE_WS_PREFIX #endif +#include "winsock2.h" +#include "ws2ipdef.h" +#include "winnls.h" +#include "wininet.h" +#ifndef __REACTOS__ +#define COBJMACROS +#endif +#include "ole2.h" +#include "dispex.h" +#include "activscp.h" +#include "wine/debug.h" +#include "wine/heap.h" +#include "wine/unicode.h" static HINSTANCE instance; @@ -89,16 +93,6 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) return TRUE; } -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline WCHAR *strdupAW( const char *src, int len ) { WCHAR *dst = NULL; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index bd747fa90b..4c50bcfc6d 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -86,7 +86,7 @@ reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-3.3 reactos/dll/win32/itss # Synced to WineStaging-3.3 reactos/dll/win32/jscript # Synced to WineStaging-3.3 -reactos/dll/win32/jsproxy # Synced to WineStaging-2.16 +reactos/dll/win32/jsproxy # Synced to WineStaging-3.3 reactos/dll/win32/loadperf # Synced to WineStaging-2.9 reactos/dll/win32/lz32 # Synced to WineStaging-2.9 reactos/dll/win32/mapi32 # Synced to WineStaging-2.16
6 years, 7 months
1
0
0
0
01/01: [JSCRIPT_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e68a367aa60f37faf49d6…
commit e68a367aa60f37faf49d6da301cf56ca4b46c912 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:12:12 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:12:12 2018 +0100 [JSCRIPT_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/jscript/activex.c | 14 +++----------- modules/rostests/winetests/jscript/api.js | 3 +++ modules/rostests/winetests/jscript/caller.c | 9 +-------- modules/rostests/winetests/jscript/jscript.c | 11 +---------- modules/rostests/winetests/jscript/lang.js | 4 ++++ modules/rostests/winetests/jscript/run.c | 9 +-------- 6 files changed, 13 insertions(+), 37 deletions(-) diff --git a/modules/rostests/winetests/jscript/activex.c b/modules/rostests/winetests/jscript/activex.c index c9b822e6b3..636dd81e19 100644 --- a/modules/rostests/winetests/jscript/activex.c +++ b/modules/rostests/winetests/jscript/activex.c @@ -16,27 +16,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <stdio.h> #define COBJMACROS #define CONST_VTABLE -#include <windef.h> -#include <winbase.h> -#include <winreg.h> -#include <winnls.h> #include <ole2.h> #include <dispex.h> #include <activscp.h> #include <objsafe.h> -//#include <urlmon.h> -//#include <mshtmhst.h> +#include <urlmon.h> +#include <mshtmhst.h> -#include <wine/test.h> +#include "wine/test.h" #ifdef _WIN64 diff --git a/modules/rostests/winetests/jscript/api.js b/modules/rostests/winetests/jscript/api.js index 5a78b3a15a..4207f5a769 100644 --- a/modules/rostests/winetests/jscript/api.js +++ b/modules/rostests/winetests/jscript/api.js @@ -294,6 +294,7 @@ obj = new Date(); ok(!obj.hasOwnProperty('getTime'), "obj.hasOwnProperty('getTime') is true"); ok(!Date.hasOwnProperty('getTime'), "Date.hasOwnProperty('getTime') is true"); ok(Date.prototype.hasOwnProperty('getTime'), "Date.prototype.hasOwnProperty('getTime') is false"); +ok(!("now" in Date), "now found in Date"); obj = new Number(); ok(!obj.hasOwnProperty('toFixed'), "obj.hasOwnProperty('toFixed') is true"); @@ -908,6 +909,8 @@ arr = [,,,,,]; tmp = arr.pop(); ok(arr.length === 5, "arr.length = " + arr.length); ok(tmp === undefined, "tmp = " + tmp); +tmp = [1,2,,,].pop(); +ok(tmp === undefined, "tmp = " + tmp); function PseudoArray() { this[0] = 0; diff --git a/modules/rostests/winetests/jscript/caller.c b/modules/rostests/winetests/jscript/caller.c index 1cbdb72e9f..f09ad90d71 100644 --- a/modules/rostests/winetests/jscript/caller.c +++ b/modules/rostests/winetests/jscript/caller.c @@ -16,24 +16,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <stdio.h> #define COBJMACROS #define CONST_VTABLE -#include <windef.h> -#include <winbase.h> -#include <winnls.h> #include <ole2.h> #include <dispex.h> #include <activscp.h> #include <objsafe.h> -#include <wine/test.h> +#include "wine/test.h" #ifdef _WIN64 diff --git a/modules/rostests/winetests/jscript/jscript.c b/modules/rostests/winetests/jscript/jscript.c index 5f16dc461e..4c5aa6cc2f 100644 --- a/modules/rostests/winetests/jscript/jscript.c +++ b/modules/rostests/winetests/jscript/jscript.c @@ -16,25 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE -#include <stdarg.h> - -#include <windef.h> -#include <winbase.h> -#include <winnls.h> #include <initguid.h> #include <ole2.h> #include <activscp.h> #include <objsafe.h> #include <dispex.h> -#include <wine/test.h> +#include "wine/test.h" #ifdef _WIN64 diff --git a/modules/rostests/winetests/jscript/lang.js b/modules/rostests/winetests/jscript/lang.js index aba6ddac6b..ef4c3165b1 100644 --- a/modules/rostests/winetests/jscript/lang.js +++ b/modules/rostests/winetests/jscript/lang.js @@ -1171,6 +1171,10 @@ ok(tmp["0"] === undefined, "tmp[0] is not undefined"); ok(tmp["3"] === 2, "tmp[3] !== 2"); ok(tmp["6"] === true, "tmp[6] !== true"); ok(tmp[2] === 1, "tmp[2] !== 1"); +ok(!("0" in tmp), "0 found in array"); +ok(!("1" in tmp), "1 found in array"); +ok("2" in tmp, "2 not found in array"); +ok(!("2" in [1,,,,]), "2 found in [1,,,,]"); ok([1,].length === 2, "[1,].length !== 2"); ok([,,].length === 3, "[,,].length !== 3"); diff --git a/modules/rostests/winetests/jscript/run.c b/modules/rostests/winetests/jscript/run.c index 05fea3b111..887b264d8f 100644 --- a/modules/rostests/winetests/jscript/run.c +++ b/modules/rostests/winetests/jscript/run.c @@ -16,23 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <stdio.h> #define COBJMACROS #define CONST_VTABLE -#include <windef.h> -#include <winbase.h> -#include <winnls.h> #include <ole2.h> #include <dispex.h> #include <activscp.h> -#include <wine/test.h> +#include "wine/test.h" #ifdef _WIN64
6 years, 7 months
1
0
0
0
01/01: [JSCRIPT] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8dba275bd6f1e61a8d2c4…
commit 8dba275bd6f1e61a8d2c4f68529db60cb532bf41 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:11:29 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:11:29 2018 +0100 [JSCRIPT] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/jscript/CMakeLists.txt | 4 +- dll/win32/jscript/activex.c | 9 +- dll/win32/jscript/array.c | 107 ++++++++- dll/win32/jscript/bool.c | 6 + dll/win32/jscript/cc_parser.tab.c | 144 ++++++----- dll/win32/jscript/cc_parser.tab.h | 82 +++++++ dll/win32/jscript/cc_parser.y | 6 + dll/win32/jscript/compile.c | 33 ++- dll/win32/jscript/date.c | 45 +++- dll/win32/jscript/decode.c | 4 + dll/win32/jscript/dispex.c | 20 +- dll/win32/jscript/engine.c | 54 +++-- dll/win32/jscript/engine.h | 3 +- dll/win32/jscript/error.c | 9 + dll/win32/jscript/function.c | 7 + dll/win32/jscript/global.c | 10 + dll/win32/jscript/jscript.c | 16 +- dll/win32/jscript/jscript.h | 81 +++---- dll/win32/jscript/jscript_main.c | 18 +- dll/win32/jscript/json.c | 28 ++- dll/win32/jscript/jsregexp.c | 7 + dll/win32/jscript/jsstr.c | 4 + dll/win32/jscript/jsutils.c | 10 + dll/win32/jscript/jsval.h | 2 +- dll/win32/jscript/lex.c | 14 ++ dll/win32/jscript/math.c | 11 +- dll/win32/jscript/number.c | 7 + dll/win32/jscript/object.c | 6 + dll/win32/jscript/parser.tab.c | 490 +++++++++++++++++++------------------- dll/win32/jscript/parser.tab.h | 8 +- dll/win32/jscript/parser.y | 6 + dll/win32/jscript/precomp.h | 24 ++ dll/win32/jscript/regexp.c | 7 + dll/win32/jscript/resource.h | 2 + dll/win32/jscript/rsrc.rc | 2 - dll/win32/jscript/string.c | 8 + dll/win32/jscript/vbarray.c | 4 + media/doc/README.WINE | 2 +- 38 files changed, 853 insertions(+), 447 deletions(-) diff --git a/dll/win32/jscript/CMakeLists.txt b/dll/win32/jscript/CMakeLists.txt index 01dc2daa5b..5551ee74a1 100644 --- a/dll/win32/jscript/CMakeLists.txt +++ b/dll/win32/jscript/CMakeLists.txt @@ -33,7 +33,7 @@ list(APPEND SOURCE regexp.c string.c vbarray.c - jscript.h) + precomp.h) list(APPEND jscript_rc_deps ${CMAKE_CURRENT_SOURCE_DIR}/jscript.rgs @@ -54,5 +54,5 @@ add_dependencies(jscript jscript_idlheader stdole2) set_module_type(jscript win32dll) target_link_libraries(jscript uuid wine) add_importlibs(jscript user32 ole32 oleaut32 advapi32 msvcrt kernel32 ntdll) -add_pch(jscript jscript.h SOURCE) +add_pch(jscript precomp.h SOURCE) add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/jscript/activex.c b/dll/win32/jscript/activex.c index 0bdf80e976..c7d9a66911 100644 --- a/dll/win32/jscript/activex.c +++ b/dll/win32/jscript/activex.c @@ -16,9 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + #include "jscript.h" +#include "objsafe.h" +#include "mshtmhst.h" + +#include "wine/debug.h" -#include <mshtmhst.h> +WINE_DEFAULT_DEBUG_CHANNEL(jscript); /* Defined as extern in urlmon.idl, but not exported by uuid.lib */ const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = diff --git a/dll/win32/jscript/array.c b/dll/win32/jscript/array.c index 4fb70a3b76..fcccdd61f3 100644 --- a/dll/win32/jscript/array.c +++ b/dll/win32/jscript/array.c @@ -16,8 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + typedef struct { jsdisp_t dispex; @@ -37,6 +47,7 @@ static const WCHAR spliceW[] = {'s','p','l','i','c','e',0}; static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0}; static const WCHAR unshiftW[] = {'u','n','s','h','i','f','t',0}; +static const WCHAR indexOfW[] = {'i','n','d','e','x','O','f',0}; static const WCHAR default_separatorW[] = {',',0}; @@ -377,9 +388,10 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned hres = jsdisp_get_idx(jsthis, length, &val); if(SUCCEEDED(hres)) hres = jsdisp_delete_idx(jsthis, length); - else if(hres == DISP_E_UNKNOWNNAME) + else if(hres == DISP_E_UNKNOWNNAME) { val = jsval_undefined(); - else + hres = S_OK; + }else return hres; if(SUCCEEDED(hres)) @@ -938,6 +950,61 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag return E_NOTIMPL; } +static HRESULT Array_indexOf(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + jsdisp_t *jsthis; + unsigned length, i, from = 0; + jsval_t search, value; + BOOL eq; + HRESULT hres; + + TRACE("\n"); + + hres = get_length(ctx, vthis, &jsthis, &length); + if(FAILED(hres)) + return hres; + if(!length) { + if(r) *r = jsval_number(-1); + return S_OK; + } + + search = argc ? argv[0] : jsval_undefined(); + + if(argc > 1) { + double from_arg; + + hres = to_integer(ctx, argv[1], &from_arg); + if(FAILED(hres)) + return hres; + + if(from_arg >= 0) + from = min(from_arg, length); + else + from = max(from_arg + length, 0); + } + + for(i = from; i < length; i++) { + hres = jsdisp_get_idx(jsthis, i, &value); + if(hres == DISP_E_UNKNOWNNAME) + continue; + if(FAILED(hres)) + return hres; + + hres = jsval_strict_equal(value, search, &eq); + jsval_release(value); + if(FAILED(hres)) + return hres; + if(eq) { + if(r) *r = jsval_number(i); + return S_OK; + } + } + + if(r) *r = jsval_number(-1); + return S_OK; +} + /* ECMA-262 3rd Edition 15.4.4.13 */ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) @@ -1036,6 +1103,7 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name) static const builtin_prop_t Array_props[] = { {concatW, Array_concat, PROPF_METHOD|1}, + {indexOfW, Array_indexOf, PROPF_ES5|PROPF_METHOD|1}, {joinW, Array_join, PROPF_METHOD|1}, {lengthW, NULL,0, Array_get_length, Array_set_length}, {popW, Array_pop, PROPF_METHOD}, @@ -1072,6 +1140,24 @@ static const builtin_info_t ArrayInst_info = { Array_on_put }; +/* ECMA-262 5.1 Edition 15.4.3.2 */ +static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + jsdisp_t *obj; + + TRACE("\n"); + + if(!argc || !is_object_instance(argv[0])) { + if(r) *r = jsval_bool(FALSE); + return S_OK; + } + + obj = iface_to_jsdisp(get_object(argv[0])); + if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY)); + if(obj) jsdisp_release(obj); + return S_OK; +} + static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { @@ -1146,6 +1232,21 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI return S_OK; } +static const WCHAR isArrayW[] = {'i','s','A','r','r','a','y',0}; + +static const builtin_prop_t ArrayConstr_props[] = { + {isArrayW, ArrayConstr_isArray, PROPF_ES5|PROPF_METHOD|1} +}; + +static const builtin_info_t ArrayConstr_info = { + JSCLASS_FUNCTION, + DEFAULT_FUNCTION_VALUE, + sizeof(ArrayConstr_props)/sizeof(*ArrayConstr_props), + ArrayConstr_props, + NULL, + NULL +}; + HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret) { ArrayInstance *array; @@ -1157,7 +1258,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis if(FAILED(hres)) return hres; - hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR|1, &array->dispex, ret); + hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, &ArrayConstr_info, PROPF_CONSTR|1, &array->dispex, ret); jsdisp_release(&array->dispex); return hres; diff --git a/dll/win32/jscript/bool.c b/dll/win32/jscript/bool.c index f7e8df2fce..75c98c2403 100644 --- a/dll/win32/jscript/bool.c +++ b/dll/win32/jscript/bool.c @@ -17,8 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + typedef struct { jsdisp_t dispex; diff --git a/dll/win32/jscript/cc_parser.tab.c b/dll/win32/jscript/cc_parser.tab.c index 264d0719b7..2e46c11953 100644 --- a/dll/win32/jscript/cc_parser.tab.c +++ b/dll/win32/jscript/cc_parser.tab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison implementation for Yacc-like parsers in C @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -70,15 +70,23 @@ /* Copy the first part of user declarations. */ #line 19 "cc_parser.y" /* yacc.c:339 */ + #include "jscript.h" +#include "engine.h" +#include "parser.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + #line 84 "cc_parser.tab.c" /* yacc.c:339 */ -# ifndef YY_NULLPTR +# ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# define YY_NULL nullptr # else -# define YY_NULLPTR 0 +# define YY_NULL 0 # endif # endif @@ -90,7 +98,10 @@ # define YYERROR_VERBOSE 0 #endif - +/* In a future release of Bison, this section will be replaced + by #include "cc_parser.tab.h". */ +#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED +# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -128,7 +139,7 @@ union YYSTYPE ccval_t ccval; -#line 140 "cc_parser.tab.c" /* yacc.c:355 */ +#line 143 "cc_parser.tab.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -138,7 +149,7 @@ union YYSTYPE int cc_parser_parse (parser_ctx_t *ctx); - +#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 47 "cc_parser.y" /* yacc.c:358 */ @@ -235,7 +246,7 @@ static int cc_parser_lex(void *lval, parser_ctx_t *ctx) } -#line 247 "cc_parser.tab.c" /* yacc.c:358 */ +#line 250 "cc_parser.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -292,30 +303,11 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif @@ -553,7 +545,7 @@ static const char *const yytname[] = "CCBitwiseORExpression", "CCBitwiseXORExpression", "CCBitwiseANDExpression", "CCEqualityExpression", "CCRelationalExpression", "CCShiftExpression", "CCAdditiveExpression", - "CCMultiplicativeExpression", YY_NULLPTR + "CCMultiplicativeExpression", YY_NULL }; #endif @@ -955,11 +947,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1016,7 +1008,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1355,233 +1347,233 @@ yyreduce: case 2: #line 146 "cc_parser.y" /* yacc.c:1646 */ { ctx->ccval = (yyvsp[0].ccval); YYACCEPT; } -#line 1367 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1351 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 3: #line 149 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1373 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1357 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 4: #line 150 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[-1].ccval); } -#line 1379 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1363 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 5: #line 151 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(!get_ccbool((yyvsp[0].ccval))); } -#line 1385 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1369 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 6: #line 152 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'~' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1391 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1375 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 7: #line 153 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'+' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1397 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1381 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 8: #line 154 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'-' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1403 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1387 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 9: #line 157 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1409 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1393 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 10: #line 159 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'||' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1415 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1399 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 11: #line 162 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1421 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1405 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 12: #line 164 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'&&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1427 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1411 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 13: #line 167 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1433 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1417 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 14: #line 169 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'|' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1439 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1423 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 15: #line 172 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1445 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1429 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 16: #line 174 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'^' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1451 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1435 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 17: #line 177 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1457 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1441 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 18: #line 179 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'&' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1463 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1447 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 19: #line 182 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1469 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1453 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 20: #line 184 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) == get_ccnum((yyvsp[0].ccval))); } -#line 1475 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1459 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 21: #line 186 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) != get_ccnum((yyvsp[0].ccval))); } -#line 1481 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1465 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 22: #line 188 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'===' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1487 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1471 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 23: #line 190 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'!==' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1493 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1477 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 24: #line 193 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1499 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1483 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 25: #line 195 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) < get_ccnum((yyvsp[0].ccval))); } -#line 1505 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1489 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 26: #line 197 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) <= get_ccnum((yyvsp[0].ccval))); } -#line 1511 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1495 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 27: #line 199 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) > get_ccnum((yyvsp[0].ccval))); } -#line 1517 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1501 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 28: #line 201 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_bool(get_ccnum((yyvsp[-2].ccval)) >= get_ccnum((yyvsp[0].ccval))); } -#line 1523 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1507 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 29: #line 204 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1529 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1513 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 30: #line 206 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'<<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1535 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1519 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 31: #line 208 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1541 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1525 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 32: #line 210 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'>>>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1547 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1531 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 33: #line 213 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1553 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1537 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 34: #line 215 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) + get_ccnum((yyvsp[0].ccval))); } -#line 1559 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1543 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 35: #line 217 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) - get_ccnum((yyvsp[0].ccval))); } -#line 1565 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1549 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 36: #line 220 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = (yyvsp[0].ccval); } -#line 1571 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1555 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 37: #line 222 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) * get_ccnum((yyvsp[0].ccval))); } -#line 1577 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1561 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 38: #line 224 "cc_parser.y" /* yacc.c:1646 */ { (yyval.ccval) = ccval_num(get_ccnum((yyvsp[-2].ccval)) / get_ccnum((yyvsp[0].ccval))); } -#line 1583 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1567 "cc_parser.tab.c" /* yacc.c:1646 */ break; case 39: #line 226 "cc_parser.y" /* yacc.c:1646 */ { FIXME("'%%' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } -#line 1589 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1573 "cc_parser.tab.c" /* yacc.c:1646 */ break; -#line 1593 "cc_parser.tab.c" /* yacc.c:1646 */ +#line 1577 "cc_parser.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/dll/win32/jscript/cc_parser.tab.h b/dll/win32/jscript/cc_parser.tab.h new file mode 100644 index 0000000000..275e13edfa --- /dev/null +++ b/dll/win32/jscript/cc_parser.tab.h @@ -0,0 +1,82 @@ +/* A Bison parser, made by GNU Bison 3.0. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <
http://www.gnu.org/licenses/
>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED +# define YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cc_parser_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + tEQ = 258, + tEQEQ = 259, + tNEQ = 260, + tNEQEQ = 261, + tLSHIFT = 262, + tRSHIFT = 263, + tRRSHIFT = 264, + tOR = 265, + tAND = 266, + tLEQ = 267, + tGEQ = 268, + tCCValue = 269 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE YYSTYPE; +union YYSTYPE +{ +#line 36 "cc_parser.y" /* yacc.c:1909 */ + + ccval_t ccval; + +#line 73 "cc_parser.tab.h" /* yacc.c:1909 */ +}; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int cc_parser_parse (parser_ctx_t *ctx); + +#endif /* !YY_CC_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_CC_PARSER_TAB_H_INCLUDED */ diff --git a/dll/win32/jscript/cc_parser.y b/dll/win32/jscript/cc_parser.y index d06ba7c703..18c1cb1c38 100644 --- a/dll/win32/jscript/cc_parser.y +++ b/dll/win32/jscript/cc_parser.y @@ -19,6 +19,12 @@ %{ #include "jscript.h" +#include "engine.h" +#include "parser.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); %} diff --git a/dll/win32/jscript/compile.c b/dll/win32/jscript/compile.c index b9dff8fe30..6e6be9135f 100644 --- a/dll/win32/jscript/compile.c +++ b/dll/win32/jscript/compile.c @@ -16,10 +16,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "engine.h" +#include "parser.h" -#include <wine/rbtree.h> +#include "wine/rbtree.h" +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(jscript); WINE_DECLARE_DEBUG_CHANNEL(jscript_disas); typedef struct _statement_ctx_t { @@ -854,29 +861,29 @@ static HRESULT literal_as_bstr(compiler_ctx_t *ctx, literal_t *literal, BSTR *st static HRESULT compile_array_literal(compiler_ctx_t *ctx, array_literal_expression_t *expr) { - unsigned i, elem_cnt = expr->length; + unsigned length = 0; array_element_t *iter; + unsigned array_instr; HRESULT hres; - for(iter = expr->element_list; iter; iter = iter->next) { - elem_cnt += iter->elision+1; + array_instr = push_instr(ctx, OP_carray); - for(i=0; i < iter->elision; i++) { - if(!push_instr(ctx, OP_undefined)) - return E_OUTOFMEMORY; - } + for(iter = expr->element_list; iter; iter = iter->next) { + length += iter->elision; hres = compile_expression(ctx, iter->expr, TRUE); if(FAILED(hres)) return hres; - } - for(i=0; i < expr->length; i++) { - if(!push_instr(ctx, OP_undefined)) - return E_OUTOFMEMORY; + hres = push_instr_uint(ctx, OP_carray_set, length); + if(FAILED(hres)) + return hres; + + length++; } - return push_instr_uint(ctx, OP_carray, elem_cnt); + instr_ptr(ctx, array_instr)->u.arg[0].uint = length + expr->length; + return S_OK; } static HRESULT compile_object_literal(compiler_ctx_t *ctx, property_value_expression_t *expr) diff --git a/dll/win32/jscript/date.c b/dll/win32/jscript/date.c index fb81dd4606..f784d51afb 100644 --- a/dll/win32/jscript/date.c +++ b/dll/win32/jscript/date.c @@ -17,8 +17,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <limits.h> +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + /* 1601 to 1970 is 369 years plus 89 leap days */ #define TIME_EPOCH ((ULONGLONG)(369 * 365 + 89) * 86400 * 1000) @@ -81,6 +92,7 @@ static const WCHAR getYearW[] = {'g','e','t','Y','e','a','r',0}; static const WCHAR setYearW[] = {'s','e','t','Y','e','a','r',0}; static const WCHAR UTCW[] = {'U','T','C',0}; +static const WCHAR nowW[] = {'n','o','w',0}; static const WCHAR parseW[] = {'p','a','r','s','e',0}; static inline DateInstance *date_from_jsdisp(jsdisp_t *jsdisp) @@ -441,6 +453,17 @@ static inline DOUBLE time_clip(DOUBLE time) return floor(time); } +static double date_now(void) +{ + FILETIME ftime; + LONGLONG time; + + GetSystemTimeAsFileTime(&ftime); + time = ((LONGLONG)ftime.dwHighDateTime << 32) + ftime.dwLowDateTime; + + return time/10000 - TIME_EPOCH; +} + static SYSTEMTIME create_systemtime(DOUBLE time) { SYSTEMTIME st; @@ -2350,6 +2373,15 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un return hres; } +/* ECMA-262 5.1 Edition 15.9.4.4 */ +static HRESULT DateConstr_now(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + TRACE("\n"); + + if(r) *r = jsval_number(date_now()); + return S_OK; +} + static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { @@ -2362,19 +2394,11 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, case DISPATCH_CONSTRUCT: switch(argc) { /* ECMA-262 3rd Edition 15.9.3.3 */ - case 0: { - FILETIME time; - LONGLONG lltime; - - GetSystemTimeAsFileTime(&time); - lltime = ((LONGLONG)time.dwHighDateTime<<32) - + time.dwLowDateTime; - - hres = create_date(ctx, NULL, lltime/10000-TIME_EPOCH, &date); + case 0: + hres = create_date(ctx, NULL, date_now(), &date); if(FAILED(hres)) return hres; break; - } /* ECMA-262 3rd Edition 15.9.3.2 */ case 1: { @@ -2443,6 +2467,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, static const builtin_prop_t DateConstr_props[] = { {UTCW, DateConstr_UTC, PROPF_METHOD}, + {nowW, DateConstr_now, PROPF_HTML|PROPF_METHOD}, {parseW, DateConstr_parse, PROPF_METHOD} }; diff --git a/dll/win32/jscript/decode.c b/dll/win32/jscript/decode.c index 1799b91864..d402d7c961 100644 --- a/dll/win32/jscript/decode.c +++ b/dll/win32/jscript/decode.c @@ -18,6 +18,10 @@ #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + /* * This file implements algorithm for decoding scripts encoded by * screnc.exe. The 'secret' algorithm that's well documented here: diff --git a/dll/win32/jscript/dispex.c b/dll/win32/jscript/dispex.c index 8bc03d1662..ffb351e2ac 100644 --- a/dll/win32/jscript/dispex.c +++ b/dll/win32/jscript/dispex.c @@ -16,8 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + #define FDEX_VERSION_MASK 0xf0000000 #define GOLDEN_RATIO 0x9E3779B9U @@ -83,8 +90,19 @@ static const builtin_prop_t *find_builtin_prop(jsdisp_t *This, const WCHAR *name i = (min+max)/2; r = strcmpW(name, This->builtin_info->props[i].name); - if(!r) + if(!r) { + /* Skip prop if it's available only in higher compatibility mode. */ + unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK) + >> PROPF_VERSION_SHIFT; + if(version && version > This->ctx->version) + return NULL; + + /* Skip prop if it's available only in HTML mode and we're not running in HTML mode. */ + if((This->builtin_info->props[i].flags & PROPF_HTML) && !This->ctx->html_mode) + return NULL; + return This->builtin_info->props + i; + } if(r < 0) max = i-1; diff --git a/dll/win32/jscript/engine.c b/dll/win32/jscript/engine.c index 16fe6aaeae..d41afa5c3b 100644 --- a/dll/win32/jscript/engine.c +++ b/dll/win32/jscript/engine.c @@ -16,7 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "engine.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0}; static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0}; @@ -514,7 +525,7 @@ static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret) } /* ECMA-262 3rd Edition 11.9.6 */ -static HRESULT equal2_values(jsval_t lval, jsval_t rval, BOOL *ret) +HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret) { jsval_type_t type = jsval_type(lval); @@ -843,7 +854,7 @@ static HRESULT interp_case(script_ctx_t *ctx) TRACE("\n"); v = stack_pop(ctx); - hres = equal2_values(stack_top(ctx), v, &b); + hres = jsval_strict_equal(stack_top(ctx), v, &b); jsval_release(v); if(FAILED(hres)) return hres; @@ -1290,7 +1301,7 @@ static HRESULT interp_local(script_ctx_t *ctx) jsval_t copy; HRESULT hres; - TRACE("%d\n", arg); + TRACE("%d: %s\n", arg, debugstr_w(local_name(frame, arg))); if(!frame->base_scope || !frame->base_scope->frame) return identifier_value(ctx, local_name(frame, arg)); @@ -1393,8 +1404,6 @@ static HRESULT interp_carray(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); jsdisp_t *array; - jsval_t val; - unsigned i; HRESULT hres; TRACE("%u\n", arg); @@ -1403,20 +1412,27 @@ static HRESULT interp_carray(script_ctx_t *ctx) if(FAILED(hres)) return hres; - i = arg; - while(i--) { - val = stack_pop(ctx); - hres = jsdisp_propput_idx(array, i, val); - jsval_release(val); - if(FAILED(hres)) { - jsdisp_release(array); - return hres; - } - } - return stack_push(ctx, jsval_obj(array)); } +static HRESULT interp_carray_set(script_ctx_t *ctx) +{ + const unsigned index = get_op_uint(ctx, 0); + jsval_t value, array; + HRESULT hres; + + value = stack_pop(ctx); + + TRACE("[%u] = %s\n", index, debugstr_jsval(value)); + + array = stack_top(ctx); + assert(is_object_instance(array)); + + hres = jsdisp_propput_idx(iface_to_jsdisp(get_object(array)), index, value); + jsval_release(value); + return hres; +} + /* ECMA-262 3rd Edition 11.1.5 */ static HRESULT interp_new_obj(script_ctx_t *ctx) { @@ -2092,7 +2108,7 @@ static HRESULT interp_preinc(script_ctx_t *ctx) static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL *ret) { if(jsval_type(lval) == jsval_type(rval) || (is_number(lval) && is_number(rval))) - return equal2_values(lval, rval, ret); + return jsval_strict_equal(lval, rval, ret); /* FIXME: NULL disps should be handled in more general way */ if(is_object_instance(lval) && !get_object(lval)) @@ -2222,7 +2238,7 @@ static HRESULT interp_eq2(script_ctx_t *ctx) TRACE("%s === %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = equal2_values(r, l, &b); + hres = jsval_strict_equal(r, l, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2243,7 +2259,7 @@ static HRESULT interp_neq2(script_ctx_t *ctx) r = stack_pop(ctx); l = stack_pop(ctx); - hres = equal2_values(r, l, &b); + hres = jsval_strict_equal(r, l, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) diff --git a/dll/win32/jscript/engine.h b/dll/win32/jscript/engine.h index ce4c326730..6d40e30905 100644 --- a/dll/win32/jscript/engine.h +++ b/dll/win32/jscript/engine.h @@ -23,12 +23,13 @@ X(and, 1, 0,0) \ X(array, 1, 0,0) \ X(assign, 1, 0,0) \ - X(assign_call,1, ARG_UINT, 0) \ + X(assign_call,1, ARG_UINT, 0) \ X(bool, 1, ARG_INT, 0) \ X(bneg, 1, 0,0) \ X(call, 1, ARG_UINT, ARG_UINT) \ X(call_member,1, ARG_UINT, ARG_UINT) \ X(carray, 1, ARG_UINT, 0) \ + X(carray_set, 1, ARG_UINT, 0) \ X(case, 0, ARG_ADDR, 0) \ X(cnd_nz, 0, ARG_ADDR, 0) \ X(cnd_z, 0, ARG_ADDR, 0) \ diff --git a/dll/win32/jscript/error.c b/dll/win32/jscript/error.c index 835f06e77d..b855b8798b 100644 --- a/dll/win32/jscript/error.c +++ b/dll/win32/jscript/error.c @@ -16,8 +16,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + static const WCHAR descriptionW[] = {'d','e','s','c','r','i','p','t','i','o','n',0}; static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0}; static const WCHAR nameW[] = {'n','a','m','e',0}; diff --git a/dll/win32/jscript/function.c b/dll/win32/jscript/function.c index c1456c24c9..8480a3bf1a 100644 --- a/dll/win32/jscript/function.c +++ b/dll/win32/jscript/function.c @@ -16,7 +16,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "engine.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); typedef struct { jsdisp_t dispex; diff --git a/dll/win32/jscript/global.c b/dll/win32/jscript/global.c index 4ac33b3cd0..6cd5ee9f6a 100644 --- a/dll/win32/jscript/global.c +++ b/dll/win32/jscript/global.c @@ -16,8 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> +#include <limits.h> + #include "jscript.h" +#include "engine.h" + +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static const WCHAR NaNW[] = {'N','a','N',0}; static const WCHAR InfinityW[] = {'I','n','f','i','n','i','t','y',0}; diff --git a/dll/win32/jscript/jscript.c b/dll/win32/jscript/jscript.c index 9e8b3cb29c..15d81d2c53 100644 --- a/dll/win32/jscript/jscript.c +++ b/dll/win32/jscript/jscript.c @@ -16,7 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "engine.h" +#include "objsafe.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); #ifdef _WIN64 @@ -47,6 +55,7 @@ typedef struct { LONG thread_id; LCID lcid; DWORD version; + BOOL html_mode; BOOL is_encode; IActiveScriptSite *site; @@ -704,6 +713,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface) ctx->active_script = &This->IActiveScript_iface; ctx->safeopt = This->safeopt; ctx->version = This->version; + ctx->html_mode = This->html_mode; ctx->ei.val = jsval_undefined(); heap_pool_init(&ctx->tmp_heap); @@ -912,12 +922,14 @@ static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface, switch(dwProperty) { case SCRIPTPROP_INVOKEVERSIONING: - if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0 || V_I4(pvarValue) > 15) { + if(V_VT(pvarValue) != VT_I4 || V_I4(pvarValue) < 0 + || (V_I4(pvarValue) > 15 && !(V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML))) { WARN("invalid value %s\n", debugstr_variant(pvarValue)); return E_INVALIDARG; } - This->version = V_I4(pvarValue); + This->version = V_I4(pvarValue) & 0x1ff; + This->html_mode = (V_I4(pvarValue) & SCRIPTLANGUAGEVERSION_HTML) != 0; break; default: FIXME("Unimplemented property %x\n", dwProperty); diff --git a/dll/win32/jscript/jscript.h b/dll/win32/jscript/jscript.h index 1a5101917b..6f06062a8b 100644 --- a/dll/win32/jscript/jscript.h +++ b/dll/win32/jscript/jscript.h @@ -16,36 +16,37 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef _WINE_JSCRIPT_H -#define _WINE_JSCRIPT_H +#pragma once -#include <wine/config.h> -#include <wine/port.h> - -#include <assert.h> #include <stdarg.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H +#include <stdio.h> #define COBJMACROS -#include <windef.h> -#include <winbase.h> -#include <objbase.h> -#include <oleauto.h> -#include <dispex.h> -#include <activscp.h> -#include <objsafe.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "dispex.h" +#include "activscp.h" -#include <wine/debug.h> -#include <wine/list.h> -#include <wine/unicode.h> +#include "resource.h" -WINE_DEFAULT_DEBUG_CHANNEL(jscript); +#include "wine/unicode.h" +#include "wine/heap.h" +#include "wine/list.h" -#include "resource.h" +/* + * This is Wine jscript extension for ES5 compatible mode. Native IE9+ implements + * a separated JavaScript enging in side MSHTML. We implement its features here + * and enable it when HTML flag is specified in SCRIPTPROP_INVOKEVERSIONING property. + */ +#define SCRIPTLANGUAGEVERSION_HTML 0x400 + +/* + * This is Wine jscript extension for ES5 compatible mode. Allowed only in HTML mode. + */ +#define SCRIPTLANGUAGEVERSION_ES5 0x102 typedef struct _jsval_t jsval_t; typedef struct _jsstr_t jsstr_t; @@ -68,26 +69,6 @@ void heap_pool_clear(heap_pool_t*) DECLSPEC_HIDDEN; void heap_pool_free(heap_pool_t*) DECLSPEC_HIDDEN; heap_pool_t *heap_pool_mark(heap_pool_t*) DECLSPEC_HIDDEN; -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); -} - -static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size) -{ - return HeapReAlloc(GetProcessHeap(), 0, mem, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline LPWSTR heap_strdupW(LPCWSTR str) { LPWSTR ret = NULL; @@ -115,6 +96,11 @@ extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN; #define PROPF_CONST 0x0800 #define PROPF_DONTDELETE 0x1000 +#define PROPF_VERSION_MASK 0x01ff0000 +#define PROPF_VERSION_SHIFT 16 +#define PROPF_HTML (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT) +#define PROPF_ES5 ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT) + /* * This is our internal dispatch flag informing calee that it's called directly from interpreter. * If calee is executed as interpreted function, we may let already running interpreter to take @@ -357,6 +343,8 @@ HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN; HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN; HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN; +HRESULT jsval_strict_equal(jsval_t,jsval_t,BOOL*) DECLSPEC_HIDDEN; + HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN; HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN; @@ -412,6 +400,7 @@ struct _script_ctx_t { IInternetHostSecurityManager *secmgr; DWORD safeopt; DWORD version; + BOOL html_mode; LCID lcid; cc_ctx_t *cc; JSCaller *jscaller; @@ -516,7 +505,7 @@ static inline BOOL is_int32(double d) static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags) { - return (ctx->version << 28) | flags; + return ((ctx->version & 0xff) << 28) | flags; } #define FACILITY_JSCRIPT 10 @@ -585,9 +574,3 @@ static inline void unlock_module(void) { InterlockedDecrement(&module_ref); } - -#include "engine.h" -#include "parser.h" -#include "regexp.h" - -#endif /* _WINE_JSCRIPT_H */ diff --git a/dll/win32/jscript/jscript_main.c b/dll/win32/jscript/jscript_main.c index 03f1f56465..9f9f4121f7 100644 --- a/dll/win32/jscript/jscript_main.c +++ b/dll/win32/jscript/jscript_main.c @@ -16,14 +16,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "initguid.h" + #include "jscript.h" -#include <rpcproxy.h> -#include <initguid.h> -#include <jscript_classes.h> +#include "winreg.h" +#include "advpub.h" +#include "activaut.h" +#include "objsafe.h" +#include "mshtmhst.h" +#include "rpcproxy.h" +#include "jscript_classes.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); LONG module_ref = 0; +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + HINSTANCE jscript_hinstance; static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) diff --git a/dll/win32/jscript/json.c b/dll/win32/jscript/json.c index fd1e471eee..fc23b54c0d 100644 --- a/dll/win32/jscript/json.c +++ b/dll/win32/jscript/json.c @@ -16,7 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "parser.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static const WCHAR parseW[] = {'p','a','r','s','e',0}; static const WCHAR stringifyW[] = {'s','t','r','i','n','g','i','f','y',0}; @@ -536,15 +545,18 @@ static HRESULT stringify_array(stringify_ctx_t *ctx, jsdisp_t *obj) } hres = jsdisp_get_idx(obj, i, &val); - if(FAILED(hres)) - return hres; - - hres = stringify(ctx, val); - if(FAILED(hres)) + if(SUCCEEDED(hres)) { + hres = stringify(ctx, val); + if(FAILED(hres)) + return hres; + if(hres == S_FALSE && !append_string(ctx, nullW)) + return E_OUTOFMEMORY; + }else if(hres == DISP_E_UNKNOWNNAME) { + if(!append_string(ctx, nullW)) + return E_OUTOFMEMORY; + }else { return hres; - - if(hres == S_FALSE && !append_string(ctx, nullW)) - return E_OUTOFMEMORY; + } } if((length && *ctx->gap && !append_char(ctx, '\n')) || !append_char(ctx, ']')) diff --git a/dll/win32/jscript/jsregexp.c b/dll/win32/jscript/jsregexp.c index 6615005404..5798635cb8 100644 --- a/dll/win32/jscript/jsregexp.c +++ b/dll/win32/jscript/jsregexp.c @@ -16,7 +16,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <math.h> + #include "jscript.h" +#include "regexp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); typedef struct { jsdisp_t dispex; diff --git a/dll/win32/jscript/jsstr.c b/dll/win32/jscript/jsstr.c index 6eb7dea34a..6a39c4c3dc 100644 --- a/dll/win32/jscript/jsstr.c +++ b/dll/win32/jscript/jsstr.c @@ -16,8 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + /* * This is the length of a string that is considered to be long enough to be * worth the rope to avoid copy. diff --git a/dll/win32/jscript/jsutils.c b/dll/win32/jscript/jsutils.c index fb691afe8d..4556ec45a3 100644 --- a/dll/win32/jscript/jsutils.c +++ b/dll/win32/jscript/jsutils.c @@ -16,8 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "engine.h" + +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(jscript); WINE_DECLARE_DEBUG_CHANNEL(heap); const char *debugstr_jsval(const jsval_t v) diff --git a/dll/win32/jscript/jsval.h b/dll/win32/jscript/jsval.h index 1121425373..963f59f6a0 100644 --- a/dll/win32/jscript/jsval.h +++ b/dll/win32/jscript/jsval.h @@ -246,4 +246,4 @@ HRESULT jsval_to_variant(jsval_t,VARIANT*) DECLSPEC_HIDDEN; void jsval_release(jsval_t) DECLSPEC_HIDDEN; HRESULT jsval_copy(jsval_t,jsval_t*) DECLSPEC_HIDDEN; -#endif /* JSVAL_H */ +#endif diff --git a/dll/win32/jscript/lex.c b/dll/win32/jscript/lex.c index 2471aaa40d..352395865f 100644 --- a/dll/win32/jscript/lex.c +++ b/dll/win32/jscript/lex.c @@ -16,10 +16,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <limits.h> + #include "jscript.h" +#include "activscp.h" +#include "objsafe.h" +#include "engine.h" +#include "parser.h" #include "parser.tab.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + static const WCHAR breakW[] = {'b','r','e','a','k',0}; static const WCHAR caseW[] = {'c','a','s','e',0}; static const WCHAR catchW[] = {'c','a','t','c','h',0}; diff --git a/dll/win32/jscript/math.c b/dll/win32/jscript/math.c index 77c2062380..ef906f5439 100644 --- a/dll/win32/jscript/math.c +++ b/dll/win32/jscript/math.c @@ -17,9 +17,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + +#include <math.h> +#include <limits.h> + #include "jscript.h" +#include "ntsecapi.h" + +#include "wine/debug.h" -#include <ntsecapi.h> +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static const WCHAR EW[] = {'E',0}; static const WCHAR LOG2EW[] = {'L','O','G','2','E',0}; diff --git a/dll/win32/jscript/number.c b/dll/win32/jscript/number.c index 94ec171785..94c8cc4e07 100644 --- a/dll/win32/jscript/number.c +++ b/dll/win32/jscript/number.c @@ -16,8 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <math.h> +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + typedef struct { jsdisp_t dispex; diff --git a/dll/win32/jscript/object.c b/dll/win32/jscript/object.c index 9a02618d5d..de09060e8a 100644 --- a/dll/win32/jscript/object.c +++ b/dll/win32/jscript/object.c @@ -16,8 +16,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <assert.h> + #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0}; static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0}; diff --git a/dll/win32/jscript/parser.tab.c b/dll/win32/jscript/parser.tab.c index 798cd1df55..d72f750ba0 100644 --- a/dll/win32/jscript/parser.tab.c +++ b/dll/win32/jscript/parser.tab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison implementation for Yacc-like parsers in C @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -72,6 +72,12 @@ #include "jscript.h" +#include "engine.h" +#include "parser.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static int parser_error(parser_ctx_t*,const char*); static void set_error(parser_ctx_t*,UINT); @@ -185,11 +191,11 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state #line 193 "parser.tab.c" /* yacc.c:339 */ -# ifndef YY_NULLPTR +# ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# define YY_NULL nullptr # else -# define YY_NULLPTR 0 +# define YY_NULL 0 # endif # endif @@ -201,7 +207,10 @@ static source_elements_t *source_elements_add_statement(source_elements_t*,state # define YYERROR_VERBOSE 0 #endif - +/* In a future release of Bison, this section will be replaced + by #include "parser.tab.h". */ +#ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED +# define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -289,7 +298,7 @@ union YYSTYPE struct _variable_list_t *variable_list; variable_declaration_t *variable_declaration; -#line 299 "parser.tab.c" /* yacc.c:355 */ +#line 302 "parser.tab.c" /* yacc.c:355 */ }; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -299,11 +308,11 @@ union YYSTYPE int parser_parse (parser_ctx_t *ctx); - +#endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED */ /* Copy the second part of user declarations. */ -#line 313 "parser.tab.c" /* yacc.c:358 */ +#line 316 "parser.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -360,30 +369,11 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif @@ -673,7 +663,7 @@ static const char *const yytname[] = "ArrayLiteral", "ElementList", "Elision", "Elision_opt", "ObjectLiteral", "PropertyNameAndValueList", "PropertyName", "Identifier_opt", "Literal", "BooleanLiteral", "semicolon_opt", "left_bracket", "right_bracket", - "semicolon", YY_NULLPTR + "semicolon", YY_NULL }; #endif @@ -1433,11 +1423,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1494,7 +1484,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1833,1279 +1823,1279 @@ yyreduce: case 2: #line 253 "parser.y" /* yacc.c:1646 */ { program_parsed(ctx, (yyvsp[-2].source_elements)); } -#line 1843 "parser.tab.c" /* yacc.c:1646 */ +#line 1827 "parser.tab.c" /* yacc.c:1646 */ break; case 3: #line 256 "parser.y" /* yacc.c:1646 */ {} -#line 1849 "parser.tab.c" /* yacc.c:1646 */ +#line 1833 "parser.tab.c" /* yacc.c:1646 */ break; case 4: #line 257 "parser.y" /* yacc.c:1646 */ {} -#line 1855 "parser.tab.c" /* yacc.c:1646 */ +#line 1839 "parser.tab.c" /* yacc.c:1646 */ break; case 5: #line 261 "parser.y" /* yacc.c:1646 */ { (yyval.source_elements) = new_source_elements(ctx); } -#line 1861 "parser.tab.c" /* yacc.c:1646 */ +#line 1845 "parser.tab.c" /* yacc.c:1646 */ break; case 6: #line 263 "parser.y" /* yacc.c:1646 */ { (yyval.source_elements) = source_elements_add_statement((yyvsp[-1].source_elements), (yyvsp[0].statement)); } -#line 1867 "parser.tab.c" /* yacc.c:1646 */ +#line 1851 "parser.tab.c" /* yacc.c:1646 */ break; case 7: #line 268 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_function_expression(ctx, NULL, (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), NULL, (yyvsp[-6].srcptr), (yyvsp[0].srcptr)-(yyvsp[-6].srcptr)+1); } -#line 1873 "parser.tab.c" /* yacc.c:1646 */ +#line 1857 "parser.tab.c" /* yacc.c:1646 */ break; case 8: #line 270 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_function_expression(ctx, (yyvsp[-6].identifier), (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), NULL, (yyvsp[-7].srcptr), (yyvsp[0].srcptr)-(yyvsp[-7].srcptr)+1); } -#line 1879 "parser.tab.c" /* yacc.c:1646 */ +#line 1863 "parser.tab.c" /* yacc.c:1646 */ break; case 9: #line 272 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_function_expression(ctx, (yyvsp[-6].identifier), (yyvsp[-4].parameter_list), (yyvsp[-1].source_elements), (yyvsp[-8].identifier), (yyvsp[-9].srcptr), (yyvsp[0].srcptr)-(yyvsp[-9].srcptr)+1); } -#line 1885 "parser.tab.c" /* yacc.c:1646 */ +#line 1869 "parser.tab.c" /* yacc.c:1646 */ break; case 10: #line 275 "parser.y" /* yacc.c:1646 */ { (yyval.srcptr) = (yyvsp[0].srcptr); } -#line 1891 "parser.tab.c" /* yacc.c:1646 */ +#line 1875 "parser.tab.c" /* yacc.c:1646 */ break; case 11: #line 279 "parser.y" /* yacc.c:1646 */ { (yyval.source_elements) = (yyvsp[0].source_elements); } -#line 1897 "parser.tab.c" /* yacc.c:1646 */ +#line 1881 "parser.tab.c" /* yacc.c:1646 */ break; case 12: #line 283 "parser.y" /* yacc.c:1646 */ { (yyval.parameter_list) = new_parameter_list(ctx, (yyvsp[0].identifier)); } -#line 1903 "parser.tab.c" /* yacc.c:1646 */ +#line 1887 "parser.tab.c" /* yacc.c:1646 */ break; case 13: #line 285 "parser.y" /* yacc.c:1646 */ { (yyval.parameter_list) = parameter_list_add(ctx, (yyvsp[-2].parameter_list), (yyvsp[0].identifier)); } -#line 1909 "parser.tab.c" /* yacc.c:1646 */ +#line 1893 "parser.tab.c" /* yacc.c:1646 */ break; case 14: #line 289 "parser.y" /* yacc.c:1646 */ { (yyval.parameter_list) = NULL; } -#line 1915 "parser.tab.c" /* yacc.c:1646 */ +#line 1899 "parser.tab.c" /* yacc.c:1646 */ break; case 15: #line 290 "parser.y" /* yacc.c:1646 */ { (yyval.parameter_list) = (yyvsp[0].parameter_list); } -#line 1921 "parser.tab.c" /* yacc.c:1646 */ +#line 1905 "parser.tab.c" /* yacc.c:1646 */ break; case 16: #line 294 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1927 "parser.tab.c" /* yacc.c:1646 */ +#line 1911 "parser.tab.c" /* yacc.c:1646 */ break; case 17: #line 295 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1933 "parser.tab.c" /* yacc.c:1646 */ +#line 1917 "parser.tab.c" /* yacc.c:1646 */ break; case 18: #line 296 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1939 "parser.tab.c" /* yacc.c:1646 */ +#line 1923 "parser.tab.c" /* yacc.c:1646 */ break; case 19: #line 297 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_expression_statement(ctx, (yyvsp[0].expr)); } -#line 1945 "parser.tab.c" /* yacc.c:1646 */ +#line 1929 "parser.tab.c" /* yacc.c:1646 */ break; case 20: #line 298 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1951 "parser.tab.c" /* yacc.c:1646 */ +#line 1935 "parser.tab.c" /* yacc.c:1646 */ break; case 21: #line 299 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1957 "parser.tab.c" /* yacc.c:1646 */ +#line 1941 "parser.tab.c" /* yacc.c:1646 */ break; case 22: #line 300 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1963 "parser.tab.c" /* yacc.c:1646 */ +#line 1947 "parser.tab.c" /* yacc.c:1646 */ break; case 23: #line 301 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1969 "parser.tab.c" /* yacc.c:1646 */ +#line 1953 "parser.tab.c" /* yacc.c:1646 */ break; case 24: #line 302 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1975 "parser.tab.c" /* yacc.c:1646 */ +#line 1959 "parser.tab.c" /* yacc.c:1646 */ break; case 25: #line 303 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1981 "parser.tab.c" /* yacc.c:1646 */ +#line 1965 "parser.tab.c" /* yacc.c:1646 */ break; case 26: #line 304 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1987 "parser.tab.c" /* yacc.c:1646 */ +#line 1971 "parser.tab.c" /* yacc.c:1646 */ break; case 27: #line 305 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1993 "parser.tab.c" /* yacc.c:1646 */ +#line 1977 "parser.tab.c" /* yacc.c:1646 */ break; case 28: #line 306 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 1999 "parser.tab.c" /* yacc.c:1646 */ +#line 1983 "parser.tab.c" /* yacc.c:1646 */ break; case 29: #line 307 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 2005 "parser.tab.c" /* yacc.c:1646 */ +#line 1989 "parser.tab.c" /* yacc.c:1646 */ break; case 30: #line 308 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 2011 "parser.tab.c" /* yacc.c:1646 */ +#line 1995 "parser.tab.c" /* yacc.c:1646 */ break; case 31: #line 312 "parser.y" /* yacc.c:1646 */ { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[0].statement)); } -#line 2017 "parser.tab.c" /* yacc.c:1646 */ +#line 2001 "parser.tab.c" /* yacc.c:1646 */ break; case 32: #line 314 "parser.y" /* yacc.c:1646 */ { (yyval.statement_list) = statement_list_add((yyvsp[-1].statement_list), (yyvsp[0].statement)); } -#line 2023 "parser.tab.c" /* yacc.c:1646 */ +#line 2007 "parser.tab.c" /* yacc.c:1646 */ break; case 33: #line 318 "parser.y" /* yacc.c:1646 */ { (yyval.statement_list) = NULL; } -#line 2029 "parser.tab.c" /* yacc.c:1646 */ +#line 2013 "parser.tab.c" /* yacc.c:1646 */ break; case 34: #line 319 "parser.y" /* yacc.c:1646 */ { (yyval.statement_list) = (yyvsp[0].statement_list); } -#line 2035 "parser.tab.c" /* yacc.c:1646 */ +#line 2019 "parser.tab.c" /* yacc.c:1646 */ break; case 35: #line 323 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_block_statement(ctx, (yyvsp[-1].statement_list)); } -#line 2041 "parser.tab.c" /* yacc.c:1646 */ +#line 2025 "parser.tab.c" /* yacc.c:1646 */ break; case 36: #line 324 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_block_statement(ctx, NULL); } -#line 2047 "parser.tab.c" /* yacc.c:1646 */ +#line 2031 "parser.tab.c" /* yacc.c:1646 */ break; case 37: #line 329 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_var_statement(ctx, (yyvsp[-1].variable_list)); } -#line 2053 "parser.tab.c" /* yacc.c:1646 */ +#line 2037 "parser.tab.c" /* yacc.c:1646 */ break; case 38: #line 333 "parser.y" /* yacc.c:1646 */ { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); } -#line 2059 "parser.tab.c" /* yacc.c:1646 */ +#line 2043 "parser.tab.c" /* yacc.c:1646 */ break; case 39: #line 335 "parser.y" /* yacc.c:1646 */ { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); } -#line 2065 "parser.tab.c" /* yacc.c:1646 */ +#line 2049 "parser.tab.c" /* yacc.c:1646 */ break; case 40: #line 340 "parser.y" /* yacc.c:1646 */ { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[0].variable_declaration)); } -#line 2071 "parser.tab.c" /* yacc.c:1646 */ +#line 2055 "parser.tab.c" /* yacc.c:1646 */ break; case 41: #line 342 "parser.y" /* yacc.c:1646 */ { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[-2].variable_list), (yyvsp[0].variable_declaration)); } -#line 2077 "parser.tab.c" /* yacc.c:1646 */ +#line 2061 "parser.tab.c" /* yacc.c:1646 */ break; case 42: #line 347 "parser.y" /* yacc.c:1646 */ { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); } -#line 2083 "parser.tab.c" /* yacc.c:1646 */ +#line 2067 "parser.tab.c" /* yacc.c:1646 */ break; case 43: #line 352 "parser.y" /* yacc.c:1646 */ { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[-1].identifier), (yyvsp[0].expr)); } -#line 2089 "parser.tab.c" /* yacc.c:1646 */ +#line 2073 "parser.tab.c" /* yacc.c:1646 */ break; case 44: #line 356 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } -#line 2095 "parser.tab.c" /* yacc.c:1646 */ +#line 2079 "parser.tab.c" /* yacc.c:1646 */ break; case 45: #line 357 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2101 "parser.tab.c" /* yacc.c:1646 */ +#line 2085 "parser.tab.c" /* yacc.c:1646 */ break; case 46: #line 362 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2107 "parser.tab.c" /* yacc.c:1646 */ +#line 2091 "parser.tab.c" /* yacc.c:1646 */ break; case 47: #line 366 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } -#line 2113 "parser.tab.c" /* yacc.c:1646 */ +#line 2097 "parser.tab.c" /* yacc.c:1646 */ break; case 48: #line 367 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2119 "parser.tab.c" /* yacc.c:1646 */ +#line 2103 "parser.tab.c" /* yacc.c:1646 */ break; case 49: #line 372 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2125 "parser.tab.c" /* yacc.c:1646 */ +#line 2109 "parser.tab.c" /* yacc.c:1646 */ break; case 50: #line 376 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_statement(ctx, STAT_EMPTY, 0); } -#line 2131 "parser.tab.c" /* yacc.c:1646 */ +#line 2115 "parser.tab.c" /* yacc.c:1646 */ break; case 51: #line 381 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_expression_statement(ctx, (yyvsp[-1].expr)); } -#line 2137 "parser.tab.c" /* yacc.c:1646 */ +#line 2121 "parser.tab.c" /* yacc.c:1646 */ break; case 52: #line 386 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_if_statement(ctx, (yyvsp[-4].expr), (yyvsp[-2].statement), (yyvsp[0].statement)); } -#line 2143 "parser.tab.c" /* yacc.c:1646 */ +#line 2127 "parser.tab.c" /* yacc.c:1646 */ break; case 53: #line 388 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_if_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement), NULL); } -#line 2149 "parser.tab.c" /* yacc.c:1646 */ +#line 2133 "parser.tab.c" /* yacc.c:1646 */ break; case 54: #line 393 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[-2].expr), (yyvsp[-5].statement)); } -#line 2155 "parser.tab.c" /* yacc.c:1646 */ +#line 2139 "parser.tab.c" /* yacc.c:1646 */ break; case 55: #line 395 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2161 "parser.tab.c" /* yacc.c:1646 */ +#line 2145 "parser.tab.c" /* yacc.c:1646 */ break; case 56: #line 397 "parser.y" /* yacc.c:1646 */ { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } -#line 2167 "parser.tab.c" /* yacc.c:1646 */ +#line 2151 "parser.tab.c" /* yacc.c:1646 */ break; case 57: #line 399 "parser.y" /* yacc.c:1646 */ { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } -#line 2173 "parser.tab.c" /* yacc.c:1646 */ +#line 2157 "parser.tab.c" /* yacc.c:1646 */ break; case 58: #line 401 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[-8].expr), (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2179 "parser.tab.c" /* yacc.c:1646 */ +#line 2163 "parser.tab.c" /* yacc.c:1646 */ break; case 59: #line 403 "parser.y" /* yacc.c:1646 */ { if(!explicit_error(ctx, (yyvsp[0].variable_list), ';')) YYABORT; } -#line 2185 "parser.tab.c" /* yacc.c:1646 */ +#line 2169 "parser.tab.c" /* yacc.c:1646 */ break; case 60: #line 405 "parser.y" /* yacc.c:1646 */ { if(!explicit_error(ctx, (yyvsp[0].expr), ';')) YYABORT; } -#line 2191 "parser.tab.c" /* yacc.c:1646 */ +#line 2175 "parser.tab.c" /* yacc.c:1646 */ break; case 61: #line 407 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_for_statement(ctx, (yyvsp[-8].variable_list), NULL, (yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2197 "parser.tab.c" /* yacc.c:1646 */ +#line 2181 "parser.tab.c" /* yacc.c:1646 */ break; case 62: #line 409 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2203 "parser.tab.c" /* yacc.c:1646 */ +#line 2187 "parser.tab.c" /* yacc.c:1646 */ break; case 63: #line 411 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_forin_statement(ctx, (yyvsp[-4].variable_declaration), NULL, (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2209 "parser.tab.c" /* yacc.c:1646 */ +#line 2193 "parser.tab.c" /* yacc.c:1646 */ break; case 64: #line 416 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_continue_statement(ctx, (yyvsp[-1].identifier)); } -#line 2215 "parser.tab.c" /* yacc.c:1646 */ +#line 2199 "parser.tab.c" /* yacc.c:1646 */ break; case 65: #line 421 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_break_statement(ctx, (yyvsp[-1].identifier)); } -#line 2221 "parser.tab.c" /* yacc.c:1646 */ +#line 2205 "parser.tab.c" /* yacc.c:1646 */ break; case 66: #line 426 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_return_statement(ctx, (yyvsp[-1].expr)); } -#line 2227 "parser.tab.c" /* yacc.c:1646 */ +#line 2211 "parser.tab.c" /* yacc.c:1646 */ break; case 67: #line 431 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_with_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].statement)); } -#line 2233 "parser.tab.c" /* yacc.c:1646 */ +#line 2217 "parser.tab.c" /* yacc.c:1646 */ break; case 68: #line 436 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); } -#line 2239 "parser.tab.c" /* yacc.c:1646 */ +#line 2223 "parser.tab.c" /* yacc.c:1646 */ break; case 69: #line 441 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_switch_statement(ctx, (yyvsp[-2].expr), (yyvsp[0].case_clausule)); } -#line 2245 "parser.tab.c" /* yacc.c:1646 */ +#line 2229 "parser.tab.c" /* yacc.c:1646 */ break; case 70: #line 446 "parser.y" /* yacc.c:1646 */ { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-1].case_list), NULL, NULL); } -#line 2251 "parser.tab.c" /* yacc.c:1646 */ +#line 2235 "parser.tab.c" /* yacc.c:1646 */ break; case 71: #line 448 "parser.y" /* yacc.c:1646 */ { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[-3].case_list), (yyvsp[-2].case_clausule), (yyvsp[-1].case_list)); } -#line 2257 "parser.tab.c" /* yacc.c:1646 */ +#line 2241 "parser.tab.c" /* yacc.c:1646 */ break; case 72: #line 452 "parser.y" /* yacc.c:1646 */ { (yyval.case_list) = NULL; } -#line 2263 "parser.tab.c" /* yacc.c:1646 */ +#line 2247 "parser.tab.c" /* yacc.c:1646 */ break; case 73: #line 453 "parser.y" /* yacc.c:1646 */ { (yyval.case_list) = (yyvsp[0].case_list); } -#line 2269 "parser.tab.c" /* yacc.c:1646 */ +#line 2253 "parser.tab.c" /* yacc.c:1646 */ break; case 74: #line 457 "parser.y" /* yacc.c:1646 */ { (yyval.case_list) = new_case_list(ctx, (yyvsp[0].case_clausule)); } -#line 2275 "parser.tab.c" /* yacc.c:1646 */ +#line 2259 "parser.tab.c" /* yacc.c:1646 */ break; case 75: #line 459 "parser.y" /* yacc.c:1646 */ { (yyval.case_list) = case_list_add(ctx, (yyvsp[-1].case_list), (yyvsp[0].case_clausule)); } -#line 2281 "parser.tab.c" /* yacc.c:1646 */ +#line 2265 "parser.tab.c" /* yacc.c:1646 */ break; case 76: #line 464 "parser.y" /* yacc.c:1646 */ { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[-2].expr), (yyvsp[0].statement_list)); } -#line 2287 "parser.tab.c" /* yacc.c:1646 */ +#line 2271 "parser.tab.c" /* yacc.c:1646 */ break; case 77: #line 469 "parser.y" /* yacc.c:1646 */ { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[0].statement_list)); } -#line 2293 "parser.tab.c" /* yacc.c:1646 */ +#line 2277 "parser.tab.c" /* yacc.c:1646 */ break; case 78: #line 474 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_throw_statement(ctx, (yyvsp[-1].expr)); } -#line 2299 "parser.tab.c" /* yacc.c:1646 */ +#line 2283 "parser.tab.c" /* yacc.c:1646 */ break; case 79: #line 478 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), (yyvsp[0].catch_block), NULL); } -#line 2305 "parser.tab.c" /* yacc.c:1646 */ +#line 2289 "parser.tab.c" /* yacc.c:1646 */ break; case 80: #line 479 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_try_statement(ctx, (yyvsp[-1].statement), NULL, (yyvsp[0].statement)); } -#line 2311 "parser.tab.c" /* yacc.c:1646 */ +#line 2295 "parser.tab.c" /* yacc.c:1646 */ break; case 81: #line 481 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = new_try_statement(ctx, (yyvsp[-2].statement), (yyvsp[-1].catch_block), (yyvsp[0].statement)); } -#line 2317 "parser.tab.c" /* yacc.c:1646 */ +#line 2301 "parser.tab.c" /* yacc.c:1646 */ break; case 82: #line 486 "parser.y" /* yacc.c:1646 */ { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[-2].identifier), (yyvsp[0].statement)); } -#line 2323 "parser.tab.c" /* yacc.c:1646 */ +#line 2307 "parser.tab.c" /* yacc.c:1646 */ break; case 83: #line 490 "parser.y" /* yacc.c:1646 */ { (yyval.statement) = (yyvsp[0].statement); } -#line 2329 "parser.tab.c" /* yacc.c:1646 */ +#line 2313 "parser.tab.c" /* yacc.c:1646 */ break; case 84: #line 494 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } -#line 2335 "parser.tab.c" /* yacc.c:1646 */ +#line 2319 "parser.tab.c" /* yacc.c:1646 */ break; case 85: #line 495 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2341 "parser.tab.c" /* yacc.c:1646 */ +#line 2325 "parser.tab.c" /* yacc.c:1646 */ break; case 86: #line 498 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2347 "parser.tab.c" /* yacc.c:1646 */ +#line 2331 "parser.tab.c" /* yacc.c:1646 */ break; case 87: #line 499 "parser.y" /* yacc.c:1646 */ { set_error(ctx, JS_E_SYNTAX); YYABORT; } -#line 2353 "parser.tab.c" /* yacc.c:1646 */ +#line 2337 "parser.tab.c" /* yacc.c:1646 */ break; case 88: #line 503 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2359 "parser.tab.c" /* yacc.c:1646 */ +#line 2343 "parser.tab.c" /* yacc.c:1646 */ break; case 89: #line 505 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2365 "parser.tab.c" /* yacc.c:1646 */ +#line 2349 "parser.tab.c" /* yacc.c:1646 */ break; case 90: #line 509 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } -#line 2371 "parser.tab.c" /* yacc.c:1646 */ +#line 2355 "parser.tab.c" /* yacc.c:1646 */ break; case 91: #line 510 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2377 "parser.tab.c" /* yacc.c:1646 */ +#line 2361 "parser.tab.c" /* yacc.c:1646 */ break; case 92: #line 515 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2383 "parser.tab.c" /* yacc.c:1646 */ +#line 2367 "parser.tab.c" /* yacc.c:1646 */ break; case 93: #line 517 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2389 "parser.tab.c" /* yacc.c:1646 */ +#line 2373 "parser.tab.c" /* yacc.c:1646 */ break; case 94: #line 520 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = (yyvsp[0].ival); } -#line 2395 "parser.tab.c" /* yacc.c:1646 */ +#line 2379 "parser.tab.c" /* yacc.c:1646 */ break; case 95: #line 521 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = EXPR_ASSIGNDIV; } -#line 2401 "parser.tab.c" /* yacc.c:1646 */ +#line 2385 "parser.tab.c" /* yacc.c:1646 */ break; case 96: #line 525 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2407 "parser.tab.c" /* yacc.c:1646 */ +#line 2391 "parser.tab.c" /* yacc.c:1646 */ break; case 97: #line 527 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2413 "parser.tab.c" /* yacc.c:1646 */ +#line 2397 "parser.tab.c" /* yacc.c:1646 */ break; case 98: #line 529 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2419 "parser.tab.c" /* yacc.c:1646 */ +#line 2403 "parser.tab.c" /* yacc.c:1646 */ break; case 99: #line 534 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2425 "parser.tab.c" /* yacc.c:1646 */ +#line 2409 "parser.tab.c" /* yacc.c:1646 */ break; case 100: #line 536 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2431 "parser.tab.c" /* yacc.c:1646 */ +#line 2415 "parser.tab.c" /* yacc.c:1646 */ break; case 101: #line 538 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2437 "parser.tab.c" /* yacc.c:1646 */ +#line 2421 "parser.tab.c" /* yacc.c:1646 */ break; case 102: #line 542 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2443 "parser.tab.c" /* yacc.c:1646 */ +#line 2427 "parser.tab.c" /* yacc.c:1646 */ break; case 103: #line 544 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2449 "parser.tab.c" /* yacc.c:1646 */ +#line 2433 "parser.tab.c" /* yacc.c:1646 */ break; case 104: #line 549 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2455 "parser.tab.c" /* yacc.c:1646 */ +#line 2439 "parser.tab.c" /* yacc.c:1646 */ break; case 105: #line 551 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2461 "parser.tab.c" /* yacc.c:1646 */ +#line 2445 "parser.tab.c" /* yacc.c:1646 */ break; case 106: #line 555 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2467 "parser.tab.c" /* yacc.c:1646 */ +#line 2451 "parser.tab.c" /* yacc.c:1646 */ break; case 107: #line 557 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2473 "parser.tab.c" /* yacc.c:1646 */ +#line 2457 "parser.tab.c" /* yacc.c:1646 */ break; case 108: #line 562 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2479 "parser.tab.c" /* yacc.c:1646 */ +#line 2463 "parser.tab.c" /* yacc.c:1646 */ break; case 109: #line 564 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2485 "parser.tab.c" /* yacc.c:1646 */ +#line 2469 "parser.tab.c" /* yacc.c:1646 */ break; case 110: #line 568 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2491 "parser.tab.c" /* yacc.c:1646 */ +#line 2475 "parser.tab.c" /* yacc.c:1646 */ break; case 111: #line 570 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2497 "parser.tab.c" /* yacc.c:1646 */ +#line 2481 "parser.tab.c" /* yacc.c:1646 */ break; case 112: #line 575 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2503 "parser.tab.c" /* yacc.c:1646 */ +#line 2487 "parser.tab.c" /* yacc.c:1646 */ break; case 113: #line 577 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2509 "parser.tab.c" /* yacc.c:1646 */ +#line 2493 "parser.tab.c" /* yacc.c:1646 */ break; case 114: #line 581 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2515 "parser.tab.c" /* yacc.c:1646 */ +#line 2499 "parser.tab.c" /* yacc.c:1646 */ break; case 115: #line 583 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2521 "parser.tab.c" /* yacc.c:1646 */ +#line 2505 "parser.tab.c" /* yacc.c:1646 */ break; case 116: #line 588 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2527 "parser.tab.c" /* yacc.c:1646 */ +#line 2511 "parser.tab.c" /* yacc.c:1646 */ break; case 117: #line 590 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2533 "parser.tab.c" /* yacc.c:1646 */ +#line 2517 "parser.tab.c" /* yacc.c:1646 */ break; case 118: #line 594 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2539 "parser.tab.c" /* yacc.c:1646 */ +#line 2523 "parser.tab.c" /* yacc.c:1646 */ break; case 119: #line 596 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2545 "parser.tab.c" /* yacc.c:1646 */ +#line 2529 "parser.tab.c" /* yacc.c:1646 */ break; case 120: #line 601 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2551 "parser.tab.c" /* yacc.c:1646 */ +#line 2535 "parser.tab.c" /* yacc.c:1646 */ break; case 121: #line 603 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2557 "parser.tab.c" /* yacc.c:1646 */ +#line 2541 "parser.tab.c" /* yacc.c:1646 */ break; case 122: #line 607 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2563 "parser.tab.c" /* yacc.c:1646 */ +#line 2547 "parser.tab.c" /* yacc.c:1646 */ break; case 123: #line 609 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2569 "parser.tab.c" /* yacc.c:1646 */ +#line 2553 "parser.tab.c" /* yacc.c:1646 */ break; case 124: #line 614 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2575 "parser.tab.c" /* yacc.c:1646 */ +#line 2559 "parser.tab.c" /* yacc.c:1646 */ break; case 125: #line 616 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2581 "parser.tab.c" /* yacc.c:1646 */ +#line 2565 "parser.tab.c" /* yacc.c:1646 */ break; case 126: #line 620 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2587 "parser.tab.c" /* yacc.c:1646 */ +#line 2571 "parser.tab.c" /* yacc.c:1646 */ break; case 127: #line 622 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2593 "parser.tab.c" /* yacc.c:1646 */ +#line 2577 "parser.tab.c" /* yacc.c:1646 */ break; case 128: #line 626 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2599 "parser.tab.c" /* yacc.c:1646 */ +#line 2583 "parser.tab.c" /* yacc.c:1646 */ break; case 129: #line 628 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2605 "parser.tab.c" /* yacc.c:1646 */ +#line 2589 "parser.tab.c" /* yacc.c:1646 */ break; case 130: #line 632 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2611 "parser.tab.c" /* yacc.c:1646 */ +#line 2595 "parser.tab.c" /* yacc.c:1646 */ break; case 131: #line 634 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2617 "parser.tab.c" /* yacc.c:1646 */ +#line 2601 "parser.tab.c" /* yacc.c:1646 */ break; case 132: #line 636 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2623 "parser.tab.c" /* yacc.c:1646 */ +#line 2607 "parser.tab.c" /* yacc.c:1646 */ break; case 133: #line 638 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2629 "parser.tab.c" /* yacc.c:1646 */ +#line 2613 "parser.tab.c" /* yacc.c:1646 */ break; case 134: #line 642 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2635 "parser.tab.c" /* yacc.c:1646 */ +#line 2619 "parser.tab.c" /* yacc.c:1646 */ break; case 135: #line 644 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2641 "parser.tab.c" /* yacc.c:1646 */ +#line 2625 "parser.tab.c" /* yacc.c:1646 */ break; case 136: #line 646 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2647 "parser.tab.c" /* yacc.c:1646 */ +#line 2631 "parser.tab.c" /* yacc.c:1646 */ break; case 137: #line 650 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2653 "parser.tab.c" /* yacc.c:1646 */ +#line 2637 "parser.tab.c" /* yacc.c:1646 */ break; case 138: #line 652 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[-1].ival), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2659 "parser.tab.c" /* yacc.c:1646 */ +#line 2643 "parser.tab.c" /* yacc.c:1646 */ break; case 139: #line 657 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2665 "parser.tab.c" /* yacc.c:1646 */ +#line 2649 "parser.tab.c" /* yacc.c:1646 */ break; case 140: #line 659 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2671 "parser.tab.c" /* yacc.c:1646 */ +#line 2655 "parser.tab.c" /* yacc.c:1646 */ break; case 141: #line 661 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2677 "parser.tab.c" /* yacc.c:1646 */ +#line 2661 "parser.tab.c" /* yacc.c:1646 */ break; case 142: #line 665 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2683 "parser.tab.c" /* yacc.c:1646 */ +#line 2667 "parser.tab.c" /* yacc.c:1646 */ break; case 143: #line 667 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2689 "parser.tab.c" /* yacc.c:1646 */ +#line 2673 "parser.tab.c" /* yacc.c:1646 */ break; case 144: #line 669 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2695 "parser.tab.c" /* yacc.c:1646 */ +#line 2679 "parser.tab.c" /* yacc.c:1646 */ break; case 145: #line 671 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 2701 "parser.tab.c" /* yacc.c:1646 */ +#line 2685 "parser.tab.c" /* yacc.c:1646 */ break; case 146: #line 675 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2707 "parser.tab.c" /* yacc.c:1646 */ +#line 2691 "parser.tab.c" /* yacc.c:1646 */ break; case 147: #line 677 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[0].expr)); } -#line 2713 "parser.tab.c" /* yacc.c:1646 */ +#line 2697 "parser.tab.c" /* yacc.c:1646 */ break; case 148: #line 678 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[0].expr)); } -#line 2719 "parser.tab.c" /* yacc.c:1646 */ +#line 2703 "parser.tab.c" /* yacc.c:1646 */ break; case 149: #line 680 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[0].expr)); } -#line 2725 "parser.tab.c" /* yacc.c:1646 */ +#line 2709 "parser.tab.c" /* yacc.c:1646 */ break; case 150: #line 681 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[0].expr)); } -#line 2731 "parser.tab.c" /* yacc.c:1646 */ +#line 2715 "parser.tab.c" /* yacc.c:1646 */ break; case 151: #line 682 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[0].expr)); } -#line 2737 "parser.tab.c" /* yacc.c:1646 */ +#line 2721 "parser.tab.c" /* yacc.c:1646 */ break; case 152: #line 683 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[0].expr)); } -#line 2743 "parser.tab.c" /* yacc.c:1646 */ +#line 2727 "parser.tab.c" /* yacc.c:1646 */ break; case 153: #line 684 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[0].expr)); } -#line 2749 "parser.tab.c" /* yacc.c:1646 */ +#line 2733 "parser.tab.c" /* yacc.c:1646 */ break; case 154: #line 685 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[0].expr)); } -#line 2755 "parser.tab.c" /* yacc.c:1646 */ +#line 2739 "parser.tab.c" /* yacc.c:1646 */ break; case 155: #line 686 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[0].expr)); } -#line 2761 "parser.tab.c" /* yacc.c:1646 */ +#line 2745 "parser.tab.c" /* yacc.c:1646 */ break; case 156: #line 691 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2767 "parser.tab.c" /* yacc.c:1646 */ +#line 2751 "parser.tab.c" /* yacc.c:1646 */ break; case 157: #line 693 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[-1].expr)); } -#line 2773 "parser.tab.c" /* yacc.c:1646 */ +#line 2757 "parser.tab.c" /* yacc.c:1646 */ break; case 158: #line 695 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[-1].expr)); } -#line 2779 "parser.tab.c" /* yacc.c:1646 */ +#line 2763 "parser.tab.c" /* yacc.c:1646 */ break; case 159: #line 700 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2785 "parser.tab.c" /* yacc.c:1646 */ +#line 2769 "parser.tab.c" /* yacc.c:1646 */ break; case 160: #line 701 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2791 "parser.tab.c" /* yacc.c:1646 */ +#line 2775 "parser.tab.c" /* yacc.c:1646 */ break; case 161: #line 705 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2797 "parser.tab.c" /* yacc.c:1646 */ +#line 2781 "parser.tab.c" /* yacc.c:1646 */ break; case 162: #line 706 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_new_expression(ctx, (yyvsp[0].expr), NULL); } -#line 2803 "parser.tab.c" /* yacc.c:1646 */ +#line 2787 "parser.tab.c" /* yacc.c:1646 */ break; case 163: #line 710 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2809 "parser.tab.c" /* yacc.c:1646 */ +#line 2793 "parser.tab.c" /* yacc.c:1646 */ break; case 164: #line 711 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2815 "parser.tab.c" /* yacc.c:1646 */ +#line 2799 "parser.tab.c" /* yacc.c:1646 */ break; case 165: #line 713 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 2821 "parser.tab.c" /* yacc.c:1646 */ +#line 2805 "parser.tab.c" /* yacc.c:1646 */ break; case 166: #line 715 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); } -#line 2827 "parser.tab.c" /* yacc.c:1646 */ +#line 2811 "parser.tab.c" /* yacc.c:1646 */ break; case 167: #line 717 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_new_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } -#line 2833 "parser.tab.c" /* yacc.c:1646 */ +#line 2817 "parser.tab.c" /* yacc.c:1646 */ break; case 168: #line 722 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } -#line 2839 "parser.tab.c" /* yacc.c:1646 */ +#line 2823 "parser.tab.c" /* yacc.c:1646 */ break; case 169: #line 724 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_call_expression(ctx, (yyvsp[-1].expr), (yyvsp[0].argument_list)); } -#line 2845 "parser.tab.c" /* yacc.c:1646 */ +#line 2829 "parser.tab.c" /* yacc.c:1646 */ break; case 170: #line 726 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_binary_expression(ctx, EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 2851 "parser.tab.c" /* yacc.c:1646 */ +#line 2835 "parser.tab.c" /* yacc.c:1646 */ break; case 171: #line 728 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_member_expression(ctx, (yyvsp[-2].expr), (yyvsp[0].identifier)); } -#line 2857 "parser.tab.c" /* yacc.c:1646 */ +#line 2841 "parser.tab.c" /* yacc.c:1646 */ break; case 172: #line 732 "parser.y" /* yacc.c:1646 */ { (yyval.argument_list) = NULL; } -#line 2863 "parser.tab.c" /* yacc.c:1646 */ +#line 2847 "parser.tab.c" /* yacc.c:1646 */ break; case 173: #line 733 "parser.y" /* yacc.c:1646 */ { (yyval.argument_list) = (yyvsp[-1].argument_list); } -#line 2869 "parser.tab.c" /* yacc.c:1646 */ +#line 2853 "parser.tab.c" /* yacc.c:1646 */ break; case 174: #line 737 "parser.y" /* yacc.c:1646 */ { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[0].expr)); } -#line 2875 "parser.tab.c" /* yacc.c:1646 */ +#line 2859 "parser.tab.c" /* yacc.c:1646 */ break; case 175: #line 739 "parser.y" /* yacc.c:1646 */ { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[-2].argument_list), (yyvsp[0].expr)); } -#line 2881 "parser.tab.c" /* yacc.c:1646 */ +#line 2865 "parser.tab.c" /* yacc.c:1646 */ break; case 176: #line 743 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_expression(ctx, EXPR_THIS, 0); } -#line 2887 "parser.tab.c" /* yacc.c:1646 */ +#line 2871 "parser.tab.c" /* yacc.c:1646 */ break; case 177: #line 744 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[0].identifier)); } -#line 2893 "parser.tab.c" /* yacc.c:1646 */ +#line 2877 "parser.tab.c" /* yacc.c:1646 */ break; case 178: #line 745 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_literal_expression(ctx, (yyvsp[0].literal)); } -#line 2899 "parser.tab.c" /* yacc.c:1646 */ +#line 2883 "parser.tab.c" /* yacc.c:1646 */ break; case 179: #line 746 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2905 "parser.tab.c" /* yacc.c:1646 */ +#line 2889 "parser.tab.c" /* yacc.c:1646 */ break; case 180: #line 747 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[0].expr); } -#line 2911 "parser.tab.c" /* yacc.c:1646 */ +#line 2895 "parser.tab.c" /* yacc.c:1646 */ break; case 181: #line 748 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = (yyvsp[-1].expr); } -#line 2917 "parser.tab.c" /* yacc.c:1646 */ +#line 2901 "parser.tab.c" /* yacc.c:1646 */ break; case 182: #line 752 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); } -#line 2923 "parser.tab.c" /* yacc.c:1646 */ +#line 2907 "parser.tab.c" /* yacc.c:1646 */ break; case 183: #line 753 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[-1].ival)+1); } -#line 2929 "parser.tab.c" /* yacc.c:1646 */ +#line 2913 "parser.tab.c" /* yacc.c:1646 */ break; case 184: #line 754 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-1].element_list), 0); } -#line 2935 "parser.tab.c" /* yacc.c:1646 */ +#line 2919 "parser.tab.c" /* yacc.c:1646 */ break; case 185: #line 756 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival)+1); } -#line 2941 "parser.tab.c" /* yacc.c:1646 */ +#line 2925 "parser.tab.c" /* yacc.c:1646 */ break; case 186: #line 761 "parser.y" /* yacc.c:1646 */ { (yyval.element_list) = new_element_list(ctx, (yyvsp[-1].ival), (yyvsp[0].expr)); } -#line 2947 "parser.tab.c" /* yacc.c:1646 */ +#line 2931 "parser.tab.c" /* yacc.c:1646 */ break; case 187: #line 763 "parser.y" /* yacc.c:1646 */ { (yyval.element_list) = element_list_add(ctx, (yyvsp[-3].element_list), (yyvsp[-1].ival), (yyvsp[0].expr)); } -#line 2953 "parser.tab.c" /* yacc.c:1646 */ +#line 2937 "parser.tab.c" /* yacc.c:1646 */ break; case 188: #line 767 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = 1; } -#line 2959 "parser.tab.c" /* yacc.c:1646 */ +#line 2943 "parser.tab.c" /* yacc.c:1646 */ break; case 189: #line 768 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = (yyvsp[-1].ival) + 1; } -#line 2965 "parser.tab.c" /* yacc.c:1646 */ +#line 2949 "parser.tab.c" /* yacc.c:1646 */ break; case 190: #line 772 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } -#line 2971 "parser.tab.c" /* yacc.c:1646 */ +#line 2955 "parser.tab.c" /* yacc.c:1646 */ break; case 191: #line 773 "parser.y" /* yacc.c:1646 */ { (yyval.ival) = (yyvsp[0].ival); } -#line 2977 "parser.tab.c" /* yacc.c:1646 */ +#line 2961 "parser.tab.c" /* yacc.c:1646 */ break; case 192: #line 777 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); } -#line 2983 "parser.tab.c" /* yacc.c:1646 */ +#line 2967 "parser.tab.c" /* yacc.c:1646 */ break; case 193: #line 779 "parser.y" /* yacc.c:1646 */ { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[-1].property_list)); } -#line 2989 "parser.tab.c" /* yacc.c:1646 */ +#line 2973 "parser.tab.c" /* yacc.c:1646 */ break; case 194: #line 784 "parser.y" /* yacc.c:1646 */ { (yyval.property_list) = new_property_list(ctx, (yyvsp[-2].literal), (yyvsp[0].expr)); } -#line 2995 "parser.tab.c" /* yacc.c:1646 */ +#line 2979 "parser.tab.c" /* yacc.c:1646 */ break; case 195: #line 786 "parser.y" /* yacc.c:1646 */ { (yyval.property_list) = property_list_add(ctx, (yyvsp[-4].property_list), (yyvsp[-2].literal), (yyvsp[0].expr)); } -#line 3001 "parser.tab.c" /* yacc.c:1646 */ +#line 2985 "parser.tab.c" /* yacc.c:1646 */ break; case 196: #line 790 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].identifier)); } -#line 3007 "parser.tab.c" /* yacc.c:1646 */ +#line 2991 "parser.tab.c" /* yacc.c:1646 */ break; case 197: #line 791 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); } -#line 3013 "parser.tab.c" /* yacc.c:1646 */ +#line 2997 "parser.tab.c" /* yacc.c:1646 */ break; case 198: #line 792 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } -#line 3019 "parser.tab.c" /* yacc.c:1646 */ +#line 3003 "parser.tab.c" /* yacc.c:1646 */ break; case 199: #line 796 "parser.y" /* yacc.c:1646 */ { (yyval.identifier) = NULL; } -#line 3025 "parser.tab.c" /* yacc.c:1646 */ +#line 3009 "parser.tab.c" /* yacc.c:1646 */ break; case 200: #line 797 "parser.y" /* yacc.c:1646 */ { (yyval.identifier) = (yyvsp[0].identifier); } -#line 3031 "parser.tab.c" /* yacc.c:1646 */ +#line 3015 "parser.tab.c" /* yacc.c:1646 */ break; case 201: #line 801 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_null_literal(ctx); } -#line 3037 "parser.tab.c" /* yacc.c:1646 */ +#line 3021 "parser.tab.c" /* yacc.c:1646 */ break; case 202: #line 802 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } -#line 3043 "parser.tab.c" /* yacc.c:1646 */ +#line 3027 "parser.tab.c" /* yacc.c:1646 */ break; case 203: #line 803 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } -#line 3049 "parser.tab.c" /* yacc.c:1646 */ +#line 3033 "parser.tab.c" /* yacc.c:1646 */ break; case 204: #line 804 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_string_literal(ctx, (yyvsp[0].wstr)); } -#line 3055 "parser.tab.c" /* yacc.c:1646 */ +#line 3039 "parser.tab.c" /* yacc.c:1646 */ break; case 205: #line 805 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = parse_regexp(ctx); if(!(yyval.literal)) YYABORT; } -#line 3062 "parser.tab.c" /* yacc.c:1646 */ +#line 3046 "parser.tab.c" /* yacc.c:1646 */ break; case 206: #line 807 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = parse_regexp(ctx); if(!(yyval.literal)) YYABORT; } -#line 3069 "parser.tab.c" /* yacc.c:1646 */ +#line 3053 "parser.tab.c" /* yacc.c:1646 */ break; case 207: #line 812 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); } -#line 3075 "parser.tab.c" /* yacc.c:1646 */ +#line 3059 "parser.tab.c" /* yacc.c:1646 */ break; case 208: #line 813 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); } -#line 3081 "parser.tab.c" /* yacc.c:1646 */ +#line 3065 "parser.tab.c" /* yacc.c:1646 */ break; case 209: #line 814 "parser.y" /* yacc.c:1646 */ { (yyval.literal) = (yyvsp[0].literal); } -#line 3087 "parser.tab.c" /* yacc.c:1646 */ +#line 3071 "parser.tab.c" /* yacc.c:1646 */ break; case 211: #line 818 "parser.y" /* yacc.c:1646 */ { if(!allow_auto_semicolon(ctx)) {YYABORT;} } -#line 3093 "parser.tab.c" /* yacc.c:1646 */ +#line 3077 "parser.tab.c" /* yacc.c:1646 */ break; case 213: #line 822 "parser.y" /* yacc.c:1646 */ { set_error(ctx, JS_E_MISSING_LBRACKET); YYABORT; } -#line 3099 "parser.tab.c" /* yacc.c:1646 */ +#line 3083 "parser.tab.c" /* yacc.c:1646 */ break; case 215: #line 826 "parser.y" /* yacc.c:1646 */ { set_error(ctx, JS_E_MISSING_RBRACKET); YYABORT; } -#line 3105 "parser.tab.c" /* yacc.c:1646 */ +#line 3089 "parser.tab.c" /* yacc.c:1646 */ break; case 217: #line 830 "parser.y" /* yacc.c:1646 */ { set_error(ctx, JS_E_MISSING_SEMICOLON); YYABORT; } -#line 3111 "parser.tab.c" /* yacc.c:1646 */ +#line 3095 "parser.tab.c" /* yacc.c:1646 */ break; -#line 3115 "parser.tab.c" /* yacc.c:1646 */ +#line 3099 "parser.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/dll/win32/jscript/parser.tab.h b/dll/win32/jscript/parser.tab.h index 0233eaf9e4..096db230a2 100644 --- a/dll/win32/jscript/parser.tab.h +++ b/dll/win32/jscript/parser.tab.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0. */ /* Bison interface for Yacc-like parsers in C @@ -30,8 +30,8 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED -# define YY_PARSER_PARSER_TAB_H_INCLUDED +#ifndef YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED +# define YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -129,4 +129,4 @@ union YYSTYPE int parser_parse (parser_ctx_t *ctx); -#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */ +#endif /* !YY_PARSER_E_REACTOSSYNC_GCC_DLL_WIN32_JSCRIPT_PARSER_TAB_H_INCLUDED */ diff --git a/dll/win32/jscript/parser.y b/dll/win32/jscript/parser.y index b97e7fd5e0..59e67575fc 100644 --- a/dll/win32/jscript/parser.y +++ b/dll/win32/jscript/parser.y @@ -19,6 +19,12 @@ %{ #include "jscript.h" +#include "engine.h" +#include "parser.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); static int parser_error(parser_ctx_t*,const char*); static void set_error(parser_ctx_t*,UINT); diff --git a/dll/win32/jscript/precomp.h b/dll/win32/jscript/precomp.h new file mode 100644 index 0000000000..abd64f187f --- /dev/null +++ b/dll/win32/jscript/precomp.h @@ -0,0 +1,24 @@ + +#ifndef _JSCRIPT_PRECOMP_H +#define _JSCRIPT_PRECOMP_H + +#include <wine/config.h> +#include <wine/port.h> + +#include <assert.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include "jscript.h" + +#include <objsafe.h> + +#include <wine/debug.h> + +#include "engine.h" +#include "parser.h" +#include "regexp.h" + +#endif /* !_JSCRIPT_PRECOMP_H */ diff --git a/dll/win32/jscript/regexp.c b/dll/win32/jscript/regexp.c index 6152ea0f65..cca7cc556c 100644 --- a/dll/win32/jscript/regexp.c +++ b/dll/win32/jscript/regexp.c @@ -31,7 +31,14 @@ * the Initial Developer. All Rights Reserved. */ +#include <assert.h> + #include "jscript.h" +#include "regexp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); /* FIXME: Better error handling */ #define ReportRegExpError(a,b,c) diff --git a/dll/win32/jscript/resource.h b/dll/win32/jscript/resource.h index f5184bd483..bb78ec19f0 100644 --- a/dll/win32/jscript/resource.h +++ b/dll/win32/jscript/resource.h @@ -18,6 +18,8 @@ #pragma once +#include <windef.h> + #define JSCRIPT_MAJOR_VERSION 5 #define JSCRIPT_MINOR_VERSION 8 #define JSCRIPT_BUILD_VERSION 16475 diff --git a/dll/win32/jscript/rsrc.rc b/dll/win32/jscript/rsrc.rc index ea0bdb992f..f843d1e94a 100644 --- a/dll/win32/jscript/rsrc.rc +++ b/dll/win32/jscript/rsrc.rc @@ -16,8 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <windef.h> - #include "resource.h" /* @makedep: jscript.rgs */ diff --git a/dll/win32/jscript/string.c b/dll/win32/jscript/string.c index 5d636e6d4c..ad978f245c 100644 --- a/dll/win32/jscript/string.c +++ b/dll/win32/jscript/string.c @@ -16,7 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + #include "jscript.h" +#include "regexp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); typedef struct { jsdisp_t dispex; diff --git a/dll/win32/jscript/vbarray.c b/dll/win32/jscript/vbarray.c index 3f38b582ff..23122282e7 100644 --- a/dll/win32/jscript/vbarray.c +++ b/dll/win32/jscript/vbarray.c @@ -18,6 +18,10 @@ #include "jscript.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + typedef struct { jsdisp_t dispex; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 93a5a04a6b..bd747fa90b 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -85,7 +85,7 @@ reactos/dll/win32/inseng # Synced to WineStaging-3.3 reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-3.3 reactos/dll/win32/itss # Synced to WineStaging-3.3 -reactos/dll/win32/jscript # Synced to Wine-3.0 +reactos/dll/win32/jscript # Synced to WineStaging-3.3 reactos/dll/win32/jsproxy # Synced to WineStaging-2.16 reactos/dll/win32/loadperf # Synced to WineStaging-2.9 reactos/dll/win32/lz32 # Synced to WineStaging-2.9
6 years, 7 months
1
0
0
0
01/01: [ITSS] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=919215fd3bf52e5068ee8…
commit 919215fd3bf52e5068ee8a77ac80a5198da95d22 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:10:01 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:10:01 2018 +0100 [ITSS] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/itss/chm_lib.c | 15 ++++++++++++++- dll/win32/itss/itss.c | 25 +++++++++++++++++++++++-- dll/win32/itss/lzx.c | 9 ++++++++- dll/win32/itss/moniker.c | 20 ++++++++++++++++++-- dll/win32/itss/precomp.h | 5 ++--- dll/win32/itss/protocol.c | 21 +++++++++++++++++---- dll/win32/itss/storage.c | 21 ++++++++++++++++++++- media/doc/README.WINE | 2 +- 8 files changed, 103 insertions(+), 15 deletions(-) diff --git a/dll/win32/itss/chm_lib.c b/dll/win32/itss/chm_lib.c index 12ba5fd0f2..829f758516 100644 --- a/dll/win32/itss/chm_lib.c +++ b/dll/win32/itss/chm_lib.c @@ -54,7 +54,20 @@ * * ***************************************************************************/ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" +#include "wine/unicode.h" + +#include "chm_lib.h" +#include "lzx.h" #define CHM_ACQUIRE_LOCK(a) do { \ EnterCriticalSection(&(a)); \ diff --git a/dll/win32/itss/itss.c b/dll/win32/itss/itss.c index c428c707e9..f47a0e96e7 100644 --- a/dll/win32/itss/itss.c +++ b/dll/win32/itss/itss.c @@ -21,9 +21,30 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" -#include <rpcproxy.h> +#include <stdarg.h> +#include <stdio.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" +#include "rpcproxy.h" +#include "advpub.h" + +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "itsstor.h" + +#include "initguid.h" +#include "wine/itss.h" + +WINE_DEFAULT_DEBUG_CHANNEL(itss); static HRESULT ITSS_create(IUnknown *pUnkOuter, LPVOID *ppObj); diff --git a/dll/win32/itss/lzx.c b/dll/win32/itss/lzx.c index 68b1e23f40..01a9492411 100644 --- a/dll/win32/itss/lzx.c +++ b/dll/win32/itss/lzx.c @@ -35,7 +35,14 @@ * ***************************************************************************/ -#include "precomp.h" +#include "lzx.h" +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" /* sized types */ typedef unsigned char UBYTE; /* 8 bits exactly */ diff --git a/dll/win32/itss/moniker.c b/dll/win32/itss/moniker.c index 86d8109186..0509c9e1a5 100644 --- a/dll/win32/itss/moniker.c +++ b/dll/win32/itss/moniker.c @@ -20,9 +20,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" -#include <oleidl.h> +#include <stdarg.h> +#include <stdio.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "wine/itss.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "itsstor.h" + +WINE_DEFAULT_DEBUG_CHANNEL(itss); /*****************************************************************************/ diff --git a/dll/win32/itss/precomp.h b/dll/win32/itss/precomp.h index 1bf6ab0c51..5f9be9183b 100644 --- a/dll/win32/itss/precomp.h +++ b/dll/win32/itss/precomp.h @@ -1,3 +1,4 @@ + #ifndef _ITSS_PCH_ #define _ITSS_PCH_ @@ -18,12 +19,10 @@ #include <wine/itss.h> #include <wine/unicode.h> - #include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(itss); #include "chm_lib.h" #include "itsstor.h" #include "lzx.h" -#endif /* _ITSS_PCH_ */ +#endif /* !_ITSS_PCH_ */ diff --git a/dll/win32/itss/protocol.c b/dll/win32/itss/protocol.c index 603e2aee73..1463518c2c 100644 --- a/dll/win32/itss/protocol.c +++ b/dll/win32/itss/protocol.c @@ -16,11 +16,24 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <stdarg.h> -#include <winreg.h> -#include <urlmon.h> -#include <shlwapi.h> +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" +#include "urlmon.h" +#include "shlwapi.h" +#include "itsstor.h" +#include "chm_lib.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(itss); typedef struct { IInternetProtocol IInternetProtocol_iface; diff --git a/dll/win32/itss/storage.c b/dll/win32/itss/storage.c index 0b10dc5238..f20c5bc0be 100644 --- a/dll/win32/itss/storage.c +++ b/dll/win32/itss/storage.c @@ -20,7 +20,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" + +#include <stdarg.h> +#include <stdio.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "chm_lib.h" +#include "itsstor.h" + +#include "wine/itss.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(itss); /************************************************************************/ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 3e9ddc8bc8..93a5a04a6b 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -84,7 +84,7 @@ reactos/dll/win32/initpki # Synced to WineStaging-3.3 reactos/dll/win32/inseng # Synced to WineStaging-3.3 reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-3.3 -reactos/dll/win32/itss # Synced to Wine-3.0 +reactos/dll/win32/itss # Synced to WineStaging-3.3 reactos/dll/win32/jscript # Synced to Wine-3.0 reactos/dll/win32/jsproxy # Synced to WineStaging-2.16 reactos/dll/win32/loadperf # Synced to WineStaging-2.9
6 years, 7 months
1
0
0
0
01/01: [ITIRCL] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1e8f5b1909797195a7a7d…
commit 1e8f5b1909797195a7a7dcd07888c2fce36ffd39 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 13:08:50 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 13:08:50 2018 +0100 [ITIRCL] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/itircl/itircl_main.c | 10 ++++------ media/doc/README.WINE | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dll/win32/itircl/itircl_main.c b/dll/win32/itircl/itircl_main.c index 243096fd2a..4fb05c0a19 100644 --- a/dll/win32/itircl/itircl_main.c +++ b/dll/win32/itircl/itircl_main.c @@ -18,15 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS - -#include <config.h> +#include "config.h" #include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <wine/debug.h> +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(itircl); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 034e9b393e..3e9ddc8bc8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -83,7 +83,7 @@ reactos/dll/win32/inetmib1 # Synced to WineStaging-3.3 reactos/dll/win32/initpki # Synced to WineStaging-3.3 reactos/dll/win32/inseng # Synced to WineStaging-3.3 reactos/dll/win32/iphlpapi # Out of sync -reactos/dll/win32/itircl # Synced to WineStaging-2.9 +reactos/dll/win32/itircl # Synced to WineStaging-3.3 reactos/dll/win32/itss # Synced to Wine-3.0 reactos/dll/win32/jscript # Synced to Wine-3.0 reactos/dll/win32/jsproxy # Synced to WineStaging-2.16
6 years, 7 months
1
0
0
0
01/01: [INSENG] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=580b6f730ed94d89aa3bc…
commit 580b6f730ed94d89aa3bce1fc8d3fb1fb5a9b82b Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 12:48:28 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 12:48:28 2018 +0100 [INSENG] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/inseng/CMakeLists.txt | 8 +- dll/win32/inseng/guid.c | 15 + dll/win32/inseng/icif.c | 1745 +++++++++++++++++++++++++++++++++++++ dll/win32/inseng/inf.c | 443 ++++++++++ dll/win32/inseng/inseng.spec | 4 +- dll/win32/inseng/inseng_main.c | 1002 +++++++++++++++++++-- dll/win32/inseng/inseng_private.h | 81 ++ dll/win32/inseng/precomp.h | 17 + media/doc/README.WINE | 2 +- 9 files changed, 3261 insertions(+), 56 deletions(-) diff --git a/dll/win32/inseng/CMakeLists.txt b/dll/win32/inseng/CMakeLists.txt index 7df9dd96ab..20f27dfa4a 100644 --- a/dll/win32/inseng/CMakeLists.txt +++ b/dll/win32/inseng/CMakeLists.txt @@ -7,12 +7,16 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) spec2def(inseng.dll inseng.spec) list(APPEND SOURCE + icif.c + inf.c inseng_main.c + precomp.h ${CMAKE_CURRENT_BINARY_DIR}/inseng_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/inseng.def) -add_library(inseng SHARED ${SOURCE} inseng.rc) +add_library(inseng SHARED ${SOURCE} guid.c inseng.rc) set_module_type(inseng win32dll) target_link_libraries(inseng uuid wine) -add_importlibs(inseng ole32 advapi32 msvcrt kernel32 ntdll) +add_importlibs(inseng ole32 urlmon kernel32_vista msvcrt kernel32 ntdll) +add_pch(inseng precomp.h SOURCE) add_cd_file(TARGET inseng DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/inseng/guid.c b/dll/win32/inseng/guid.c new file mode 100644 index 0000000000..cb44059951 --- /dev/null +++ b/dll/win32/inseng/guid.c @@ -0,0 +1,15 @@ +/* DO NOT USE THE PRECOMPILED HEADER FOR THIS FILE! */ + +#include <stdarg.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <windef.h> +#include <winbase.h> +#include <objbase.h> +#include <initguid.h> +#include <inseng.h> + +/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ diff --git a/dll/win32/inseng/icif.c b/dll/win32/inseng/icif.c new file mode 100644 index 0000000000..f7bf0a0707 --- /dev/null +++ b/dll/win32/inseng/icif.c @@ -0,0 +1,1745 @@ +/* + * Copyright 2016 Michael Müller + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" + +#include <stdarg.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "rpcproxy.h" +#include "inseng.h" + +#include "inseng_private.h" + +#include "wine/list.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(inseng); + +#define DEFAULT_INSTALLER_DESC "Active Setup Installation" + +struct cifgroup +{ + ICifGroup ICifGroup_iface; + + struct list entry; + + ICifFile *parent; + + char *id; + char *description; + DWORD priority; +}; + +struct ciffenum_components +{ + IEnumCifComponents IEnumCifComponents_iface; + LONG ref; + + ICifFile *file; + struct list *start; + struct list *position; + + char *group_id; +}; + +struct ciffenum_groups +{ + IEnumCifGroups IEnumCifGroups_iface; + LONG ref; + + ICifFile *file; + struct list *start; + struct list *position; +}; + +struct url_info +{ + struct list entry; + INT index; + char *url; + DWORD flags; +}; + +struct dependency_info +{ + struct list entry; + char *id; + char *type; +}; + +struct cifcomponent +{ + ICifComponent ICifComponent_iface; + + struct list entry; + + ICifFile *parent; + + char *id; + char *guid; + char *description; + char *details; + char *group; + + + DWORD version; + DWORD build; + char *patchid; + + char *locale; + char *key_uninstall; + + DWORD size_win; + DWORD size_app; + DWORD size_download; + DWORD size_extracted; + + char *key_success; + char *key_progress; + char *key_cancel; + + DWORD as_aware; + DWORD reboot; + DWORD admin; + DWORD visibleui; + + DWORD priority; + DWORD platform; + + struct list dependencies; + struct list urls; + + /* mode */ + /* det version */ + /* one component */ + /* custom data */ + + /* in memory state */ + DWORD queue_state; + DWORD current_priority; + DWORD size_actual_download; + BOOL downloaded; + BOOL installed; +}; + +struct ciffile +{ + ICifFile ICifFile_iface; + LONG ref; + + struct list components; + struct list groups; + + char *name; +}; + +static inline struct ciffile *impl_from_ICiffile(ICifFile *iface) +{ + return CONTAINING_RECORD(iface, struct ciffile, ICifFile_iface); +} + +static inline struct cifcomponent *impl_from_ICifComponent(ICifComponent *iface) +{ + return CONTAINING_RECORD(iface, struct cifcomponent, ICifComponent_iface); +} + +static inline struct cifgroup *impl_from_ICifGroup(ICifGroup *iface) +{ + return CONTAINING_RECORD(iface, struct cifgroup, ICifGroup_iface); +} + +static inline struct ciffenum_components *impl_from_IEnumCifComponents(IEnumCifComponents *iface) +{ + return CONTAINING_RECORD(iface, struct ciffenum_components, IEnumCifComponents_iface); +} + +static inline struct ciffenum_groups *impl_from_IEnumCifGroups(IEnumCifGroups *iface) +{ + return CONTAINING_RECORD(iface, struct ciffenum_groups, IEnumCifGroups_iface); +} + +static HRESULT enum_components_create(ICifFile *file, struct list *start, char *group_id, IEnumCifComponents **iface); + +static HRESULT copy_substring_null(char *dest, int max_len, char *src) +{ + if (!src) + return E_FAIL; + + if (max_len <= 0) + return S_OK; + + if (!dest) + return E_FAIL; + + while (*src && max_len-- > 1) + *dest++ = *src++; + *dest = 0; + + return S_OK; +} + +static void url_entry_free(struct url_info *url) +{ + heap_free(url->url); + heap_free(url); +} + +static void dependency_entry_free(struct dependency_info *dependency) +{ + heap_free(dependency->id); + heap_free(dependency); +} + +static void component_free(struct cifcomponent *comp) +{ + struct dependency_info *dependency, *dependency_next; + struct url_info *url, *url_next; + + heap_free(comp->id); + heap_free(comp->guid); + heap_free(comp->description); + heap_free(comp->details); + heap_free(comp->group); + + heap_free(comp->patchid); + + heap_free(comp->locale); + heap_free(comp->key_uninstall); + + heap_free(comp->key_success); + heap_free(comp->key_progress); + heap_free(comp->key_cancel); + + LIST_FOR_EACH_ENTRY_SAFE(dependency, dependency_next, &comp->dependencies, struct dependency_info, entry) + { + list_remove(&dependency->entry); + dependency_entry_free(dependency); + } + + LIST_FOR_EACH_ENTRY_SAFE(url, url_next, &comp->urls, struct url_info, entry) + { + list_remove(&url->entry); + url_entry_free(url); + } + + heap_free(comp); +} + +static void group_free(struct cifgroup *group) +{ + heap_free(group->id); + heap_free(group->description); + heap_free(group); +} + +static HRESULT WINAPI group_GetID(ICifGroup *iface, char *id, DWORD size) +{ + struct cifgroup *This = impl_from_ICifGroup(iface); + + TRACE("(%p)->(%p, %u)\n", This, id, size); + + return copy_substring_null(id, size, This->id); +} + +static HRESULT WINAPI group_GetDescription(ICifGroup *iface, char *desc, DWORD size) +{ + struct cifgroup *This = impl_from_ICifGroup(iface); + + TRACE("(%p)->(%p, %u)\n", This, desc, size); + + return copy_substring_null(desc, size, This->description); +} + +static DWORD WINAPI group_GetPriority(ICifGroup *iface) +{ + struct cifgroup *This = impl_from_ICifGroup(iface); + + TRACE("(%p)\n", This); + + return This->priority; +} + +static HRESULT WINAPI group_EnumComponents(ICifGroup *iface, IEnumCifComponents **enum_components, DWORD filter, LPVOID pv) +{ + struct cifgroup *This = impl_from_ICifGroup(iface); + struct ciffile *file; + + TRACE("(%p)->(%p, %u, %p)\n", This, enum_components, filter, pv); + + if (filter) + FIXME("filter (%x) not supported\n", filter); + if (pv) + FIXME("how to handle pv (%p)?\n", pv); + + file = impl_from_ICiffile(This->parent); + return enum_components_create(This->parent, &file->components, This->id, enum_components); +} + +static DWORD WINAPI group_GetCurrentPriority(ICifGroup *iface) +{ + struct cifgroup *This = impl_from_ICifGroup(iface); + + FIXME("(%p): stub\n", This); + + return 0; +} + +static const ICifGroupVtbl cifgroupVtbl = +{ + group_GetID, + group_GetDescription, + group_GetPriority, + group_EnumComponents, + group_GetCurrentPriority, +}; + +void component_set_actual_download_size(ICifComponent *iface, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + This->size_actual_download = size; +} + +void component_set_downloaded(ICifComponent *iface, BOOL value) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + This->downloaded = value; +} + +void component_set_installed(ICifComponent *iface, BOOL value) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + This->installed = value; +} + +char *component_get_id(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + return This->id; +} + +static HRESULT WINAPI component_GetID(ICifComponent *iface, char *id, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, id, size); + + return copy_substring_null(id, size, This->id); +} + +static HRESULT WINAPI component_GetGUID(ICifComponent *iface, char *guid, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, guid, size); + + return copy_substring_null(guid, size, This->guid); +} + +static HRESULT WINAPI component_GetDescription(ICifComponent *iface, char *desc, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, desc, size); + + return copy_substring_null(desc, size, This->description); +} + +static HRESULT WINAPI component_GetDetails(ICifComponent *iface, char *details, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, details, size); + + return copy_substring_null(details, size, This->details); +} + +static HRESULT WINAPI component_GetUrl(ICifComponent *iface, UINT index, char *url, DWORD size, DWORD *flags) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + struct url_info *entry; + + TRACE("(%p)->(%u, %p, %u, %p)\n", This, index, url, size, flags); + + /* FIXME: check how functions behaves for url == NULL */ + + if (!flags) + return E_FAIL; + + LIST_FOR_EACH_ENTRY(entry, &This->urls, struct url_info, entry) + { + if (entry->index != index) + continue; + + *flags = entry->flags; + return copy_substring_null(url, size, entry->url); + } + + return E_FAIL; +} + +static HRESULT WINAPI component_GetFileExtractList(ICifComponent *iface, UINT index, char *list, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %p, %u): stub\n", This, index, list, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetUrlCheckRange(ICifComponent *iface, UINT index, DWORD *min, DWORD *max) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %p, %p): stub\n", This, index, min, max); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetCommand(ICifComponent *iface, UINT index, char *cmd, DWORD cmd_size, char *switches, DWORD switch_size, DWORD *type) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %p, %u, %p, %u, %p): stub\n", This, index, cmd, cmd_size, switches, switch_size, type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetVersion(ICifComponent *iface, DWORD *version, DWORD *build) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %p)\n", This, version, build); + + if (!version || !build) + return E_FAIL; + + *version = This->version; + *build = This->build; + + return S_OK; +} + +static HRESULT WINAPI component_GetLocale(ICifComponent *iface, char *locale, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, locale, size); + + return copy_substring_null(locale, size, This->locale); +} + +static HRESULT WINAPI component_GetUninstallKey(ICifComponent *iface, char *key, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, key, size); + + return copy_substring_null(key, size, This->key_uninstall); +} + +static HRESULT WINAPI component_GetInstalledSize(ICifComponent *iface, DWORD *win, DWORD *app) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %p)\n", This, win, app); + + if (!win || !app) + return E_FAIL; + + *win = This->size_win; + *app = This->size_app; + + return S_OK; +} + +static DWORD WINAPI component_GetDownloadSize(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->size_download; +} + +static DWORD WINAPI component_GetExtractSize(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->size_extracted; +} + +static HRESULT WINAPI component_GetSuccessKey(ICifComponent *iface, char *key, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, key, size); + + return copy_substring_null(key, size, This->key_success); +} + +static HRESULT WINAPI component_GetProgressKeys(ICifComponent *iface, char *progress, DWORD progress_size, + char *cancel, DWORD cancel_size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + HRESULT hr; + + TRACE("(%p)->(%p, %u, %p, %u): semi-stub\n", This, progress, progress_size, cancel, cancel_size); + + hr = copy_substring_null(progress, progress_size, This->key_progress); + if (hr != S_OK) return hr; + + if (cancel_size > 0 && cancel) + *cancel = 0; + + return S_OK; +} + +static HRESULT WINAPI component_IsActiveSetupAware(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->as_aware ? S_OK : S_FALSE; +} + +static HRESULT WINAPI component_IsRebootRequired(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->reboot ? S_OK : S_FALSE; +} + +static HRESULT WINAPI component_RequiresAdminRights(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->admin ? S_OK : S_FALSE; +} + +static DWORD WINAPI component_GetPriority(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->priority; +} + +static HRESULT WINAPI component_GetDependency(ICifComponent *iface, UINT index, char *id, DWORD id_size, char *type, DWORD *ver, DWORD *build) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + struct dependency_info *entry; + ICifComponent *dependency; + int pos = 0; + + TRACE("(%p)->(%u, %p, %u, %p, %p, %p)\n", This, index, id, id_size, type, ver, build); + + if (!id || !ver || !build) + return E_FAIL; + + LIST_FOR_EACH_ENTRY(entry, &This->dependencies, struct dependency_info, entry) + { + if (pos++ < index) + continue; + + if (ICifFile_FindComponent(This->parent, entry->id, &dependency) == S_OK) + { + ICifComponent_GetVersion(dependency, ver, build); + } + else + { + *ver = -1; + *build = -1; + } + + if (entry->type) + *type = *entry->type; + else + *type = 'I'; + + return copy_substring_null(id, id_size, entry->id); + } + + return E_FAIL; +} + +static DWORD WINAPI component_GetPlatform(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->platform; +} + +static HRESULT WINAPI component_GetMode(ICifComponent *iface, UINT index, char *mode, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %p, %u): stub\n", This, index, mode, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetGroup(ICifComponent *iface, char *id, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, id, size); + + return copy_substring_null(id, size, This->group); +} + +static HRESULT WINAPI component_IsUIVisible(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->visibleui ? S_OK : S_FALSE; +} + +static HRESULT WINAPI component_GetPatchID(ICifComponent *iface, char *id, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%p, %u)\n", This, id, size); + + return copy_substring_null(id, size, This->patchid); +} + +static HRESULT WINAPI component_GetDetVersion(ICifComponent *iface, char *dll, DWORD dll_size, char *entry, DWORD entry_size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%p, %u, %p, %u): stub\n", This, dll, dll_size, entry, entry_size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetTreatAsOneComponents(ICifComponent *iface, UINT index, char *id, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %p, %u): stub\n", This, index, id, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI component_GetCustomData(ICifComponent *iface, char *key, char *data, DWORD size) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%s, %p, %u): stub\n", This, debugstr_a(key), data, size); + + return E_NOTIMPL; +} + +static DWORD WINAPI component_IsComponentInstalled(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->installed; +} + +static HRESULT WINAPI component_IsComponentDownloaded(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->downloaded ? S_OK : S_FALSE; +} + +static DWORD WINAPI component_IsThisVersionInstalled(ICifComponent *iface, DWORD version, DWORD build, DWORD *ret_version, DWORD *ret_build) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + FIXME("(%p)->(%u, %u, %p, %p): stub\n", This, version, build, ret_version, ret_build); + + return 0; +} + +static DWORD WINAPI component_GetInstallQueueState(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->queue_state; +} + +static HRESULT WINAPI component_SetInstallQueueState(ICifComponent *iface, DWORD state) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%u)\n", This, state); + + This->queue_state = state; + return S_OK; +} + +static DWORD WINAPI component_GetActualDownloadSize(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->size_download; +} + +static DWORD WINAPI component_GetCurrentPriority(ICifComponent *iface) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)\n", This); + + return This->current_priority; +} + + +static HRESULT WINAPI component_SetCurrentPriority(ICifComponent *iface, DWORD priority) +{ + struct cifcomponent *This = impl_from_ICifComponent(iface); + + TRACE("(%p)->(%u)\n", This, priority); + + This->current_priority = priority; + return S_OK; +} + +static const ICifComponentVtbl cifcomponentVtbl = +{ + component_GetID, + component_GetGUID, + component_GetDescription, + component_GetDetails, + component_GetUrl, + component_GetFileExtractList, + component_GetUrlCheckRange, + component_GetCommand, + component_GetVersion, + component_GetLocale, + component_GetUninstallKey, + component_GetInstalledSize, + component_GetDownloadSize, + component_GetExtractSize, + component_GetSuccessKey, + component_GetProgressKeys, + component_IsActiveSetupAware, + component_IsRebootRequired, + component_RequiresAdminRights, + component_GetPriority, + component_GetDependency, + component_GetPlatform, + component_GetMode, + component_GetGroup, + component_IsUIVisible, + component_GetPatchID, + component_GetDetVersion, + component_GetTreatAsOneComponents, + component_GetCustomData, + component_IsComponentInstalled, + component_IsComponentDownloaded, + component_IsThisVersionInstalled, + component_GetInstallQueueState, + component_SetInstallQueueState, + component_GetActualDownloadSize, + component_GetCurrentPriority, + component_SetCurrentPriority, +}; + +static HRESULT WINAPI enum_components_QueryInterface(IEnumCifComponents *iface, REFIID riid, void **ppv) +{ + struct ciffenum_components *This = impl_from_IEnumCifComponents(iface); + + if (IsEqualGUID(&IID_IUnknown, riid)) + { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IEnumCifComponents_iface; + } + /* + else if (IsEqualGUID(&IID_IEnumCifComponents, riid)) + { + TRACE("(%p)->(IID_ICifFile %p)\n", This, ppv); + *ppv = &This->IEnumCifComponents_iface; + } + */ + else + { + FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + return S_OK; +} + +static ULONG WINAPI enum_components_AddRef(IEnumCifComponents *iface) +{ + struct ciffenum_components *This = impl_from_IEnumCifComponents(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI enum_components_Release(IEnumCifComponents *iface) +{ + struct ciffenum_components *This = impl_from_IEnumCifComponents(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + { + ICifFile_Release(This->file); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI enum_components_Next(IEnumCifComponents *iface, ICifComponent **component) +{ + struct ciffenum_components *This = impl_from_IEnumCifComponents(iface); + struct cifcomponent *comp; + + TRACE("(%p)->(%p)\n", This, component); + + if (!component) + return E_FAIL; + + if (!This->position) + { + *component = NULL; + return E_FAIL; + } + + do + { + This->position = list_next(This->start, This->position); + if (!This->position) + { + *component = NULL; + return E_FAIL; + } + + comp = CONTAINING_RECORD(This->position, struct cifcomponent, entry); + } while (This->group_id && (!comp->group || strcmp(This->group_id, comp->group))); + + *component = &comp->ICifComponent_iface; + return S_OK; +} + +static HRESULT WINAPI enum_components_Reset(IEnumCifComponents *iface) +{ + struct ciffenum_components *This = impl_from_IEnumCifComponents(iface); + + TRACE("(%p)\n", This); + + This->position = This->start; + return S_OK; +} + +static const IEnumCifComponentsVtbl enum_componentsVtbl = +{ + enum_components_QueryInterface, + enum_components_AddRef, + enum_components_Release, + enum_components_Next, + enum_components_Reset, +}; + +static HRESULT enum_components_create(ICifFile *file, struct list *start, char *group_id, IEnumCifComponents **iface) +{ + struct ciffenum_components *enumerator; + + enumerator = heap_alloc_zero(sizeof(*enumerator)); + if (!enumerator) return E_OUTOFMEMORY; + + enumerator->IEnumCifComponents_iface.lpVtbl = &enum_componentsVtbl; + enumerator->ref = 1; + enumerator->file = file; + enumerator->start = start; + enumerator->position = start; + enumerator->group_id = group_id; + + ICifFile_AddRef(file); + + *iface = &enumerator->IEnumCifComponents_iface; + return S_OK; +} + +static HRESULT WINAPI enum_groups_QueryInterface(IEnumCifGroups *iface, REFIID riid, void **ppv) +{ + struct ciffenum_groups *This = impl_from_IEnumCifGroups(iface); + + if (IsEqualGUID(&IID_IUnknown, riid)) + { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IEnumCifGroups_iface; + } + /* + else if (IsEqualGUID(&IID_IEnumCifGroups, riid)) + { + TRACE("(%p)->(IID_ICifFile %p)\n", This, ppv); + *ppv = &This->IEnumCifGroups_iface; + } + */ + else + { + FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + return S_OK; +} + +static ULONG WINAPI enum_groups_AddRef(IEnumCifGroups *iface) +{ + struct ciffenum_groups *This = impl_from_IEnumCifGroups(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI enum_groups_Release(IEnumCifGroups *iface) +{ + struct ciffenum_groups *This = impl_from_IEnumCifGroups(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + { + ICifFile_Release(This->file); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI enum_groups_Next(IEnumCifGroups *iface, ICifGroup **group) +{ + struct ciffenum_groups *This = impl_from_IEnumCifGroups(iface); + struct cifgroup *gp; + + TRACE("(%p)->(%p)\n", This, group); + + if (!This->position || !group) + return E_FAIL; + + This->position = list_next(This->start, This->position); + + if (!This->position) + return E_FAIL; + + gp = CONTAINING_RECORD(This->position, struct cifgroup, entry); + *group = &gp->ICifGroup_iface; + return S_OK; +} + +static HRESULT WINAPI enum_groups_Reset(IEnumCifGroups *iface) +{ + struct ciffenum_groups *This = impl_from_IEnumCifGroups(iface); + + TRACE("(%p)\n", This); + + This->position = This->start; + return S_OK; +} + +static const IEnumCifGroupsVtbl enum_groupsVtbl = +{ + enum_groups_QueryInterface, + enum_groups_AddRef, + enum_groups_Release, + enum_groups_Next, + enum_groups_Reset, +}; + +static HRESULT enum_groups_create(ICifFile *file, struct list *start, IEnumCifGroups **iface) +{ + struct ciffenum_groups *enumerator; + + enumerator = heap_alloc_zero(sizeof(*enumerator)); + if (!enumerator) return E_OUTOFMEMORY; + + enumerator->IEnumCifGroups_iface.lpVtbl = &enum_groupsVtbl; + enumerator->ref = 1; + enumerator->file = file; + enumerator->start = start; + enumerator->position = start; + + ICifFile_AddRef(file); + + *iface = &enumerator->IEnumCifGroups_iface; + return S_OK; +} + +static HRESULT WINAPI ciffile_QueryInterface(ICifFile *iface, REFIID riid, void **ppv) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + if (IsEqualGUID(&IID_IUnknown, riid)) + { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->ICifFile_iface; + } + else if (IsEqualGUID(&IID_ICifFile, riid)) + { + TRACE("(%p)->(IID_ICifFile %p)\n", This, ppv); + *ppv = &This->ICifFile_iface; + } + else + { + FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + return S_OK; +} + +static ULONG WINAPI ciffile_AddRef(ICifFile *iface) +{ + struct ciffile *This = impl_from_ICiffile(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI ciffile_Release(ICifFile *iface) +{ + struct ciffile *This = impl_from_ICiffile(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + { + struct cifcomponent *comp, *comp_next; + struct cifgroup *group, *group_next; + + heap_free(This->name); + + LIST_FOR_EACH_ENTRY_SAFE(comp, comp_next, &This->components, struct cifcomponent, entry) + { + list_remove(&comp->entry); + component_free(comp); + } + + LIST_FOR_EACH_ENTRY_SAFE(group, group_next, &This->groups, struct cifgroup, entry) + { + list_remove(&group->entry); + group_free(group); + } + + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI ciffile_EnumComponents(ICifFile *iface, IEnumCifComponents **enum_components, DWORD filter, void *pv) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + TRACE("(%p)->(%p, %u, %p)\n", This, enum_components, filter, pv); + + if (filter) + FIXME("filter (%x) not supported\n", filter); + if (pv) + FIXME("how to handle pv (%p)?\n", pv); + + return enum_components_create(iface, &This->components, NULL, enum_components); +} + +static HRESULT WINAPI ciffile_FindComponent(ICifFile *iface, const char *id, ICifComponent **component) +{ + struct ciffile *This = impl_from_ICiffile(iface); + struct cifcomponent *comp; + + TRACE("(%p)->(%s, %p)\n", This, debugstr_a(id), component); + + LIST_FOR_EACH_ENTRY(comp, &This->components, struct cifcomponent, entry) + { + if (strcmp(comp->id, id) != 0) + continue; + + *component = &comp->ICifComponent_iface; + return S_OK; + } + + return E_FAIL; +} + +static HRESULT WINAPI ciffile_EnumGroups(ICifFile *iface, IEnumCifGroups **enum_groups, DWORD filter, void *pv) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + TRACE("(%p)->(%p, %u, %p)\n", This, enum_groups, filter, pv); + + if (filter) + FIXME("filter (%x) not supported\n", filter); + if (pv) + FIXME("how to handle pv (%p)?\n", pv); + + return enum_groups_create(iface, &This->groups, enum_groups); +} + +static HRESULT WINAPI ciffile_FindGroup(ICifFile *iface, const char *id, ICifGroup **group) +{ + struct ciffile *This = impl_from_ICiffile(iface); + struct cifgroup *gp; + + TRACE("(%p)->(%s, %p)\n", This, debugstr_a(id), group); + + LIST_FOR_EACH_ENTRY(gp, &This->groups, struct cifgroup, entry) + { + if (strcmp(gp->id, id) != 0) + continue; + + *group = &gp->ICifGroup_iface; + return S_OK; + } + + return E_FAIL; +} + +static HRESULT WINAPI ciffile_EnumModes(ICifFile *iface, IEnumCifModes **cuf_modes, DWORD filter, void *pv) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + FIXME("(%p)->(%p, %u, %p): stub\n", This, cuf_modes, filter, pv); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ciffile_FindMode(ICifFile *iface, const char *id, ICifMode **mode) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + FIXME("(%p)->(%s, %p): stub\n", This, debugstr_a(id), mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ciffile_GetDescription(ICifFile *iface, char *desc, DWORD size) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + TRACE("(%p)->(%p, %u)\n", This, desc, size); + + return copy_substring_null(desc, size, This->name); +} + +static HRESULT WINAPI ciffile_GetDetDlls(ICifFile *iface, char *dlls, DWORD size) +{ + struct ciffile *This = impl_from_ICiffile(iface); + + FIXME("(%p)->(%p, %u): stub\n", This, dlls, size); + + return E_NOTIMPL; +} + +static const ICifFileVtbl ciffileVtbl = +{ + ciffile_QueryInterface, + ciffile_AddRef, + ciffile_Release, + ciffile_EnumComponents, + ciffile_FindComponent, + ciffile_EnumGroups, + ciffile_FindGroup, + ciffile_EnumModes, + ciffile_FindMode, + ciffile_GetDescription, + ciffile_GetDetDlls, +}; + +static BOOL copy_string(char **dest, const char *source) +{ + if (!source) + { + *dest = NULL; + return TRUE; + } + + *dest = strdupA(source); + if (!dest) return FALSE; + return TRUE; +} + +static BOOL section_get_str(struct inf_section *inf_sec, const char *key, char **value, const char *def) +{ + struct inf_value *inf_val; + + inf_val = inf_get_value(inf_sec, key); + if (!inf_val) return copy_string(value, def); + + *value = inf_value_get_value(inf_val); + if (!*value) return FALSE; + + return TRUE; +} + +static char *next_part(char **str, BOOL strip_quotes) +{ + char *start = *str; + char *next = *str; + + while (*next && *next != ',') + next++; + + if (!*next) + { + *str = trim(start, NULL, strip_quotes); + return NULL; + } + + *next = 0; + *str = trim(start, NULL, strip_quotes); + return ++next; +} + +static BOOL value_get_str_field(struct inf_value *inf_val, int field, char **value, const char *def) +{ + char *line, *str, *next; + int i = 0; + + line = inf_value_get_value(inf_val); + if (!line) return FALSE; + + str = line; + do + { + i++; + next = next_part(&str, TRUE); + + if (field == i) + { + BOOL ret = copy_string(value, str); + heap_free(line); + return ret; + } + + str = next; + } while (str); + + return copy_string(value, def); +} + +/* +static BOOL section_get_str_field(struct inf_section *inf_sec, const char *key, int field, char **value, const char *def) +{ + struct inf_value *inf_val; + + inf_val = inf_get_value(inf_sec, key); + if (!inf_val) return copy_string(value, def); + + return value_get_str_field(inf_val, field, value, def); +} +*/ + +static BOOL section_get_dword(struct inf_section *inf_sec, const char *key, DWORD *value, DWORD def) +{ + struct inf_value *inf_val; + char *str; + + inf_val = inf_get_value(inf_sec, key); + if (!inf_val) + { + *value = def; + return TRUE; + } + + str = inf_value_get_value(inf_val); + if (!str) return FALSE; + + *value = atoi(str); + heap_free(str); + + return TRUE; +} + +static BOOL value_get_dword_field(struct inf_value *inf_val, int field, DWORD *value, DWORD def) +{ + char *value_str; + BOOL ret; + + ret = value_get_str_field(inf_val, field, &value_str, NULL); + if (!ret) return FALSE; + if (!value_str) + { + *value = def; + return TRUE; + } + + *value = atoi(value_str); + heap_free(value_str); + + return TRUE; +} + +static BOOL section_get_dword_field(struct inf_section *inf_sec, const char *key, int field, DWORD *value, DWORD def) +{ + struct inf_value *inf_val; + + inf_val = inf_get_value(inf_sec, key); + if (!inf_val) + { + *value = def; + return TRUE; + } + + return value_get_dword_field(inf_val, field, value, def); +} + +static HRESULT process_version(struct ciffile *file, struct inf_section *section) +{ + if (!section_get_str(section, "DisplayName", &file->name, DEFAULT_INSTALLER_DESC)) + return E_OUTOFMEMORY; + + return S_OK; +} + +static BOOL read_version_entry(struct inf_section *section, DWORD *ret_ver, DWORD *ret_build) +{ + DWORD version = 0; + DWORD build = 0; + char *line, *str, *next; + + if (!section_get_str(section, "Version", &line, NULL)) + return FALSE; + if (!line) goto done; + + str = line; + + next = next_part(&str, TRUE); + version |= atoi(str) << 16; + if (!next) goto done; + str = next; + + next = next_part(&str, TRUE); + version |= atoi(str) & 0xffff; + if (!next) goto done; + str = next; + + next = next_part(&str, TRUE); + build |= atoi(str) << 16; + if (!next) goto done; + str = next; + + next_part(&str, TRUE); + build |= atoi(str) & 0xffff; + +done: + heap_free(line); + *ret_ver = version; + *ret_build = build; + return TRUE; +} + +static BOOL read_platform_entry(struct inf_section *section, DWORD *ret_platform) +{ + DWORD platform = PLATFORM_ALL; + char *line, *str, *next; + + if (!section_get_str(section, "Platform", &line, NULL)) + return FALSE; + if (!line) goto done; + + platform = 0; + str = line; + do + { + next = next_part(&str, TRUE); + + if (strcasecmp(str, "Win95") == 0) + platform |= PLATFORM_WIN98; + else if (strcasecmp(str, "Win98") == 0) + platform |= PLATFORM_WIN98; + else if (strcasecmp(str, "NT4") == 0) + platform |= PLATFORM_NT4; + else if (strcasecmp(str, "NT5") == 0) + platform |= PLATFORM_NT5; + else if (strcasecmp(str, "NT4Alpha") == 0) + platform |= PLATFORM_NT4; + else if (strcasecmp(str, "NT5Alpha") == 0) + platform |= PLATFORM_NT5; + else if (strcasecmp(str, "Millen") == 0) + platform |= PLATFORM_MILLEN; + else + FIXME("Unknown platform: %s\n", debugstr_a(str)); + + str = next; + } while (str); + +done: + heap_free(line); + *ret_platform = platform; + return TRUE; +} + +static BOOL read_dependencies(struct cifcomponent *component, struct inf_section *section) +{ + struct dependency_info *dependency; + char *line, *str, *next; + BOOL ret = TRUE; + + if (!section_get_str(section, "Dependencies", &line, NULL)) + return E_OUTOFMEMORY; + if (!line) goto done; + + ret = FALSE; + str = line; + do + { + next = next_part(&str, TRUE); + + dependency = heap_alloc_zero(sizeof(*dependency)); + if (!dependency) goto done; + + dependency->id = strdupA(str); + if (!dependency->id) + { + heap_free(dependency); + goto done; + } + + dependency->type = strstr(dependency->id, ":"); + if (dependency->type) *dependency->type++ = 0; + + list_add_tail(&component->dependencies, &dependency->entry); + + str = next; + } while (str); + + ret = TRUE; + +done: + heap_free(line); + return ret; +} + +static BOOL read_urls(struct cifcomponent *component, struct inf_section *section) +{ + struct inf_value *inf_value = NULL; + struct url_info *url_entry; + char *str, *next; + int index; + + while (inf_section_next_value(section, &inf_value)) + { + str = inf_value_get_key(inf_value); + if (!str) return E_OUTOFMEMORY; + + if (strncasecmp(str, "URL", 3)) + goto next; + + if (!str[3]) + goto next; + + index = strtol(str+3, &next, 10); + if (next == str+3 || *next != 0 || index < 1) + goto next; + index--; + + url_entry = heap_alloc_zero(sizeof(*url_entry)); + if (!url_entry) goto error; + + url_entry->index = index; + + if (!value_get_str_field(inf_value, 1, &url_entry->url, NULL)) + goto error; + if (!url_entry->url || !*url_entry->url) + { + url_entry_free(url_entry); + goto next; + } + + if (!value_get_dword_field(inf_value, 2, &url_entry->flags, 0)) + goto error; + + list_add_tail(&component->urls, &url_entry->entry); + + next: + heap_free(str); + } + + return TRUE; + +error: + heap_free(str); + url_entry_free(url_entry); + return FALSE; +}; + +void add_component_by_priority(struct ciffile *file, struct cifcomponent *component) +{ + struct cifcomponent *entry; + + LIST_FOR_EACH_ENTRY(entry, &file->components, struct cifcomponent, entry) + { + if (entry->priority > component->priority) + continue; + + list_add_before(&entry->entry, &component->entry); + return; + } + + list_add_tail(&file->components, &component->entry); +} + +static HRESULT process_component(struct ciffile *file, struct inf_section *section, const char *section_name) +{ + struct cifcomponent *component; + HRESULT hr = E_OUTOFMEMORY; + + component = heap_alloc_zero(sizeof(*component)); + if (!component) return E_OUTOFMEMORY; + + component->ICifComponent_iface.lpVtbl = &cifcomponentVtbl; + component->parent = &file->ICifFile_iface; + + list_init(&component->urls); + list_init(&component->dependencies); + + component->queue_state = ActionNone; + + component->id = strdupA(section_name); + if (!component->id) goto error; + + if (!section_get_str(section, "DisplayName", &component->description, NULL)) + goto error; + if (!section_get_str(section, "GUID", &component->guid, NULL)) + goto error; + if (!section_get_str(section, "Details", &component->details, NULL)) + goto error; + if (!section_get_str(section, "Group", &component->group, NULL)) + goto error; + if (!section_get_str(section, "Locale", &component->locale, "en")) + goto error; + if (!section_get_str(section, "PatchID", &component->patchid, NULL)) + goto error; + + if (!section_get_dword_field(section, "Size", 1, &component->size_download, 0)) + goto error; + if (!section_get_dword_field(section, "Size", 2, &component->size_extracted, 0)) + goto error; + if (!section_get_dword_field(section, "InstalledSize", 1, &component->size_app, 0)) + goto error; + if (!section_get_dword_field(section, "InstalledSize", 2, &component->size_win, 0)) + goto error; + + if (!section_get_str(section, "SuccessKey", &component->key_success, NULL)) + goto error; + if (!section_get_str(section, "CancelKey", &component->key_cancel, NULL)) + goto error; + if (!section_get_str(section, "ProgressKey", &component->key_progress, NULL)) + goto error; + if (!section_get_str(section, "UninstallKey", &component->key_uninstall, NULL)) + goto error; + if (!section_get_dword(section, "Reboot", &component->reboot, 0)) + goto error; + if (!section_get_dword(section, "AdminCheck", &component->admin, 0)) + goto error; + if (!section_get_dword(section, "UIVisible", &component->visibleui, 1)) + goto error; + if (!section_get_dword(section, "ActiveSetupAware", &component->as_aware, 0)) + goto error; + if (!section_get_dword(section, "Priority", &component->priority, 0)) + goto error; + + if (!read_version_entry(section, &component->version, &component->build)) + goto error; + if (!read_platform_entry(section, &component->platform)) + goto error; + if (!read_urls(component, section)) + goto error; + if (!read_dependencies(component, section)) + goto error; + + component->current_priority = component->priority; + + add_component_by_priority(file, component); + return S_OK; + +error: + component_free(component); + return hr; +} + +static HRESULT process_group(struct ciffile *file, struct inf_section *section, const char *section_name) +{ + struct cifgroup *group; + HRESULT hr = E_OUTOFMEMORY; + + group = heap_alloc_zero(sizeof(*group)); + if (!group) return E_OUTOFMEMORY; + + group->ICifGroup_iface.lpVtbl = &cifgroupVtbl; + group->parent = &file->ICifFile_iface; + + group->id = strdupA(section_name); + if (!group->id) goto error; + + if (!section_get_str(section, "DisplayName", &group->description, NULL)) + goto error; + if (!section_get_dword(section, "Priority", &group->priority, 0)) + goto error; + + list_add_head(&file->groups, &group->entry); + return S_OK; + +error: + group_free(group); + return hr; +} + +static HRESULT process_section(struct ciffile *file, struct inf_section *section, const char *section_name) +{ + HRESULT hr; + char *type; + + if (!section_get_str(section, "SectionType", &type, "Component")) + return E_OUTOFMEMORY; + + if (!strcasecmp(type, "Component")) + hr = process_component(file, section, section_name); + else if (strcasecmp(type, "Group") == 0) + hr = process_group(file, section, section_name); + else + FIXME("Don't know how to process %s\n", debugstr_a(type)); + + heap_free(type); + return hr; +} + +static HRESULT process_inf(struct ciffile *file, struct inf_file *inf) +{ + struct inf_section *section = NULL; + char *section_name; + HRESULT hr = S_OK; + + while (SUCCEEDED(hr) && inf_next_section(inf, §ion)) + { + section_name = inf_section_get_name(section); + if (!section_name) return E_OUTOFMEMORY; + + TRACE("start processing section %s\n", debugstr_a(section_name)); + + if (!strcasecmp(section_name, "Strings") || + !strncasecmp(section_name, "Strings.", strlen("Strings."))) + { + /* Ignore string sections */ + } + else if (strcasecmp(section_name, "Version") == 0) + hr = process_version(file, section); + else + hr = process_section(file, section, section_name); + + TRACE("finished processing section %s (%x)\n", debugstr_a(section_name), hr); + heap_free(section_name); + } + + /* In case there was no version section, set the default installer description */ + if (SUCCEEDED(hr) && !file->name) + { + file->name = strdupA(DEFAULT_INSTALLER_DESC); + if (!file->name) hr = E_OUTOFMEMORY; + } + + return hr; +} + +static HRESULT load_ciffile(const char *path, ICifFile **icif) +{ + struct inf_file *inf = NULL; + struct ciffile *file; + HRESULT hr = E_FAIL; + + file = heap_alloc_zero(sizeof(*file)); + if(!file) return E_OUTOFMEMORY; + + file->ICifFile_iface.lpVtbl = &ciffileVtbl; + file->ref = 1; + + list_init(&file->components); + list_init(&file->groups); + + hr = inf_load(path, &inf); + if (FAILED(hr)) goto error; + + hr = process_inf(file, inf); + if (FAILED(hr)) goto error; + + *icif = &file->ICifFile_iface; + return S_OK; + +error: + if (inf) inf_free(inf); + ICifFile_Release(&file->ICifFile_iface); + return hr; +} + +HRESULT WINAPI GetICifFileFromFile(ICifFile **icif, const char *path) +{ + TRACE("(%p, %s)\n", icif, debugstr_a(path)); + + return load_ciffile(path, icif); +} + + +HRESULT WINAPI GetICifRWFileFromFile(ICifRWFile **icif, const char *path) +{ + FIXME("(%p, %s): stub\n", icif, debugstr_a(path)); + + return E_NOTIMPL; +} diff --git a/dll/win32/inseng/inf.c b/dll/win32/inseng/inf.c new file mode 100644 index 0000000000..bead72c082 --- /dev/null +++ b/dll/win32/inseng/inf.c @@ -0,0 +1,443 @@ +/* + * Copyright 2016 Michael Müller + * + * 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 <string.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" + +#include "inseng_private.h" + +#include "wine/list.h" + +struct inf_value +{ + struct list entry; + char *key; + char *value; + + struct inf_section *section; +}; + +struct inf_section +{ + struct list entry; + char *name; + struct list values; + + struct inf_file *file; +}; + +struct inf_file +{ + char *content; + DWORD size; + struct list sections; +}; + +static void inf_value_free(struct inf_value *value) +{ + heap_free(value); +} + +static void inf_section_free(struct inf_section *section) +{ + struct inf_value *val, *val_next; + LIST_FOR_EACH_ENTRY_SAFE(val, val_next, §ion->values, struct inf_value, entry) + { + list_remove(&val->entry); + inf_value_free(val); + } + + heap_free(section); +} + +static const char *get_substitution(struct inf_file *inf, const char *name, int len) +{ + struct inf_section *sec; + struct inf_value *value = NULL; + + sec = inf_get_section(inf, "Strings"); + if (!sec) return NULL; + + while (inf_section_next_value(sec, &value)) + { + if (strlen(value->key) == len && !strncasecmp(value->key, name, len)) + return value->value; + } + + return NULL; +} + +static int expand_variables_buffer(struct inf_file *inf, const char *str, char *output) +{ + const char *p, *var_start = NULL; + int var_len = 0, len = 0; + const char *substitution; + + for (p = str; *p; p++) + { + if (*p != '%') + { + if (var_start) + var_len++; + else + { + if (output) + *output++ = *p; + len++; + } + + continue; + } + + if (!var_start) + { + var_start = p; + var_len = 0; + + continue; + } + + if (!var_len) + { + /* just an escaped % */ + if (output) + *output++ = '%'; + len += 1; + + var_start = NULL; + continue; + } + + substitution = get_substitution(inf, var_start + 1, var_len); + if (!substitution) + { + if (output) + { + memcpy(output, var_start, var_len + 2); + output += var_len + 2; + } + len += var_len + 2; + } + else + { + int sub_len = strlen(substitution); + + if (output) + { + memcpy(output, substitution, sub_len); + output += sub_len; + } + len += sub_len; + } + + var_start = NULL; + } + + if (output) *output = 0; + return len + 1; +} + +static char *expand_variables(struct inf_file *inf, const char *str) +{ + char *buffer; + int len; + + len = expand_variables_buffer(inf, str, NULL); + buffer = heap_alloc(len); + if (!len) return NULL; + + expand_variables_buffer(inf, str, buffer); + return buffer; +} + +void inf_free(struct inf_file *inf) +{ + struct inf_section *sec, *sec_next; + LIST_FOR_EACH_ENTRY_SAFE(sec, sec_next, &inf->sections, struct inf_section, entry) + { + list_remove(&sec->entry); + inf_section_free(sec); + } + + heap_free(inf->content); + heap_free(inf); +} + +BOOL inf_next_section(struct inf_file *inf, struct inf_section **sec) +{ + struct list *next_entry, *cur_position; + + if (*sec) + cur_position = &(*sec)->entry; + else + cur_position = &inf->sections; + + next_entry = list_next(&inf->sections, cur_position); + if (!next_entry) return FALSE; + + *sec = CONTAINING_RECORD(next_entry, struct inf_section, entry); + return TRUE; +} + +struct inf_section *inf_get_section(struct inf_file *inf, const char *name) +{ + struct inf_section *sec = NULL; + + while (inf_next_section(inf, &sec)) + { + if (!strcasecmp(sec->name, name)) + return sec; + } + + return NULL; +} + +char *inf_section_get_name(struct inf_section *section) +{ + return strdupA(section->name); +} + +BOOL inf_section_next_value(struct inf_section *sec, struct inf_value **value) +{ + struct list *next_entry, *cur_position; + + if (*value) + cur_position = &(*value)->entry; + else + cur_position = &sec->values; + + next_entry = list_next(&sec->values, cur_position); + if (!next_entry) return FALSE; + + *value = CONTAINING_RECORD(next_entry, struct inf_value, entry); + return TRUE; +} + +struct inf_value *inf_get_value(struct inf_section *sec, const char *key) +{ + struct inf_value *value = NULL; + + while (inf_section_next_value(sec, &value)) + { + if (!strcasecmp(value->key, key)) + return value; + } + + return NULL; +} + +char *inf_value_get_key(struct inf_value *value) +{ + return strdupA(value->key); +} + +char *inf_value_get_value(struct inf_value *value) +{ + return expand_variables(value->section->file, value->value); +} + +char *trim(char *str, char **last_chr, BOOL strip_quotes) +{ + char *last; + + for (; *str; str++) + { + if (*str != '\t' && *str != ' ') + break; + } + + if (!*str) + { + if (last_chr) *last_chr = str; + return str; + } + + last = str + strlen(str) - 1; + + for (; last > str; last--) + { + if (*last != '\t' && *last != ' ') + break; + *last = 0; + } + + if (strip_quotes && last != str) + { + if (*last == '"' && *str == '"') + { + str++; + *last = 0; + } + } + + if (last_chr) *last_chr = last; + return str; +} + +static char *get_next_line(char **str, char **last_chr) +{ + BOOL in_next_line = FALSE; + char *start, *next; + + start = *str; + if (!start || !*start) return NULL; + + for (next = start; *next; next++) + { + if (*next == '\n' || *next == '\r') + { + *next = 0; + in_next_line = TRUE; + } + else if (in_next_line) + { + break; + } + } + + *str = next; + return trim(start, last_chr, FALSE); +} + +/* This function only fails in case of an memory allocation error + * and does not touch section in case the parsing failed. */ +static HRESULT inf_section_parse(struct inf_file *inf, char *line, char *last_chr, struct inf_section **section) +{ + struct inf_section *sec; + char *comment; + char *name; + + if (*line != '[') + return S_OK; + + line++; + + comment = strchr(line, ';'); + if (comment) + { + *comment = 0; + line = trim(line, &last_chr, FALSE); + } + + if (*last_chr != ']') + return S_OK; + + *last_chr = 0; + name = trim(line, NULL, FALSE); + if (!name) return S_OK; + + sec = heap_alloc_zero(sizeof(*sec)); + if (!sec) return E_OUTOFMEMORY; + + sec->name = name; + sec->file = inf; + list_init(&sec->values); + + list_add_tail(&inf->sections, &sec->entry); + + *section = sec; + return S_OK; +} + +static HRESULT inf_value_parse(struct inf_section *sec, char *line) +{ + struct inf_value *key_val; + char *key, *value, *del; + + del = strchr(line, '='); + if (!del) return S_OK; + + *del = 0; + key = line; + value = del + 1; + + key = trim(key, NULL, FALSE); + value = trim(value, NULL, TRUE); + + key_val = heap_alloc_zero(sizeof(*key_val)); + if (!key_val) return E_OUTOFMEMORY; + + key_val->key = key; + key_val->value = value; + key_val->section = sec; + + list_add_tail(&sec->values, &key_val->entry); + return S_OK; +} + +static HRESULT inf_process_content(struct inf_file *inf) +{ + struct inf_section *section = NULL; + char *content = inf->content; + char *line, *last_chr; + HRESULT hr = S_OK; + + while (SUCCEEDED(hr) && (line = get_next_line(&content, &last_chr))) + { + if (*line == '[') + hr = inf_section_parse(inf, line, last_chr, §ion); + else if (strchr(line, '=') && section) + hr = inf_value_parse(section, line); + } + + return hr; +} + +HRESULT inf_load(const char *path, struct inf_file **inf_file) +{ + LARGE_INTEGER file_size; + struct inf_file *inf; + HRESULT hr = E_FAIL; + HANDLE file; + DWORD read; + + file = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (file == INVALID_HANDLE_VALUE) return E_FAIL; + + inf = heap_alloc_zero(sizeof(*inf)); + if (!inf) goto error; + + if (!GetFileSizeEx(file, &file_size)) + goto error; + + inf->size = file_size.QuadPart; + + inf->content = heap_alloc_zero(inf->size); + if (!inf->content) goto error; + + list_init(&inf->sections); + + if (!ReadFile(file, inf->content, inf->size, &read, NULL) || read != inf->size) + goto error; + + hr = inf_process_content(inf); + if (FAILED(hr)) goto error; + + CloseHandle(file); + *inf_file = inf; + return S_OK; + +error: + if (inf) inf_free(inf); + CloseHandle(file); + return hr; +} diff --git a/dll/win32/inseng/inseng.spec b/dll/win32/inseng/inseng.spec index 69703284e6..849c3c5663 100644 --- a/dll/win32/inseng/inseng.spec +++ b/dll/win32/inseng/inseng.spec @@ -7,6 +7,6 @@ @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() @ stub DownloadFile -@ stdcall -stub GetICifFileFromFile(ptr str) -@ stdcall -stub GetICifRWFileFromFile(ptr str) +@ stdcall GetICifFileFromFile(ptr str) +@ stdcall GetICifRWFileFromFile(ptr str) @ stub PurgeDownloadDirectory diff --git a/dll/win32/inseng/inseng_main.c b/dll/win32/inseng/inseng_main.c index 4b69f282f7..8e2c481493 100644 --- a/dll/win32/inseng/inseng_main.c +++ b/dll/win32/inseng/inseng_main.c @@ -2,6 +2,7 @@ * INSENG Implementation * * Copyright 2006 Mike McCormack + * Copyright 2016 Michael M�ller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,13 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS -#include <config.h> +#include "config.h" #include <stdarg.h> @@ -33,28 +30,73 @@ #include "winuser.h" #include "ole2.h" #include "rpcproxy.h" +#include "urlmon.h" +#ifdef __REACTOS__ +#include <winreg.h> +#endif +#include "shlwapi.h" #include "initguid.h" #include "inseng.h" +#include "inseng_private.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(inseng); -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) +static HINSTANCE instance; + +enum thread_operation { - return HeapAlloc(GetProcessHeap(), 0, size); -} + OP_DOWNLOAD, + OP_INSTALL +}; -static inline BOOL heap_free(void *mem) +struct thread_info { - return HeapFree(GetProcessHeap(), 0, mem); -} + DWORD operation; + DWORD jobflags; + IEnumCifComponents *enum_comp; -static HINSTANCE instance; + DWORD download_size; + DWORD install_size; + + DWORD downloaded_kb; + ULONGLONG download_start; +}; struct InstallEngine { IInstallEngine2 IInstallEngine2_iface; + IInstallEngineTiming IInstallEngineTiming_iface; LONG ref; + + IInstallEngineCallback *callback; + char *baseurl; + char *downloaddir; + ICifFile *icif; + DWORD status; + + /* used for the installation thread */ + struct thread_info thread; +}; + +struct downloadcb +{ + IBindStatusCallback IBindStatusCallback_iface; + LONG ref; + + WCHAR *file_name; + WCHAR *cache_file; + + char *id; + char *display; + + DWORD dl_size; + DWORD dl_previous_kb; + + InstallEngine *engine; + HANDLE event_done; + HRESULT hr; }; static inline InstallEngine *impl_from_IInstallEngine2(IInstallEngine2 *iface) @@ -62,6 +104,250 @@ static inline InstallEngine *impl_from_IInstallEngine2(IInstallEngine2 *iface) return CONTAINING_RECORD(iface, InstallEngine, IInstallEngine2_iface); } +static inline struct downloadcb *impl_from_IBindStatusCallback(IBindStatusCallback *iface) +{ + return CONTAINING_RECORD(iface, struct downloadcb, IBindStatusCallback_iface); +} + +static inline InstallEngine *impl_from_IInstallEngineTiming(IInstallEngineTiming *iface) +{ + return CONTAINING_RECORD(iface, InstallEngine, IInstallEngineTiming_iface); +} + +static HRESULT WINAPI downloadcb_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + if (IsEqualGUID(&IID_IUnknown, riid)) + { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IBindStatusCallback_iface; + } + else if (IsEqualGUID(&IID_IBindStatusCallback, riid)) + { + TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv); + *ppv = &This->IBindStatusCallback_iface; + } + else + { + FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + return S_OK; +} + +static ULONG WINAPI downloadcb_AddRef(IBindStatusCallback *iface) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref = %d\n", This, ref); + + return ref; +} + +static ULONG WINAPI downloadcb_Release(IBindStatusCallback *iface) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref = %d\n", This, ref); + + if (!ref) + { + heap_free(This->file_name); + heap_free(This->cache_file); + + IInstallEngine2_Release(&This->engine->IInstallEngine2_iface); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI downloadcb_OnStartBinding(IBindStatusCallback *iface, DWORD reserved, IBinding *pbind) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + TRACE("(%p)->(%u %p)\n", This, reserved, pbind); + + return S_OK; +} + +static HRESULT WINAPI downloadcb_GetPriority(IBindStatusCallback *iface, LONG *priority) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + FIXME("(%p)->(%p): stub\n", This, priority); + + return E_NOTIMPL; +} + +static HRESULT WINAPI downloadcb_OnLowResource(IBindStatusCallback *iface, DWORD reserved) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + FIXME("(%p)->(%u): stub\n", This, reserved); + + return E_NOTIMPL; +} + +static HRESULT WINAPI downloadcb_OnProgress(IBindStatusCallback *iface, ULONG progress, + ULONG progress_max, ULONG status, const WCHAR *status_text) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + HRESULT hr = S_OK; + + TRACE("%p)->(%u %u %u %s)\n", This, progress, progress_max, status, debugstr_w(status_text)); + + switch(status) + { + case BINDSTATUS_BEGINDOWNLOADDATA: + if (!This->engine->thread.download_start) + This->engine->thread.download_start = GetTickCount64(); + /* fall-through */ + case BINDSTATUS_DOWNLOADINGDATA: + case BINDSTATUS_ENDDOWNLOADDATA: + This->engine->thread.downloaded_kb = This->dl_previous_kb + progress / 1024; + if (This->engine->callback) + { + hr = IInstallEngineCallback_OnComponentProgress(This->engine->callback, + This->id, INSTALLSTATUS_DOWNLOADING, This->display, NULL, progress / 1024, This->dl_size); + } + break; + + case BINDSTATUS_CACHEFILENAMEAVAILABLE: + This->cache_file = strdupW(status_text); + if (!This->cache_file) + { + ERR("Failed to allocate memory for cache file\n"); + hr = E_OUTOFMEMORY; + } + break; + + case BINDSTATUS_CONNECTING: + case BINDSTATUS_SENDINGREQUEST: + case BINDSTATUS_MIMETYPEAVAILABLE: + case BINDSTATUS_FINDINGRESOURCE: + break; + + default: + FIXME("Unsupported status %u\n", status); + } + + return hr; +} + +static HRESULT WINAPI downloadcb_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError)); + + if (FAILED(hresult)) + { + This->hr = hresult; + goto done; + } + + if (!This->cache_file) + { + This->hr = E_FAIL; + goto done; + } + + if (CopyFileW(This->cache_file, This->file_name, FALSE)) + This->hr = S_OK; + else + { + ERR("CopyFile failed: %u\n", GetLastError()); + This->hr = E_FAIL; + } + +done: + SetEvent(This->event_done); + return S_OK; +} + +static HRESULT WINAPI downloadcb_GetBindInfo(IBindStatusCallback *iface, + DWORD *grfBINDF, BINDINFO *pbindinfo) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo); + + *grfBINDF = BINDF_PULLDATA | BINDF_NEEDFILE; + return S_OK; +} + +static HRESULT WINAPI downloadcb_OnDataAvailable(IBindStatusCallback *iface, + DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + TRACE("(%p)->(%08x %u %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed); + + return S_OK; +} + +static HRESULT WINAPI downloadcb_OnObjectAvailable(IBindStatusCallback *iface, + REFIID riid, IUnknown *punk) +{ + struct downloadcb *This = impl_from_IBindStatusCallback(iface); + + FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), punk); + + return E_NOTIMPL; +} + +static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = +{ + downloadcb_QueryInterface, + downloadcb_AddRef, + downloadcb_Release, + downloadcb_OnStartBinding, + downloadcb_GetPriority, + downloadcb_OnLowResource, + downloadcb_OnProgress, + downloadcb_OnStopBinding, + downloadcb_GetBindInfo, + downloadcb_OnDataAvailable, + downloadcb_OnObjectAvailable +}; + +static HRESULT downloadcb_create(InstallEngine *engine, HANDLE event, char *file_name, char *id, + char *display, DWORD dl_size, struct downloadcb **callback) +{ + struct downloadcb *cb; + + cb = heap_alloc_zero(sizeof(*cb)); + if (!cb) return E_OUTOFMEMORY; + + cb->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl; + cb->ref = 1; + cb->hr = E_FAIL; + cb->id = id; + cb->display = display; + cb->engine = engine; + cb->dl_size = dl_size; + cb->dl_previous_kb = engine->thread.downloaded_kb; + cb->event_done = event; + cb->file_name = strAtoW(file_name); + if (!cb->file_name) + { + heap_free(cb); + return E_OUTOFMEMORY; + } + + IInstallEngine2_AddRef(&engine->IInstallEngine2_iface); + + *callback = cb; + return S_OK; +} + static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv) { InstallEngine *This = impl_from_IInstallEngine2(iface); @@ -75,13 +361,16 @@ static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFII }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) { TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv); *ppv = &This->IInstallEngine2_iface; + }else if(IsEqualGUID(&IID_IInstallEngineTiming, riid)) { + TRACE("(%p)->(IID_IInstallEngineTiming %p)\n", This, ppv); + *ppv = &This->IInstallEngineTiming_iface; }else { - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); *ppv = NULL; return E_NOINTERFACE; } - IUnknown_AddRef((IUnknown*)*ppv); + IUnknown_AddRef((IUnknown *)*ppv); return S_OK; } @@ -102,181 +391,726 @@ static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface) TRACE("(%p) ref=%d\n", This, ref); - if(!ref) + if (!ref) + { + if (This->icif) + ICifFile_Release(This->icif); + + heap_free(This->baseurl); + heap_free(This->downloaddir); heap_free(This); + } return ref; } +static void set_status(InstallEngine *This, DWORD status) +{ + This->status = status; + + if (This->callback) + IInstallEngineCallback_OnEngineStatusChange(This->callback, status, 0); +} + +static HRESULT calc_sizes(IEnumCifComponents *enum_comp, DWORD operation, DWORD *size_download, DWORD *size_install) +{ + ICifComponent *comp; + DWORD download = 0; + DWORD install = 0; + HRESULT hr; + + /* FIXME: what about inactive dependencies and how does + * INSTALLOPTIONS_FORCEDEPENDENCIES play into this ?*/ + + hr = IEnumCifComponents_Reset(enum_comp); + if (FAILED(hr)) return hr; + + while (SUCCEEDED(IEnumCifComponents_Next(enum_comp, &comp))) + { + if (ICifComponent_GetInstallQueueState(comp) != ActionInstall) + continue; + + /* FIXME: handle install options and find out the default options*/ + if (operation == OP_DOWNLOAD && ICifComponent_IsComponentDownloaded(comp) == S_FALSE) + download = ICifComponent_GetDownloadSize(comp); + /* + if (operation == OP_INSTALL && ICifComponent_IsComponentInstalled(comp) == S_FALSE) + install = ICifComponent_GetInstalledSize(comp); + */ + } + + *size_download = download; + *size_install = install; + + return S_OK; +} + +static HRESULT get_next_component(IEnumCifComponents *enum_comp, DWORD operation, ICifComponent **ret_comp) +{ + ICifComponent *comp; + HRESULT hr; + + hr = IEnumCifComponents_Reset(enum_comp); + if (FAILED(hr)) return hr; + + while (SUCCEEDED(IEnumCifComponents_Next(enum_comp, &comp))) + { + if (ICifComponent_GetInstallQueueState(comp) != ActionInstall) + continue; + + /* FIXME: handle install options and find out the default options*/ + if (operation == OP_DOWNLOAD && ICifComponent_IsComponentDownloaded(comp) != S_FALSE) + continue; + if (operation == OP_INSTALL && ICifComponent_IsComponentInstalled(comp) != S_FALSE) + continue; + + *ret_comp = comp; + return S_OK; + } + + return S_FALSE; +} + +static HRESULT get_url(ICifComponent *comp, int index, char **url, DWORD *flags) +{ + char *url_temp = NULL; + int size = MAX_PATH / 2; + HRESULT hr; + + /* FIXME: should we add an internal get function to prevent this ugly code ? */ + + /* check if there is an url with such an index */ + hr = ICifComponent_GetUrl(comp, index, NULL, 0, flags); + if (FAILED(hr)) + { + *url = NULL; + *flags = 0; + return S_OK; + } + + do + { + size *= 2; + heap_free(url_temp); + url_temp = heap_alloc(size); + if (!url_temp) return E_OUTOFMEMORY; + + hr = ICifComponent_GetUrl(comp, index, url_temp, size, flags); + if (FAILED(hr)) + { + heap_free(url_temp); + return hr; + } + } + while (strlen(url_temp) == size-1); + + *url = url_temp; + return S_OK; +} + +static char *combine_url(char *baseurl, char *url) +{ + int len_base = strlen(baseurl); + int len_url = strlen(url); + char *combined; + + combined = heap_alloc(len_base + len_url + 2); + if (!combined) return NULL; + + strcpy(combined, baseurl); + if (len_base && combined[len_base-1] != '/') + strcat(combined, "/"); + strcat(combined, url); + + return combined; +} + +static HRESULT generate_moniker(char *baseurl, char *url, DWORD flags, IMoniker **moniker) +{ + WCHAR *urlW; + HRESULT hr; + + if (flags & URLF_RELATIVEURL) + { + char *combined; + if (!baseurl) + return E_FAIL; + + combined = combine_url(baseurl, url); + if (!combined) return E_OUTOFMEMORY; + + urlW = strAtoW(combined); + heap_free(combined); + if (!urlW) return E_OUTOFMEMORY; + } + else + { + urlW = strAtoW(url); + if (!urlW) return E_OUTOFMEMORY; + } + + hr = CreateURLMoniker(NULL, urlW, moniker); + heap_free(urlW); + return hr; +} + +static char *merge_path(char *path1, char *path2) +{ + int len = strlen(path1) + strlen(path2) + 2; + char *combined = heap_alloc(len); + + if (!combined) return NULL; + strcpy(combined, path1); + strcat(combined, "\\"); + strcat(combined, path2); + + return combined; +} + +static HRESULT download_url(InstallEngine *This, char *id, char *display, char *url, DWORD flags, DWORD dl_size) +{ + struct downloadcb *callback = NULL; + char *filename = NULL; + IUnknown *unk = NULL; + IMoniker *mon = NULL; + IBindCtx *bindctx = NULL; + HANDLE event = NULL; + HRESULT hr; + + if (!This->downloaddir) + { + WARN("No download directory set\n"); + return E_FAIL; + } + + hr = generate_moniker(This->baseurl, url, flags, &mon); + if (FAILED(hr)) + { + FIXME("Failed to create moniker\n"); + return hr; + } + + event = CreateEventW(NULL, TRUE, FALSE, NULL); + if (!event) + { + IMoniker_Release(mon); + return E_FAIL; + } + + filename = strrchr(url, '/'); + if (!filename) filename = url; + + filename = merge_path(This->downloaddir, filename); + if (!filename) + { + hr = E_OUTOFMEMORY; + goto error; + } + + hr = downloadcb_create(This, event, filename, id, display, dl_size, &callback); + if (FAILED(hr)) goto error; + + hr = CreateAsyncBindCtx(0, &callback->IBindStatusCallback_iface, NULL, &bindctx); + if(FAILED(hr)) goto error; + + hr = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk); + if (FAILED(hr)) goto error; + if (unk) IUnknown_Release(unk); + + heap_free(filename); + IMoniker_Release(mon); + IBindCtx_Release(bindctx); + + WaitForSingleObject(event, INFINITE); + hr = callback->hr; + + CloseHandle(event); + IBindStatusCallback_Release(&callback->IBindStatusCallback_iface); + return hr; + +error: + if (mon) IMoniker_Release(mon); + if (event) CloseHandle(event); + if (callback) IBindStatusCallback_Release(&callback->IBindStatusCallback_iface); + if (bindctx) IBindCtx_Release(bindctx); + if (filename) heap_free(filename); + return hr; +} + +static HRESULT process_component_dependencies(InstallEngine *This, ICifComponent *comp) +{ + char id[MAX_ID_LENGTH+1], type; + DWORD ver, build; + HRESULT hr; + int i; + + for (i = 0;; i++) + { + hr = ICifComponent_GetDependency(comp, i, id, sizeof(id), &type, &ver, &build); + if (SUCCEEDED(hr)) + FIXME("Can't handle dependencies yet: %s\n", debugstr_a(id)); + else + break; + } + + return S_OK; +} + +static HRESULT process_component(InstallEngine *This, ICifComponent *comp) +{ + DWORD size_dl, size_install, phase; + char display[MAX_DISPLAYNAME_LENGTH+1]; + char id[MAX_ID_LENGTH+1]; + HRESULT hr; + int i; + + hr = ICifComponent_GetID(comp, id, sizeof(id)); + if (FAILED(hr)) return hr; + + TRACE("processing component %s\n", debugstr_a(id)); + + hr = ICifComponent_GetDescription(comp, display, sizeof(display)); + if (FAILED(hr)) return hr; + + size_dl = (This->thread.operation == OP_DOWNLOAD) ? ICifComponent_GetDownloadSize(comp) : 0; + size_install = 0; /* (This->thread.operation == OP_INSTALL) ? ICifComponent_GetInstalledSize(comp) : 0; */ + + if (This->callback) + { + IInstallEngineCallback_OnStartComponent(This->callback, id, size_dl, size_install, display); + IInstallEngineCallback_OnComponentProgress(This->callback, id, INSTALLSTATUS_INITIALIZING, display, NULL, 0, 0); + phase = INSTALLSTATUS_INITIALIZING; + } + + hr = process_component_dependencies(This, comp); + if (FAILED(hr)) return hr; + + if (This->thread.operation == OP_DOWNLOAD) + { + for (i = 0;; i++) + { + DWORD flags; + char *url; + + phase = INSTALLSTATUS_DOWNLOADING; + + hr = get_url(comp, i, &url, &flags); + if (FAILED(hr)) goto done; + if (!url) break; + + TRACE("processing url %s\n", debugstr_a(url)); + + hr = download_url(This, id, display, url, flags, size_dl); + heap_free(url); + if (FAILED(hr)) + { + DWORD retry = 0; + + if (This->callback) + IInstallEngineCallback_OnEngineProblem(This->callback, ENGINEPROBLEM_DOWNLOADFAIL, &retry); + if (!retry) goto done; + + i--; + continue; + } + + phase = INSTALLSTATUS_CHECKINGTRUST; + /* FIXME: check trust */ + IInstallEngineCallback_OnComponentProgress(This->callback, id, INSTALLSTATUS_CHECKINGTRUST, display, NULL, 0, 0); + } + + component_set_downloaded(comp, TRUE); + phase = INSTALLSTATUS_DOWNLOADFINISHED; + } + else + FIXME("Installation not yet implemented\n"); + +done: + IInstallEngineCallback_OnStopComponent(This->callback, id, hr, phase, display, 0); + return hr; +} + +DWORD WINAPI thread_installation(LPVOID param) +{ + InstallEngine *This = param; + ICifComponent *comp; + HRESULT hr; + + if (This->callback) + IInstallEngineCallback_OnStartInstall(This->callback, This->thread.download_size, This->thread.install_size); + + for (;;) + { + hr = get_next_component(This->thread.enum_comp, This->thread.operation, &comp); + if (FAILED(hr)) break; + if (hr == S_FALSE) + { + hr = S_OK; + break; + } + + hr = process_component(This, comp); + if (FAILED(hr)) break; + } + + if (This->callback) + IInstallEngineCallback_OnStopInstall(This->callback, hr, NULL, 0); + + IEnumCifComponents_Release(This->thread.enum_comp); + IInstallEngine2_Release(&This->IInstallEngine2_iface); + + set_status(This, ENGINESTATUS_READY); + return 0; +} + +static HRESULT start_installation(InstallEngine *This, DWORD operation, DWORD jobflags) +{ + HANDLE thread; + HRESULT hr; + + This->thread.operation = operation; + This->thread.jobflags = jobflags; + This->thread.downloaded_kb = 0; + This->thread.download_start = 0; + + /* Windows sends the OnStartInstall event from a different thread, + * but OnStartInstall already contains the required download and install size. + * The only way to signal an error from the thread is to send an OnStopComponent / + * OnStopInstall signal which can only occur after OnStartInstall. We need to + * precompute the sizes here to be able inform the application about errors while + * calculating the required sizes. */ + + hr = ICifFile_EnumComponents(This->icif, &This->thread.enum_comp, 0, NULL); + if (FAILED(hr)) return hr; + + hr = calc_sizes(This->thread.enum_comp, operation, &This->thread.download_size, &This->thread.install_size); + if (FAILED(hr)) goto error; + + IInstallEngine2_AddRef(&This->IInstallEngine2_iface); + + thread = CreateThread(NULL, 0, thread_installation, This, 0, NULL); + if (!thread) + { + IInstallEngine2_Release(&This->IInstallEngine2_iface); + hr = E_FAIL; + goto error; + } + + CloseHandle(thread); + return S_OK; + +error: + IEnumCifComponents_Release(This->thread.enum_comp); + return hr; +} + static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%p)\n", This, status); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, status); + + if (!status) + return E_FAIL; + + *status = This->status; + return S_OK; } static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %s)\n", This, debugstr_a(cab_name), debugstr_a(cif_name)); + + FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(cab_name), debugstr_a(cif_name)); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%x)\n", This, flags); - return E_NOTIMPL; + + TRACE("(%p)->(%x)\n", This, flags); + + /* The interface is not really threadsafe on windows, but we can at least prevent multiple installations */ + if (InterlockedCompareExchange((LONG *)&This->status, ENGINESTATUS_INSTALLING, ENGINESTATUS_READY) != ENGINESTATUS_READY) + return E_FAIL; + + if (This->callback) + IInstallEngineCallback_OnEngineStatusChange(This->callback, ENGINESTATUS_INSTALLING, 0); + + return start_installation(This, OP_DOWNLOAD, flags); } static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%x)\n", This, flags); + + FIXME("(%p)->(%x): stub\n", This, flags); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%d %p)\n", This, index, id); + + FIXME("(%p)->(%u %p): stub\n", This, index, id); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%d %p)\n", This, index, id); - return E_NOTIMPL; + IEnumCifComponents *enum_components; + ICifComponent *comp; + HRESULT hr; + + TRACE("(%p)->(%u %p)\n", This, index, id); + + if (!This->icif || !id) + return E_FAIL; + + hr = ICifFile_EnumComponents(This->icif, &enum_components, 0, NULL); + if (FAILED(hr)) return hr; + + for (;;) + { + hr = IEnumCifComponents_Next(enum_components, &comp); + if (FAILED(hr)) goto done; + + if (ICifComponent_GetInstallQueueState(comp) != ActionInstall) + continue; + + if (ICifComponent_IsComponentDownloaded(comp) != S_FALSE) + continue; + + if (index == 0) + { + char *id_src = component_get_id(comp); + *id = CoTaskMemAlloc(strlen(id_src) + 1); + + if (*id) + strcpy(*id, id_src); + else + hr = E_OUTOFMEMORY; + goto done; + } + + index--; + } + +done: + IEnumCifComponents_Release(enum_components); + return hr; } static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), status); + + FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), status); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%p)\n", This, callback); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, callback); + + This->callback = callback; + return S_OK; } static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + + TRACE("(%p)\n", This); + + This->callback = NULL; + return S_OK; } static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %d %d)\n", This, debugstr_a(id), action, priority); - return E_NOTIMPL; + ICifComponent *comp; + HRESULT hr; + + TRACE("(%p)->(%s %u %u)\n", This, debugstr_a(id), action, priority); + + if (!This->icif) + return E_FAIL; /* FIXME: check error code */ + + hr = ICifFile_FindComponent(This->icif, id, &comp); + if (FAILED(hr)) return hr; + + hr = ICifComponent_SetInstallQueueState(comp, action); + if (FAILED(hr)) return hr; + + hr = ICifComponent_SetCurrentPriority(comp, priority); + return hr; } static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), sizes); + + FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), sizes); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %s)\n", This, debugstr_a(inf_name), debugstr_a(section)); + + FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(inf_name), debugstr_a(section)); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s %s)\n", This, debugstr_a(id), debugstr_a(name)); + + FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(id), debugstr_a(name)); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_a(base_name)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_a(base_name)); + + if (This->baseurl) + heap_free(This->baseurl); + + This->baseurl = strdupA(base_name); + return This->baseurl ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_a(download_dir)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_a(download_dir)); + + if (This->downloaddir) + heap_free(This->downloaddir); + + This->downloaddir = strdupA(download_dir); + return This->downloaddir ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%c)\n", This, drive); + + FIXME("(%p)->(%c): stub\n", This, drive); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_SetInstallOptions(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%x)\n", This, flags); + + FIXME("(%p)->(%x): stub\n", This, flags); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%p)\n", This, hwnd); + + FIXME("(%p)->(%p): stub\n", This, hwnd); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%p)\n", This, stream); + + FIXME("(%p)->(%p): stub\n", This, stream); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%x)\n", This, flags); + + FIXME("(%p)->(%x): stub\n", This, flags); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)\n", This); + + FIXME("(%p): stub\n", This); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)\n", This); + + FIXME("(%p): stub\n", This); + return E_NOTIMPL; } static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_a(cif)); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_a(cif)); + + if (This->icif) + ICifFile_Release(This->icif); + + set_status(This, ENGINESTATUS_LOADING); + + hr = GetICifFileFromFile(&This->icif, cif); + if (SUCCEEDED(hr)) + set_status(This, ENGINESTATUS_READY); + else + { + This->icif = NULL; + set_status(This, ENGINESTATUS_NOTREADY); + } + return hr; } static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file) { InstallEngine *This = impl_from_IInstallEngine2(iface); - FIXME("(%p)->(%p)\n", This, cif_file); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, cif_file); + + if (!This->icif || !cif_file) + return E_FAIL; + + ICifFile_AddRef(This->icif); + *cif_file = This->icif; + return S_OK; } -static const IInstallEngine2Vtbl InstallEngine2Vtbl = { +static const IInstallEngine2Vtbl InstallEngine2Vtbl = +{ InstallEngine_QueryInterface, InstallEngine_AddRef, InstallEngine_Release, @@ -306,6 +1140,70 @@ static const IInstallEngine2Vtbl InstallEngine2Vtbl = { InstallEngine2_GetICifFile }; +static HRESULT WINAPI InstallEngineTiming_QueryInterface(IInstallEngineTiming *iface, REFIID riid, void **ppv) +{ + InstallEngine *This = impl_from_IInstallEngineTiming(iface); + return IInstallEngine2_QueryInterface(&This->IInstallEngine2_iface, riid, ppv); +} + +static ULONG WINAPI InstallEngineTiming_AddRef(IInstallEngineTiming *iface) +{ + InstallEngine *This = impl_from_IInstallEngineTiming(iface); + return IInstallEngine2_AddRef(&This->IInstallEngine2_iface); +} + +static ULONG WINAPI InstallEngineTiming_Release(IInstallEngineTiming *iface) +{ + InstallEngine *This = impl_from_IInstallEngineTiming(iface); + return IInstallEngine2_Release(&This->IInstallEngine2_iface); +} + +static HRESULT WINAPI InstallEngineTiming_GetRates(IInstallEngineTiming *iface, DWORD *download, DWORD *install) +{ + InstallEngine *This = impl_from_IInstallEngineTiming(iface); + + FIXME("(%p)->(%p, %p): stub\n", This, download, install); + + *download = 0; + *install = 0; + + return S_OK; +} + +static HRESULT WINAPI InstallEngineTiming_GetInstallProgress(IInstallEngineTiming *iface, INSTALLPROGRESS *progress) +{ + InstallEngine *This = impl_from_IInstallEngineTiming(iface); + ULONGLONG elapsed; + static int once; + + if (!once) + FIXME("(%p)->(%p): semi-stub\n", This, progress); + else + TRACE("(%p)->(%p): semi-stub\n", This, progress); + + progress->dwDownloadKBRemaining = max(This->thread.download_size, This->thread.downloaded_kb) - This->thread.downloaded_kb; + + elapsed = GetTickCount64() - This->thread.download_start; + if (This->thread.download_start && This->thread.downloaded_kb && elapsed > 100) + progress->dwDownloadSecsRemaining = (progress->dwDownloadKBRemaining * elapsed) / (This->thread.downloaded_kb * 1000); + else + progress->dwDownloadSecsRemaining = -1; + + progress->dwInstallKBRemaining = 0; + progress->dwInstallSecsRemaining = -1; + + return S_OK; +} + +static const IInstallEngineTimingVtbl InstallEngineTimingVtbl = +{ + InstallEngineTiming_QueryInterface, + InstallEngineTiming_AddRef, + InstallEngineTiming_Release, + InstallEngineTiming_GetRates, + InstallEngineTiming_GetInstallProgress, +}; + static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) { *ppv = NULL; @@ -350,12 +1248,14 @@ static HRESULT WINAPI InstallEngineCF_CreateInstance(IClassFactory *iface, IUnkn TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv); - engine = heap_alloc(sizeof(*engine)); + engine = heap_alloc_zero(sizeof(*engine)); if(!engine) return E_OUTOFMEMORY; engine->IInstallEngine2_iface.lpVtbl = &InstallEngine2Vtbl; + engine->IInstallEngineTiming_iface.lpVtbl = &InstallEngineTimingVtbl; engine->ref = 1; + engine->status = ENGINESTATUS_NOTREADY; hres = IInstallEngine2_QueryInterface(&engine->IInstallEngine2_iface, riid, ppv); IInstallEngine2_Release(&engine->IInstallEngine2_iface); diff --git a/dll/win32/inseng/inseng_private.h b/dll/win32/inseng/inseng_private.h new file mode 100644 index 0000000000..60b6db953c --- /dev/null +++ b/dll/win32/inseng/inseng_private.h @@ -0,0 +1,81 @@ +/* + * Copyright 2016 Michael Müller + * + * 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 + */ + +#pragma once + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "rpcproxy.h" +#include "inseng.h" +#include "wine/heap.h" +#include "wine/unicode.h" + +static inline char *strdupA(const char *src) +{ + char *dest = heap_alloc(strlen(src) + 1); + if (dest) strcpy(dest, src); + return dest; +} + +static inline WCHAR *strdupW(const WCHAR *src) +{ + WCHAR *dest; + if (!src) return NULL; + dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src) + 1) * sizeof(WCHAR)); + if (dest) strcpyW(dest, src); + return dest; +} + +static inline LPWSTR strAtoW(const char *str) +{ + LPWSTR ret = NULL; + + if (str) + { + DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + } + + return ret; +} + +struct inf_value; +struct inf_section; +struct inf_file; + +HRESULT inf_load(const char *path, struct inf_file **inf_file) DECLSPEC_HIDDEN; +void inf_free(struct inf_file *inf) DECLSPEC_HIDDEN; + +BOOL inf_next_section(struct inf_file *inf, struct inf_section **sec) DECLSPEC_HIDDEN; +struct inf_section *inf_get_section(struct inf_file *inf, const char *name) DECLSPEC_HIDDEN; +char *inf_section_get_name(struct inf_section *section) DECLSPEC_HIDDEN; +BOOL inf_section_next_value(struct inf_section *sec, struct inf_value **value) DECLSPEC_HIDDEN; + +struct inf_value *inf_get_value(struct inf_section *sec, const char *key) DECLSPEC_HIDDEN; +char *inf_value_get_key(struct inf_value *value) DECLSPEC_HIDDEN; +char *inf_value_get_value(struct inf_value *value) DECLSPEC_HIDDEN; + +char *trim(char *str, char **last_chr, BOOL strip_quotes) DECLSPEC_HIDDEN; + +void component_set_actual_download_size(ICifComponent *iface, DWORD size) DECLSPEC_HIDDEN; +void component_set_downloaded(ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN; +void component_set_installed(ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN; + char *component_get_id(ICifComponent *iface) DECLSPEC_HIDDEN; diff --git a/dll/win32/inseng/precomp.h b/dll/win32/inseng/precomp.h new file mode 100644 index 0000000000..18e231259c --- /dev/null +++ b/dll/win32/inseng/precomp.h @@ -0,0 +1,17 @@ + +#ifndef _INSENG_PRECOMP_H +#define _INSENG_PRECOMP_H + +#include <wine/config.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#define COBJMACROS + +#include "inseng_private.h" + +#include <wine/list.h> +#include <wine/debug.h> + +#endif /* !_INSENG_PRECOMP_H */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index bbb63785c0..034e9b393e 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -81,7 +81,7 @@ reactos/dll/win32/imm32 # Synced to WineStaging-3.3 reactos/dll/win32/inetcomm # Synced to WineStaging-3.3 reactos/dll/win32/inetmib1 # Synced to WineStaging-3.3 reactos/dll/win32/initpki # Synced to WineStaging-3.3 -reactos/dll/win32/inseng # Synced to Wine-3.0 +reactos/dll/win32/inseng # Synced to WineStaging-3.3 reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-2.9 reactos/dll/win32/itss # Synced to Wine-3.0
6 years, 7 months
1
0
0
0
01/01: [INITPKI] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b592846ef4e5f3d8f575…
commit 2b592846ef4e5f3d8f57557ee2732bc1e2c25d99 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 17 12:46:23 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 17 12:46:47 2018 +0100 [INITPKI] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/initpki/main.c | 10 ++++------ media/doc/README.WINE | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dll/win32/initpki/main.c b/dll/win32/initpki/main.c index 75cdce4eff..c5def6c221 100644 --- a/dll/win32/initpki/main.c +++ b/dll/win32/initpki/main.c @@ -16,15 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS - -#include <config.h> +#include "config.h" #include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <wine/debug.h> +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(initpki); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 5cb8a0a8da..bbb63785c0 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -80,7 +80,7 @@ reactos/dll/win32/imagehlp # Synced to WineStaging-3.3 reactos/dll/win32/imm32 # Synced to WineStaging-3.3 reactos/dll/win32/inetcomm # Synced to WineStaging-3.3 reactos/dll/win32/inetmib1 # Synced to WineStaging-3.3 -reactos/dll/win32/initpki # Synced to WineStaging-2.9 +reactos/dll/win32/initpki # Synced to WineStaging-3.3 reactos/dll/win32/inseng # Synced to Wine-3.0 reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-2.9
6 years, 7 months
1
0
0
0
01/01: [NTOSKRNL] Misc fixes to VACB reference counting This fixes various bugs linked to VACB counting: - VACB not released when it should be - Reference count expectations not being accurate
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=13b57fb5b5688a5e67175…
commit 13b57fb5b5688a5e67175e0908f1fe7ad272045b Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Mar 17 11:56:25 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Mar 17 11:56:25 2018 +0100 [NTOSKRNL] Misc fixes to VACB reference counting This fixes various bugs linked to VACB counting: - VACB not released when it should be - Reference count expectations not being accurate For the record, VACB should always have at least a reference count of 1, unless you are to free it and removed it from any linked list. This commit also adds a bunch of asserts that should help triggering invalid reference counting. It should also fix numerous ASSERT currently triggered and may help fixing random behaviours in Cc. CORE-14285 CORE-14401 CORE-14293 --- ntoskrnl/cc/fs.c | 9 ++++++-- ntoskrnl/cc/pin.c | 8 +++++++ ntoskrnl/cc/view.c | 51 ++++++++++++++++++++++-------------------- ntoskrnl/include/internal/cc.h | 21 +++++++++++++++++ 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/ntoskrnl/cc/fs.c b/ntoskrnl/cc/fs.c index 38c9ae527c..05a9a89475 100644 --- a/ntoskrnl/cc/fs.c +++ b/ntoskrnl/cc/fs.c @@ -222,14 +222,18 @@ CcPurgeCacheSection ( break; } - /* Still in use, it cannot be purged, fail */ - if (Vacb->ReferenceCount != 0 && !Vacb->Dirty) + /* Still in use, it cannot be purged, fail + * Allow one ref: VACB is supposed to be always 1-referenced + */ + if ((Vacb->ReferenceCount > 1 && !Vacb->Dirty) || + (Vacb->ReferenceCount > 2 && Vacb->Dirty)) { Success = FALSE; break; } /* This VACB is in range, so unlink it and mark for free */ + ASSERT(Vacb->ReferenceCount == 1 || Vacb->Dirty); RemoveEntryList(&Vacb->VacbLruListEntry); if (Vacb->Dirty) { @@ -246,6 +250,7 @@ CcPurgeCacheSection ( Vacb = CONTAINING_RECORD(RemoveHeadList(&FreeList), ROS_VACB, CacheMapVacbListEntry); + CcRosVacbDecRefCount(Vacb); CcRosInternalFreeVacb(Vacb); } diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c index 20b409662f..c9167834c0 100644 --- a/ntoskrnl/cc/pin.c +++ b/ntoskrnl/cc/pin.c @@ -382,7 +382,15 @@ CcUnpinRepinnedBcb ( iBcb->Pinned = FALSE; CcRosAcquireVacbLock(iBcb->Vacb, NULL); iBcb->Vacb->PinCount--; + ASSERT(iBcb->Vacb->PinCount == 0); } + + CcRosReleaseVacb(iBcb->Vacb->SharedCacheMap, + iBcb->Vacb, + TRUE, + iBcb->Dirty, + FALSE); + ExDeleteResourceLite(&iBcb->Lock); ExFreeToNPagedLookasideList(&iBcbLookasideList, iBcb); } diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index cf2d2c5cb7..4651abe670 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -65,7 +65,7 @@ KSPIN_LOCK CcDeferredWriteSpinLock; LIST_ENTRY CcCleanSharedCacheMapList; #if DBG -static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line) +VOID CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line) { ++vacb->ReferenceCount; if (vacb->SharedCacheMap->Trace) @@ -74,7 +74,7 @@ static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line) file, line, vacb, vacb->ReferenceCount, vacb->Dirty, vacb->PageOut); } } -static void CcRosVacbDecRefCount_(PROS_VACB vacb, const char* file, int line) +VOID CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line) { ASSERT(vacb->ReferenceCount != 0); --vacb->ReferenceCount; @@ -85,11 +85,6 @@ static void CcRosVacbDecRefCount_(PROS_VACB vacb, const char* file, int line) file, line, vacb, vacb->ReferenceCount, vacb->Dirty, vacb->PageOut); } } -#define CcRosVacbIncRefCount(vacb) CcRosVacbIncRefCount_(vacb,__FILE__,__LINE__) -#define CcRosVacbDecRefCount(vacb) CcRosVacbDecRefCount_(vacb,__FILE__,__LINE__) -#else -#define CcRosVacbIncRefCount(vacb) (++((vacb)->ReferenceCount)) -#define CcRosVacbDecRefCount(vacb) (--((vacb)->ReferenceCount)) #endif NTSTATUS @@ -350,10 +345,11 @@ retry: CcRosVacbDecRefCount(current); /* Check if we can free this entry now */ - if (current->ReferenceCount == 0) + if (current->ReferenceCount < 2) { ASSERT(!current->Dirty); ASSERT(!current->MappedCount); + ASSERT(current->ReferenceCount == 1); RemoveEntryList(¤t->CacheMapVacbListEntry); RemoveEntryList(¤t->VacbLruListEntry); @@ -395,6 +391,7 @@ retry: current = CONTAINING_RECORD(current_entry, ROS_VACB, CacheMapVacbListEntry); + CcRosVacbDecRefCount(current); CcRosInternalFreeVacb(current); } @@ -434,6 +431,8 @@ CcRosReleaseVacb ( CcRosVacbIncRefCount(Vacb); } + ASSERT(Vacb->ReferenceCount != 0); + CcRosReleaseVacbLock(Vacb); return STATUS_SUCCESS; @@ -575,16 +574,15 @@ CcRosMarkDirtyFile ( KeBugCheck(CACHE_MANAGER); } - if (!Vacb->Dirty) - { - CcRosMarkDirtyVacb(Vacb); - } - - CcRosReleaseVacbLock(Vacb); + CcRosReleaseVacb(SharedCacheMap, Vacb, Vacb->Valid, TRUE, FALSE); return STATUS_SUCCESS; } +/* + * Note: this is not the contrary function of + * CcRosMapVacbInKernelSpace() + */ NTSTATUS NTAPI CcRosUnmapVacb ( @@ -605,28 +603,22 @@ CcRosUnmapVacb ( return STATUS_UNSUCCESSFUL; } - if (NowDirty && !Vacb->Dirty) - { - CcRosMarkDirtyVacb(Vacb); - } - ASSERT(Vacb->MappedCount != 0); Vacb->MappedCount--; - CcRosVacbDecRefCount(Vacb); if (Vacb->MappedCount == 0) { CcRosVacbDecRefCount(Vacb); } - CcRosReleaseVacbLock(Vacb); + CcRosReleaseVacb(SharedCacheMap, Vacb, Vacb->Valid, NowDirty, FALSE); return STATUS_SUCCESS; } static NTSTATUS -CcRosMapVacb( +CcRosMapVacbInKernelSpace( PROS_VACB Vacb) { ULONG i; @@ -721,7 +713,7 @@ CcRosCreateVacb ( current->MappedCount = 0; current->DirtyVacbListEntry.Flink = NULL; current->DirtyVacbListEntry.Blink = NULL; - current->ReferenceCount = 1; + current->ReferenceCount = 0; current->PinCount = 0; KeInitializeMutex(¤t->Mutex, 0); CcRosAcquireVacbLock(current, NULL); @@ -785,6 +777,7 @@ CcRosCreateVacb ( } KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql); InsertTailList(&VacbLruListHead, ¤t->VacbLruListEntry); + CcRosVacbIncRefCount(current); KeReleaseGuardedMutex(&ViewLock); MI_SET_USAGE(MI_USAGE_CACHE); @@ -806,7 +799,7 @@ CcRosCreateVacb ( } #endif - Status = CcRosMapVacb(current); + Status = CcRosMapVacbInKernelSpace(current); if (!NT_SUCCESS(Status)) { RemoveEntryList(¤t->CacheMapVacbListEntry); @@ -849,6 +842,8 @@ CcRosGetVacb ( { return Status; } + + CcRosVacbIncRefCount(current); } KeAcquireGuardedMutex(&ViewLock); @@ -941,6 +936,13 @@ CcRosInternalFreeVacb ( NULL); MmUnlockAddressSpace(MmGetKernelAddressSpace()); + if (Vacb->PinCount != 0 || Vacb->ReferenceCount != 0) + { + DPRINT1("Invalid free: %ld, %ld\n", Vacb->ReferenceCount, Vacb->PinCount); + } + + ASSERT(Vacb->PinCount == 0); + ASSERT(Vacb->ReferenceCount == 0); ExFreeToNPagedLookasideList(&VacbLookasideList, Vacb); return STATUS_SUCCESS; } @@ -1092,6 +1094,7 @@ CcRosDeleteFileCache ( { current_entry = RemoveTailList(&FreeList); current = CONTAINING_RECORD(current_entry, ROS_VACB, CacheMapVacbListEntry); + CcRosVacbDecRefCount(current); CcRosInternalFreeVacb(current); } diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index e91f1b4993..ad939a12a9 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -519,3 +519,24 @@ IsPointInRange( } #define CcBugCheck(A, B, C) KeBugCheckEx(CACHE_MANAGER, BugCheckFileId | ((ULONG)(__LINE__)), A, B, C) + +#if DBG +#define CcRosVacbIncRefCount(vacb) CcRosVacbIncRefCount_(vacb,__FILE__,__LINE__) +#define CcRosVacbDecRefCount(vacb) CcRosVacbDecRefCount_(vacb,__FILE__,__LINE__) + +VOID +CcRosVacbIncRefCount_( + PROS_VACB vacb, + PCSTR file, + INT line); + +VOID +CcRosVacbDecRefCount_( + PROS_VACB vacb, + PCSTR file, + INT line); + +#else +#define CcRosVacbIncRefCount(vacb) (++((vacb)->ReferenceCount)) +#define CcRosVacbDecRefCount(vacb) (--((vacb)->ReferenceCount)) +#endif
6 years, 7 months
1
0
0
0
01/01: [SNDVOL32] Set the ranges, pagesize and ticks for the balance and volume trackbars and fix the conversion between trackbar position and volume value
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad3bda1c8dd0c79541d59…
commit ad3bda1c8dd0c79541d59d2ea483d2de04c043b0 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Thu Mar 15 22:03:33 2018 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Thu Mar 15 22:03:33 2018 +0100 [SNDVOL32] Set the ranges, pagesize and ticks for the balance and volume trackbars and fix the conversion between trackbar position and volume value --- base/applications/sndvol32/dialog.c | 164 ++++++++++++++++++++-------------- base/applications/sndvol32/sndvol32.c | 11 ++- base/applications/sndvol32/sndvol32.h | 7 ++ 3 files changed, 111 insertions(+), 71 deletions(-) diff --git a/base/applications/sndvol32/dialog.c b/base/applications/sndvol32/dialog.c index e736f4bb0a..621e905a81 100644 --- a/base/applications/sndvol32/dialog.c +++ b/base/applications/sndvol32/dialog.c @@ -79,6 +79,7 @@ AddDialogControl( LPWSTR ClassName, WindowName = NULL; HWND hwnd; DWORD wID; + INT nSteps, i; /* initialize client rectangle */ rect.left = DialogItem->x; @@ -145,6 +146,11 @@ AddDialogControl( wID = DialogItem->id * (DialogIdMultiplier + 1); } + + /* Hack: Disable TBS_AUTOTICKS because it looks ugly */ + if (!wcsicmp(ClassName, L"msctls_trackbar32")) + DialogItem->style &= ~TBS_AUTOTICKS; + /* now create the window */ hwnd = CreateWindowExW(DialogItem->dwExtendedStyle, ClassName, @@ -168,18 +174,46 @@ AddDialogControl( /* check if this the track bar */ if (!wcsicmp(ClassName, L"msctls_trackbar32")) { - /* set up range */ - SendMessage(hwnd, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 5)); + if (DialogItem->style & TBS_VERT) + { + /* Vertical trackbar: Volume */ - /* set up page size */ - SendMessage(hwnd, TBM_SETPAGESIZE, 0, (LPARAM) 1); + /* set up range */ + SendMessage(hwnd, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, VOLUME_STEPS)); - /* set available range */ - //SendMessage(hwnd, TBM_SETSEL, (WPARAM) FALSE, (LPARAM) MAKELONG(0, 5)); + /* set up page size */ + SendMessage(hwnd, TBM_SETPAGESIZE, 0, (LPARAM)VOLUME_PAGE_SIZE); - /* set position */ - SendMessage(hwnd, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 0); + /* set position */ + SendMessage(hwnd, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)0); + /* Calculate and set ticks */ + nSteps = (VOLUME_STEPS / (VOLUME_TICKS + 1)); + if (VOLUME_STEPS % (VOLUME_TICKS + 1) != 0) + nSteps++; + for (i = nSteps; i < VOLUME_STEPS; i += nSteps) + SendMessage(hwnd, TBM_SETTIC, 0, (LPARAM)i); + } + else + { + /* Horizontal trackbar: Balance */ + + /* set up range */ + SendMessage(hwnd, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, BALANCE_STEPS)); + + /* set up page size */ + SendMessage(hwnd, TBM_SETPAGESIZE, 0, (LPARAM)BALANCE_PAGE_SIZE); + + /* set position */ + SendMessage(hwnd, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)BALANCE_STEPS / 2); + + /* Calculate and set ticks */ + nSteps = (BALANCE_STEPS / (BALANCE_TICKS + 1)); + if (BALANCE_STEPS % (BALANCE_TICKS + 1) != 0) + nSteps++; + for (i = nSteps; i < BALANCE_STEPS; i += nSteps) + SendMessage(hwnd, TBM_SETTIC, 0, (LPARAM)i); + } } else if (!wcsicmp(ClassName, L"static") || !wcsicmp(ClassName, L"button")) { @@ -419,64 +453,64 @@ EnumConnectionsCallback( if (SndMixerQueryControls(Mixer, &ControlCount, Line, &Control) != FALSE) { /* now go through all controls and update their states */ - for(Index = 0; Index < ControlCount; Index++) + for(Index = 0; Index < Line->cControls; Index++) { - if ((Control[Index].dwControlType & MIXERCONTROL_CT_CLASS_MASK) == MIXERCONTROL_CT_CLASS_SWITCH) - { - MIXERCONTROLDETAILS_BOOLEAN Details; - - /* get volume control details */ - if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, sizeof(MIXERCONTROLDETAILS_BOOLEAN), (LPVOID)&Details) != -1) - { - /* update dialog control */ - wID = (PrefContext->Count + 1) * IDC_LINE_SWITCH; - - /* get dialog control */ - hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID); - - if (hDlgCtrl != NULL) - { - /* check state */ - if (SendMessageW(hDlgCtrl, BM_GETCHECK, 0, 0) != Details.fValue) - { - /* update control state */ - SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)Details.fValue, 0); - } - } - } - } - else if ((Control[Index].dwControlType & MIXERCONTROL_CT_CLASS_MASK) == MIXERCONTROL_CT_CLASS_FADER) - { - MIXERCONTROLDETAILS_UNSIGNED Details; - - /* get volume control details */ - if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)&Details) != -1) - { - /* update dialog control */ - DWORD Position; - DWORD Step = 0x10000 / 5; - - /* FIXME: give me granularity */ - Position = 5 - (Details.dwValue / Step); - - /* FIXME support left - right slider */ - wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_VERT; - - /* get dialog control */ - hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID); - - if (hDlgCtrl != NULL) - { - /* check state */ - LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0); - if (OldPosition != Position) - { - /* update control state */ - SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, Position + Index); - } - } - } - } + if ((Control[Index].dwControlType & MIXERCONTROL_CT_CLASS_MASK) == MIXERCONTROL_CT_CLASS_SWITCH) + { + MIXERCONTROLDETAILS_BOOLEAN Details; + + /* get volume control details */ + if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, sizeof(MIXERCONTROLDETAILS_BOOLEAN), (LPVOID)&Details) != -1) + { + /* update dialog control */ + wID = (PrefContext->Count + 1) * IDC_LINE_SWITCH; + + /* get dialog control */ + hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID); + + if (hDlgCtrl != NULL) + { + /* check state */ + if (SendMessageW(hDlgCtrl, BM_GETCHECK, 0, 0) != Details.fValue) + { + /* update control state */ + SendMessageW(hDlgCtrl, BM_SETCHECK, (WPARAM)Details.fValue, 0); + } + } + } + } + else if ((Control[Index].dwControlType & MIXERCONTROL_CT_CLASS_MASK) == MIXERCONTROL_CT_CLASS_FADER) + { + MIXERCONTROLDETAILS_UNSIGNED Details; + + /* get volume control details */ + if (SndMixerGetVolumeControlDetails(Mixer, Control[Index].dwControlID, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)&Details) != -1) + { + /* update dialog control */ + DWORD Position; + DWORD Step = 0x10000 / VOLUME_STEPS; + + /* FIXME: give me granularity */ + Position = VOLUME_STEPS - (Details.dwValue / Step); + + /* FIXME support left - right slider */ + wID = (PrefContext->Count + 1) * IDC_LINE_SLIDER_VERT; + + /* get dialog control */ + hDlgCtrl = GetDlgItem(PrefContext->MixerWindow->hWnd, wID); + + if (hDlgCtrl != NULL) + { + /* check state */ + LRESULT OldPosition = SendMessageW(hDlgCtrl, TBM_GETPOS, 0, 0); + if (OldPosition != Position) + { + /* update control state */ + SendMessageW(hDlgCtrl, TBM_SETPOS, (WPARAM)TRUE, Position + Index); + } + } + } + } } /* free controls */ diff --git a/base/applications/sndvol32/sndvol32.c b/base/applications/sndvol32/sndvol32.c index 26b5ba99e7..44c4b44956 100644 --- a/base/applications/sndvol32/sndvol32.c +++ b/base/applications/sndvol32/sndvol32.c @@ -651,14 +651,14 @@ SetVolumeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Ctx) } /* now go through all controls and compare control ids */ - for(Index = 0; Index < ControlCount; Index++) + for (Index = 0; Index < ControlCount; Index++) { if (Context->bVertical) { if ((Control[Index].dwControlType & MIXERCONTROL_CT_CLASS_MASK) == MIXERCONTROL_CT_CLASS_FADER) { /* FIXME: give me granularity */ - DWORD Step = 0x10000 / 5; + DWORD Step = 0x10000 / VOLUME_STEPS; /* set up details */ uDetails.dwValue = 0x10000 - Step * Context->SliderPos; @@ -722,7 +722,7 @@ MixerControlChangeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVO } /* now go through all controls and compare control ids */ - for(Index = 0; Index < ControlCount; Index++) + for (Index = 0; Index < ControlCount; Index++) { if (Control[Index].dwControlID == PtrToUlong(Context)) { @@ -746,10 +746,10 @@ MixerControlChangeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVO { /* update dialog control */ DWORD Position; - DWORD Step = 0x10000 / 5; + DWORD Step = 0x10000 / VOLUME_STEPS; /* FIXME: give me granularity */ - Position = 5 - (Details.dwValue / Step); + Position = VOLUME_STEPS - (Details.dwValue / Step); /* update volume control slider */ UpdateDialogLineSliderControl(&Preferences, Line, Control[Index].dwControlID, IDC_LINE_SLIDER_VERT, Position); @@ -762,7 +762,6 @@ MixerControlChangeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVO /* free controls */ HeapFree(GetProcessHeap(), 0, Control); - /* done */ return TRUE; } diff --git a/base/applications/sndvol32/sndvol32.h b/base/applications/sndvol32/sndvol32.h index 640ac20c8f..ad7311fa86 100644 --- a/base/applications/sndvol32/sndvol32.h +++ b/base/applications/sndvol32/sndvol32.h @@ -14,6 +14,13 @@ #include "resources.h" +#define VOLUME_STEPS 500 +#define VOLUME_TICKS 5 +#define VOLUME_PAGE_SIZE 100 +#define BALANCE_STEPS 64 +#define BALANCE_TICKS 1 +#define BALANCE_PAGE_SIZE 12 + typedef enum _WINDOW_MODE { NORMAL_MODE,
6 years, 7 months
1
0
0
0
← Newer
1
...
27
28
29
30
31
32
33
...
44
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
Results per page:
10
25
50
100
200