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
Paul Gofman : ntdll: Support nested exceptions on x64.
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: ae07938ba661dc0515673835878710a25c99eec8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae07938ba661dc0515673835…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Fri Aug 14 12:08:25 2020 +0300 ntdll: Support nested exceptions on x64. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_x86_64.c | 6 ++--- dlls/ntdll/tests/exception.c | 64 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 28e4ec8ca6..0cbcc177b2 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -380,10 +380,10 @@ NTSTATUS WINAPI RtlWow64SetThreadContext( HANDLE handle, const WOW64_CONTEXT *co static DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame, CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher ) { - if (rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)) return ExceptionContinueSearch; + if (!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND))) + rec->ExceptionFlags |= EH_NESTED_CALL; - /* FIXME */ - return ExceptionNestedException; + return ExceptionContinueSearch; } /********************************************************************** diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index f74ddde0f2..b6307264bc 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -68,6 +68,10 @@ typedef struct _RTL_UNLOAD_EVENT_TRACE static RTL_UNLOAD_EVENT_TRACE *(WINAPI *pRtlGetUnloadEventTrace)(void); static void (WINAPI *pRtlGetUnloadEventTraceEx)(ULONG **element_size, ULONG **element_count, void **event_trace); +#ifndef EH_NESTED_CALL +#define EH_NESTED_CALL 0x10 +#endif + #if defined(__x86_64__) typedef struct { @@ -3782,6 +3786,65 @@ static void test_kiuserexceptiondispatcher(void) ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError()); } +static BOOL got_nested_exception, got_prev_frame_exception; +static void *nested_exception_initial_frame; + +static DWORD nested_exception_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame, + CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher) +{ + trace("nested_exception_handler Rip %p, Rsp %p, code %#x, flags %#x, ExceptionAddress %p.\n", + (void *)context->Rip, (void *)context->Rsp, rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress); + + if (rec->ExceptionCode == 0x80000003 + && !(rec->ExceptionFlags & EH_NESTED_CALL)) + { + ok(rec->NumberParameters == 1, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters); + ok((void *)context->Rsp == frame, "Got unexpected frame %p.\n", frame); + ok(*(void **)frame == (char *)code_mem + 5, "Got unexpected *frame %p.\n", *(void **)frame); + ok(context->Rip == (ULONG_PTR)((char *)code_mem + 7), "Got unexpected Rip %#lx.\n", context->Rip); + + nested_exception_initial_frame = frame; + RaiseException(0xdeadbeef, 0, 0, 0); + ++context->Rip; + return ExceptionContinueExecution; + } + + if (rec->ExceptionCode == 0xdeadbeef && rec->ExceptionFlags == EH_NESTED_CALL) + { + ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters); + got_nested_exception = TRUE; + ok(frame == nested_exception_initial_frame, "Got unexpected frame %p.\n", frame); + return ExceptionContinueSearch; + } + + ok(rec->ExceptionCode == 0xdeadbeef && !rec->ExceptionFlags, + "Got unexpected exception code %#x, flags %#x.\n", rec->ExceptionCode, rec->ExceptionFlags); + ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters); + ok(frame == (void *)((BYTE *)nested_exception_initial_frame + 8), + "Got unexpected frame %p.\n", frame); + got_prev_frame_exception = TRUE; + return ExceptionContinueExecution; +} + +static void test_nested_exception(void) +{ + static const BYTE except_code[] = + { + 0xe8, 0x02, 0x00, 0x00, 0x00, /* call nest */ + 0x90, /* nop */ + 0xc3, /* ret */ + /* nest: */ + 0xcc, /* int3 */ + 0x90, /* nop */ + 0xc3, /* ret */ + }; + + got_nested_exception = got_prev_frame_exception = FALSE; + run_exception_test(nested_exception_handler, NULL, except_code, ARRAY_SIZE(except_code), PAGE_EXECUTE_READ); + ok(got_nested_exception, "Did not get nested exception.\n"); + ok(got_prev_frame_exception, "Did not get nested exception in the previous frame.\n"); +} + #elif defined(__arm__) static void test_thread_context(void) @@ -5450,6 +5513,7 @@ START_TEST(exception) test_dpe_exceptions(); test_wow64_context(); test_kiuserexceptiondispatcher(); + test_nested_exception(); if (pRtlAddFunctionTable && pRtlDeleteFunctionTable && pRtlInstallFunctionTableCallback && pRtlLookupFunctionEntry) test_dynamic_unwind();
1
0
0
0
Dmitry Timoshkov : ieframe: When activating UI also activate the embedded document.
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: 44a983f650cfc07848bf29027aca8d8b83634d5a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=44a983f650cfc07848bf2902…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Aug 14 15:04:03 2020 +0800 ieframe: When activating UI also activate the embedded document. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ieframe/dochost.c | 26 ++++++++++++++++++++++++++ dlls/ieframe/ieframe.h | 1 + dlls/ieframe/oleobject.c | 2 ++ 3 files changed, 29 insertions(+) diff --git a/dlls/ieframe/dochost.c b/dlls/ieframe/dochost.c index 46d5cc5dd1..042417b5b1 100644 --- a/dlls/ieframe/dochost.c +++ b/dlls/ieframe/dochost.c @@ -598,6 +598,32 @@ HRESULT refresh_document(DocHost *This, const VARIANT *level) return S_OK; } +void activate_document(DocHost *This) +{ + IOleObject *oleobj; + IHlinkTarget *hlink; + HRESULT hres; + + if(!This->document) return; + + hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink); + if(SUCCEEDED(hres)) { + IHlinkTarget_Navigate(hlink, 0, NULL); + IHlinkTarget_Release(hlink); + } + + hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj); + if(SUCCEEDED(hres)) { + IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, NULL, -1, 0, NULL); + IOleObject_Release(oleobj); + } + + refresh_document(This, NULL); + + if(This->view) + IOleDocumentView_UIActivate(This->view, TRUE); +} + void release_dochost_client(DocHost *This) { if(This->hwnd) { diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h index 24d490c272..a35507e6fb 100644 --- a/dlls/ieframe/ieframe.h +++ b/dlls/ieframe/ieframe.h @@ -283,6 +283,7 @@ HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN; void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN; HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN; void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN; +void activate_document(DocHost*) DECLSPEC_HIDDEN; void deactivate_document(DocHost*) DECLSPEC_HIDDEN; void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN; void on_commandstate_change(DocHost*,LONG,BOOL) DECLSPEC_HIDDEN; diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c index a2f87dda2f..be0e6ec5bf 100644 --- a/dlls/ieframe/oleobject.c +++ b/dlls/ieframe/oleobject.c @@ -230,6 +230,8 @@ static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site) SetFocus(This->shell_embedding_hwnd); notify_on_focus(This, TRUE); + activate_document(&This->doc_host); + This->ui_activated = TRUE; return S_OK;
1
0
0
0
Dmitry Timoshkov : mshtml: Add trace to IOleCommandTarget::Exec().
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: 8975ec118c28a028b7560bd1a4fef66b625ad867 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8975ec118c28a028b7560bd1…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Aug 14 15:04:00 2020 +0800 mshtml: Add trace to IOleCommandTarget::Exec(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/olecmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 43f9285e8f..a79f2d000e 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -917,6 +917,8 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID { HTMLDocument *This = impl_from_IOleCommandTarget(iface); + TRACE("(%p)->(%s %d %d %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut); + if(!This->doc_node->browser) return E_UNEXPECTED;
1
0
0
0
Nikolay Sivov : combase: Move CoInitializeSecurity().
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: 561a192317de945ff60a2140c5c027775c7a72ef URL:
https://source.winehq.org/git/wine.git/?a=commit;h=561a192317de945ff60a2140…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Aug 14 09:16:29 2020 +0300 combase: Move CoInitializeSecurity(). 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 | 13 +++++++++++++ dlls/combase/combase.spec | 2 +- dlls/ole32/compobj.c | 15 --------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 5752d90d5c..8d8d83005b 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -785,6 +785,19 @@ HRESULT WINAPI CoRevertToSelf(void) return hr; } +/*********************************************************************** + * CoInitializeSecurity (combase.@) + */ +HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR sd, LONG cAuthSvc, + SOLE_AUTHENTICATION_SERVICE *asAuthSvc, void *reserved1, DWORD authn_level, + DWORD imp_level, void *reserved2, DWORD capabilities, void *reserved3) +{ + FIXME("%p, %d, %p, %p, %d, %d, %p, %d, %p stub\n", sd, cAuthSvc, asAuthSvc, reserved1, authn_level, + imp_level, reserved2, capabilities, reserved3); + + return S_OK; +} + /*********************************************************************** * CoGetObjectContext (combase.@) */ diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index be5ed85a8e..0f34dc6918 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -124,7 +124,7 @@ @ stdcall CoImpersonateClient() @ stdcall CoIncrementMTAUsage(ptr) ole32.CoIncrementMTAUsage @ stdcall CoInitializeEx(ptr long) ole32.CoInitializeEx -@ stdcall CoInitializeSecurity(ptr long ptr ptr long long ptr long ptr) ole32.CoInitializeSecurity +@ stdcall CoInitializeSecurity(ptr long ptr ptr long long ptr long ptr) @ stdcall CoInitializeWOW(long long) ole32.CoInitializeWOW @ stub CoInvalidateRemoteMachineBindings @ stdcall CoIsHandlerConnected(ptr) ole32.CoIsHandlerConnected diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index f983b07f20..350508ac9a 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3352,21 +3352,6 @@ BOOL WINAPI IsEqualGUID( return !memcmp(rguid1,rguid2,sizeof(GUID)); } -/*********************************************************************** - * CoInitializeSecurity [OLE32.@] - */ -HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, - SOLE_AUTHENTICATION_SERVICE* asAuthSvc, - void* pReserved1, DWORD dwAuthnLevel, - DWORD dwImpLevel, void* pReserved2, - DWORD dwCapabilities, void* pReserved3) -{ - FIXME("(%p,%d,%p,%p,%d,%d,%p,%d,%p) - stub!\n", pSecDesc, cAuthSvc, - asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2, - dwCapabilities, pReserved3); - return S_OK; -} - /*********************************************************************** * CoSuspendClassObjects [OLE32.@] * diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 7ab90e7b7a..7b2c583661 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -51,7 +51,7 @@ @ stdcall CoIncrementMTAUsage(ptr) @ stdcall CoInitialize(ptr) @ stdcall CoInitializeEx(ptr long) -@ stdcall CoInitializeSecurity(ptr long ptr ptr long long ptr long ptr) +@ stdcall CoInitializeSecurity(ptr long ptr ptr long long ptr long ptr) combase.CoInitializeSecurity @ stdcall CoInitializeWOW(long long) @ stdcall CoIsHandlerConnected(ptr) @ stdcall CoIsOle1Class (ptr)
1
0
0
0
Nikolay Sivov : combase: Move CoMarshalInterface().
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: bca780c020ba8e2ae21f6e876e78160029a46385 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bca780c020ba8e2ae21f6e87…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Aug 14 09:16:28 2020 +0300 combase: Move CoMarshalInterface(). 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.spec | 2 +- dlls/combase/marshal.c | 95 +++++++++++++++++++++++++++++ dlls/ole32/marshal.c | 149 ---------------------------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 97 insertions(+), 151 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=bca780c020ba8e2ae21f…
1
0
0
0
Nikolay Sivov : combase: Move CoGetMarshalSizeMax().
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: 3aefd100d73705b4d8bbe6f7dabc631322bb3a0c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3aefd100d73705b4d8bbe6f7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Aug 14 09:16:27 2020 +0300 combase: Move CoGetMarshalSizeMax(). 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.spec | 2 +- dlls/combase/marshal.c | 32 +++++++++++++++++++++++++++++ dlls/ole32/marshal.c | 52 ----------------------------------------------- dlls/ole32/ole32.spec | 2 +- 4 files changed, 34 insertions(+), 54 deletions(-) diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 3214f54550..8bcac10cdc 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -112,7 +112,7 @@ @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) @ stdcall CoGetMalloc(long ptr) -@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) ole32.CoGetMarshalSizeMax +@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) @ stub CoGetModuleType @ stdcall CoGetObjectContext(ptr ptr) @ stdcall CoGetPSClsid(ptr ptr) ole32.CoGetPSClsid diff --git a/dlls/combase/marshal.c b/dlls/combase/marshal.c index 2b0c005812..3c577a9bff 100644 --- a/dlls/combase/marshal.c +++ b/dlls/combase/marshal.c @@ -24,6 +24,7 @@ #include "wine/debug.h" #include "wine/heap.h" +#include "wine/orpc.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -379,3 +380,34 @@ HRESULT WINAPI CoCreateFreeThreadedMarshaler(IUnknown *outer, IUnknown **marshal return S_OK; } + +/*********************************************************************** + * CoGetMarshalSizeMax (combase.@) + */ +HRESULT WINAPI CoGetMarshalSizeMax(ULONG *size, REFIID riid, IUnknown *unk, + DWORD dest_context, void *pvDestContext, DWORD mshlFlags) +{ + BOOL std_marshal = FALSE; + IMarshal *marshal; + HRESULT hr; + + if (!unk) + return E_POINTER; + + hr = IUnknown_QueryInterface(unk, &IID_IMarshal, (void **)&marshal); + if (hr != S_OK) + { + std_marshal = TRUE; + hr = CoGetStandardMarshal(riid, unk, dest_context, pvDestContext, mshlFlags, &marshal); + } + if (hr != S_OK) + return hr; + + hr = IMarshal_GetMarshalSizeMax(marshal, riid, unk, dest_context, pvDestContext, mshlFlags, size); + if (!std_marshal) + /* add on the size of the whole OBJREF structure like native does */ + *size += sizeof(OBJREF); + + IMarshal_Release(marshal); + return hr; +} diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index cf1e55babe..ea8432e2ee 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -1777,58 +1777,6 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal, return hr; } -/*********************************************************************** - * CoGetMarshalSizeMax [OLE32.@] - * - * Gets the maximum amount of data that will be needed by a marshal. - * - * PARAMS - * pulSize [O] Address where maximum marshal size will be stored. - * riid [I] Identifier of the interface to marshal. - * pUnk [I] Pointer to the object to marshal. - * dwDestContext [I] Destination. Used to enable or disable optimizations. - * pvDestContext [I] Reserved. Must be NULL. - * mshlFlags [I] Flags that affect the marshaling. See CoMarshalInterface(). - * - * RETURNS - * Success: S_OK. - * Failure: HRESULT code. - * - * SEE ALSO - * CoMarshalInterface(). - */ -HRESULT WINAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk, - DWORD dwDestContext, void *pvDestContext, - DWORD mshlFlags) -{ - HRESULT hr; - LPMARSHAL pMarshal; - BOOL std_marshal = FALSE; - - if(!pUnk) - return E_POINTER; - - hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (void**)&pMarshal); - if (hr != S_OK) - { - std_marshal = TRUE; - hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext, - mshlFlags, &pMarshal); - } - if (hr != S_OK) - return hr; - - hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext, - pvDestContext, mshlFlags, pulSize); - if (!std_marshal) - /* add on the size of the whole OBJREF structure like native does */ - *pulSize += sizeof(OBJREF); - - IMarshal_Release(pMarshal); - return hr; -} - - static void dump_MSHLFLAGS(MSHLFLAGS flags) { if (flags & MSHLFLAGS_TABLESTRONG) diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index a19264127f..772599b4cf 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -39,7 +39,7 @@ @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) combase.CoGetInstanceFromIStorage @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) combase.CoGetInterfaceAndReleaseStream @ stdcall CoGetMalloc(long ptr) combase.CoGetMalloc -@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) +@ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) combase.CoGetMarshalSizeMax @ stdcall CoGetObject(wstr ptr ptr ptr) @ stdcall CoGetObjectContext(ptr ptr) combase.CoGetObjectContext @ stdcall CoGetPSClsid(ptr ptr)
1
0
0
0
Nikolay Sivov : include: Move fundamental ORPC types to separate private header.
by Alexandre Julliard
14 Aug '20
14 Aug '20
Module: wine Branch: master Commit: aaef46ea480cdbad08971f7f683cdbf37882f518 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=aaef46ea480cdbad08971f7f…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Aug 14 09:16:26 2020 +0300 include: Move fundamental ORPC types to separate private header. 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/dcom.idl | 151 +-------------------------------------- include/Makefile.in | 1 + include/wine/orpc.idl | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+), 150 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=aaef46ea480cdbad0897…
1
0
0
0
Rémi Bernon : dinput8: Stop using LL hooks for mouse devices.
by Alexandre Julliard
13 Aug '20
13 Aug '20
Module: wine Branch: master Commit: 447bce4117a58910690a0d2610ebcbdd49ae9127 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=447bce4117a58910690a0d26…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 10 11:04:17 2020 +0200 dinput8: Stop using LL hooks for mouse devices. LL hooks are heavy and using them cause performance hit with high polling rate mice. We don't need them anymore since we now use rawinput API for mouse device. This also uses a separate list for rawinput mouse devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 1c4a26987f..45023fc104 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -104,6 +104,7 @@ static BOOL check_hook_thread(void); static CRITICAL_SECTION dinput_hook_crit; static struct list direct_input_list = LIST_INIT( direct_input_list ); static struct list acquired_mouse_list = LIST_INIT( acquired_mouse_list ); +static struct list acquired_rawmouse_list = LIST_INIT( acquired_rawmouse_list ); static struct list acquired_keyboard_list = LIST_INIT( acquired_keyboard_list ); static struct list acquired_device_list = LIST_INIT( acquired_device_list ); @@ -116,7 +117,7 @@ void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface) EnterCriticalSection( &dinput_hook_crit ); if (IsEqualGUID( &dev->guid, &GUID_SysMouse )) - list_add_tail( &acquired_mouse_list, &dev->entry ); + list_add_tail( dev->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &dev->entry ); else if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard )) list_add_tail( &acquired_keyboard_list, &dev->entry ); else @@ -657,11 +658,8 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR else if (ri.header.dwType == RIM_TYPEMOUSE) { EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) - { - if (!dev->use_raw_input) continue; + LIST_FOR_EACH_ENTRY( dev, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam, &ri ); - } LeaveCriticalSection( &dinput_hook_crit ); } } @@ -1720,7 +1718,6 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) EnterCriticalSection( &dinput_hook_crit ); LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) { - if (dev->use_raw_input) continue; TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); } @@ -1764,6 +1761,14 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface ); } } + LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) + { + if (msg->hwnd == dev->win && msg->hwnd != foreground) + { + TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); + IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface ); + } + } LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) { if (msg->hwnd == dev->win && msg->hwnd != foreground)
1
0
0
0
Rémi Bernon : dinput8: Use rawinput interface for mouse device.
by Alexandre Julliard
13 Aug '20
13 Aug '20
Module: wine Branch: master Commit: 81d1c79dcda0eea8fd35b2dcc6dfa3c3a17e2393 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=81d1c79dcda0eea8fd35b2dc…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 10 11:04:16 2020 +0200 dinput8: Use rawinput interface for mouse device. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 10 +++++ dlls/dinput/dinput_private.h | 1 + dlls/dinput/mouse.c | 90 ++++++++++++++++++++++++++++++++++++++++++++ dlls/dinput8/tests/device.c | 11 ++---- 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index cd1a11b02f..1c4a26987f 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -654,6 +654,16 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR size = GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER) ); if (size == (UINT)-1 || size < sizeof(RAWINPUTHEADER)) WARN( "Unable to read raw input data\n" ); + else if (ri.header.dwType == RIM_TYPEMOUSE) + { + EnterCriticalSection( &dinput_hook_crit ); + LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + { + if (!dev->use_raw_input) continue; + dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam, &ri ); + } + LeaveCriticalSection( &dinput_hook_crit ); + } } return DefWindowProcW( hwnd, msg, wparam, lparam ); diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 06a439d6a4..c0c88da967 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -73,6 +73,7 @@ extern void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface); extern void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface); extern int dinput_mouse_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam); extern int dinput_keyboard_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam); +extern void dinput_mouse_rawinput_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam, RAWINPUT *raw ); extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN; extern void check_dinput_events(void) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 5e6f34f0ec..e50731fda4 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -239,6 +239,13 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput) newDevice->base.data_format.wine_df = df; IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface); + if (dinput->dwVersion >= 0x0800) + { + newDevice->base.use_raw_input = TRUE; + newDevice->base.raw_device.usUsagePage = 1; /* HID generic device page */ + newDevice->base.raw_device.usUsage = 2; /* HID generic mouse */ + } + return newDevice; failed: @@ -306,6 +313,89 @@ const struct dinput_device mouse_device = { * SysMouseA (DInput Mouse support) */ +void dinput_mouse_rawinput_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam, RAWINPUT *ri ) +{ + SysMouseImpl* This = impl_from_IDirectInputDevice8A( iface ); + POINT rel, pt; + DWORD seq; + int i, wdata = 0; + + static const USHORT mouse_button_flags[] = + { + RI_MOUSE_BUTTON_1_DOWN, RI_MOUSE_BUTTON_1_UP, + RI_MOUSE_BUTTON_2_DOWN, RI_MOUSE_BUTTON_2_UP, + RI_MOUSE_BUTTON_3_DOWN, RI_MOUSE_BUTTON_3_UP, + RI_MOUSE_BUTTON_4_DOWN, RI_MOUSE_BUTTON_4_UP, + RI_MOUSE_BUTTON_5_DOWN, RI_MOUSE_BUTTON_5_UP + }; + + TRACE( "(%p) wp %08lx, lp %08lx\n", iface, wparam, lparam ); + + if (ri->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP) + FIXME( "Unimplemented MOUSE_VIRTUAL_DESKTOP flag\n" ); + if (ri->data.mouse.usFlags & MOUSE_ATTRIBUTES_CHANGED) + FIXME( "Unimplemented MOUSE_ATTRIBUTES_CHANGED flag\n" ); + + EnterCriticalSection( &This->base.crit ); + seq = This->base.dinput->evsequence++; + + rel.x = ri->data.mouse.lLastX; + rel.y = ri->data.mouse.lLastY; + if (ri->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) + { + GetCursorPos( &pt ); + rel.x -= pt.x; + rel.y -= pt.y; + } + + This->m_state.lX += rel.x; + This->m_state.lY += rel.y; + + if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + { + pt.x = This->m_state.lX; + pt.y = This->m_state.lY; + } + else + { + pt = rel; + } + + if (rel.x) + queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS, + pt.x, GetCurrentTime(), seq ); + + if (rel.y) + queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS, + pt.y, GetCurrentTime(), seq ); + + if (rel.x || rel.y) + { + if ((This->warp_override == WARP_FORCE_ON) || + (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE))) + This->need_warp = TRUE; + } + + if (ri->data.mouse.usButtonFlags & RI_MOUSE_WHEEL) + { + This->m_state.lZ += (wdata = (SHORT)ri->data.mouse.usButtonData); + queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS, + wdata, GetCurrentTime(), seq ); + } + + for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i) + { + if (ri->data.mouse.usButtonFlags & mouse_button_flags[i]) + { + This->m_state.rgbButtons[i / 2] = 0x80 - (i % 2) * 0x80; + queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE +(i / 2) ) | DIDFT_PSHBUTTON, + This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq ); + } + } + + LeaveCriticalSection( &This->base.crit ); +} + /* low-level mouse hook */ int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam ) { diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c index 6fe9a63551..80a7fe26c3 100644 --- a/dlls/dinput8/tests/device.c +++ b/dlls/dinput8/tests/device.c @@ -646,13 +646,9 @@ static void test_mouse_keyboard(void) raw_devices_count = ARRAY_SIZE(raw_devices); memset(raw_devices, 0, sizeof(raw_devices)); hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); - todo_wine ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); - todo_wine ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage); - todo_wine ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage); - todo_wine ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); todo_wine ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); @@ -662,6 +658,9 @@ static void test_mouse_keyboard(void) GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE)); ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count); + if (raw_devices[0].hwndTarget != NULL) + di_hwnd = raw_devices[0].hwndTarget; + /* expect dinput8 to take over any activated raw input devices */ raw_devices[0].usUsagePage = 0x01; raw_devices[0].usUsage = 0x05; @@ -689,9 +688,7 @@ static void test_mouse_keyboard(void) ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage); ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage); - todo_wine ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); - todo_wine ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget); ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage); ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage); @@ -723,7 +720,6 @@ static void test_mouse_keyboard(void) memset(raw_devices, 0, sizeof(raw_devices)); hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE)); ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); - todo_wine ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); todo_wine ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags); @@ -737,7 +733,6 @@ static void test_mouse_keyboard(void) todo_wine ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count); ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage); - todo_wine ok(raw_devices[0].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage); ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags); ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
1
0
0
0
Rémi Bernon : dinput8: Add support for rawinput based devices.
by Alexandre Julliard
13 Aug '20
13 Aug '20
Module: wine Branch: master Commit: 225be12999ef8d7e9c8a504d0d26254c9cace568 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=225be12999ef8d7e9c8a504d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Aug 10 11:04:15 2020 +0200 dinput8: Add support for rawinput based devices. This adds a message window that will be used as the rawinput target window for WM_INPUT messages. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device_private.h | 3 ++ dlls/dinput/dinput_main.c | 77 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index fe5644f21c..2fac4f0e61 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -69,6 +69,9 @@ struct IDirectInputDeviceImpl HWND win; int acquired; + BOOL use_raw_input; /* use raw input instead of low-level messages */ + RAWINPUTDEVICE raw_device; /* raw device to (un)register */ + LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */ int queue_len; /* valid size of the queue */ int queue_head; /* position to write new event into queue */ diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 2e56150240..cd1a11b02f 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -97,6 +97,9 @@ static const struct dinput_device *dinput_devices[] = HINSTANCE DINPUT_instance; +static const WCHAR di_em_win_w[] = {'D','I','E','m','W','i','n',0}; +static HWND di_em_win; + static BOOL check_hook_thread(void); static CRITICAL_SECTION dinput_hook_crit; static struct list direct_input_list = LIST_INIT( direct_input_list ); @@ -637,6 +640,45 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, RE return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj ); } +static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + IDirectInputDeviceImpl *dev; + RAWINPUT ri; + UINT size = sizeof(ri); + int rim = GET_RAWINPUT_CODE_WPARAM( wparam ); + + TRACE( "%p %d %lx %lx\n", hwnd, msg, wparam, lparam ); + + if (msg == WM_INPUT && (rim == RIM_INPUT || rim == RIM_INPUTSINK)) + { + size = GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER) ); + if (size == (UINT)-1 || size < sizeof(RAWINPUTHEADER)) + WARN( "Unable to read raw input data\n" ); + } + + return DefWindowProcW( hwnd, msg, wparam, lparam ); +} + +static void register_di_em_win_class(void) +{ + WNDCLASSEXW class; + + memset(&class, 0, sizeof(class)); + class.cbSize = sizeof(class); + class.lpfnWndProc = di_em_win_wndproc; + class.hInstance = DINPUT_instance; + class.lpszClassName = di_em_win_w; + + if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) + WARN( "Unable to register message window class\n" ); +} + +static void unregister_di_em_win_class(void) +{ + if (!UnregisterClassW( di_em_win_w, NULL ) && GetLastError() != ERROR_CLASS_DOES_NOT_EXIST) + WARN( "Unable to unregister message window class\n" ); +} + static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion) { if (!This->initialized) @@ -1668,11 +1710,13 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) EnterCriticalSection( &dinput_hook_crit ); LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) { + if (dev->use_raw_input) continue; TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); } LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) { + if (dev->use_raw_input) continue; TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam ); } @@ -1728,6 +1772,9 @@ static DWORD WINAPI hook_thread_proc(void *param) static HHOOK kbd_hook, mouse_hook; MSG msg; + di_em_win = CreateWindowW( di_em_win_w, di_em_win_w, 0, 0, 0, 0, 0, + HWND_MESSAGE, 0, DINPUT_instance, NULL ); + /* Force creation of the message queue */ PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); SetEvent(param); @@ -1778,6 +1825,9 @@ static DWORD WINAPI hook_thread_proc(void *param) DispatchMessageW(&msg); } + DestroyWindow( di_em_win ); + di_em_win = NULL; + FreeLibraryAndExitThread(DINPUT_instance, 0); } @@ -1860,6 +1910,31 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) hook_thread_event = NULL; } + if (dev->use_raw_input) + { + if (acquired) + { + dev->raw_device.dwFlags = 0; + if (dev->dwCoopLevel & DISCL_BACKGROUND) + dev->raw_device.dwFlags |= RIDEV_INPUTSINK; + if (dev->dwCoopLevel & DISCL_EXCLUSIVE) + dev->raw_device.dwFlags |= RIDEV_NOLEGACY; + if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 2) + dev->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE; + if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 6) + dev->raw_device.dwFlags |= RIDEV_NOHOTKEYS; + dev->raw_device.hwndTarget = di_em_win; + } + else + { + dev->raw_device.dwFlags = RIDEV_REMOVE; + dev->raw_device.hwndTarget = NULL; + } + + if (!RegisterRawInputDevices( &dev->raw_device, 1, sizeof(RAWINPUTDEVICE) )) + WARN( "Unable to (un)register raw device %x:%x\n", dev->raw_device.usUsagePage, dev->raw_device.usUsage ); + } + if (acquired) hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL ); PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, (LPARAM)hook_change_finished_event ); @@ -1894,9 +1969,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(inst); DINPUT_instance = inst; + register_di_em_win_class(); break; case DLL_PROCESS_DETACH: if (reserved) break; + unregister_di_em_win_class(); DeleteCriticalSection(&dinput_hook_crit); break; }
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
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