winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
692 discussions
Start a n
N
ew thread
Jacek Caban : conhost: Implement IOCTL_CONDRV_GET_INPUT_INFO.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 0e939eb969d3bd3caab3d5efea4778db07c00c87 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0e939eb969d3bd3caab3d5ef…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Aug 24 13:21:06 2020 +0200 conhost: Implement IOCTL_CONDRV_GET_INPUT_INFO. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/conhost/conhost.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 6eedfc9d65..8f6217b3e9 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -1,5 +1,8 @@ /* + * Copyright 1998 Alexandre Julliard + * Copyright 2001 Eric Pouech * Copyright 2012 Detlef Riekenberg + * Copyright 2020 Jacek Caban * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +26,7 @@ #include <windef.h> #include <winbase.h> #include <winuser.h> +#include <winnls.h> #include <winternl.h> #include "wine/condrv.h" @@ -35,6 +39,14 @@ struct console { HANDLE server; /* console server handle */ unsigned int mode; /* input mode */ + unsigned int recnum; /* number of input records */ + unsigned int history_size; /* number of entries in history array */ + unsigned int history_index; /* number of used entries in history array */ + unsigned int history_mode; /* mode of history (non zero means remove doubled strings */ + unsigned int edition_mode; /* index to edition mode flavors */ + unsigned int input_cp; /* console input codepage */ + unsigned int output_cp; /* console output codepage */ + unsigned int win; /* window handle if backend supports it */ }; static void *ioctl_buffer; @@ -73,6 +85,23 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code, TRACE( "set %x mode\n", console->mode ); return STATUS_SUCCESS; + case IOCTL_CONDRV_GET_INPUT_INFO: + { + struct condrv_input_info *info; + TRACE( "get info\n" ); + if (in_size || *out_size != sizeof(*info)) return STATUS_INVALID_PARAMETER; + if (!(info = alloc_ioctl_buffer( sizeof(*info )))) return STATUS_NO_MEMORY; + info->history_mode = console->history_mode; + info->history_size = console->history_size; + info->history_index = console->history_index; + info->edition_mode = console->edition_mode; + info->input_cp = console->input_cp; + info->output_cp = console->output_cp; + info->win = console->win; + info->input_count = console->recnum; + return STATUS_SUCCESS; + } + default: FIXME( "unsupported ioctl %x\n", code ); return STATUS_NOT_SUPPORTED; @@ -187,6 +216,8 @@ int __cdecl wmain(int argc, WCHAR *argv[]) console.mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION; + console.input_cp = console.output_cp = GetOEMCP(); + console.history_size = 50; for (i = 1; i < argc; i++) {
1
0
0
0
Jacek Caban : conhost: Implement IOCTL_CONDRV_SET_MODE.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 5a151b060a08f36d9a667dec8d0e9fbdbe0851f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5a151b060a08f36d9a667dec…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Aug 24 13:20:53 2020 +0200 conhost: Implement IOCTL_CONDRV_SET_MODE. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 31 ++++++++++++++++++++++++------- programs/conhost/conhost.c | 6 ++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index b45e707ac8..922a250993 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3945,6 +3945,29 @@ static void test_AllocConsole(void) CloseHandle(pipe_write); } +static void test_pseudo_console_child(HANDLE input) +{ + DWORD mode; + BOOL ret; + + ret = GetConsoleMode(input, &mode); + ok(ret, "GetConsoleMode failed: %u\n", GetLastError()); + ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | + ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION), + "mode = %x\n", mode); + + ret = SetConsoleMode(input, mode & ~ENABLE_AUTO_POSITION); + ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); + + ret = GetConsoleMode(input, &mode); + ok(ret, "GetConsoleMode failed: %u\n", GetLastError()); + ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | + ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS), "mode = %x\n", mode); + + ret = SetConsoleMode(input, mode | ENABLE_AUTO_POSITION); + ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); +} + static DWORD WINAPI read_pipe_proc( void *handle ) { char buf[64]; @@ -4118,13 +4141,7 @@ START_TEST(console) if (using_pseudo_console) { - DWORD mode; - - ret = GetConsoleMode(hConIn, &mode); - ok(ret, "GetConsoleMode failed: %u\n", GetLastError()); - ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | - ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION), - "mode = %x\n", mode); + test_pseudo_console_child(hConIn); return; } diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index dae30d1576..6eedfc9d65 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -67,6 +67,12 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code, return STATUS_SUCCESS; } + case IOCTL_CONDRV_SET_MODE: + if (in_size != sizeof(unsigned int) || *out_size) return STATUS_INVALID_PARAMETER; + console->mode = *(unsigned int *)in_data; + TRACE( "set %x mode\n", console->mode ); + return STATUS_SUCCESS; + default: FIXME( "unsupported ioctl %x\n", code ); return STATUS_NOT_SUPPORTED;
1
0
0
0
Nikolay Sivov : ole32: Use combase for ROT access.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 2105602edf1b11179b1d887035186b38526bf693 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2105602edf1b11179b1d8870…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 24 14:28:00 2020 +0300 ole32: Use combase for ROT access. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/irot.idl | 2 +- dlls/ole32/moniker.c | 254 ++++++--------------------------------------------- 2 files changed, 28 insertions(+), 228 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=2105602edf1b11179b1d…
1
0
0
0
Nikolay Sivov : combase: Expose ROT access helpers.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 33606dbcc5f59f3da72b925dab7c9b1ecfa50797 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=33606dbcc5f59f3da72b925d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Aug 24 14:27:59 2020 +0300 combase: Expose ROT access helpers. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/combase/combase.c | 2 +- dlls/combase/combase.spec | 14 +++--- dlls/combase/combase_private.h | 2 +- dlls/combase/irpcss.idl | 1 + dlls/combase/rpc.c | 108 +++++++++++++++++++++++++++++++++-------- 5 files changed, 98 insertions(+), 29 deletions(-) diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index df97799fe0..80d6ece266 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -2245,7 +2245,7 @@ DWORD WINAPI CoGetCurrentProcess(void) return 0; if (!tlsdata->thread_seqid) - tlsdata->thread_seqid = rpcss_get_next_seqid(); + rpcss_get_next_seqid(&tlsdata->thread_seqid); return tlsdata->thread_seqid; } diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index a88c5d66fe..9038d5fa8b 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -255,13 +255,13 @@ @ stub InternalFillLocalOXIDInfo @ stub InternalFreeObjRef @ stub InternalGetWindowPropInterface -@ stub InternalIrotEnumRunning -@ stub InternalIrotGetObject -@ stub InternalIrotGetTimeOfLastChange -@ stub InternalIrotIsRunning -@ stub InternalIrotNoteChangeTime -@ stub InternalIrotRegister -@ stub InternalIrotRevoke +@ stdcall InternalIrotEnumRunning(ptr) +@ stdcall InternalIrotGetObject(ptr ptr ptr) +@ stdcall InternalIrotGetTimeOfLastChange(ptr ptr) +@ stdcall InternalIrotIsRunning(ptr) +@ stdcall InternalIrotNoteChangeTime(long ptr) +@ stdcall InternalIrotRegister(ptr ptr ptr ptr long ptr ptr) +@ stdcall InternalIrotRevoke(long ptr ptr ptr) @ stub InternalIsApartmentInitialized @ stub InternalIsProcessInitialized @ stub InternalMarshalObjRef diff --git a/dlls/combase/combase_private.h b/dlls/combase/combase_private.h index e910166fff..7d7583282e 100644 --- a/dlls/combase/combase_private.h +++ b/dlls/combase/combase_private.h @@ -90,4 +90,4 @@ static inline struct apartment* com_get_current_apt(void) } /* RpcSs interface */ -DWORD rpcss_get_next_seqid(void) DECLSPEC_HIDDEN; +HRESULT rpcss_get_next_seqid(DWORD *id) DECLSPEC_HIDDEN; diff --git a/dlls/combase/irpcss.idl b/dlls/combase/irpcss.idl index 65078167de..fab69f7310 100644 --- a/dlls/combase/irpcss.idl +++ b/dlls/combase/irpcss.idl @@ -18,4 +18,5 @@ #pragma makedep client +#include "wine/irot.idl" #include "wine/irpcss.idl" diff --git a/dlls/combase/rpc.c b/dlls/combase/rpc.c index 2fbccfd740..3b53166172 100644 --- a/dlls/combase/rpc.c +++ b/dlls/combase/rpc.c @@ -127,29 +127,97 @@ static RPC_BINDING_HANDLE get_irpcss_handle(void) return irpcss_handle; } -DWORD rpcss_get_next_seqid(void) +static RPC_BINDING_HANDLE get_irot_handle(void) { - DWORD id = 0; - HRESULT hr; + static RPC_BINDING_HANDLE irot_handle; - for (;;) + if (!irot_handle) { - __TRY - { - hr = irpcss_get_thread_seq_id(get_irpcss_handle(), &id); - } - __EXCEPT(rpc_filter) - { - hr = HRESULT_FROM_WIN32(GetExceptionCode()); - } - __ENDTRY - if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)) - { - if (start_rpcss()) - continue; - } - break; + unsigned short protseq[] = IROT_PROTSEQ; + unsigned short endpoint[] = IROT_ENDPOINT; + + RPC_BINDING_HANDLE new_handle = get_rpc_handle(protseq, endpoint); + if (InterlockedCompareExchangePointer(&irot_handle, new_handle, NULL)) + /* another thread beat us to it */ + RpcBindingFree(&new_handle); } + return irot_handle; +} + +#define RPCSS_CALL_START \ + HRESULT hr; \ + for (;;) { \ + __TRY { + +#define RPCSS_CALL_END \ + } __EXCEPT(rpc_filter) { \ + hr = HRESULT_FROM_WIN32(GetExceptionCode()); \ + } \ + __ENDTRY \ + if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)) { \ + if (start_rpcss()) \ + continue; \ + } \ + break; \ + } \ + return hr; + +HRESULT rpcss_get_next_seqid(DWORD *id) +{ + RPCSS_CALL_START + hr = irpcss_get_thread_seq_id(get_irpcss_handle(), id); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotRegister(const MonikerComparisonData *moniker_data, + const InterfaceData *object, const InterfaceData *moniker, + const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle) +{ + RPCSS_CALL_START + hr = IrotRegister(get_irot_handle(), moniker_data, object, moniker, time, flags, cookie, ctxt_handle); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotIsRunning(const MonikerComparisonData *moniker_data) +{ + RPCSS_CALL_START + hr = IrotIsRunning(get_irot_handle(), moniker_data); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotGetObject(const MonikerComparisonData *moniker_data, PInterfaceData *obj, + IrotCookie *cookie) +{ + RPCSS_CALL_START + hr = IrotGetObject(get_irot_handle(), moniker_data, obj, cookie); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotNoteChangeTime(IrotCookie cookie, const FILETIME *time) +{ + RPCSS_CALL_START + hr = IrotNoteChangeTime(get_irot_handle(), cookie, time); + RPCSS_CALL_END +} - return id; +HRESULT WINAPI InternalIrotGetTimeOfLastChange(const MonikerComparisonData *moniker_data, FILETIME *time) +{ + RPCSS_CALL_START + hr = IrotGetTimeOfLastChange(get_irot_handle(), moniker_data, time); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotEnumRunning(PInterfaceList *list) +{ + RPCSS_CALL_START + hr = IrotEnumRunning(get_irot_handle(), list); + RPCSS_CALL_END +} + +HRESULT WINAPI InternalIrotRevoke(IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object, + PInterfaceData *moniker) +{ + RPCSS_CALL_START + hr = IrotRevoke(get_irot_handle(), cookie, ctxt_handle, object, moniker); + RPCSS_CALL_END }
1
0
0
0
Robert Wilhelm : vbscript: Support arrays in TypeName.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 769dd6aed480a764154d8001d2a93396835d14ab URL:
https://source.winehq.org/git/wine.git/?a=commit;h=769dd6aed480a764154d8001…
Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Mon Aug 24 11:57:40 2020 +0200 vbscript: Support arrays in TypeName. Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/global.c | 3 +++ dlls/vbscript/tests/api.vbs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index d2fadb3422..cdfbdf2215 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -2203,6 +2203,9 @@ static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cn assert(args_cnt == 1); + if (V_ISARRAY(arg)) + return return_string(res, L"Variant()"); + switch(V_VT(arg)) { case VT_UI1: return return_string(res, ByteW); diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 6add0579e8..4834029183 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -1380,6 +1380,8 @@ Call ok(TypeName(CStr(0.5)) = "String", "TypeName(CStr(0.5)) = " & TypeName(CStr Call ok(getVT(TypeName(CStr(0.5))) = "VT_BSTR", "getVT(TypeName(CStr(0.5))) = " & getVT(TypeName(CStr(0.5)))) Call ok(TypeName(True) = "Boolean", "TypeName(True) = " & TypeName(True)) Call ok(getVT(TypeName(True)) = "VT_BSTR", "getVT(TypeName(True)) = " & getVT(TypeName(True))) +Call ok(TypeName(arr) = "Variant()", "TypeName(arr) = " & TypeName(arr)) +Call ok(getVT(TypeName(arr)) = "VT_BSTR", "getVT(TypeName(arr)) = " & getVT(TypeName(arr))) Call ok(VarType(Empty) = vbEmpty, "VarType(Empty) = " & VarType(Empty)) Call ok(getVT(VarType(Empty)) = "VT_I2", "getVT(VarType(Empty)) = " & getVT(VarType(Empty)))
1
0
0
0
Robert Wilhelm : vbscript: Implement IsArray.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: b72d8118da5456411cf9ddde458d7d4a7816d570 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b72d8118da5456411cf9ddde…
Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Mon Aug 24 11:57:20 2020 +0200 vbscript: Implement IsArray. Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/global.c | 7 +++++-- dlls/vbscript/tests/api.vbs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 00f74104de..d2fadb3422 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -961,8 +961,11 @@ static HRESULT Global_IsNumeric(BuiltinDisp *This, VARIANT *arg, unsigned args_c static HRESULT Global_IsArray(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("(%s)\n", debugstr_variant(arg)); + + assert(args_cnt == 1); + + return return_bool(res, V_ISARRAY(arg)); } static HRESULT Global_IsObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 787da7cd71..6add0579e8 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -223,6 +223,21 @@ arr(0) = 2 arr(1) = 3 Call ok(not isNumeric(arr), "isNumeric(arr) is not true?") +Call ok(isArray(arr), "isArray(arr) is not true?") +x = Array() +Call ok(isArray(arr), "isArray(Array()) is not true?") +Call ok(not isArray(Empty), "isArray(empty) is true?") +Call ok(not isArray(Null), "isArray(Null) is true?") +Call ok(not isArray(42), "isArray(42) is true?") +Call ok(not isArray(CSng(3242.4)), "isArray(CSng(3242.4)) is true?") +Call ok(not isArray(CCur(32768.4)), "isArray(CCur(32768.4)) is true?") +Call ok(not isArray("44"), "isArray(""44"") is true?") +Call ok(not isArray("rwrf"), "isArray(""rwrf"") is true?") +Call ok(not isArray(Nothing), "isArray(Nothing) is true?") +Call ok(not isArray(New EmptyClass), "isArray(New EmptyClass) is true?") +Call ok(not isArray(true), "isArray(true) is true?") +Call ok(not isArray(CByte(32)), "isArray(CByte(32)) is true?") + Call ok(getVT(Array()) = "VT_ARRAY|VT_VARIANT", "getVT(Array()) = " & getVT(Array())) x = Array("a1", 2, "a3") Call ok(getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(array) = " & getVT(x))
1
0
0
0
Robert Wilhelm : vbscript: Implement Split.
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: d50f5f67c7b143ebc92d206ab78110da5a3efc4e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d50f5f67c7b143ebc92d206a…
Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Mon Aug 24 11:43:57 2020 +0200 vbscript: Implement Split. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=47570
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/global.c | 149 +++++++++++++++++++++++++++++++++++++++++++- dlls/vbscript/tests/api.vbs | 65 +++++++++++++++++++ 2 files changed, 211 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 122f5c7b71..00f74104de 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -2291,10 +2291,153 @@ static HRESULT Global_Join(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, V return E_NOTIMPL; } -static HRESULT Global_Split(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Split(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR str, string, delimeter = NULL; + int count, max, mode, len, start, end, ret, delimeterlen = 1; + int i,*indices = NULL, indices_max = 8; + SAFEARRAYBOUND bounds; + SAFEARRAY *sa = NULL; + VARIANT *data, var; + HRESULT hres = S_OK; + + TRACE("%s %u...\n", debugstr_variant(args), args_cnt); + + assert(1 <= args_cnt && args_cnt <= 4); + + if(V_VT(args) == VT_NULL || (args_cnt > 1 && V_VT(args+1) == VT_NULL) || (args_cnt > 2 && V_VT(args+2) == VT_NULL) + || (args_cnt == 4 && V_VT(args+3) == VT_NULL)) + return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE); + + if(V_VT(args) != VT_BSTR) { + hres = to_string(args, &string); + if(FAILED(hres)) + return hres; + }else { + string = V_BSTR(args); + } + + if(args_cnt > 1) { + if(V_VT(args+1) != VT_BSTR) { + hres = to_string(args+1, &delimeter); + if(FAILED(hres)) + goto error; + }else { + delimeter = V_BSTR(args+1); + } + delimeterlen = SysStringLen(delimeter); + } + + if(args_cnt > 2) { + hres = to_int(args+2, &max); + if(FAILED(hres)) + goto error; + if (max < -1) { + hres = MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + goto error; + } + }else { + max = -1; + } + + if(args_cnt == 4) { + hres = to_int(args+3, &mode); + if(FAILED(hres)) + goto error; + if (mode != 0 && mode != 1) { + hres = MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + goto error; + } + }else { + mode = 0; + } + + start = 0; + + len = SysStringLen(string); + count = 0; + + indices = heap_alloc( indices_max * sizeof(int)); + if(!indices) { + hres = E_OUTOFMEMORY; + goto error; + } + + while(1) { + ret = -1; + if (delimeterlen) { + ret = FindStringOrdinal(FIND_FROMSTART, string + start, len - start, + delimeter ? delimeter : L" ", delimeterlen, mode); + } + + if (ret == -1) { + end = len; + }else { + end = start + ret; + } + + if (count == indices_max) { + indices_max *= 2; + indices = heap_realloc( indices, indices_max * sizeof(int)); + if(!indices) { + hres = E_OUTOFMEMORY; + goto error; + } + } + indices[count++] = end; + + if (ret == -1 || count == max) break; + start = start + ret + delimeterlen; + if (start > len) break; + } + + bounds.lLbound = 0; + bounds.cElements = count; + sa = SafeArrayCreate( VT_VARIANT, 1, &bounds); + if (!sa) { + hres = E_OUTOFMEMORY; + goto error; + } + hres = SafeArrayAccessData(sa, (void**)&data); + if(FAILED(hres)) { + SafeArrayDestroy(sa); + goto error; + } + + start = 0; + for (i = 0; i < count; i++) { + str = SysAllocStringLen(string + start, indices[i] - start); + if (!str) { + hres = E_OUTOFMEMORY; + break; + } + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = str; + + hres = VariantCopyInd(data+i, &var); + if(FAILED(hres)) { + SafeArrayUnaccessData(sa); + SafeArrayDestroy(sa); + goto error; + } + start = indices[i]+delimeterlen; + } + SafeArrayUnaccessData(sa); + +error: + if(SUCCEEDED(hres) && res) { + V_VT(res) = VT_ARRAY|VT_VARIANT; + V_ARRAY(res) = sa; + }else { + if (sa) SafeArrayDestroy(sa); + } + + heap_free(indices); + if(V_VT(args) != VT_BSTR) + SysFreeString(string); + if(V_VT(args+1) != VT_BSTR) + SysFreeString(delimeter); + return hres; } static HRESULT Global_Replace(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 6af49c849d..787da7cd71 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -609,6 +609,71 @@ TestLCase 0.123, doubleAsString(0.123) TestLCase Empty, "" Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null))) +x=Split("abc") +Call ok(x(0) = "abc", "Split(""abc"")(0)=" & x(0)) +x = Split("abc def") +Call ok(x(0) = "abc", "Split(""abc def"")(0)=" & x(0)) +Call ok(x(1) = "def", "Split(""abc def"")(1)=" & x(1)) +x = Split("abc def ghi") +Call ok(x(0) = "abc", "Split(""abc def ghi"")(0)=" & x(0)) +Call ok(x(1) = "def", "Split(""abc def ghi"")(1)=" & x(1)) +Call ok(x(2) = "ghi", "Split(""abc def ghi"")(2)=" & x(2)) +x = Split("abc def","") +Call ok(x(0) = "abc def", "Split(""abc def"","""")(0)=" & x(0)) +x = Split("abc-def","-") +Call ok(x(0) = "abc", "Split(""abc-def"",""-"")(0)=" & x(0)) +Call ok(x(1) = "def", "Split(""abc-def"",""-"")(1)=" & x(1)) +x = Split("abc--def","-") +Call ok(x(0) = "abc", "Split(""abc--def"",""-"")(0)=" & x(0)) +Call ok(x(1) = "", "Split(""abc--def"",""-"")(1)=" & x(1)) +Call ok(x(2) = "def", "Split(""abc--def"",""-"")(2)=" & x(2)) +x = Split("abcdefghi","def") +Call ok(x(0) = "abc", "Split(""abcdefghi"",""def"")(0)=" & x(0)) +Call ok(x(1) = "ghi", "Split(""abcdefghi"",""def"")(1)=" & x(1)) +x = Split("12345",3) +Call ok(x(0) = "12", "Split(""12345"",3)(0)=" & x(0)) +Call ok(x(1) = "45", "Split(""12345"",3)(1)=" & x(1)) +x = Split("12345",5) +Call ok(x(0) = "1234", "Split(""12345"",5)(0)=" & x(0)) +Call ok(x(1) = "", "Split(""12345"",5)(1)=" & x(1)) +x = Split("12345",12) +Call ok(x(0) = "", "Split(""12345"",12)(0)=" & x(0)) +Call ok(x(1) = "345", "Split(""12345"",12)(1)=" & x(1)) +x = Split("abc-def-ghi","-") +Call ok(UBound(x) = 2, "UBound(Split(""abc-def-ghi"",""-""))=" & UBound(x)) +x = Split("a b c d e f g h i j k l m n o p q") +Call ok(UBound(x) = 16, "UBound(Split(""a b c d e f g h i j k l m n o p q""))=" & UBound(x)) +x = Split("abc-def-ghi","-",2) +Call ok(UBound(x) = 1, "UBound(Split(""abc-def-ghi"",""-"",2))=" & UBound(x)) +x = Split("abc-def-ghi","-",4) +Call ok(UBound(x) = 2, "UBound(Split(""abc-def-ghi"",""-"",4))=" & UBound(x)) +x = Split("abc-def-ghi","-",-1) +Call ok(UBound(x) = 2, "UBound(Split(""abc-def-ghi"",""-"",-1))=" & UBound(x)) +x = Split("abc-def-ghi","-",-1) +Call ok(UBound(x) = 2, "UBound(Split(""abc-def-ghi"",""-"",-42))=" & UBound(x)) +x = Split("abcZdefZghi","Z",3,0) +Call ok(UBound(x) = 2, "UBound(Split(""abcZdefZghi"",""Z"",3,0))=" & UBound(x)) +x = Split("abcZdefZghi","z",3,0) +Call ok(UBound(x) = 0, "UBound(Split(""abcZdefZghi"",""z"",3,0))=" & UBound(x)) +x = Split("abcZdefZghi","z",3,1) +Call ok(UBound(x) = 2, "UBound(Split(""abcZdefZghi"",""z"",3,1))=" & UBound(x)) + +Sub testSplitError(arg1, arg2, arg3, arg4, error_num) + on error resume next + Dim x + + Call Err.clear() + x = Split(arg1, arg2, arg3, arg4) + Call ok(Err.number = error_num, "Err.number = " & Err.number) +End Sub + +call testSplitError("abc-def-ghi", "-", -1, 2, 5) +call testSplitError("abc-def-ghi", "-", -42, 0, 5) +call testSplitError(null, "-", -1, 0, 94) +call testSplitError("abc-def-ghi", null, -1, 0, 94) +call testSplitError("abc-def-ghi", "-", null, 0, 94) +call testSplitError("abc-def-ghi", "-", -1, null, 94) + Sub TestStrComp(str_left, str_right, mode, ex) x = StrComp(str_left, str_right, mode) Call ok(x = ex, "StrComp(" & str_left & ", " & str_right & ", " & mode & ") = " & x & " expected " & ex)
1
0
0
0
Ziqing Hui : windowscodecs: Introduce decode_block() for DdsFrameDecode_CopyPixels().
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 60f1fe59a9a2083b7e9ea22baa0efb75a1ce5dd2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=60f1fe59a9a2083b7e9ea22b…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Mon Aug 24 12:11:25 2020 +0800 windowscodecs: Introduce decode_block() for DdsFrameDecode_CopyPixels(). Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/ddsformat.c | 126 +++++++++++++++++++++++++++++++++++ dlls/windowscodecs/tests/ddsformat.c | 2 - 2 files changed, 126 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c index ed105a2642..fae7cd8e75 100644 --- a/dlls/windowscodecs/ddsformat.c +++ b/dlls/windowscodecs/ddsformat.c @@ -50,6 +50,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) #endif +#define GET_RGB565_R(color) ((BYTE)(((color) >> 11) & 0x1F)) +#define GET_RGB565_G(color) ((BYTE)(((color) >> 5) & 0x3F)) +#define GET_RGB565_B(color) ((BYTE)(((color) >> 0) & 0x1F)) +#define MAKE_RGB565(r, g, b) ((WORD)(((BYTE)(r) << 11) | ((BYTE)(g) << 5) | (BYTE)(b))) +#define MAKE_ARGB(a, r, g, b) (((DWORD)(a) << 24) | ((DWORD)(r) << 16) | ((DWORD)(g) << 8) | (DWORD)(b)) + #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_ALPHA 0x00000002 #define DDPF_FOURCC 0x00000004 @@ -211,6 +217,13 @@ static DXGI_FORMAT compressed_formats[] = { static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *, UINT, UINT, UINT, IWICBitmapFrameDecode **); +static DWORD rgb565_to_argb(WORD color, BYTE alpha) +{ + return MAKE_ARGB(alpha, (GET_RGB565_R(color) * 0xFF + 0x0F) / 0x1F, + (GET_RGB565_G(color) * 0xFF + 0x1F) / 0x3F, + (GET_RGB565_B(color) * 0xFF + 0x0F) / 0x1F); +} + static inline BOOL has_extended_header(DDS_HEADER *header) { return (header->ddspf.flags & DDPF_FOURCC) && @@ -470,6 +483,117 @@ end: return bpp; } +static void decode_block(const BYTE *block_data, UINT block_count, DXGI_FORMAT format, + UINT width, UINT height, DWORD *buffer) +{ + const BYTE *block, *color_indices, *alpha_indices, *alpha_table; + int i, j, x, y, block_x, block_y, color_index, alpha_index; + int block_size, color_offset, color_indices_offset; + WORD color[4], color_value = 0; + BYTE alpha[8], alpha_value = 0; + + if (format == DXGI_FORMAT_BC1_UNORM) { + block_size = 8; + color_offset = 0; + color_indices_offset = 4; + } else { + block_size = 16; + color_offset = 8; + color_indices_offset = 12; + } + block_x = 0; + block_y = 0; + + for (i = 0; i < block_count; i++) + { + block = block_data + i * block_size; + + color[0] = *((WORD *)(block + color_offset)); + color[1] = *((WORD *)(block + color_offset + 2)); + color[2] = MAKE_RGB565(((GET_RGB565_R(color[0]) * 2 + GET_RGB565_R(color[1]) + 1) / 3), + ((GET_RGB565_G(color[0]) * 2 + GET_RGB565_G(color[1]) + 1) / 3), + ((GET_RGB565_B(color[0]) * 2 + GET_RGB565_B(color[1]) + 1) / 3)); + color[3] = MAKE_RGB565(((GET_RGB565_R(color[0]) + GET_RGB565_R(color[1]) * 2 + 1) / 3), + ((GET_RGB565_G(color[0]) + GET_RGB565_G(color[1]) * 2 + 1) / 3), + ((GET_RGB565_B(color[0]) + GET_RGB565_B(color[1]) * 2 + 1) / 3)); + + switch (format) + { + case DXGI_FORMAT_BC1_UNORM: + if (color[0] <= color[1]) { + color[2] = MAKE_RGB565(((GET_RGB565_R(color[0]) + GET_RGB565_R(color[1]) + 1) / 2), + ((GET_RGB565_G(color[0]) + GET_RGB565_G(color[1]) + 1) / 2), + ((GET_RGB565_B(color[0]) + GET_RGB565_B(color[1]) + 1) / 2)); + color[3] = 0; + } + break; + case DXGI_FORMAT_BC2_UNORM: + alpha_table = block; + break; + case DXGI_FORMAT_BC3_UNORM: + alpha[0] = *block; + alpha[1] = *(block + 1); + if (alpha[0] > alpha[1]) { + for (j = 2; j < 8; j++) + { + alpha[j] = (BYTE)((alpha[0] * (8 - j) + alpha[1] * (j - 1) + 3) / 7); + } + } else { + for (j = 2; j < 6; j++) + { + alpha[j] = (BYTE)((alpha[0] * (6 - j) + alpha[1] * (j - 1) + 2) / 5); + } + alpha[6] = 0; + alpha[7] = 0xFF; + } + alpha_indices = block + 2; + break; + default: + break; + } + + color_indices = block + color_indices_offset; + for (j = 0; j < 16; j++) + { + x = block_x + j % 4; + y = block_y + j / 4; + if (x >= width || y >= height) continue; + + color_index = (color_indices[j / 4] >> ((j % 4) * 2)) & 0x3; + color_value = color[color_index]; + + switch (format) + { + case DXGI_FORMAT_BC1_UNORM: + if ((color[0] <= color[1]) && !color_value) { + color_value = 0; + alpha_value = 0; + } else { + alpha_value = 0xFF; + } + break; + case DXGI_FORMAT_BC2_UNORM: + alpha_value = (alpha_table[j / 2] >> (j % 2) * 4) & 0xF; + alpha_value = (BYTE)((alpha_value * 0xFF + 0x7)/ 0xF); + break; + case DXGI_FORMAT_BC3_UNORM: + alpha_index = (*((DWORD *)(alpha_indices + (j / 8) * 3)) >> ((j % 8) * 3)) & 0x7; + alpha_value = alpha[alpha_index]; + break; + default: + break; + } + buffer[x + y * width] = rgb565_to_argb(color_value, alpha_value); + } + + block_x += DDS_BLOCK_WIDTH; + if (block_x >= width) { + block_x = 0; + block_y += DDS_BLOCK_HEIGHT; + } + } +} + static inline DdsDecoder *impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface) { return CONTAINING_RECORD(iface, DdsDecoder, IWICBitmapDecoder_iface); @@ -629,6 +753,8 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, hr = E_OUTOFMEMORY; goto end; } + decode_block(This->block_data, This->info.width_in_blocks * This->info.height_in_blocks, This->info.format, + This->info.width, This->info.height, (DWORD *)This->pixel_data); } hr = copy_pixels(bpp, This->pixel_data, This->info.width, This->info.height, frame_stride, diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 790c28315a..43f266d392 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -1116,7 +1116,6 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, sizeof(buffer), buffer); ok(hr == S_OK, "Test %u, frame %u: CopyPixels failed, hr %#x\n", i, frame_index, hr); if (hr == S_OK) { - todo_wine ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, 1), "Test %u, frame %u: Pixels mismatch\n", i, frame_index); } @@ -1124,7 +1123,6 @@ static void test_dds_decoder_frame_data(IWICBitmapFrameDecode* frame, IWICDdsFra hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, sizeof(buffer), buffer); ok(hr == S_OK, "Test %u, frame %u: CopyPixels failed, hr %#x\n", i, frame_index, hr); if (hr == S_OK) { - todo_wine ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, frame_size / (bpp / 8)), "Test %u, frame %u: Pixels mismatch\n", i, frame_index); }
1
0
0
0
Ziqing Hui : windowscodecs: More complete implementation of DdsFrameDecode_CopyPixels().
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 3f082762f81708f00eec599b70c2db94c49b59f6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3f082762f81708f00eec599b…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Mon Aug 24 12:11:01 2020 +0800 windowscodecs: More complete implementation of DdsFrameDecode_CopyPixels(). Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/ddsformat.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c index ccd83ace55..ed105a2642 100644 --- a/dlls/windowscodecs/ddsformat.c +++ b/dlls/windowscodecs/ddsformat.c @@ -607,20 +607,19 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, if (!prc) { if (cbStride < frame_stride) return E_INVALIDARG; if (cbBufferSize < frame_size) return WINCODEC_ERR_INSUFFICIENTBUFFER; - return S_OK; - } - - x = prc->X; - y = prc->Y; - width = prc->Width; - height = prc->Height; - if (x < 0 || y < 0 || width <= 0 || height <= 0 || - x + width > This->info.width || - y + height > This->info.height) { - return E_INVALIDARG; + } else { + x = prc->X; + y = prc->Y; + width = prc->Width; + height = prc->Height; + if (x < 0 || y < 0 || width <= 0 || height <= 0 || + x + width > This->info.width || + y + height > This->info.height) { + return E_INVALIDARG; + } + if (cbStride < width * bpp / 8) return E_INVALIDARG; + if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER; } - if (cbStride < width * bpp / 8) return E_INVALIDARG; - if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER; EnterCriticalSection(&This->lock); @@ -632,6 +631,9 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, } } + hr = copy_pixels(bpp, This->pixel_data, This->info.width, This->info.height, frame_stride, + prc, cbStride, cbBufferSize, pbBuffer); + end: LeaveCriticalSection(&This->lock);
1
0
0
0
Ziqing Hui : windowscodecs: In struct DdsFrameDecode, add a new member "pixel_data" and rename member "data" to "block_data".
by Alexandre Julliard
24 Aug '20
24 Aug '20
Module: wine Branch: master Commit: 1b4318b14c7f7b9394babafa84dbb917c0bbcc50 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1b4318b14c7f7b9394babafa…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Mon Aug 24 12:10:18 2020 +0800 windowscodecs: In struct DdsFrameDecode, add a new member "pixel_data" and rename member "data" to "block_data". Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/ddsformat.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c index c179a38935..ccd83ace55 100644 --- a/dlls/windowscodecs/ddsformat.c +++ b/dlls/windowscodecs/ddsformat.c @@ -149,7 +149,8 @@ typedef struct DdsFrameDecode { IWICBitmapFrameDecode IWICBitmapFrameDecode_iface; IWICDdsFrameDecode IWICDdsFrameDecode_iface; LONG ref; - BYTE *data; + BYTE *block_data; + BYTE *pixel_data; CRITICAL_SECTION lock; dds_frame_info info; } DdsFrameDecode; @@ -535,7 +536,8 @@ static ULONG WINAPI DdsFrameDecode_Release(IWICBitmapFrameDecode *iface) TRACE("(%p) refcount=%u\n", iface, ref); if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This->data); + HeapFree(GetProcessHeap(), 0, This->pixel_data); + HeapFree(GetProcessHeap(), 0, This->block_data); HeapFree(GetProcessHeap(), 0, This); } @@ -593,6 +595,7 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, DdsFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface); UINT bpp, frame_stride, frame_size; INT x, y, width, height; + HRESULT hr = S_OK; TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer); @@ -619,7 +622,20 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, if (cbStride < width * bpp / 8) return E_INVALIDARG; if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER; - return S_OK; + EnterCriticalSection(&This->lock); + + if (!This->pixel_data) { + This->pixel_data = HeapAlloc(GetProcessHeap(), 0, frame_size); + if (!This->pixel_data) { + hr = E_OUTOFMEMORY; + goto end; + } + } + +end: + LeaveCriticalSection(&This->lock); + + return hr; } static HRESULT WINAPI DdsFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, @@ -731,7 +747,7 @@ static HRESULT WINAPI DdsFrameDecode_Dds_CopyBlocks(IWICDdsFrameDecode *iface, if (!boundsInBlocks) { if (stride < frame_stride) return E_INVALIDARG; if (bufferSize < frame_size) return E_INVALIDARG; - memcpy(buffer, This->data, frame_size); + memcpy(buffer, This->block_data, frame_size); return S_OK; } @@ -747,7 +763,7 @@ static HRESULT WINAPI DdsFrameDecode_Dds_CopyBlocks(IWICDdsFrameDecode *iface, if (stride < width * bytes_per_block) return E_INVALIDARG; if (bufferSize < stride * height) return E_INVALIDARG; - data = This->data + (x + y * This->info.width_in_blocks) * bytes_per_block; + data = This->block_data + (x + y * This->info.width_in_blocks) * bytes_per_block; dst_buffer = buffer; for (i = 0; i < height; i++) { @@ -1143,10 +1159,11 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface, frame_decode->info.height_in_blocks = frame_height_in_blocks; frame_decode->info.pixel_format = This->info.pixel_format; frame_decode->info.pixel_format_bpp = get_pixel_format_bpp(This->info.pixel_format); - frame_decode->data = HeapAlloc(GetProcessHeap(), 0, frame_size); + frame_decode->block_data = HeapAlloc(GetProcessHeap(), 0, frame_size); + frame_decode->pixel_data = NULL; hr = IStream_Seek(This->stream, seek, SEEK_SET, NULL); if (hr != S_OK) goto end; - hr = IStream_Read(This->stream, frame_decode->data, frame_size, &bytesread); + hr = IStream_Read(This->stream, frame_decode->block_data, frame_size, &bytesread); if (hr != S_OK || bytesread != frame_size) { hr = WINCODEC_ERR_STREAMREAD; goto end;
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
70
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Results per page:
10
25
50
100
200