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
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
List overview
Download
Ros-diffs
November 2018
----- 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
ros-diffs@reactos.org
29 participants
250 discussions
Start a n
N
ew thread
[reactos] 01/01: [MC] Add messages 4800-4862 to netmsg.dll.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=792dd0dac5686c86485f1…
commit 792dd0dac5686c86485f16eeec93783f88cd08bb Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Fri Nov 30 23:58:21 2018 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Fri Nov 30 23:58:59 2018 +0100 [MC] Add messages 4800-4862 to netmsg.dll. --- sdk/include/reactos/mc/netmsgmsg.mc | 539 ++++++++++++++++++++++++++++++++++++ 1 file changed, 539 insertions(+) diff --git a/sdk/include/reactos/mc/netmsgmsg.mc b/sdk/include/reactos/mc/netmsgmsg.mc index a91d5a4959..48c334ca9e 100644 --- a/sdk/include/reactos/mc/netmsgmsg.mc +++ b/sdk/include/reactos/mc/netmsgmsg.mc @@ -11351,6 +11351,545 @@ Language=Russian None%0 . +MessageId=4800 +Severity=Success +Facility=System +SymbolicName=APPERR2_4800 +Language=English +Name%0 +. +Language=Russian +Name%0 +. + +MessageId=4801 +Severity=Success +Facility=System +SymbolicName=APPERR2_4801 +Language=English +Forwarded to%0 +. +Language=Russian +Forwarded to%0 +. + +MessageId=4802 +Severity=Success +Facility=System +SymbolicName=APPERR2_4802 +Language=English +Forwarded to you from%0 +. +Language=Russian +Forwarded to you from%0 +. + +MessageId=4803 +Severity=Success +Facility=System +SymbolicName=APPERR2_4803 +Language=English +Users of this server%0 +. +Language=Russian +Users of this server%0 +. + +MessageId=4804 +Severity=Success +Facility=System +SymbolicName=APPERR2_4804 +Language=English +Net Send has been interrupted by a Ctrl+Break from the user. +. +Language=Russian +Net Send has been interrupted by a Ctrl+Break from the user. +. + +MessageId=4810 +Severity=Success +Facility=System +SymbolicName=APPERR2_4810 +Language=English +Name Job # Size Status +. +Language=Russian +Name Job # Size Status +. + +MessageId=4811 +Severity=Success +Facility=System +SymbolicName=APPERR2_4811 +Language=English +jobs%0 +. +Language=Russian +jobs%0 +. + +MessageId=4812 +Severity=Success +Facility=System +SymbolicName=APPERR2_4812 +Language=English +Print%0 +. +Language=Russian +Print%0 +. + +MessageId=4813 +Severity=Success +Facility=System +SymbolicName=APPERR2_4813 +Language=English +Name%0 +. +Language=Russian +Name%0 +. + +MessageId=4814 +Severity=Success +Facility=System +SymbolicName=APPERR2_4814 +Language=English +Job #%0 +. +Language=Russian +Job #%0 +. + +MessageId=4815 +Severity=Success +Facility=System +SymbolicName=APPERR2_4815 +Language=English +Size%0 +. +Language=Russian +Size%0 +. + +MessageId=4816 +Severity=Success +Facility=System +SymbolicName=APPERR2_4816 +Language=English +Status%0 +. +Language=Russian +Status%0 +. + +MessageId=4817 +Severity=Success +Facility=System +SymbolicName=APPERR2_4817 +Language=English +Separator file%0 +. +Language=Russian +Separator file%0 +. + +MessageId=4818 +Severity=Success +Facility=System +SymbolicName=APPERR2_4818 +Language=English +Comment%0 +. +Language=Russian +Comment%0 +. + +MessageId=4819 +Severity=Success +Facility=System +SymbolicName=APPERR2_4819 +Language=English +Priority%0 +. +Language=Russian +Priority%0 +. + +MessageId=4820 +Severity=Success +Facility=System +SymbolicName=APPERR2_4820 +Language=English +Print after%0 +. +Language=Russian +Print after%0 +. + +MessageId=4821 +Severity=Success +Facility=System +SymbolicName=APPERR2_4821 +Language=English +Print until%0 +. +Language=Russian +Print until%0 +. + +MessageId=4822 +Severity=Success +Facility=System +SymbolicName=APPERR2_4822 +Language=English +Print processor%0 +. +Language=Russian +Print processor%0 +. + +MessageId=4823 +Severity=Success +Facility=System +SymbolicName=APPERR2_4823 +Language=English +Additional info%0 +. +Language=Russian +Additional info%0 +. + +MessageId=4824 +Severity=Success +Facility=System +SymbolicName=APPERR2_4824 +Language=English +Parameters%0 +. +Language=Russian +Parameters%0 +. + +MessageId=4825 +Severity=Success +Facility=System +SymbolicName=APPERR2_4825 +Language=English +Print Devices%0 +. +Language=Russian +Print Devices%0 +. + +MessageId=4826 +Severity=Success +Facility=System +SymbolicName=APPERR2_4826 +Language=English +Printer Active%0 +. +Language=Russian +Printer Active%0 +. + +MessageId=4827 +Severity=Success +Facility=System +SymbolicName=APPERR2_4827 +Language=English +Printer held%0 +. +Language=Russian +Printer held%0 +. + +MessageId=4828 +Severity=Success +Facility=System +SymbolicName=APPERR2_4828 +Language=English +Printer error%0 +. +Language=Russian +Printer error%0 +. + +MessageId=4829 +Severity=Success +Facility=System +SymbolicName=APPERR2_4829 +Language=English +Printer being deleted%0 +. +Language=Russian +Printer being deleted%0 +. + +MessageId=4830 +Severity=Success +Facility=System +SymbolicName=APPERR2_4830 +Language=English +Printer status unknown%0 +. +Language=Russian +Printer status unknown%0 +. + +MessageId=4840 +Severity=Success +Facility=System +SymbolicName=APPERR2_4840 +Language=English +Held until %1%0 +. +Language=Russian +Held until %1%0 +. + +MessageId=4841 +Severity=Success +Facility=System +SymbolicName=APPERR2_4841 +Language=English +Job #%0 +. +Language=Russian +Job #%0 +. + +MessageId=4842 +Severity=Success +Facility=System +SymbolicName=APPERR2_4842 +Language=English +Submitting user%0 +. +Language=Russian +Submitting user%0 +. + +MessageId=4843 +Severity=Success +Facility=System +SymbolicName=APPERR2_4843 +Language=English +Notify%0 +. +Language=Russian +Notify%0 +. + +MessageId=4844 +Severity=Success +Facility=System +SymbolicName=APPERR2_4844 +Language=English +Job data type%0 +. +Language=Russian +Job data type%0 +. + +MessageId=4845 +Severity=Success +Facility=System +SymbolicName=APPERR2_4845 +Language=English +Job parameters%0 +. +Language=Russian +Job parameters%0 +. + +MessageId=4846 +Severity=Success +Facility=System +SymbolicName=APPERR2_4846 +Language=English +Waiting%0 +. +Language=Russian +Waiting%0 +. + +MessageId=4847 +Severity=Success +Facility=System +SymbolicName=APPERR2_4847 +Language=English +Held in queue%0 +. +Language=Russian +Held in queue%0 +. + +MessageId=4848 +Severity=Success +Facility=System +SymbolicName=APPERR2_4848 +Language=English +Spooling%0 +. +Language=Russian +Spooling%0 +. + +MessageId=4849 +Severity=Success +Facility=System +SymbolicName=APPERR2_4849 +Language=English +Paused%0 +. +Language=Russian +Paused%0 +. + +MessageId=4850 +Severity=Success +Facility=System +SymbolicName=APPERR2_4850 +Language=English +Offline%0 +. +Language=Russian +Offline%0 +. + +MessageId=4851 +Severity=Success +Facility=System +SymbolicName=APPERR2_4851 +Language=English +Error%0 +. +Language=Russian +Error%0 +. + +MessageId=4852 +Severity=Success +Facility=System +SymbolicName=APPERR2_4852 +Language=English +Out of paper%0 +. +Language=Russian +Out of paper%0 +. + +MessageId=4853 +Severity=Success +Facility=System +SymbolicName=APPERR2_4853 +Language=English +Intervention required%0 +. +Language=Russian +Intervention required%0 +. + +MessageId=4854 +Severity=Success +Facility=System +SymbolicName=APPERR2_4854 +Language=English +Printing%0 +. +Language=Russian +Printing%0 +. + +MessageId=4855 +Severity=Success +Facility=System +SymbolicName=APPERR2_4855 +Language=English +on %0 +. +Language=Russian +on %0 +. + +MessageId=4856 +Severity=Success +Facility=System +SymbolicName=APPERR2_4856 +Language=English +Paused on %1%0 +. +Language=Russian +Paused on %1%0 +. + +MessageId=4857 +Severity=Success +Facility=System +SymbolicName=APPERR2_4857 +Language=English +Offline on %1%0 +. +Language=Russian +Offline on %1%0 +. + +MessageId=4858 +Severity=Success +Facility=System +SymbolicName=APPERR2_4858 +Language=English +Error on%1%0 +. +Language=Russian +Error on%1%0 +. + +MessageId=4859 +Severity=Success +Facility=System +SymbolicName=APPERR2_4859 +Language=English +Out of Paper on %1%0 +. +Language=Russian +Out of Paper on %1%0 +. + +MessageId=4860 +Severity=Success +Facility=System +SymbolicName=APPERR2_4860 +Language=English +Check printer on %1%0 +. +Language=Russian +Check printer on %1%0 +. + +MessageId=4861 +Severity=Success +Facility=System +SymbolicName=APPERR2_4861 +Language=English +Printing on %1%0 +. +Language=Russian +Printing on %1%0 +. + +MessageId=4862 +Severity=Success +Facility=System +SymbolicName=APPERR2_4862 +Language=English +Driver%0 +. +Language=Russian +Driver%0 +. + ;
6 years
1
0
0
0
[reactos] 02/02: [XOLEHLP] Import xolehlp.dll from Wine(-Staging) 3.21.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95deef460bc00d66ba81d…
commit 95deef460bc00d66ba81dd0300ca5ab44b25f605 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Fri Nov 30 21:45:36 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Nov 30 21:49:28 2018 +0100 [XOLEHLP] Import xolehlp.dll from Wine(-Staging) 3.21. Should help improving the situation of the Microsoft SQL Server 2005 Express Edition installer. CORE-15399 --- dll/win32/CMakeLists.txt | 1 + dll/win32/xolehlp/CMakeLists.txt | 15 + dll/win32/xolehlp/xolehlp.c | 710 +++++++++++++++++++++++++++++++++++++++ dll/win32/xolehlp/xolehlp.spec | 6 + media/doc/README.WINE | 1 + 5 files changed, 733 insertions(+) diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt index 917c43d06d..8f426f9532 100644 --- a/dll/win32/CMakeLists.txt +++ b/dll/win32/CMakeLists.txt @@ -261,3 +261,4 @@ add_subdirectory(xinput1_2) add_subdirectory(xinput1_3) add_subdirectory(xinput9_1_0) add_subdirectory(xmllite) +add_subdirectory(xolehlp) diff --git a/dll/win32/xolehlp/CMakeLists.txt b/dll/win32/xolehlp/CMakeLists.txt new file mode 100644 index 0000000000..28a30d5abe --- /dev/null +++ b/dll/win32/xolehlp/CMakeLists.txt @@ -0,0 +1,15 @@ + +add_definitions(-D__WINESRC__) +include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) +spec2def(xolehlp.dll xolehlp.spec) + +list(APPEND SOURCE + xolehlp.c + ${CMAKE_CURRENT_BINARY_DIR}/xolehlp_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/xolehlp.def) + +add_library(xolehlp SHARED ${SOURCE}) +set_module_type(xolehlp win32dll) +target_link_libraries(xolehlp adsiid uuid wine) +add_importlibs(xolehlp msvcrt kernel32 ntdll) +add_cd_file(TARGET xolehlp DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/xolehlp/xolehlp.c b/dll/win32/xolehlp/xolehlp.c new file mode 100644 index 0000000000..2a741f4914 --- /dev/null +++ b/dll/win32/xolehlp/xolehlp.c @@ -0,0 +1,710 @@ +/* + * Copyright 2011 Hans Leidekker for CodeWeavers + * + * 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> +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "transact.h" +#include "initguid.h" +#include "txdtc.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(xolehlp); + +/* Resource manager start */ + +typedef struct { + IResourceManager IResourceManager_iface; + LONG ref; +} ResourceManager; + +static inline ResourceManager *impl_from_IResourceManager(IResourceManager *iface) +{ + return CONTAINING_RECORD(iface, ResourceManager, IResourceManager_iface); +} + +static HRESULT WINAPI ResourceManager_QueryInterface(IResourceManager *iface, REFIID iid, + void **ppv) +{ + ResourceManager *This = impl_from_IResourceManager(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IResourceManager, iid)) + { + *ppv = &This->IResourceManager_iface; + } + else + { + FIXME("(%s): not implemented\n", debugstr_guid(iid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ResourceManager_AddRef(IResourceManager *iface) +{ + ResourceManager *This = impl_from_IResourceManager(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI ResourceManager_Release(IResourceManager *iface) +{ + ResourceManager *This = impl_from_IResourceManager(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} +static HRESULT WINAPI ResourceManager_Enlist(IResourceManager *iface, + ITransaction *pTransaction,ITransactionResourceAsync *pRes,XACTUOW *pUOW, + LONG *pisoLevel,ITransactionEnlistmentAsync **ppEnlist) +{ + FIXME("(%p, %p, %p, %p, %p, %p): stub\n", iface, pTransaction,pRes,pUOW, + pisoLevel,ppEnlist); + return E_NOTIMPL; +} +static HRESULT WINAPI ResourceManager_Reenlist(IResourceManager *iface, + byte *pPrepInfo,ULONG cbPrepInfo,DWORD lTimeout,XACTSTAT *pXactStat) +{ + FIXME("(%p, %p, %u, %u, %p): stub\n", iface, pPrepInfo, cbPrepInfo, lTimeout, pXactStat); + return E_NOTIMPL; +} +static HRESULT WINAPI ResourceManager_ReenlistmentComplete(IResourceManager *iface) +{ + FIXME("(%p): stub\n", iface); + return S_OK; +} +static HRESULT WINAPI ResourceManager_GetDistributedTransactionManager(IResourceManager *iface, + REFIID iid,void **ppvObject) +{ + FIXME("(%p, %s, %p): stub\n", iface, debugstr_guid(iid), ppvObject); + return E_NOTIMPL; +} + +static const IResourceManagerVtbl ResourceManager_Vtbl = { + ResourceManager_QueryInterface, + ResourceManager_AddRef, + ResourceManager_Release, + ResourceManager_Enlist, + ResourceManager_Reenlist, + ResourceManager_ReenlistmentComplete, + ResourceManager_GetDistributedTransactionManager +}; + +static HRESULT ResourceManager_Create(REFIID riid, void **ppv) +{ + ResourceManager *This; + HRESULT ret; + + if (!ppv) return E_INVALIDARG; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(ResourceManager)); + if (!This) return E_OUTOFMEMORY; + + This->IResourceManager_iface.lpVtbl = &ResourceManager_Vtbl; + This->ref = 1; + + ret = IResourceManager_QueryInterface(&This->IResourceManager_iface, riid, ppv); + IResourceManager_Release(&This->IResourceManager_iface); + + return ret; +} + +/* Resource manager end */ + +/* Transaction options start */ + +typedef struct { + ITransactionOptions ITransactionOptions_iface; + LONG ref; + XACTOPT opts; +} TransactionOptions; + +static inline TransactionOptions *impl_from_ITransactionOptions(ITransactionOptions *iface) +{ + return CONTAINING_RECORD(iface, TransactionOptions, ITransactionOptions_iface); +} + +static HRESULT WINAPI TransactionOptions_QueryInterface(ITransactionOptions *iface, REFIID iid, + void **ppv) +{ + TransactionOptions *This = impl_from_ITransactionOptions(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_ITransactionOptions, iid)) + { + *ppv = &This->ITransactionOptions_iface; + } + else + { + FIXME("(%s): not implemented\n", debugstr_guid(iid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI TransactionOptions_AddRef(ITransactionOptions *iface) +{ + TransactionOptions *This = impl_from_ITransactionOptions(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI TransactionOptions_Release(ITransactionOptions *iface) +{ + TransactionOptions *This = impl_from_ITransactionOptions(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} +static HRESULT WINAPI TransactionOptions_SetOptions(ITransactionOptions *iface, + XACTOPT *pOptions) +{ + TransactionOptions *This = impl_from_ITransactionOptions(iface); + + if (!pOptions) return E_INVALIDARG; + TRACE("(%p, %u, %s)\n", iface, pOptions->ulTimeout, debugstr_a(pOptions->szDescription)); + This->opts = *pOptions; + return S_OK; +} +static HRESULT WINAPI TransactionOptions_GetOptions(ITransactionOptions *iface, + XACTOPT *pOptions) +{ + TransactionOptions *This = impl_from_ITransactionOptions(iface); + + TRACE("(%p, %p)\n", iface, pOptions); + if (!pOptions) return E_INVALIDARG; + *pOptions = This->opts; + return S_OK; +} + +static const ITransactionOptionsVtbl TransactionOptions_Vtbl = { + TransactionOptions_QueryInterface, + TransactionOptions_AddRef, + TransactionOptions_Release, + TransactionOptions_SetOptions, + TransactionOptions_GetOptions +}; + +static HRESULT TransactionOptions_Create(ITransactionOptions **ppv) +{ + TransactionOptions *This; + + if (!ppv) return E_INVALIDARG; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(TransactionOptions)); + if (!This) return E_OUTOFMEMORY; + + This->ITransactionOptions_iface.lpVtbl = &TransactionOptions_Vtbl; + This->ref = 1; + + *ppv = &This->ITransactionOptions_iface; + + return S_OK; +} + +/* Transaction options end */ + +/* Transaction start */ + +typedef struct { + ITransaction ITransaction_iface; + LONG ref; + XACTTRANSINFO info; +} Transaction; + +static inline Transaction *impl_from_ITransaction(ITransaction *iface) +{ + return CONTAINING_RECORD(iface, Transaction, ITransaction_iface); +} + +static HRESULT WINAPI Transaction_QueryInterface(ITransaction *iface, REFIID iid, + void **ppv) +{ + Transaction *This = impl_from_ITransaction(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_ITransaction, iid)) + { + *ppv = &This->ITransaction_iface; + } + else + { + FIXME("(%s): not implemented\n", debugstr_guid(iid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI Transaction_AddRef(ITransaction *iface) +{ + Transaction *This = impl_from_ITransaction(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI Transaction_Release(ITransaction *iface) +{ + Transaction *This = impl_from_ITransaction(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} +static HRESULT WINAPI Transaction_Commit(ITransaction *iface, + BOOL fRetaining, DWORD grfTC, DWORD grfRM) +{ + FIXME("(%p, %d, %08x, %08x): stub\n", iface, fRetaining, grfTC, grfRM); + return E_NOTIMPL; +} +static HRESULT WINAPI Transaction_Abort(ITransaction *iface, + BOID *pboidReason, BOOL fRetaining, BOOL fAsync) +{ + FIXME("(%p, %p, %d, %d): stub\n", iface, pboidReason, fRetaining, fAsync); + return E_NOTIMPL; +} +static HRESULT WINAPI Transaction_GetTransactionInfo(ITransaction *iface, + XACTTRANSINFO *pinfo) +{ + Transaction *This = impl_from_ITransaction(iface); + TRACE("(%p, %p)\n", iface, pinfo); + if (!pinfo) return E_INVALIDARG; + *pinfo = This->info; + return S_OK; +} + +static const ITransactionVtbl Transaction_Vtbl = { + Transaction_QueryInterface, + Transaction_AddRef, + Transaction_Release, + Transaction_Commit, + Transaction_Abort, + Transaction_GetTransactionInfo +}; + +static HRESULT Transaction_Create(ISOLEVEL isoLevel, ULONG isoFlags, + ITransactionOptions *pOptions, ITransaction **ppv) +{ + Transaction *This; + + if (!ppv) return E_INVALIDARG; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(Transaction)); + if (!This) return E_OUTOFMEMORY; + ZeroMemory(&This->info, sizeof(This->info)); + + This->ITransaction_iface.lpVtbl = &Transaction_Vtbl; + This->ref = 1; + This->info.isoLevel = isoLevel; + This->info.isoFlags = isoFlags; + + *ppv = &This->ITransaction_iface; + + return S_OK; +} + +/* Transaction end */ + +/* DTC Proxy Core Object start */ + +typedef struct { + ITransactionDispenser ITransactionDispenser_iface; + LONG ref; + IResourceManagerFactory2 IResourceManagerFactory2_iface; + ITransactionImportWhereabouts ITransactionImportWhereabouts_iface; + ITransactionImport ITransactionImport_iface; +} TransactionManager; + +static inline TransactionManager *impl_from_ITransactionDispenser(ITransactionDispenser *iface) +{ + return CONTAINING_RECORD(iface, TransactionManager, ITransactionDispenser_iface); +} + +static HRESULT WINAPI TransactionDispenser_QueryInterface(ITransactionDispenser *iface, REFIID iid, + void **ppv) +{ + TransactionManager *This = impl_from_ITransactionDispenser(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_ITransactionDispenser, iid)) + { + *ppv = &This->ITransactionDispenser_iface; + } + else if (IsEqualIID(&IID_IResourceManagerFactory, iid) || + IsEqualIID(&IID_IResourceManagerFactory2, iid)) + { + *ppv = &This->IResourceManagerFactory2_iface; + } + else if (IsEqualIID(&IID_ITransactionImportWhereabouts, iid)) + { + *ppv = &This->ITransactionImportWhereabouts_iface; + } + else if (IsEqualIID(&IID_ITransactionImport, iid)) + { + *ppv = &This->ITransactionImport_iface; + } + else + { + FIXME("(%s): not implemented\n", debugstr_guid(iid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI TransactionDispenser_AddRef(ITransactionDispenser *iface) +{ + TransactionManager *This = impl_from_ITransactionDispenser(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI TransactionDispenser_Release(ITransactionDispenser *iface) +{ + TransactionManager *This = impl_from_ITransactionDispenser(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI TransactionDispenser_GetOptionsObject(ITransactionDispenser *iface, + ITransactionOptions **ppOptions) +{ + TRACE("(%p, %p)\n", iface, ppOptions); + + if (!ppOptions) return E_INVALIDARG; + return TransactionOptions_Create(ppOptions); +} +static HRESULT WINAPI TransactionDispenser_BeginTransaction(ITransactionDispenser *iface, + IUnknown *punkOuter, + ISOLEVEL isoLevel, + ULONG isoFlags, + ITransactionOptions *pOptions, + ITransaction **ppTransaction) +{ + FIXME("(%p, %p, %08x, %08x, %p, %p): semi-stub\n", iface, punkOuter, + isoLevel, isoFlags, pOptions, ppTransaction); + + if (!ppTransaction) return E_INVALIDARG; + if (punkOuter) return CLASS_E_NOAGGREGATION; + return Transaction_Create(isoLevel, isoFlags, pOptions, ppTransaction); +} +static const ITransactionDispenserVtbl TransactionDispenser_Vtbl = { + TransactionDispenser_QueryInterface, + TransactionDispenser_AddRef, + TransactionDispenser_Release, + TransactionDispenser_GetOptionsObject, + TransactionDispenser_BeginTransaction +}; + +static inline TransactionManager *impl_from_IResourceManagerFactory2(IResourceManagerFactory2 *iface) +{ + return CONTAINING_RECORD(iface, TransactionManager, IResourceManagerFactory2_iface); +} + +static HRESULT WINAPI ResourceManagerFactory2_QueryInterface(IResourceManagerFactory2 *iface, REFIID iid, + void **ppv) +{ + TransactionManager *This = impl_from_IResourceManagerFactory2(iface); + return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv); +} + +static ULONG WINAPI ResourceManagerFactory2_AddRef(IResourceManagerFactory2 *iface) +{ + TransactionManager *This = impl_from_IResourceManagerFactory2(iface); + return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface); +} + +static ULONG WINAPI ResourceManagerFactory2_Release(IResourceManagerFactory2 *iface) +{ + TransactionManager *This = impl_from_IResourceManagerFactory2(iface); + return TransactionDispenser_Release(&This->ITransactionDispenser_iface); +} +static HRESULT WINAPI ResourceManagerFactory2_Create(IResourceManagerFactory2 *iface, + GUID *pguidRM, CHAR *pszRMName, IResourceManagerSink *pIResMgrSink, IResourceManager **ppResMgr) +{ + FIXME("(%p, %s, %s, %p, %p): semi-stub\n", iface, debugstr_guid(pguidRM), + debugstr_a(pszRMName), pIResMgrSink, ppResMgr); + return ResourceManager_Create(&IID_IResourceManager, (void**)ppResMgr); +} +static HRESULT WINAPI ResourceManagerFactory2_CreateEx(IResourceManagerFactory2 *iface, + GUID *pguidRM, CHAR *pszRMName, IResourceManagerSink *pIResMgrSink, REFIID riidRequested, void **ppResMgr) +{ + FIXME("(%p, %s, %s, %p, %s, %p): semi-stub\n", iface, debugstr_guid(pguidRM), + debugstr_a(pszRMName), pIResMgrSink, debugstr_guid(riidRequested), ppResMgr); + + return ResourceManager_Create(riidRequested, ppResMgr); +} +static const IResourceManagerFactory2Vtbl ResourceManagerFactory2_Vtbl = { + ResourceManagerFactory2_QueryInterface, + ResourceManagerFactory2_AddRef, + ResourceManagerFactory2_Release, + ResourceManagerFactory2_Create, + ResourceManagerFactory2_CreateEx +}; + +static inline TransactionManager *impl_from_ITransactionImportWhereabouts(ITransactionImportWhereabouts *iface) +{ + return CONTAINING_RECORD(iface, TransactionManager, ITransactionImportWhereabouts_iface); +} + +static HRESULT WINAPI TransactionImportWhereabouts_QueryInterface(ITransactionImportWhereabouts *iface, REFIID iid, + void **ppv) +{ + TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface); + return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv); +} + +static ULONG WINAPI TransactionImportWhereabouts_AddRef(ITransactionImportWhereabouts *iface) +{ + TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface); + return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface); +} + +static ULONG WINAPI TransactionImportWhereabouts_Release(ITransactionImportWhereabouts *iface) +{ + TransactionManager *This = impl_from_ITransactionImportWhereabouts(iface); + return TransactionDispenser_Release(&This->ITransactionDispenser_iface); +} +static HRESULT WINAPI TransactionImportWhereabouts_GetWhereaboutsSize(ITransactionImportWhereabouts *iface, + ULONG *pcbWhereabouts) +{ + FIXME("(%p, %p): stub returning fake value\n", iface, pcbWhereabouts); + + if (!pcbWhereabouts) return E_INVALIDARG; + *pcbWhereabouts = 1; + return S_OK; +} +static HRESULT WINAPI TransactionImportWhereabouts_GetWhereabouts(ITransactionImportWhereabouts *iface, + ULONG cbWhereabouts, BYTE *rgbWhereabouts,ULONG *pcbUsed) +{ + FIXME("(%p, %u, %p, %p): stub returning fake value\n", iface, cbWhereabouts, rgbWhereabouts, pcbUsed); + + if (!rgbWhereabouts || !pcbUsed) return E_INVALIDARG; + *rgbWhereabouts = 0; + *pcbUsed = 1; + return S_OK; +} +static const ITransactionImportWhereaboutsVtbl TransactionImportWhereabouts_Vtbl = { + TransactionImportWhereabouts_QueryInterface, + TransactionImportWhereabouts_AddRef, + TransactionImportWhereabouts_Release, + TransactionImportWhereabouts_GetWhereaboutsSize, + TransactionImportWhereabouts_GetWhereabouts +}; + +static inline TransactionManager *impl_from_ITransactionImport(ITransactionImport *iface) +{ + return CONTAINING_RECORD(iface, TransactionManager, ITransactionImport_iface); +} + +static HRESULT WINAPI TransactionImport_QueryInterface(ITransactionImport *iface, REFIID iid, + void **ppv) +{ + TransactionManager *This = impl_from_ITransactionImport(iface); + return TransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, iid, ppv); +} + +static ULONG WINAPI TransactionImport_AddRef(ITransactionImport *iface) +{ + TransactionManager *This = impl_from_ITransactionImport(iface); + return TransactionDispenser_AddRef(&This->ITransactionDispenser_iface); +} + +static ULONG WINAPI TransactionImport_Release(ITransactionImport *iface) +{ + TransactionManager *This = impl_from_ITransactionImport(iface); + return TransactionDispenser_Release(&This->ITransactionDispenser_iface); +} +static HRESULT WINAPI TransactionImport_Import(ITransactionImport *iface, + ULONG cbTransactionCookie, byte *rgbTransactionCookie, IID *piid, void **ppvTransaction) +{ + FIXME("(%p, %u, %p, %s, %p): stub\n", iface, cbTransactionCookie, rgbTransactionCookie, debugstr_guid(piid), ppvTransaction); + + if (!rgbTransactionCookie || !piid || !ppvTransaction) return E_INVALIDARG; + return E_NOTIMPL; +} +static const ITransactionImportVtbl TransactionImport_Vtbl = { + TransactionImport_QueryInterface, + TransactionImport_AddRef, + TransactionImport_Release, + TransactionImport_Import +}; + +static HRESULT TransactionManager_Create(REFIID riid, void **ppv) +{ + TransactionManager *This; + HRESULT ret; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(TransactionManager)); + if (!This) return E_OUTOFMEMORY; + + This->ITransactionDispenser_iface.lpVtbl = &TransactionDispenser_Vtbl; + This->IResourceManagerFactory2_iface.lpVtbl = &ResourceManagerFactory2_Vtbl; + This->ITransactionImportWhereabouts_iface.lpVtbl = &TransactionImportWhereabouts_Vtbl; + This->ITransactionImport_iface.lpVtbl = &TransactionImport_Vtbl; + This->ref = 1; + + ret = ITransactionDispenser_QueryInterface(&This->ITransactionDispenser_iface, riid, ppv); + ITransactionDispenser_Release(&This->ITransactionDispenser_iface); + + return ret; +} +/* DTC Proxy Core Object end */ + +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) +{ + TRACE("%p, %u, %p\n", hinst, reason, reserved); + + switch (reason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( hinst ); + break; + } + return TRUE; +} + +static BOOL is_local_machineA( const CHAR *server ) +{ + static const CHAR dot[] = "."; + CHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = ARRAY_SIZE( buffer ); + + if (!server || !strcmp( server, dot )) return TRUE; + if (GetComputerNameA( buffer, &len ) && !lstrcmpiA( server, buffer )) return TRUE; + return FALSE; +} +static BOOL is_local_machineW( const WCHAR *server ) +{ + static const WCHAR dotW[] = {'.',0}; + WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = ARRAY_SIZE( buffer ); + + if (!server || !strcmpW( server, dotW )) return TRUE; + if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; + return FALSE; +} + +HRESULT CDECL DtcGetTransactionManager(char *host, char *tm_name, REFIID riid, + DWORD dwReserved1, WORD wcbReserved2, void *pvReserved2, void **ppv) +{ + TRACE("(%s, %s, %s, %d, %d, %p, %p)\n", debugstr_a(host), debugstr_a(tm_name), + debugstr_guid(riid), dwReserved1, wcbReserved2, pvReserved2, ppv); + + if (!is_local_machineA(host)) + { + FIXME("remote computer not supported\n"); + return E_NOTIMPL; + } + return TransactionManager_Create(riid, ppv); +} + +HRESULT CDECL DtcGetTransactionManagerExA(CHAR *host, CHAR *tm_name, REFIID riid, + DWORD options, void *config, void **ppv) +{ + TRACE("(%s, %s, %s, %d, %p, %p)\n", debugstr_a(host), debugstr_a(tm_name), + debugstr_guid(riid), options, config, ppv); + + if (!is_local_machineA(host)) + { + FIXME("remote computer not supported\n"); + return E_NOTIMPL; + } + return TransactionManager_Create(riid, ppv); +} + +HRESULT CDECL DtcGetTransactionManagerExW(WCHAR *host, WCHAR *tm_name, REFIID riid, + DWORD options, void *config, void **ppv) +{ + TRACE("(%s, %s, %s, %d, %p, %p)\n", debugstr_w(host), debugstr_w(tm_name), + debugstr_guid(riid), options, config, ppv); + + if (!is_local_machineW(host)) + { + FIXME("remote computer not supported\n"); + return E_NOTIMPL; + } + return TransactionManager_Create(riid, ppv); +} diff --git a/dll/win32/xolehlp/xolehlp.spec b/dll/win32/xolehlp/xolehlp.spec new file mode 100644 index 0000000000..80c7c6061a --- /dev/null +++ b/dll/win32/xolehlp/xolehlp.spec @@ -0,0 +1,6 @@ +@ stub GetDtcLocaleResourceHandle +@ cdecl DtcGetTransactionManager(str str ptr long long ptr ptr) +@ stub DtcGetTransactionManagerEx +@ stub DtcGetTransactionManagerC +@ cdecl DtcGetTransactionManagerExA(str str ptr long ptr ptr) +@ cdecl DtcGetTransactionManagerExW(wstr wstr ptr long ptr ptr) diff --git a/media/doc/README.WINE b/media/doc/README.WINE index a867ad3b16..262dd5743b 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -219,6 +219,7 @@ reactos/dll/win32/xinput1_2 # Synced to WineStaging-2.9 reactos/dll/win32/xinput1_3 # Synced to WineStaging-2.9 reactos/dll/win32/xinput9_1_0 # Synced to WineStaging-2.9 reactos/dll/win32/xmllite # Synced to WineStaging-3.3 +reactos/dll/win32/xolehlp # Synced to WineStaging-3.21 reactos/dll/cpl/inetcpl # Synced to WineStaging-3.17
6 years
1
0
0
0
[reactos] 01/02: [SDK] Add transact.idl, txcoord.idl and txdtc.idl, and introduce MS-PSDK-compatible adsiid library that defines GUIDs used by ADS interfaces.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6e9cdf8e04286686c98d…
commit e6e9cdf8e04286686c98d6ed1f29deb710d1d346 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Fri Nov 30 21:44:21 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Nov 30 21:49:23 2018 +0100 [SDK] Add transact.idl, txcoord.idl and txdtc.idl, and introduce MS-PSDK-compatible adsiid library that defines GUIDs used by ADS interfaces. --- sdk/include/psdk/CMakeLists.txt | 4 + sdk/include/psdk/transact.idl | 226 ++++++++++++++++++ sdk/include/psdk/txcoord.idl | 181 ++++++++++++++ sdk/include/psdk/txdtc.idl | 515 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 926 insertions(+) diff --git a/sdk/include/psdk/CMakeLists.txt b/sdk/include/psdk/CMakeLists.txt index 845873fca6..7667ff07ae 100644 --- a/sdk/include/psdk/CMakeLists.txt +++ b/sdk/include/psdk/CMakeLists.txt @@ -116,7 +116,10 @@ list(APPEND SOURCE textstor.idl tlogstg.idl tom.idl + transact.idl tuner.idl + txcoord.idl + txdtc.idl unknwn.idl urlhist.idl urlmon.idl @@ -149,6 +152,7 @@ add_custom_target(stdole2 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stdole2.tlb) add_idl_headers(d3d_idl_headers d3dcommon.idl) +add_iid_library(adsiid iads.idl transact.idl) add_iid_library(wuguid wuapi.idl) add_iid_library(xml_uuids msxml2.idl) diff --git a/sdk/include/psdk/transact.idl b/sdk/include/psdk/transact.idl new file mode 100644 index 0000000000..fb3bd42de1 --- /dev/null +++ b/sdk/include/psdk/transact.idl @@ -0,0 +1,226 @@ +/* + * Copyright (C) 2013 Daniel Jeliński + * + * 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 + */ + +import "unknwn.idl"; + +cpp_quote("#include <winerror.h>") + +interface ITransaction; +interface ITransactionCloner; +interface ITransaction2; +interface ITransactionDispenser; +interface ITransactionOptions; +interface ITransactionOutcomeEvents; +interface ITmNodeName; + +typedef struct BOID { + byte rgb[16]; +} BOID; + +cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED") +cpp_quote("#define MAX_TRAN_DESC_DEFINED") +typedef enum TX_MISC_CONSTANTS { + MAX_TRAN_DESC = 40 +} TX_MISC_CONSTANTS; +cpp_quote("#endif") + +typedef BOID XACTUOW; +typedef LONG ISOLEVEL; + +typedef enum ISOLATIONLEVEL { + ISOLATIONLEVEL_UNSPECIFIED = 0xffffffff, + ISOLATIONLEVEL_CHAOS = 0x10, + ISOLATIONLEVEL_READUNCOMMITTED = 0x100, + ISOLATIONLEVEL_BROWSE = 0x100, + ISOLATIONLEVEL_CURSORSTABILITY = 0x1000, + ISOLATIONLEVEL_READCOMMITTED = 0x1000, + ISOLATIONLEVEL_REPEATABLEREAD = 0x10000, + ISOLATIONLEVEL_SERIALIZABLE = 0x100000, + ISOLATIONLEVEL_ISOLATED = 0x100000 +} ISOLATIONLEVEL; + +typedef struct XACTTRANSINFO { + XACTUOW uow; + ISOLEVEL isoLevel; + ULONG isoFlags; + DWORD grfTCSupported; + DWORD grfRMSupported; + DWORD grfTCSupportedRetaining; + DWORD grfRMSupportedRetaining; +} XACTTRANSINFO; + +typedef struct XACTSTATS { + ULONG cOpen; + ULONG cCommitting; + ULONG cCommitted; + ULONG cAborting; + ULONG cAborted; + ULONG cInDoubt; + ULONG cHeuristicDecision; + FILETIME timeTransactionsUp; +} XACTSTATS; + +typedef enum ISOFLAG { + ISOFLAG_RETAIN_COMMIT_DC = 1, + ISOFLAG_RETAIN_COMMIT = 2, + ISOFLAG_RETAIN_COMMIT_NO = 3, + ISOFLAG_RETAIN_ABORT_DC = 4, + ISOFLAG_RETAIN_ABORT = 8, + ISOFLAG_RETAIN_ABORT_NO = 12, + ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, + ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT, + ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, + ISOFLAG_OPTIMISTIC = 16, + ISOFLAG_READONLY = 32 +} ISOFLAG; + +typedef enum XACTTC { + XACTTC_NONE = 0, + XACTTC_SYNC_PHASEONE = 1, + XACTTC_SYNC_PHASETWO = 2, + XACTTC_SYNC = 2, + XACTTC_ASYNC_PHASEONE = 4, + XACTTC_ASYNC = 4 +} XACTTC; + +typedef enum XACTRM { + XACTRM_OPTIMISTICLASTWINS = 1, + XACTRM_NOREADONLYPREPARES +} XACTRM; + +typedef enum XACTCONST { + XACTCONST_TIMEOUTINFINITE +} XACTCONST; + +typedef enum XACTHEURISTIC { + XACTHEURISTIC_ABORT = 1, + XACTHEURISTIC_COMMIT, + XACTHEURISTIC_DAMAGE, + XACTHEURISTIC_DANGER +} XACTHEURISTIC; + +typedef enum XACTSTAT { + XACTSTAT_NONE = 0, + XACTSTAT_OPENNORMAL = 0x1, + XACTSTAT_OPENREFUSED = 0x2, + XACTSTAT_PREPARING = 0x4, + XACTSTAT_PREPARED = 0x8, + XACTSTAT_PREPARERETAINING = 0x10, + XACTSTAT_PREPARERETAINED = 0x20, + XACTSTAT_COMMITTING = 0x40, + XACTSTAT_COMMITRETAINING = 0x80, + XACTSTAT_ABORTING = 0x100, + XACTSTAT_ABORTED = 0x200, + XACTSTAT_COMMITTED = 0x400, + XACTSTAT_HEURISTIC_ABORT = 0x800, + XACTSTAT_HEURISTIC_COMMIT = 0x1000, + XACTSTAT_HEURISTIC_DAMAGE = 0x2000, + XACTSTAT_HEURISTIC_DANGER = 0x4000, + XACTSTAT_FORCED_ABORT = 0x8000, + XACTSTAT_FORCED_COMMIT = 0x10000, + XACTSTAT_INDOUBT = 0x20000, + XACTSTAT_CLOSED = 0x40000, + XACTSTAT_OPEN = 0x3, + XACTSTAT_NOTPREPARED = 0x7ffc3, + XACTSTAT_ALL = 0x7ffff +} XACTSTAT; + +typedef struct XACTOPT { + ULONG ulTimeout; + char szDescription[40 ]; +} XACTOPT; + +[ + object, + uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020) +] +interface ITransaction : IUnknown { + HRESULT Commit([in] BOOL fRetaining, + [in] DWORD grfTC, + [in] DWORD grfRM); + HRESULT Abort([in, unique] BOID *pboidReason, + [in] BOOL fRetaining, + [in] BOOL fAsync); + HRESULT GetTransactionInfo([out] XACTTRANSINFO *pinfo); +} + +[ + object, + uuid(02656950-2152-11d0-944C-00A0C905416E) +] +interface ITransactionCloner : ITransaction { + HRESULT CloneWithCommitDisabled([out] ITransaction **ppITransaction); +} + +[ + object, + uuid(34021548-0065-11d3-bac1-00c04f797be2) +] +interface ITransaction2 : ITransactionCloner { + HRESULT GetTransactionInfo2([out] XACTTRANSINFO *pinfo); +} + +[ + object, + uuid(3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD) +] +interface ITransactionDispenser : IUnknown { + HRESULT GetOptionsObject([out] ITransactionOptions **ppOptions); + HRESULT BeginTransaction([in, unique] IUnknown *punkOuter, + [in] ISOLEVEL isoLevel, + [in] ULONG isoFlags, + [in, unique] ITransactionOptions *pOptions, + [out] ITransaction **ppTransaction); +} + +[ + object, + uuid(3A6AD9E0-23B9-11cf-AD60-00AA00A74CCD) +] +interface ITransactionOptions : IUnknown { + HRESULT SetOptions([in] XACTOPT *pOptions); + HRESULT GetOptions([in, out] XACTOPT *pOptions); +} + +[ + object, + uuid(3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD) +] +interface ITransactionOutcomeEvents : IUnknown { + HRESULT Committed([in] BOOL fRetaining, + [in, unique] XACTUOW *pNewUOW, + [in] HRESULT hr); + HRESULT Aborted([in, unique] BOID *pboidReason, + [in] BOOL fRetaining, + [in, unique] XACTUOW *pNewUOW, + [in] HRESULT hr); + HRESULT HeuristicDecision([in] DWORD dwDecision, + [in, unique] BOID *pboidReason, + [in] HRESULT hr); + HRESULT Indoubt(void); +} + +[ + object, + uuid(30274F88-6EE4-474e-9B95-7807BC9EF8CF) +] +interface ITmNodeName : IUnknown { + HRESULT GetNodeNameSize([out] ULONG *pcbNodeNameSize); + HRESULT GetNodeName([in] ULONG cbNodeNameBufferSize, + [in, out] LPWSTR pNodeNameBuffer); +} diff --git a/sdk/include/psdk/txcoord.idl b/sdk/include/psdk/txcoord.idl new file mode 100644 index 0000000000..e4a578494c --- /dev/null +++ b/sdk/include/psdk/txcoord.idl @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2013 Daniel Jeliński + * + * 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 + */ + +import "transact.idl"; +import "objidl.idl"; + +interface ITransactionResourceAsync; +interface ITransactionLastResourceAsync; +interface ITransactionResource; +interface ITransactionEnlistmentAsync; +interface ITransactionLastEnlistmentAsync; +interface ITransactionExportFactory; +interface ITransactionImportWhereabouts; +interface ITransactionExport; +interface ITransactionImport; +interface ITipTransaction; +interface ITipHelper; +interface ITipPullSink; +interface IDtcNetworkAccessConfig; +interface IDtcNetworkAccessConfig2; + +[ + object, + uuid(69e971f0-23ce-11cf-ad60-00aa00a74ccd) +] +interface ITransactionResourceAsync : IUnknown { + HRESULT PrepareRequest([in]BOOL fRetaining,[in]DWORD grfRM,[in]BOOL fWantMoniker,[in]BOOL fSinglePhase); + HRESULT CommitRequest([in]DWORD grfRM,[in]XACTUOW *pNewUOW); + HRESULT AbortRequest([in]BOID *pboidReason,[in]BOOL fRetaining,[in]XACTUOW *pNewUOW); + HRESULT TMDown(void); +} + +[ + object, + uuid(c82bd532-5b30-11d3-8a91-00c04f79eb6d) +] +interface ITransactionLastResourceAsync : IUnknown { + HRESULT DelegateCommit([in]DWORD grfRM); + HRESULT ForgetRequest([in]XACTUOW *pNewUOW); +} + +[ + object, + uuid(ee5ff7b3-4572-11d0-9452-00a0c905416e) +] +interface ITransactionResource : IUnknown { + HRESULT PrepareRequest([in]BOOL fRetaining,[in]DWORD grfRM,[in]BOOL fWantMoniker,[in]BOOL fSinglePhase); + HRESULT CommitRequest([in]DWORD grfRM,[in]XACTUOW *pNewUOW); + HRESULT AbortRequest([in]BOID *pboidReason,[in]BOOL fRetaining,[in]XACTUOW *pNewUOW); + HRESULT TMDown(void); +} + +[ + object, + uuid(0fb15081-af41-11ce-bd2b-204c4f4f5020) +] +interface ITransactionEnlistmentAsync : IUnknown { + HRESULT PrepareRequestDone([in]HRESULT hr,[in]IMoniker *pmk,[in]BOID *pboidReason); + HRESULT CommitRequestDone([in]HRESULT hr); + HRESULT AbortRequestDone([in]HRESULT hr); +} + +[ + object, + uuid(c82bd533-5b30-11d3-8a91-00c04f79eb6d) +] +interface ITransactionLastEnlistmentAsync : IUnknown { + HRESULT TransactionOutcome([in]XACTSTAT XactStat,[in]BOID *pboidReason); +} + +[ + object, + uuid(e1cf9b53-8745-11ce-a9ba-00aa006c3706) +] +interface ITransactionExportFactory : IUnknown { + HRESULT GetRemoteClassId([in]CLSID *pclsid); + HRESULT Create([in]ULONG cbWhereabouts,[in]byte *rgbWhereabouts,[out]ITransactionExport **ppExport); +} + +[ + object, + uuid(0141fda4-8fc0-11ce-bd18-204c4f4f5020) +] +interface ITransactionImportWhereabouts : IUnknown { + HRESULT GetWhereaboutsSize([out]ULONG *pcbWhereabouts); + HRESULT GetWhereabouts([in]ULONG cbWhereabouts,[out]byte *rgbWhereabouts,[out]ULONG *pcbUsed); +} + +[ + object, + uuid(0141fda5-8fc0-11ce-bd18-204c4f4f5020) +] +interface ITransactionExport : IUnknown { + HRESULT Export([in]IUnknown *punkTransaction,[out]ULONG *pcbTransactionCookie); + HRESULT GetTransactionCookie([in]IUnknown *punkTransaction,[in]ULONG cbTransactionCookie,[out]byte *rgbTransactionCookie,[out]ULONG *pcbUsed); +} + +[ + object, + uuid(e1cf9b5a-8745-11ce-a9ba-00aa006c3706) +] +interface ITransactionImport : IUnknown { + HRESULT Import([in]ULONG cbTransactionCookie,[in]byte *rgbTransactionCookie,[in]IID *piid,[out,iid_is(piid)]void **ppvTransaction); +} +[ + object, + uuid(17cf72d0-bac5-11d1-b1bf-00c04fc2f3ef) +] +interface ITipTransaction : IUnknown { + HRESULT Push([in]char *i_pszRemoteTmUrl,[out]char **o_ppszRemoteTxUrl); + HRESULT GetTransactionUrl([out]char **o_ppszLocalTxUrl); +} +[ + object, + uuid(17cf72d1-bac5-11d1-b1bf-00c04fc2f3ef) +] +interface ITipHelper : IUnknown { + HRESULT Pull([in]char *i_pszTxUrl,[out]ITransaction **o_ppITransaction); + HRESULT PullAsync([in]char *i_pszTxUrl,[in]ITipPullSink *i_pTipPullSink,[out]ITransaction **o_ppITransaction); + HRESULT GetLocalTmUrl([out]char **o_ppszLocalTmUrl); +} +[ + object, + uuid(17cf72d2-bac5-11d1-b1bf-00c04fc2f3ef) +] +interface ITipPullSink : IUnknown { + HRESULT PullComplete([in]HRESULT i_hrPull); +} +[ + object, + uuid(9797c15d-a428-4291-87b6-0995031a678d) +] +interface IDtcNetworkAccessConfig : IUnknown { + HRESULT GetAnyNetworkAccess([out]BOOL *pbAnyNetworkAccess); + HRESULT SetAnyNetworkAccess([in]BOOL bAnyNetworkAccess); + HRESULT GetNetworkAdministrationAccess([out]BOOL *pbNetworkAdministrationAccess); + HRESULT SetNetworkAdministrationAccess([in]BOOL bNetworkAdministrationAccess); + HRESULT GetNetworkTransactionAccess([out]BOOL *pbNetworkTransactionAccess); + HRESULT SetNetworkTransactionAccess([in]BOOL bNetworkTransactionAccess); + HRESULT GetNetworkClientAccess([out]BOOL *pbNetworkClientAccess); + HRESULT SetNetworkClientAccess([in]BOOL bNetworkClientAccess); + HRESULT GetNetworkTIPAccess([out]BOOL *pbNetworkTIPAccess); + HRESULT SetNetworkTIPAccess([in]BOOL bNetworkTIPAccess); + HRESULT GetXAAccess([out]BOOL *pbXAAccess); + HRESULT SetXAAccess([in]BOOL bXAAccess); + HRESULT RestartDtcService(void); +} + +typedef enum AUTHENTICATION_LEVEL { + NO_AUTHENTICATION_REQUIRED, + INCOMING_AUTHENTICATION_REQUIRED, + MUTUAL_AUTHENTICATION_REQUIRED +} AUTHENTICATION_LEVEL; + +[ + object, + uuid(a7aa013b-eb7d-4f42-b41c-b2dec09ae034) +] +interface IDtcNetworkAccessConfig2 : IDtcNetworkAccessConfig { + HRESULT GetNetworkInboundAccess([out]BOOL *pbInbound); + HRESULT GetNetworkOutboundAccess([out]BOOL *pbOutbound); + HRESULT SetNetworkInboundAccess([in]BOOL bInbound); + HRESULT SetNetworkOutboundAccess([in]BOOL bOutbound); + HRESULT GetAuthenticationLevel([out]AUTHENTICATION_LEVEL *pAuthLevel); + HRESULT SetAuthenticationLevel([in]AUTHENTICATION_LEVEL AuthLevel); +} diff --git a/sdk/include/psdk/txdtc.idl b/sdk/include/psdk/txdtc.idl new file mode 100644 index 0000000000..c29447047a --- /dev/null +++ b/sdk/include/psdk/txdtc.idl @@ -0,0 +1,515 @@ +/* + * Copyright (C) 2013 Daniel Jeliński + * + * 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 + */ + +import "txcoord.idl"; + +interface IXATransLookup; +interface IXATransLookup2; +interface IResourceManagerSink; +interface IResourceManager; +interface ILastResourceManager; +interface IResourceManager2; +interface IXAConfig; +/*interface IRMHelper; +interface IXAObtainRMInfo;*/ +interface IResourceManagerFactory; +interface IResourceManagerFactory2; +interface IPrepareInfo; +interface IPrepareInfo2; +interface IGetDispenser; +interface ITransactionVoterBallotAsync2; +interface ITransactionVoterNotifyAsync2; +interface ITransactionVoterFactory2; +interface ITransactionPhase0EnlistmentAsync; +interface ITransactionPhase0NotifyAsync; +interface ITransactionPhase0Factory; +interface ITransactionTransmitter; +interface ITransactionTransmitterFactory; +interface ITransactionReceiver; +interface ITransactionReceiverFactory; +interface IDtcLuConfigure; +interface IDtcLuRecovery; +interface IDtcLuRecoveryFactory; +interface IDtcLuRecoveryInitiatedByDtcTransWork; +interface IDtcLuRecoveryInitiatedByDtcStatusWork; +interface IDtcLuRecoveryInitiatedByDtc; +interface IDtcLuRecoveryInitiatedByLuWork; +interface IDtcLuRecoveryInitiatedByLu; +interface IDtcLuRmEnlistment; +interface IDtcLuRmEnlistmentSink; +interface IDtcLuRmEnlistmentFactory; +interface IDtcLuSubordinateDtc; +interface IDtcLuSubordinateDtcSink; +interface IDtcLuSubordinateDtcFactory; + +cpp_quote("#define XACTTOMSG(dwXact) (dwXact-0x00040000+0x40000000)") +typedef enum XACT_DTC_CONSTANTS { + XACT_E_CONNECTION_REQUEST_DENIED = 0x8004d100, + XACT_E_TOOMANY_ENLISTMENTS = 0x8004d101, + XACT_E_DUPLICATE_GUID = 0x8004d102, + XACT_E_NOTSINGLEPHASE = 0x8004d103, + XACT_E_RECOVERYALREADYDONE = 0x8004d104, + XACT_E_PROTOCOL = 0x8004d105, + XACT_E_RM_FAILURE = 0x8004d106, + XACT_E_RECOVERY_FAILED = 0x8004d107, + XACT_E_LU_NOT_FOUND = 0x8004d108, + XACT_E_DUPLICATE_LU = 0x8004d109, + XACT_E_LU_NOT_CONNECTED = 0x8004d10a, + XACT_E_DUPLICATE_TRANSID = 0x8004d10b, + XACT_E_LU_BUSY = 0x8004d10c, + XACT_E_LU_NO_RECOVERY_PROCESS = 0x8004d10d, + XACT_E_LU_DOWN = 0x8004d10e, + XACT_E_LU_RECOVERING = 0x8004d10f, + XACT_E_LU_RECOVERY_MISMATCH = 0x8004d110, + XACT_E_RM_UNAVAILABLE = 0x8004d111, + XACT_E_LRMRECOVERYALREADYDONE = 0x8004d112, + XACT_E_NOLASTRESOURCEINTERFACE = 0x8004d113, + XACT_S_NONOTIFY = 0x4d100, + XACT_OK_NONOTIFY = 0x4d101, + dwUSER_MS_SQLSERVER = 0xffff +} XACT_DTC_CONSTANTS; + +cpp_quote("#ifndef _XID_T_DEFINED") +cpp_quote("#define _XID_T_DEFINED") +typedef struct xid_t { + LONG32 formatID; + LONG32 gtrid_length; + LONG32 bqual_length; + char data[128 ]; +} XID; +cpp_quote("#endif") +/* idl doesn't like this type +cpp_quote("#ifndef _XA_SWITCH_T_DEFINED") +cpp_quote("#define _XA_SWITCH_T_DEFINED") +typedef struct xa_switch_t { + char name[32 ]; + LONG32 flags; + LONG32 version; + int (__cdecl *xa_open_entry)(char *__MIDL_0004,int __MIDL_0005,LONG32 __MIDL_0006); + int (__cdecl *xa_close_entry)(char *__MIDL_0008,int __MIDL_0009,LONG32 __MIDL_0010); + int (__cdecl *xa_start_entry)(XID *__MIDL_0012,int __MIDL_0013,LONG32 __MIDL_0014); + int (__cdecl *xa_end_entry)(XID *__MIDL_0016,int __MIDL_0017,LONG32 __MIDL_0018); + int (__cdecl *xa_rollback_entry)(XID *__MIDL_0020,int __MIDL_0021,LONG32 __MIDL_0022); + int (__cdecl *xa_prepare_entry)(XID *__MIDL_0024,int __MIDL_0025,LONG32 __MIDL_0026); + int (__cdecl *xa_commit_entry)(XID *__MIDL_0028,int __MIDL_0029,LONG32 __MIDL_0030); + int (__cdecl *xa_recover_entry)(XID *__MIDL_0032,LONG32 __MIDL_0033,int __MIDL_0034,LONG32 __MIDL_0035); + int (__cdecl *xa_forget_entry)(XID *__MIDL_0037,int __MIDL_0038,LONG32 __MIDL_0039); + int (__cdecl *xa_complete_entry)(int *__MIDL_0041,int *__MIDL_0042,int __MIDL_0043,LONG32 __MIDL_0044); +} xa_switch_t; +cpp_quote("#endif") +*/ +[ + object, + uuid(f3b1f131-eeda-11ce-aed4-00aa0051e2c4) +] +interface IXATransLookup : IUnknown { + HRESULT Lookup([out]ITransaction **ppTransaction); +} +[ + object, + uuid(bf193c85-0d1a-4290-b88f-d2cb8873d1e7) +] +interface IXATransLookup2 : IUnknown { + HRESULT Lookup([in]XID *pXID,[out]ITransaction **ppTransaction); +} +[ + object, + uuid(0d563181-defb-11ce-aed1-00aa0051e2c4) +] +interface IResourceManagerSink : IUnknown { + HRESULT TMDown(void); +} +[ + object, + uuid(13741d21-87eb-11ce-8081-0080c758527e) +] +interface IResourceManager : IUnknown { + HRESULT Enlist([in]ITransaction *pTransaction,[in]ITransactionResourceAsync *pRes,[out]XACTUOW *pUOW,[out]LONG *pisoLevel,[out]ITransactionEnlistmentAsync **ppEnlist); + HRESULT Reenlist([in]byte *pPrepInfo,[in]ULONG cbPrepInfo,[in]DWORD lTimeout,[out]XACTSTAT *pXactStat); + HRESULT ReenlistmentComplete(void); + HRESULT GetDistributedTransactionManager([in]REFIID iid,[out,iid_is(iid)]void **ppvObject); +} +[ + object, + uuid(4d964ad4-5b33-11d3-8a91-00c04f79eb6d) +] +interface ILastResourceManager : IUnknown { + HRESULT TransactionCommitted([in]byte *pPrepInfo,[in]ULONG cbPrepInfo); + HRESULT RecoveryDone(void); +} +[ + object, + uuid(d136c69a-f749-11d1-8f47-00c04f8ee57d) +] +interface IResourceManager2 : IResourceManager { + HRESULT Enlist2([in]ITransaction *pTransaction,[in]ITransactionResourceAsync *pResAsync,[out]XACTUOW *pUOW,[out]LONG *pisoLevel,[out]XID *pXid,[out]ITransactionEnlistmentAsync **ppEnlist); + HRESULT Reenlist2([in]XID *pXid,[in]DWORD dwTimeout,[out]XACTSTAT *pXactStat); +} +[ + object, + uuid(c8a6e3a1-9a8c-11cf-a308-00a0c905416e) +] +interface IXAConfig : IUnknown { + HRESULT Initialize([in]GUID clsidHelperDll); + HRESULT Terminate(void); +} +/* commented out because idl doesn't accept xa_switch_t type +[ + object, + uuid(E793F6D1-F53D-11cf-A60D-00A0C905416E) +] +interface IRMHelper : IUnknown { + HRESULT RMCount([in]DWORD dwcTotalNumberOfRMs); + HRESULT RMInfo([in]xa_switch_t *pXa_Switch,[in]BOOL fCDeclCallingConv,[in]char *pszOpenString,[in]char *pszCloseString,[in]GUID guidRMRecovery); +} +[ + object, + uuid(E793F6D2-F53D-11cf-A60D-00A0C905416E) +] +interface IXAObtainRMInfo : IUnknown { + HRESULT ObtainRMInfo([in]IRMHelper *pIRMHelper); +}*/ +[ + object, + uuid(13741d20-87eb-11ce-8081-0080c758527e) +] +interface IResourceManagerFactory : IUnknown { + HRESULT Create([in]GUID *pguidRM,[in]CHAR *pszRMName,[in]IResourceManagerSink *pIResMgrSink,[out]IResourceManager **ppResMgr); +} +[ + object, + uuid(6b369c21-fbd2-11d1-8f47-00c04f8ee57d) +] +interface IResourceManagerFactory2 : IResourceManagerFactory { + HRESULT CreateEx([in]GUID *pguidRM,[in]CHAR *pszRMName,[in]IResourceManagerSink *pIResMgrSink,[in]REFIID riidRequested,[out, iid_is(riidRequested)]void **ppvResMgr); +} + +[ + object, + uuid(80c7bfd0-87ee-11ce-8081-0080c758527e) +] +interface IPrepareInfo : IUnknown { + HRESULT GetPrepareInfoSize([out]ULONG *pcbPrepInfo); + HRESULT GetPrepareInfo([out]byte *pPrepInfo); +} +[ + object, + uuid(5fab2547-9779-11d1-b886-00c04fb9618a) +] +interface IPrepareInfo2 : IUnknown { + HRESULT GetPrepareInfoSize([out]ULONG *pcbPrepInfo); + HRESULT GetPrepareInfo([in]ULONG cbPrepareInfo,[out]byte *pPrepInfo); +} +[ + object, + uuid(c23cc370-87ef-11ce-8081-0080c758527e) +] +interface IGetDispenser : IUnknown { + HRESULT GetDispenser([in]REFIID iid,[out,iid_is(iid)]void **ppvObject); +} +[ + object, + uuid(5433376c-414d-11d3-b206-00c04fc2f3ef) +] +interface ITransactionVoterBallotAsync2 : IUnknown { + HRESULT VoteRequestDone([in]HRESULT hr,[in]BOID *pboidReason); +} +[ + object, + uuid(5433376b-414d-11d3-b206-00c04fc2f3ef) +] +interface ITransactionVoterNotifyAsync2 : ITransactionOutcomeEvents { + HRESULT VoteRequest(void); +} +[ + object, + uuid(5433376a-414d-11d3-b206-00c04fc2f3ef) +] +interface ITransactionVoterFactory2 : IUnknown { + HRESULT Create([in]ITransaction *pTransaction,[in]ITransactionVoterNotifyAsync2 *pVoterNotify,[out]ITransactionVoterBallotAsync2 **ppVoterBallot); +} +[ + object, + uuid(82dc88e1-a954-11d1-8f88-00600895e7d5) +] +interface ITransactionPhase0EnlistmentAsync : IUnknown { + HRESULT Enable(void); + HRESULT WaitForEnlistment(void); + HRESULT Phase0Done(void); + HRESULT Unenlist(void); + HRESULT GetTransaction([out]ITransaction **ppITransaction); +} +[ + object, + uuid(ef081809-0c76-11d2-87a6-00c04f990f34) +] +interface ITransactionPhase0NotifyAsync : IUnknown { + HRESULT Phase0Request([in]BOOL fAbortingHint); + HRESULT EnlistCompleted([in]HRESULT status); +} +[ + object, + uuid(82dc88e0-a954-11d1-8f88-00600895e7d5) +] +interface ITransactionPhase0Factory : IUnknown { + HRESULT Create([in]ITransactionPhase0NotifyAsync *pPhase0Notify,[out]ITransactionPhase0EnlistmentAsync **ppPhase0Enlistment); +} +[ + object, + uuid(59313e01-b36c-11cf-a539-00aa006887c3) +] +interface ITransactionTransmitter : IUnknown { + HRESULT Set([in]ITransaction *pTransaction); + HRESULT GetPropagationTokenSize([out]ULONG *pcbToken); + HRESULT MarshalPropagationToken([in]ULONG cbToken,[out]byte *rgbToken,[out]ULONG *pcbUsed); + HRESULT UnmarshalReturnToken([in]ULONG cbReturnToken,[in]byte *rgbReturnToken); + HRESULT Reset(void); +} +[ + object, + uuid(59313e00-b36c-11cf-a539-00aa006887c3) +] +interface ITransactionTransmitterFactory : IUnknown { + HRESULT Create([out]ITransactionTransmitter **ppTransmitter); +} +[ + object, + uuid(59313e03-b36c-11cf-a539-00aa006887c3) +] +interface ITransactionReceiver : IUnknown { + HRESULT UnmarshalPropagationToken([in]ULONG cbToken,[in]byte *rgbToken,[out]ITransaction **ppTransaction); + HRESULT GetReturnTokenSize([out]ULONG *pcbReturnToken); + HRESULT MarshalReturnToken([in]ULONG cbReturnToken,[out]byte *rgbReturnToken,[out]ULONG *pcbUsed); + HRESULT Reset(void); +} +[ + object, + uuid(59313e02-b36c-11cf-a539-00aa006887c3) +] +interface ITransactionReceiverFactory : IUnknown { + HRESULT Create([out]ITransactionReceiver **ppReceiver); +} + +typedef struct _ProxyConfigParams { + WORD wcThreadsMax; +} PROXY_CONFIG_PARAMS; + +[ + object, + uuid(4131e760-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuConfigure : IUnknown { + HRESULT Add([in]byte *pucLuPair,[in]DWORD cbLuPair); + HRESULT Delete([in]byte *pucLuPair,[in]DWORD cbLuPair); +} +[ + object, + uuid(ac2b8ad2-d6f0-11d0-b386-00a0c9083365) +] +interface IDtcLuRecovery : IUnknown { +} +[ + object, + uuid(4131e762-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRecoveryFactory : IUnknown { + HRESULT Create([in]byte *pucLuPair,[in]DWORD cbLuPair,[out]IDtcLuRecovery **ppRecovery); +} + +typedef enum _DtcLu_LocalRecovery_Work { + DTCINITIATEDRECOVERYWORK_CHECKLUSTATUS = 1, + DTCINITIATEDRECOVERYWORK_TRANS, + DTCINITIATEDRECOVERYWORK_TMDOWN +} DTCINITIATEDRECOVERYWORK; + +typedef enum _DtcLu_Xln { + DTCLUXLN_COLD = 1, + DTCLUXLN_WARM +} DTCLUXLN; + +typedef enum _DtcLu_Xln_Confirmation { + DTCLUXLNCONFIRMATION_CONFIRM = 1, + DTCLUXLNCONFIRMATION_LOGNAMEMISMATCH, + DTCLUXLNCONFIRMATION_COLDWARMMISMATCH, + DTCLUXLNCONFIRMATION_OBSOLETE +} DTCLUXLNCONFIRMATION; + +typedef enum _DtcLu_Xln_Response { + DTCLUXLNRESPONSE_OK_SENDOURXLNBACK = 1, + DTCLUXLNRESPONSE_OK_SENDCONFIRMATION, + DTCLUXLNRESPONSE_LOGNAMEMISMATCH, + DTCLUXLNRESPONSE_COLDWARMMISMATCH +} DTCLUXLNRESPONSE; + +typedef enum _DtcLu_Xln_Error { + DTCLUXLNERROR_PROTOCOL = 1, + DTCLUXLNERROR_LOGNAMEMISMATCH, + DTCLUXLNERROR_COLDWARMMISMATCH +} DTCLUXLNERROR; + +typedef enum _DtcLu_CompareState { + DTCLUCOMPARESTATE_COMMITTED = 1, + DTCLUCOMPARESTATE_HEURISTICCOMMITTED, + DTCLUCOMPARESTATE_HEURISTICMIXED, + DTCLUCOMPARESTATE_HEURISTICRESET, + DTCLUCOMPARESTATE_INDOUBT, + DTCLUCOMPARESTATE_RESET +} DTCLUCOMPARESTATE; + +typedef enum _DtcLu_CompareStates_Confirmation { + DTCLUCOMPARESTATESCONFIRMATION_CONFIRM = 1, + DTCLUCOMPARESTATESCONFIRMATION_PROTOCOL +} DTCLUCOMPARESTATESCONFIRMATION; + +typedef enum _DtcLu_CompareStates_Error { + DTCLUCOMPARESTATESERROR_PROTOCOL = 1 +} DTCLUCOMPARESTATESERROR; + +typedef enum _DtcLu_CompareStates_Response { + DTCLUCOMPARESTATESRESPONSE_OK = 1, + DTCLUCOMPARESTATESRESPONSE_PROTOCOL +} DTCLUCOMPARESTATESRESPONSE; + +[ + object, + uuid(4131e765-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRecoveryInitiatedByDtcTransWork : IUnknown { + HRESULT GetLogNameSizes([out]DWORD *pcbOurLogName,[out]DWORD *pcbRemoteLogName); + HRESULT GetOurXln([out]DTCLUXLN *pXln,[in,out]unsigned char *pOurLogName,[in,out]unsigned char *pRemoteLogName,[out]DWORD *pdwProtocol); + HRESULT HandleConfirmationFromOurXln([in]DTCLUXLNCONFIRMATION Confirmation); + HRESULT HandleTheirXlnResponse([in]DTCLUXLN Xln,[in]unsigned char *pRemoteLogName,[in]DWORD cbRemoteLogName,[in]DWORD dwProtocol,[out]DTCLUXLNCONFIRMATION *pConfirmation); + HRESULT HandleErrorFromOurXln([in]DTCLUXLNERROR Error); + HRESULT CheckForCompareStates([out]BOOL *fCompareStates); + HRESULT GetOurTransIdSize([in,out]DWORD *pcbOurTransId); + HRESULT GetOurCompareStates([in,out]unsigned char *pOurTransId,[out]DTCLUCOMPARESTATE *pCompareState); + HRESULT HandleTheirCompareStatesResponse([in]DTCLUCOMPARESTATE CompareState,[out]DTCLUCOMPARESTATESCONFIRMATION *pConfirmation); + HRESULT HandleErrorFromOurCompareStates([in]DTCLUCOMPARESTATESERROR Error); + HRESULT ConversationLost(void); + HRESULT GetRecoverySeqNum([out]LONG *plRecoverySeqNum); + HRESULT ObsoleteRecoverySeqNum([in]LONG lNewRecoverySeqNum); +} +[ + object, + uuid(4131e766-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRecoveryInitiatedByDtcStatusWork : IUnknown { + HRESULT HandleCheckLuStatus([in]LONG lRecoverySeqNum); +} +[ + object, + uuid(4131e764-1aea-11d0-944b-00a0c905416e) +] +[local] interface IDtcLuRecoveryInitiatedByDtc : IUnknown { + HRESULT GetWork([in,out]DTCINITIATEDRECOVERYWORK *pWork,[in,out]void **ppv); +} +[ + object, + uuid(ac2b8ad1-d6f0-11d0-b386-00a0c9083365) +] +interface IDtcLuRecoveryInitiatedByLuWork : IUnknown { + HRESULT HandleTheirXln([in]LONG lRecoverySeqNum,[in]DTCLUXLN Xln,[in]unsigned char *pRemoteLogName,[in]DWORD cbRemoteLogName,[in]unsigned char *pOurLogName,[in]DWORD cbOurLogName,[in]DWORD dwProtocol,[out]DTCLUXLNRESPONSE *pResponse); + HRESULT GetOurLogNameSize([in,out]DWORD *pcbOurLogName); + HRESULT GetOurXln([out]DTCLUXLN *pXln,[in,out]unsigned char *pOurLogName,[out]DWORD *pdwProtocol); + HRESULT HandleConfirmationOfOurXln([in]DTCLUXLNCONFIRMATION Confirmation); + HRESULT HandleTheirCompareStates([in,out]unsigned char *pRemoteTransId,[in]DWORD cbRemoteTransId,[in]DTCLUCOMPARESTATE CompareState,[out]DTCLUCOMPARESTATESRESPONSE *pResponse,[out]DTCLUCOMPARESTATE *pCompareState); + HRESULT HandleConfirmationOfOurCompareStates([in]DTCLUCOMPARESTATESCONFIRMATION Confirmation); + HRESULT HandleErrorFromOurCompareStates([in]DTCLUCOMPARESTATESERROR Error); + HRESULT ConversationLost(void); +} +[ + object, + uuid(4131e768-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRecoveryInitiatedByLu : IUnknown { + HRESULT GetObjectToHandleWorkFromLu([out]IDtcLuRecoveryInitiatedByLuWork **ppWork); +} +[ + object, + uuid(4131e769-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRmEnlistment : IUnknown { + HRESULT Unplug([in]BOOL fConversationLost); + HRESULT BackedOut(void); + HRESULT BackOut(void); + HRESULT Committed(void); + HRESULT Forget(void); + HRESULT RequestCommit(void); +} +[ + object, + uuid(4131e770-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRmEnlistmentSink : IUnknown { + HRESULT AckUnplug(void); + HRESULT TmDown(void); + HRESULT SessionLost(void); + HRESULT BackedOut(void); + HRESULT BackOut(void); + HRESULT Committed(void); + HRESULT Forget(void); + HRESULT Prepare(void); + HRESULT RequestCommit(void); +} +[ + object, + uuid(4131e771-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuRmEnlistmentFactory : IUnknown { + HRESULT Create([in]unsigned char *pucLuPair,[in]DWORD cbLuPair,[in]ITransaction *pITransaction,[in]unsigned char *pTransId,[in]DWORD cbTransId,[in]IDtcLuRmEnlistmentSink *pRmEnlistmentSink,[in,out]IDtcLuRmEnlistment **ppRmEnlistment); +} +[ + object, + uuid(4131e773-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuSubordinateDtc : IUnknown { + HRESULT Unplug([in]BOOL fConversationLost); + HRESULT BackedOut(void); + HRESULT BackOut(void); + HRESULT Committed(void); + HRESULT Forget(void); + HRESULT Prepare(void); + HRESULT RequestCommit(void); +} +[ + object, + uuid(4131e774-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuSubordinateDtcSink : IUnknown { + HRESULT AckUnplug(void); + HRESULT TmDown(void); + HRESULT SessionLost(void); + HRESULT BackedOut(void); + HRESULT BackOut(void); + HRESULT Committed(void); + HRESULT Forget(void); + HRESULT RequestCommit(void); +} +[ + object, + uuid(4131e775-1aea-11d0-944b-00a0c905416e) +] +interface IDtcLuSubordinateDtcFactory : IUnknown { + HRESULT Create([in]unsigned char *pucLuPair,[in]DWORD cbLuPair,[in]IUnknown *punkTransactionOuter,[in]ISOLEVEL isoLevel,[in]ULONG isoFlags,[in]ITransactionOptions *pOptions,[out]ITransaction **ppTransaction,[in]unsigned char *pTransId,[in]DWORD cbTransId,[in]IDtcLuSubordinateDtcSink *pSubordinateDtcSink,[in,out]IDtcLuSubordinateDtc **ppSubordinateDtc); +} + +/* these GUIDs were found in mingw header, but without corresponding interface definitions + DEFINE_GUID(IID_IXAResourceManager,0x4131e751,0x1aea,0x11d0,0x94,0x4b,0x00,0xa0,0xc9,0x05,0x41,0x6e); + DEFINE_GUID(IID_IXAResourceManagerFactory,0x4131e750,0x1aea,0x11d0,0x94,0x4b,0x00,0xa0,0xc9,0x05,0x41,0x6e); + DEFINE_GUID(IID_IXATransaction,0x4131e752,0x1aea,0x11d0,0x94,0x4b,0x00,0xa0,0xc9,0x05,0x41,0x6e); +*/
6 years
1
0
0
0
[reactos] 02/02: [IPHLPAPI] Don't assume first member of MIB tables is always DWORD-big
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=226195d4f27ff8345dac5…
commit 226195d4f27ff8345dac50a3814a9d3ce0797d28 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Fri Nov 30 20:05:11 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Fri Nov 30 20:06:29 2018 +0100 [IPHLPAPI] Don't assume first member of MIB tables is always DWORD-big This fixes last bits of heap corruption when using UDP/TCP enumeration functions. --- dll/win32/iphlpapi/iphlpapi_main.c | 75 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c index 11bddb40c5..07b987ed72 100644 --- a/dll/win32/iphlpapi/iphlpapi_main.c +++ b/dll/win32/iphlpapi/iphlpapi_main.c @@ -1022,7 +1022,7 @@ static int TcpTableSorter(const void *a, const void *b) DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, TCP_TABLE_CLASS TableClass, ULONG Reserved) { - DWORD i, count; + DWORD i, count, size; DWORD ret = NO_ERROR; if (!pdwSize) @@ -1045,14 +1045,15 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurTcpTable) { - if (sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE, table) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirTcpTable, pOurTcpTable, sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW)); + memcpy(pTheirTcpTable, pOurTcpTable, size); if (bOrder) qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries, @@ -1079,9 +1080,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE, table) + count * sizeof(MIB_TCPROW); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1123,9 +1125,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE, table) + count * sizeof(MIB_TCPROW); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1159,14 +1162,15 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurTcpTable) { - if (sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_PID) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID, table) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_PID); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_PID); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirTcpTable, pOurTcpTable, sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_PID)); + memcpy(pTheirTcpTable, pOurTcpTable, size); /* Don't sort on PID, so use basic helper */ if (bOrder) @@ -1194,9 +1198,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_PID) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID, table) + count * sizeof(MIB_TCPROW_OWNER_PID); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_PID); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1239,9 +1244,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_PID) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID, table) + count * sizeof(MIB_TCPROW_OWNER_PID); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_PID); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1276,14 +1282,15 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurTcpTable) { - if (sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_MODULE) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE, table) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_MODULE); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_MODULE); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirTcpTable, pOurTcpTable, sizeof(DWORD) + pOurTcpTable->dwNumEntries * sizeof(MIB_TCPROW_OWNER_MODULE)); + memcpy(pTheirTcpTable, pOurTcpTable, size); /* Don't sort on PID, so use basic helper */ if (bOrder) @@ -1311,9 +1318,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_MODULE) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE, table) + count * sizeof(MIB_TCPROW_OWNER_MODULE); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_MODULE); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1356,9 +1364,10 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U } } - if (sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_MODULE) > *pdwSize || !pTheirTcpTable) + size = FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE, table) + count * sizeof(MIB_TCPROW_OWNER_MODULE); + if (size > *pdwSize || !pTheirTcpTable) { - *pdwSize = sizeof(DWORD) + count * sizeof(MIB_TCPROW_OWNER_MODULE); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else @@ -1433,6 +1442,7 @@ static int UdpTableSorter(const void *a, const void *b) DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, UDP_TABLE_CLASS TableClass, ULONG Reserved) { + DWORD size; DWORD ret = NO_ERROR; if (!pdwSize) @@ -1455,14 +1465,15 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurUdpTable) { - if (sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW) > *pdwSize || !pTheirUdpTable) + size = FIELD_OFFSET(MIB_UDPTABLE, table) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW); + if (size > *pdwSize || !pTheirUdpTable) { - *pdwSize = sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirUdpTable, pOurUdpTable, sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_PID)); + memcpy(pTheirUdpTable, pOurUdpTable, size); if (bOrder) qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries, @@ -1481,14 +1492,15 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurUdpTable) { - if (sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_PID) > *pdwSize || !pTheirUdpTable) + size = FIELD_OFFSET(MIB_UDPTABLE_OWNER_PID, table) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_PID); + if (size > *pdwSize || !pTheirUdpTable) { - *pdwSize = sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_PID); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirUdpTable, pOurUdpTable, sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_PID)); + memcpy(pTheirUdpTable, pOurUdpTable, size); if (bOrder) qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries, @@ -1507,14 +1519,15 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U if (pOurUdpTable) { - if (sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_MODULE) > *pdwSize || !pTheirUdpTable) + size = FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE, table) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_MODULE); + if (size > *pdwSize || !pTheirUdpTable) { - *pdwSize = sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_MODULE); + *pdwSize = size; ret = ERROR_INSUFFICIENT_BUFFER; } else { - memcpy(pTheirUdpTable, pOurUdpTable, sizeof(DWORD) + pOurUdpTable->dwNumEntries * sizeof(MIB_UDPROW_OWNER_MODULE)); + memcpy(pTheirUdpTable, pOurUdpTable, size); if (bOrder) qsort(pTheirUdpTable->table, pTheirUdpTable->dwNumEntries,
6 years
1
0
0
0
[reactos] 01/02: [IPHLPAPI] Reduce code duplication and use a single function for TCP and UDP enumerations
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bf052e120b3ad451b1b45…
commit bf052e120b3ad451b1b450cc7c1ebf12b1f57ffa Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Fri Nov 30 19:42:38 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Fri Nov 30 20:06:29 2018 +0100 [IPHLPAPI] Reduce code duplication and use a single function for TCP and UDP enumerations Furthermore, memory was improperly allocated before (alignment issues) leading to heap corruption under certain circumstances --- dll/win32/iphlpapi/iphlpapi_main.c | 24 +-- dll/win32/iphlpapi/ipstats.h | 30 +--- dll/win32/iphlpapi/ipstats_reactos.c | 291 ++++------------------------------- 3 files changed, 53 insertions(+), 292 deletions(-) diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c index 023f2fd082..11bddb40c5 100644 --- a/dll/win32/iphlpapi/iphlpapi_main.c +++ b/dll/win32/iphlpapi/iphlpapi_main.c @@ -1040,7 +1040,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U { case TCP_TABLE_BASIC_ALL: { - PMIB_TCPTABLE pOurTcpTable = getTcpTable(); + PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic); PMIB_TCPTABLE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1066,7 +1066,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_BASIC_CONNECTIONS: { - PMIB_TCPTABLE pOurTcpTable = getTcpTable(); + PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic); PMIB_TCPTABLE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1110,7 +1110,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_BASIC_LISTENER: { - PMIB_TCPTABLE pOurTcpTable = getTcpTable(); + PMIB_TCPTABLE pOurTcpTable = getTcpTable(ClassBasic); PMIB_TCPTABLE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1154,7 +1154,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_PID_ALL: { - PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getOwnerTcpTable(); + PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getTcpTable(ClassModulePid); PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1181,7 +1181,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_PID_CONNECTIONS: { - PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getOwnerTcpTable(); + PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getTcpTable(ClassModulePid); PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1226,7 +1226,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_PID_LISTENER: { - PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getOwnerTcpTable(); + PMIB_TCPTABLE_OWNER_PID pOurTcpTable = getTcpTable(ClassModulePid); PMIB_TCPTABLE_OWNER_PID pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1271,7 +1271,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_MODULE_ALL: { - PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getOwnerModTcpTable(); + PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getTcpTable(ClassModule); PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1298,7 +1298,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_MODULE_CONNECTIONS: { - PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getOwnerModTcpTable(); + PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getTcpTable(ClassModule); PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1343,7 +1343,7 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U case TCP_TABLE_OWNER_MODULE_LISTENER: { - PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getOwnerModTcpTable(); + PMIB_TCPTABLE_OWNER_MODULE pOurTcpTable = getTcpTable(ClassModule); PMIB_TCPTABLE_OWNER_MODULE pTheirTcpTable = pTcpTable; if (pOurTcpTable) @@ -1450,7 +1450,7 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U { case UDP_TABLE_BASIC: { - PMIB_UDPTABLE pOurUdpTable = getUdpTable(); + PMIB_UDPTABLE pOurUdpTable = getUdpTable(ClassBasic); PMIB_UDPTABLE pTheirUdpTable = pUdpTable; if (pOurUdpTable) @@ -1476,7 +1476,7 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U case UDP_TABLE_OWNER_PID: { - PMIB_UDPTABLE_OWNER_PID pOurUdpTable = getOwnerUdpTable(); + PMIB_UDPTABLE_OWNER_PID pOurUdpTable = getUdpTable(ClassModulePid); PMIB_UDPTABLE_OWNER_PID pTheirUdpTable = pUdpTable; if (pOurUdpTable) @@ -1502,7 +1502,7 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, U case UDP_TABLE_OWNER_MODULE: { - PMIB_UDPTABLE_OWNER_MODULE pOurUdpTable = getOwnerModUdpTable(); + PMIB_UDPTABLE_OWNER_MODULE pOurUdpTable = getUdpTable(ClassModule); PMIB_UDPTABLE_OWNER_MODULE pTheirUdpTable = pUdpTable; if (pOurUdpTable) diff --git a/dll/win32/iphlpapi/ipstats.h b/dll/win32/iphlpapi/ipstats.h index 6becd0014c..66d78c946f 100644 --- a/dll/win32/iphlpapi/ipstats.h +++ b/dll/win32/iphlpapi/ipstats.h @@ -76,6 +76,12 @@ typedef struct _RouteTable { RouteEntry routes[1]; } RouteTable; +typedef enum _CLASS_TABLE { + ClassBasic, + ClassModulePid, + ClassModule +} CLASS_TABLE; + /* Allocates and returns to you the route table, or NULL if it can't allocate * enough memory. free() the returned table. */ @@ -95,17 +101,7 @@ DWORD getNumUdpEntries(void); /* Allocates and returns to you the UDP state table, or NULL if it can't * allocate enough memory. free() the returned table. */ -PMIB_UDPTABLE getUdpTable(void); - -/* Allocates and returns to you the UDP state table with owner PID, - * or NULL if it can't allocate enough memory. free() the returned table. - */ -PMIB_UDPTABLE_OWNER_PID getOwnerUdpTable(void); - -/* Allocates and returns to you the UDP state table with module info, - * or NULL if it can't allocate enough memory. free() the returned table. - */ -PMIB_UDPTABLE_OWNER_MODULE getOwnerModUdpTable(void); +PVOID getUdpTable(CLASS_TABLE Class); /* Returns the number of entries in the TCP state table. */ DWORD getNumTcpEntries(void); @@ -113,16 +109,6 @@ DWORD getNumTcpEntries(void); /* Allocates and returns to you the TCP state table, or NULL if it can't * allocate enough memory. free() the returned table. */ -PMIB_TCPTABLE getTcpTable(void); - -/* Allocates and returns to you the TCP state table with owner PID, - * or NULL if it can't allocate enough memory. free() the returned table. - */ -PMIB_TCPTABLE_OWNER_PID getOwnerTcpTable(void); - -/* Allocates and returns to you the TCP state table with module info, - * or NULL if it can't allocate enough memory. free() the returned table. - */ -PMIB_TCPTABLE_OWNER_MODULE getOwnerModTcpTable(void); +PVOID getTcpTable(CLASS_TABLE Class); #endif /* ndef WINE_IPSTATS_H_ */ diff --git a/dll/win32/iphlpapi/ipstats_reactos.c b/dll/win32/iphlpapi/ipstats_reactos.c index 84351ea9a0..5906388fc4 100644 --- a/dll/win32/iphlpapi/ipstats_reactos.c +++ b/dll/win32/iphlpapi/ipstats_reactos.c @@ -590,6 +590,21 @@ PMIB_IPNETTABLE getArpTable(void) return IpArpTable; } +struct _TABLE_CALL +{ + DWORD TOIID; + SIZE_T UdpSize; + SIZE_T TcpSize; + SIZE_T UdpOffset; + SIZE_T TcpOffset; +} UdpTcpTableCall[] = { + {IP_MIB_ARPTABLE_ENTRY_ID, sizeof(MIB_UDPROW), sizeof(MIB_TCPROW), FIELD_OFFSET(MIB_UDPTABLE, table), FIELD_OFFSET(MIB_TCPTABLE, table)}, + {IP_MIB_ADDRTABLE_ENTRY_ID, sizeof(MIB_UDPROW_OWNER_PID), sizeof(MIB_TCPROW_OWNER_PID), FIELD_OFFSET(MIB_UDPTABLE_OWNER_PID, table), FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID, table)}, + {IP_SPECIFIC_MODULE_ENTRY_ID, sizeof(MIB_UDPROW_OWNER_MODULE), sizeof(MIB_TCPROW_OWNER_MODULE), FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE, table), FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE, table)}, +}; + +#define Add2Ptr(PTR, INC) (PVOID)((ULONG_PTR)(PTR) + (INC)) + DWORD getNumUdpEntries(void) { DWORD numEntities; @@ -639,7 +654,7 @@ DWORD getNumUdpEntries(void) return totalNumber; } -PMIB_UDPTABLE getUdpTable(void) +PVOID getUdpTable(CLASS_TABLE Class) { DWORD numEntities, returnSize; TDIEntityID *entitySet; @@ -647,7 +662,7 @@ PMIB_UDPTABLE getUdpTable(void) int i, totalNumber, TmpIdx, CurrIdx = 0; NTSTATUS status; PMIB_UDPTABLE IpUdpTable = NULL; - PMIB_UDPROW AdapterUdpTable = NULL; + PVOID AdapterUdpTable = NULL; TRACE("called.\n"); @@ -661,7 +676,7 @@ PMIB_UDPTABLE getUdpTable(void) IpUdpTable = HeapAlloc ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_UDPROW) * totalNumber) ); + UdpTcpTableCall[Class].UdpOffset + (UdpTcpTableCall[Class].UdpSize * totalNumber) ); if (!IpUdpTable) { closeTcpFile(tcpFile); return NULL; @@ -676,17 +691,19 @@ PMIB_UDPTABLE getUdpTable(void) status = tdiGetSetOfThings( tcpFile, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, - IP_MIB_ARPTABLE_ENTRY_ID, + UdpTcpTableCall[Class].TOIID, CL_TL_ENTITY, entitySet[i].tei_instance, 0, - sizeof(MIB_UDPROW), - (PVOID *)&AdapterUdpTable, + UdpTcpTableCall[Class].UdpSize, + &AdapterUdpTable, &returnSize ); if( status == STATUS_SUCCESS ) { for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpUdpTable->table[CurrIdx] = AdapterUdpTable[TmpIdx]; + CopyMemory(Add2Ptr(IpUdpTable, UdpTcpTableCall[Class].UdpOffset + UdpTcpTableCall[Class].UdpSize * CurrIdx), + Add2Ptr(AdapterUdpTable, UdpTcpTableCall[Class].UdpSize * TmpIdx), + UdpTcpTableCall[Class].UdpSize); tdiFreeThingSet( AdapterUdpTable ); } } @@ -700,128 +717,6 @@ PMIB_UDPTABLE getUdpTable(void) return IpUdpTable; } -PMIB_UDPTABLE_OWNER_PID getOwnerUdpTable(void) -{ - DWORD numEntities, returnSize; - TDIEntityID *entitySet; - HANDLE tcpFile; - int i, totalNumber, TmpIdx, CurrIdx = 0; - NTSTATUS status; - PMIB_UDPTABLE_OWNER_PID IpOwnerUdpTable = NULL; - PMIB_UDPROW_OWNER_PID AdapterOwnerUdpTable = NULL; - - TRACE("called.\n"); - - totalNumber = getNumUdpEntries(); - - status = openTcpFile( &tcpFile, FILE_READ_DATA ); - if( !NT_SUCCESS(status) ) { - ERR("openTcpFile returned 0x%08lx\n", status); - return 0; - } - - IpOwnerUdpTable = HeapAlloc - ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_UDPROW_OWNER_PID) * totalNumber) ); - if (!IpOwnerUdpTable) { - closeTcpFile(tcpFile); - return NULL; - } - - status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities ); - - for( i = 0; i < numEntities; i++ ) { - if( entitySet[i].tei_entity == CL_TL_ENTITY && - hasArp( tcpFile, &entitySet[i] ) ) { - - status = tdiGetSetOfThings( tcpFile, - INFO_CLASS_PROTOCOL, - INFO_TYPE_PROVIDER, - IP_MIB_ADDRTABLE_ENTRY_ID, - CL_TL_ENTITY, - entitySet[i].tei_instance, - 0, - sizeof(MIB_UDPROW_OWNER_PID), - (PVOID *)&AdapterOwnerUdpTable, - &returnSize ); - - if( status == STATUS_SUCCESS ) { - for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpOwnerUdpTable->table[CurrIdx] = AdapterOwnerUdpTable[TmpIdx]; - tdiFreeThingSet( AdapterOwnerUdpTable ); - } - } - } - - closeTcpFile( tcpFile ); - - tdiFreeThingSet( entitySet ); - IpOwnerUdpTable->dwNumEntries = CurrIdx; - - return IpOwnerUdpTable; -} - -PMIB_UDPTABLE_OWNER_MODULE getOwnerModUdpTable(void) -{ - DWORD numEntities, returnSize; - TDIEntityID *entitySet; - HANDLE tcpFile; - int i, totalNumber, TmpIdx, CurrIdx = 0; - NTSTATUS status; - PMIB_UDPTABLE_OWNER_MODULE IpOwnerModUdpTable = NULL; - PMIB_UDPROW_OWNER_MODULE AdapterOwnerModUdpTable = NULL; - - TRACE("called.\n"); - - totalNumber = getNumUdpEntries(); - - status = openTcpFile( &tcpFile, FILE_READ_DATA ); - if( !NT_SUCCESS(status) ) { - ERR("openTcpFile returned 0x%08lx\n", status); - return 0; - } - - IpOwnerModUdpTable = HeapAlloc - ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_UDPROW_OWNER_MODULE) * totalNumber) ); - if (!IpOwnerModUdpTable) { - closeTcpFile(tcpFile); - return NULL; - } - - status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities ); - - for( i = 0; i < numEntities; i++ ) { - if( entitySet[i].tei_entity == CL_TL_ENTITY && - hasArp( tcpFile, &entitySet[i] ) ) { - - status = tdiGetSetOfThings( tcpFile, - INFO_CLASS_PROTOCOL, - INFO_TYPE_PROVIDER, - IP_SPECIFIC_MODULE_ENTRY_ID, - CL_TL_ENTITY, - entitySet[i].tei_instance, - 0, - sizeof(MIB_UDPROW_OWNER_MODULE), - (PVOID *)&AdapterOwnerModUdpTable, - &returnSize ); - - if( status == STATUS_SUCCESS ) { - for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpOwnerModUdpTable->table[CurrIdx] = AdapterOwnerModUdpTable[TmpIdx]; - tdiFreeThingSet( AdapterOwnerModUdpTable ); - } - } - } - - closeTcpFile( tcpFile ); - - tdiFreeThingSet( entitySet ); - IpOwnerModUdpTable->dwNumEntries = CurrIdx; - - return IpOwnerModUdpTable; -} - DWORD getNumTcpEntries(void) { DWORD numEntities; @@ -871,7 +766,7 @@ DWORD getNumTcpEntries(void) return totalNumber; } -PMIB_TCPTABLE getTcpTable(void) +PVOID getTcpTable(CLASS_TABLE Class) { DWORD numEntities, returnSize; TDIEntityID *entitySet; @@ -879,7 +774,7 @@ PMIB_TCPTABLE getTcpTable(void) int i, totalNumber, TmpIdx, CurrIdx = 0; NTSTATUS status; PMIB_TCPTABLE IpTcpTable = NULL; - PMIB_TCPROW AdapterTcpTable = NULL; + PVOID AdapterTcpTable = NULL; TRACE("called.\n"); @@ -893,7 +788,7 @@ PMIB_TCPTABLE getTcpTable(void) IpTcpTable = HeapAlloc ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_TCPROW) * totalNumber) ); + UdpTcpTableCall[Class].TcpOffset + (UdpTcpTableCall[Class].TcpSize * totalNumber) ); if (!IpTcpTable) { closeTcpFile(tcpFile); return NULL; @@ -908,17 +803,19 @@ PMIB_TCPTABLE getTcpTable(void) status = tdiGetSetOfThings( tcpFile, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, - IP_MIB_ARPTABLE_ENTRY_ID, + UdpTcpTableCall[Class].TOIID, CO_TL_ENTITY, entitySet[i].tei_instance, 0, - sizeof(MIB_TCPROW), - (PVOID *)&AdapterTcpTable, + UdpTcpTableCall[Class].TcpSize, + &AdapterTcpTable, &returnSize ); if( status == STATUS_SUCCESS ) { for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpTcpTable->table[CurrIdx] = AdapterTcpTable[TmpIdx]; + CopyMemory(Add2Ptr(IpTcpTable, UdpTcpTableCall[Class].TcpOffset + UdpTcpTableCall[Class].TcpSize * CurrIdx), + Add2Ptr(AdapterTcpTable, UdpTcpTableCall[Class].TcpSize * TmpIdx), + UdpTcpTableCall[Class].TcpSize); tdiFreeThingSet( AdapterTcpTable ); } } @@ -931,125 +828,3 @@ PMIB_TCPTABLE getTcpTable(void) return IpTcpTable; } - -PMIB_TCPTABLE_OWNER_PID getOwnerTcpTable(void) -{ - DWORD numEntities, returnSize; - TDIEntityID *entitySet; - HANDLE tcpFile; - int i, totalNumber, TmpIdx, CurrIdx = 0; - NTSTATUS status; - PMIB_TCPTABLE_OWNER_PID IpOwnerTcpTable = NULL; - PMIB_TCPROW_OWNER_PID AdapterOwnerTcpTable = NULL; - - TRACE("called.\n"); - - totalNumber = getNumTcpEntries(); - - status = openTcpFile( &tcpFile, FILE_READ_DATA ); - if( !NT_SUCCESS(status) ) { - ERR("openTcpFile returned 0x%08lx\n", status); - return 0; - } - - IpOwnerTcpTable = HeapAlloc - ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_TCPROW_OWNER_PID) * totalNumber) ); - if (!IpOwnerTcpTable) { - closeTcpFile(tcpFile); - return NULL; - } - - status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities ); - - for( i = 0; i < numEntities; i++ ) { - if( entitySet[i].tei_entity == CO_TL_ENTITY && - hasArp( tcpFile, &entitySet[i] ) ) { - - status = tdiGetSetOfThings( tcpFile, - INFO_CLASS_PROTOCOL, - INFO_TYPE_PROVIDER, - IP_MIB_ADDRTABLE_ENTRY_ID, - CO_TL_ENTITY, - entitySet[i].tei_instance, - 0, - sizeof(MIB_TCPROW_OWNER_PID), - (PVOID *)&AdapterOwnerTcpTable, - &returnSize ); - - if( status == STATUS_SUCCESS ) { - for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpOwnerTcpTable->table[CurrIdx] = AdapterOwnerTcpTable[TmpIdx]; - tdiFreeThingSet( AdapterOwnerTcpTable ); - } - } - } - - closeTcpFile( tcpFile ); - - tdiFreeThingSet( entitySet ); - IpOwnerTcpTable->dwNumEntries = CurrIdx; - - return IpOwnerTcpTable; -} - -PMIB_TCPTABLE_OWNER_MODULE getOwnerModTcpTable(void) -{ - DWORD numEntities, returnSize; - TDIEntityID *entitySet; - HANDLE tcpFile; - int i, totalNumber, TmpIdx, CurrIdx = 0; - NTSTATUS status; - PMIB_TCPTABLE_OWNER_MODULE IpOwnerModTcpTable = NULL; - PMIB_TCPROW_OWNER_MODULE AdapterOwnerModTcpTable = NULL; - - TRACE("called.\n"); - - totalNumber = getNumTcpEntries(); - - status = openTcpFile( &tcpFile, FILE_READ_DATA ); - if( !NT_SUCCESS(status) ) { - ERR("openTcpFile returned 0x%08lx\n", status); - return 0; - } - - IpOwnerModTcpTable = HeapAlloc - ( GetProcessHeap(), 0, - sizeof(DWORD) + (sizeof(MIB_TCPROW_OWNER_MODULE) * totalNumber) ); - if (!IpOwnerModTcpTable) { - closeTcpFile(tcpFile); - return NULL; - } - - status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities ); - - for( i = 0; i < numEntities; i++ ) { - if( entitySet[i].tei_entity == CO_TL_ENTITY && - hasArp( tcpFile, &entitySet[i] ) ) { - - status = tdiGetSetOfThings( tcpFile, - INFO_CLASS_PROTOCOL, - INFO_TYPE_PROVIDER, - IP_SPECIFIC_MODULE_ENTRY_ID, - CO_TL_ENTITY, - entitySet[i].tei_instance, - 0, - sizeof(MIB_TCPROW_OWNER_MODULE), - (PVOID *)&AdapterOwnerModTcpTable, - &returnSize ); - - if( status == STATUS_SUCCESS ) { - for( TmpIdx = 0; TmpIdx < returnSize; TmpIdx++, CurrIdx++ ) - IpOwnerModTcpTable->table[CurrIdx] = AdapterOwnerModTcpTable[TmpIdx]; - tdiFreeThingSet( AdapterOwnerModTcpTable ); - } - } - } - - closeTcpFile( tcpFile ); - - tdiFreeThingSet( entitySet ); - IpOwnerModTcpTable->dwNumEntries = CurrIdx; - - return IpOwnerModTcpTable; -}
6 years
1
0
0
0
[reactos] 01/01: [SYSDM] Explicitly check DMI strings for NULL pointers
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ed7a78e97a79e08304590…
commit ed7a78e97a79e083045909c4421bc5512f3d0062 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Fri Nov 30 16:55:29 2018 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Fri Nov 30 16:55:29 2018 +0300 [SYSDM] Explicitly check DMI strings for NULL pointers ...to make CRT string comparison functions happy. CORE-15403 --- dll/cpl/sysdm/smbios.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dll/cpl/sysdm/smbios.c b/dll/cpl/sysdm/smbios.c index 5c7e38e467..d7d49976ee 100644 --- a/dll/cpl/sysdm/smbios.c +++ b/dll/cpl/sysdm/smbios.c @@ -331,6 +331,7 @@ void AppendSystemFamily(PWSTR pBuf, SIZE_T cchBuf, PCHAR * DmiStrings, PWSTR dev if (wcsistr(dev, wideStr) == NULL && (!Aliases[i] || wcsistr(dev, Aliases[i]) == NULL) && + DmiStrings[SYS_FAMILY] != NULL && !stricmp(DmiStrings[SYS_FAMILY], KnownFamilies[i])) { if (wcslen(pBuf) > 0 && wcslen(dev) > 0) @@ -514,7 +515,8 @@ BOOL GetSystemName(PWSTR pBuf, SIZE_T cchBuf) { StringCchCopyW(ven, _countof(ven), L"Lenovo"); - if (stricmp(DmiStrings[SYS_VERSION], "Lenovo") && + if (DmiStrings[SYS_VERSION] != NULL && + stricmp(DmiStrings[SYS_VERSION], "Lenovo") && stricmp(DmiStrings[SYS_VERSION], "Lenovo Product") && stricmp(DmiStrings[SYS_VERSION], " ") && _strnicmp(DmiStrings[SYS_VERSION], " ", 3) && @@ -545,8 +547,9 @@ BOOL GetSystemName(PWSTR pBuf, SIZE_T cchBuf) // workaround for DEXP if (!wcscmp(ven, L"DEXP")) { - if (!stricmp(DmiStrings[SYS_PRODUCT], "Tablet PC") - && DmiStrings[SYS_VERSION] != NULL) + if (DmiStrings[SYS_PRODUCT] != NULL && + !stricmp(DmiStrings[SYS_PRODUCT], "Tablet PC") && + DmiStrings[SYS_VERSION] != NULL) { GetSMBiosStringW(DmiStrings[SYS_VERSION], dev, _countof(dev), TRUE); }
6 years
1
0
0
0
[reactos] 01/01: [SDK] Allow use of SYSTEM_MEMORY_LIST_INFORMATION in kernel code
by Andrew Boyarshin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8c710dc518f49c953a73b…
commit 8c710dc518f49c953a73b97b450d4ea24787ca1c Author: Andrew Boyarshin <andrew.boyarshin(a)gmail.com> AuthorDate: Sun Nov 25 14:45:16 2018 +0700 Commit: Colin Finck <colin(a)reactos.org> CommitDate: Fri Nov 30 10:21:12 2018 +0100 [SDK] Allow use of SYSTEM_MEMORY_LIST_INFORMATION in kernel code --- sdk/include/ndk/extypes.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sdk/include/ndk/extypes.h b/sdk/include/ndk/extypes.h index adf1371500..5c3ba03659 100644 --- a/sdk/include/ndk/extypes.h +++ b/sdk/include/ndk/extypes.h @@ -1511,23 +1511,23 @@ typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION UCHAR TableBuffer[1]; } SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION; +#endif // !NTOS_MODE_USER + // -// Class 81 +// Class 80 // typedef struct _SYSTEM_MEMORY_LIST_INFORMATION { - SIZE_T ZeroPageCount; - SIZE_T FreePageCount; - SIZE_T ModifiedPageCount; - SIZE_T ModifiedNoWritePageCount; - SIZE_T BadPageCount; - SIZE_T PageCountByPriority[8]; - SIZE_T RepurposedPagesByPriority[8]; - SIZE_T ModifiedPageCountPageFile; + SIZE_T ZeroPageCount; + SIZE_T FreePageCount; + SIZE_T ModifiedPageCount; + SIZE_T ModifiedNoWritePageCount; + SIZE_T BadPageCount; + SIZE_T PageCountByPriority[8]; + SIZE_T RepurposedPagesByPriority[8]; + SIZE_T ModifiedPageCountPageFile; } SYSTEM_MEMORY_LIST_INFORMATION, *PSYSTEM_MEMORY_LIST_INFORMATION; -#endif // !NTOS_MODE_USER - #ifdef __cplusplus }; // extern "C" #endif
6 years
1
0
0
0
[reactos] 01/01: [MC] Add messages 4700-4778 to netmsg.dll.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8bc141a9ade1a2cac6871…
commit 8bc141a9ade1a2cac6871893689356d2331d6b85 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Thu Nov 29 21:26:44 2018 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Thu Nov 29 21:27:31 2018 +0100 [MC] Add messages 4700-4778 to netmsg.dll. --- sdk/include/reactos/mc/netmsgmsg.mc | 653 +++++++++++++++++++++++++++++++++++- 1 file changed, 652 insertions(+), 1 deletion(-) diff --git a/sdk/include/reactos/mc/netmsgmsg.mc b/sdk/include/reactos/mc/netmsgmsg.mc index 9146554bc0..a91d5a4959 100644 --- a/sdk/include/reactos/mc/netmsgmsg.mc +++ b/sdk/include/reactos/mc/netmsgmsg.mc @@ -10700,10 +10700,661 @@ Language=Russian Created at %1 . +MessageId=4700 +Severity=Success +Facility=System +SymbolicName=APPERR2_4700 +Language=English +Server Name Remark +. +Language=Russian +Server Name Remark +. + +MessageId=4702 +Severity=Success +Facility=System +SymbolicName=APPERR2_4702 +Language=English +(UNC)%0 +. +Language=Russian +(UNC)%0 +. + +MessageId=4703 +Severity=Success +Facility=System +SymbolicName=APPERR2_4703 +Language=English +...%0 +. +Language=Russian +...%0 +. + +MessageId=4704 +Severity=Success +Facility=System +SymbolicName=APPERR2_4704 +Language=English +Domain +. +Language=Russian +Domain +. + +MessageId=4705 +Severity=Success +Facility=System +SymbolicName=APPERR2_4705 +Language=English +Resources on %1 +. +Language=Russian +Resources on %1 +. + +MessageId=4706 +Severity=Success +Facility=System +SymbolicName=APPERR2_4706 +Language=English +Invalid network provider. Available networks are: +. +Language=Russian +Invalid network provider. Available networks are: +. + +MessageId=4710 +Severity=Success +Facility=System +SymbolicName=APPERR2_4710 +Language=English +Disk%0 +. +Language=Russian +Disk%0 +. + +MessageId=4711 +Severity=Success +Facility=System +SymbolicName=APPERR2_4711 +Language=English +Print%0 +. +Language=Russian +Print%0 +. + +MessageId=4712 +Severity=Success +Facility=System +SymbolicName=APPERR2_4712 +Language=English +Comm%0 +. +Language=Russian +Comm%0 +. + +MessageId=4713 +Severity=Success +Facility=System +SymbolicName=APPERR2_4713 +Language=English +IPC%0 +. +Language=Russian +IPC%0 +. + +MessageId=4714 +Severity=Success +Facility=System +SymbolicName=APPERR2_4714 +Language=English +Status Local Remote Network +. +Language=Russian +Status Local Remote Network +. + +MessageId=4715 +Severity=Success +Facility=System +SymbolicName=APPERR2_4715 +Language=English +OK%0 +. +Language=Russian +OK%0 +. + +MessageId=4716 +Severity=Success +Facility=System +SymbolicName=APPERR2_4716 +Language=English +Dormant%0 +. +Language=Russian +Dormant%0 +. + +MessageId=4717 +Severity=Success +Facility=System +SymbolicName=APPERR2_4717 +Language=English +Paused%0 +. +Language=Russian +Paused%0 +. + +MessageId=4718 +Severity=Success +Facility=System +SymbolicName=APPERR2_4718 +Language=English +Disconnected%0 +. +Language=Russian +Disconnected%0 +. + +MessageId=4719 +Severity=Success +Facility=System +SymbolicName=APPERR2_4719 +Language=English +Error%0 +. +Language=Russian +Error%0 +. + +MessageId=4720 +Severity=Success +Facility=System +SymbolicName=APPERR2_4720 +Language=English +Connecting%0 +. +Language=Russian +Connecting%0 +. + +MessageId=4721 +Severity=Success +Facility=System +SymbolicName=APPERR2_4721 +Language=English +Reconnecting%0 +. +Language=Russian +Reconnecting%0 +. + +MessageId=4722 +Severity=Success +Facility=System +SymbolicName=APPERR2_4722 +Language=English +Status%0 +. +Language=Russian +Status%0 +. + +MessageId=4723 +Severity=Success +Facility=System +SymbolicName=APPERR2_4723 +Language=English +Local name%0 +. +Language=Russian +Local name%0 +. + +MessageId=4724 +Severity=Success +Facility=System +SymbolicName=APPERR2_4724 +Language=English +Remote name%0 +. +Language=Russian +Remote name%0 +. + +MessageId=4725 +Severity=Success +Facility=System +SymbolicName=APPERR2_4725 +Language=English +Resource type%0 +. +Language=Russian +Resource type%0 +. + +MessageId=4726 +Severity=Success +Facility=System +SymbolicName=APPERR2_4726 +Language=English +# Opens%0 +. +Language=Russian +# Opens%0 +. + +MessageId=4727 +Severity=Success +Facility=System +SymbolicName=APPERR2_4727 +Language=English +# Connections%0 +. +Language=Russian +# Connections%0 +. + +MessageId=4728 +Severity=Success +Facility=System +SymbolicName=APPERR2_4728 +Language=English +Unavailable%0 +. +Language=Russian +Unavailable%0 +. + +MessageId=4730 +Severity=Success +Facility=System +SymbolicName=APPERR2_4730 +Language=English +Share name Resource Remark +. +Language=Russian +Share name Resource Remark +. + +MessageId=4731 +Severity=Success +Facility=System +SymbolicName=APPERR2_4731 +Language=English +Share name%0 +. +Language=Russian +Share name%0 +. + +MessageId=4732 +Severity=Success +Facility=System +SymbolicName=APPERR2_4732 +Language=English +Resource%0 +. +Language=Russian +Resource%0 +. + +MessageId=4733 +Severity=Success +Facility=System +SymbolicName=APPERR2_4733 +Language=English +Spooled%0 +. +Language=Russian +Spooled%0 +. + +MessageId=4734 +Severity=Success +Facility=System +SymbolicName=APPERR2_4734 +Language=English +Permission%0 +. +Language=Russian +Permission%0 +. + +MessageId=4735 +Severity=Success +Facility=System +SymbolicName=APPERR2_4735 +Language=English +Maximum users%0 +. +Language=Russian +Maximum users%0 +. + +MessageId=4736 +Severity=Success +Facility=System +SymbolicName=APPERR2_4736 +Language=English +No limit%0 +. +Language=Russian +No limit%0 +. + +MessageId=4737 +Severity=Success +Facility=System +SymbolicName=APPERR2_4737 +Language=English +Users%0 +. +Language=Russian +Users%0 +. + +MessageId=4738 +Severity=Success +Facility=System +SymbolicName=APPERR2_4738 +Language=English +The share name entered may not be accessible from some MS-DOS workstations.\n +Are you sure you want to use this share name? %1: %0 +. +Language=Russian +The share name entered may not be accessible from some MS-DOS workstations.\n +Are you sure you want to use this share name? %1: %0 +. + +MessageId=4739 +Severity=Success +Facility=System +SymbolicName=APPERR2_4739 +Language=English +Caching%0 +. +Language=Russian +Caching%0 +. + +MessageId=4740 +Severity=Success +Facility=System +SymbolicName=APPERR2_4740 +Language=English +ID Path User name # Locks +. +Language=Russian +ID Path User name # Locks +. + +MessageId=4741 +Severity=Success +Facility=System +SymbolicName=APPERR2_4741 +Language=English +File ID%0 +. +Language=Russian +File ID%0 +. + +MessageId=4742 +Severity=Success +Facility=System +SymbolicName=APPERR2_4742 +Language=English +Locks%0 +. +Language=Russian +Locks%0 +. + +MessageId=4743 +Severity=Success +Facility=System +SymbolicName=APPERR2_4743 +Language=English +Permissions%0 +. +Language=Russian +Permissions%0 +. + +MessageId=4744 +Severity=Success +Facility=System +SymbolicName=APPERR2_4744 +Language=English +Share name%0 +. +Language=Russian +Share name%0 +. + +MessageId=4745 +Severity=Success +Facility=System +SymbolicName=APPERR2_4745 +Language=English +Type%0 +. +Language=Russian +Type%0 +. + +MessageId=4746 +Severity=Success +Facility=System +SymbolicName=APPERR2_4746 +Language=English +Used as%0 +. +Language=Russian +Used as%0 +. + +MessageId=4747 +Severity=Success +Facility=System +SymbolicName=APPERR2_4747 +Language=English +Comment%0 +. +Language=Russian +Comment%0 +. + +MessageId=4750 +Severity=Success +Facility=System +SymbolicName=APPERR2_4750 +Language=English +Computer User name Client Type Opens Idle time +. +Language=Russian +Computer User name Client Type Opens Idle time +. + +MessageId=4751 +Severity=Success +Facility=System +SymbolicName=APPERR2_4751 +Language=English +Computer%0 +. +Language=Russian +Computer%0 +. + +MessageId=4752 +Severity=Success +Facility=System +SymbolicName=APPERR2_4752 +Language=English +Sess time%0 +. +Language=Russian +Sess time%0 +. + +MessageId=4753 +Severity=Success +Facility=System +SymbolicName=APPERR2_4753 +Language=English +Idle time%0 +. +Language=Russian +Idle time%0 +. + +MessageId=4754 +Severity=Success +Facility=System +SymbolicName=APPERR2_4754 +Language=English +Share name Type # Opens +. +Language=Russian +Share name Type # Opens +. + +MessageId=4755 +Severity=Success +Facility=System +SymbolicName=APPERR2_4755 +Language=English +Client type%0 +. +Language=Russian +Client type%0 +. + +MessageId=4756 +Severity=Success +Facility=System +SymbolicName=APPERR2_4756 +Language=English +Guest logon%0 +. +Language=Russian +Guest logon%0 +. + +MessageId=4770 +Severity=Success +Facility=System +SymbolicName=APPERR2_4770 +Language=English +Manual caching of documents%0 +. +Language=Russian +Manual caching of documents%0 +. + +MessageId=4771 +Severity=Success +Facility=System +SymbolicName=APPERR2_4771 +Language=English +Automatic caching of documents%0 +. +Language=Russian +Automatic caching of documents%0 +. + +MessageId=4772 +Severity=Success +Facility=System +SymbolicName=APPERR2_4772 +Language=English +Automatic caching of programs and documents%0 +. +Language=Russian +Automatic caching of programs and documents%0 +. + +MessageId=4773 +Severity=Success +Facility=System +SymbolicName=APPERR2_4773 +Language=English +Caching disabled%0 +. +Language=Russian +Caching disabled%0 +. + +MessageId=4774 +Severity=Success +Facility=System +SymbolicName=APPERR2_4774 +Language=English +Automatic%0 +. +Language=Russian +Automatic%0 +. + +MessageId=4775 +Severity=Success +Facility=System +SymbolicName=APPERR2_4775 +Language=English +Manual%0 +. +Language=Russian +Manual%0 +. + +MessageId=4776 +Severity=Success +Facility=System +SymbolicName=APPERR2_4776 +Language=English +Documents%0 +. +Language=Russian +Documents%0 +. + +MessageId=4777 +Severity=Success +Facility=System +SymbolicName=APPERR2_4777 +Language=English +Programs%0 +. +Language=Russian +Programs%0 +. + +MessageId=4778 +Severity=Success +Facility=System +SymbolicName=APPERR2_4778 +Language=English +None%0 +. +Language=Russian +None%0 +. + ; -; ncberr.h (non-public) nessage definitions (5300 - 5499 NRCERR_BASE) +; ncberr.h (non-public) message definitions (5300 - 5499 NRCERR_BASE) ; MessageId=5300
6 years
1
0
0
0
[reactos] 05/05: [IPHLPAPI] Implement GetOwnerModuleFromTcpEntry()
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d2d957f81dcf5e32d35e…
commit 3d2d957f81dcf5e32d35e3c406271c93b8daaf6e Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Nov 29 20:28:06 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Nov 29 20:36:08 2018 +0100 [IPHLPAPI] Implement GetOwnerModuleFromTcpEntry() CORE-4792 --- dll/win32/iphlpapi/CMakeLists.txt | 2 +- dll/win32/iphlpapi/iphlpapi_main.c | 62 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/dll/win32/iphlpapi/CMakeLists.txt b/dll/win32/iphlpapi/CMakeLists.txt index 72acbf8b13..2b47c61629 100644 --- a/dll/win32/iphlpapi/CMakeLists.txt +++ b/dll/win32/iphlpapi/CMakeLists.txt @@ -29,6 +29,6 @@ add_library(iphlpapi SHARED set_module_type(iphlpapi win32dll UNICODE) target_link_libraries(iphlpapi wine tdilib) -add_importlibs(iphlpapi dhcpcsvc advapi32 ws2_32 msvcrt kernel32 ntdll) +add_importlibs(iphlpapi dhcpcsvc advapi32 psapi ws2_32 msvcrt kernel32 ntdll) add_pch(iphlpapi iphlpapi_private.h SOURCE) add_cd_file(TARGET iphlpapi DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c index 31cf158c6d..023f2fd082 100644 --- a/dll/win32/iphlpapi/iphlpapi_main.c +++ b/dll/win32/iphlpapi/iphlpapi_main.c @@ -2,6 +2,7 @@ * iphlpapi dll implementation * * Copyright (C) 2003 Juan Lang + * 2018 Pierre Schweitzer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +24,7 @@ #include <config.h> #include "iphlpapi_private.h" #include <strsafe.h> +#include <psapi.h> WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); @@ -2292,9 +2294,63 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf) */ DWORD WINAPI GetOwnerModuleFromTcpEntry( PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize) { - DWORD ret = NO_ERROR; - UNIMPLEMENTED; - return ret; + HANDLE Process; + DWORD FileLen, PathLen; + WCHAR File[MAX_PATH], Path[MAX_PATH]; + PTCPIP_OWNER_MODULE_BASIC_INFO BasicInfo; + + if (pTcpEntry->dwOwningPid == 0) + { + return ERROR_NOT_FOUND; + } + + Process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pTcpEntry->dwOwningPid); + if (Process == NULL) + { + return GetLastError(); + } + + FileLen = GetModuleBaseNameW(Process, NULL, File, MAX_PATH); + if (FileLen != 0) + { + PathLen = GetModuleFileNameExW(Process, NULL, Path, MAX_PATH); + if (PathLen == 0) + { + CloseHandle(Process); + return GetLastError(); + } + + /* Add NULL char */ + ++FileLen; + ++PathLen; + PathLen *= sizeof(WCHAR); + FileLen *= sizeof(WCHAR); + } + else if (GetLastError() == ERROR_PARTIAL_COPY) + { + wcscpy(File, L"System"); + wcscpy(Path, L"System"); + + PathLen = sizeof(L"System"); + FileLen = sizeof(L"System"); + } + + CloseHandle(Process); + + if (*pdwSize < sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen) + { + *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen; + return ERROR_INSUFFICIENT_BUFFER; + } + + BasicInfo = Buffer; + BasicInfo->pModuleName = (PVOID)((ULONG_PTR)BasicInfo + sizeof(TCPIP_OWNER_MODULE_BASIC_INFO)); + BasicInfo->pModulePath = (PVOID)((ULONG_PTR)BasicInfo->pModuleName + FileLen); + wcscpy(BasicInfo->pModuleName, File); + wcscpy(BasicInfo->pModulePath, Path); + *pdwSize = sizeof(TCPIP_OWNER_MODULE_BASIC_INFO) + PathLen + FileLen; + + return NO_ERROR; } static void CreateNameServerListEnumNamesFunc( PWCHAR Interface, PWCHAR Server, PVOID Data)
6 years
1
0
0
0
[reactos] 04/05: [IPHLPAPI_APITEST] Add tests for GetOwnerModuleFromTcpEntry()
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e9c7c6fd2c26e02ed2c81…
commit e9c7c6fd2c26e02ed2c813f2c7f96802488ca332 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Nov 29 19:58:36 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Nov 29 20:30:23 2018 +0100 [IPHLPAPI_APITEST] Add tests for GetOwnerModuleFromTcpEntry() --- modules/rostests/apitests/iphlpapi/CMakeLists.txt | 1 + .../apitests/iphlpapi/GetExtendedTcpTable.c | 2 +- .../apitests/iphlpapi/GetOwnerModuleFromTcpEntry.c | 163 +++++++++++++++++++++ modules/rostests/apitests/iphlpapi/testlist.c | 12 +- 4 files changed, 172 insertions(+), 6 deletions(-) diff --git a/modules/rostests/apitests/iphlpapi/CMakeLists.txt b/modules/rostests/apitests/iphlpapi/CMakeLists.txt index 23b8218972..81ca68cae9 100644 --- a/modules/rostests/apitests/iphlpapi/CMakeLists.txt +++ b/modules/rostests/apitests/iphlpapi/CMakeLists.txt @@ -3,6 +3,7 @@ list(APPEND SOURCE GetExtendedTcpTable.c GetInterfaceName.c GetNetworkParams.c + GetOwnerModuleFromTcpEntry.c icmp.c SendARP.c testlist.c) diff --git a/modules/rostests/apitests/iphlpapi/GetExtendedTcpTable.c b/modules/rostests/apitests/iphlpapi/GetExtendedTcpTable.c index 3beda7e8fd..87f3b65d3a 100644 --- a/modules/rostests/apitests/iphlpapi/GetExtendedTcpTable.c +++ b/modules/rostests/apitests/iphlpapi/GetExtendedTcpTable.c @@ -11,7 +11,7 @@ #include <iphlpapi.h> #include <winsock2.h> -DWORD GetExtendedTcpTableWithAlloc(PVOID *TcpTable, BOOL Order, DWORD Family, TCP_TABLE_CLASS Class) +static DWORD GetExtendedTcpTableWithAlloc(PVOID *TcpTable, BOOL Order, DWORD Family, TCP_TABLE_CLASS Class) { DWORD ret; DWORD Size = 0; diff --git a/modules/rostests/apitests/iphlpapi/GetOwnerModuleFromTcpEntry.c b/modules/rostests/apitests/iphlpapi/GetOwnerModuleFromTcpEntry.c new file mode 100644 index 0000000000..a57142118f --- /dev/null +++ b/modules/rostests/apitests/iphlpapi/GetOwnerModuleFromTcpEntry.c @@ -0,0 +1,163 @@ +/* + * PROJECT: ReactOS API Tests + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Tests for TCP connections owner functions + * COPYRIGHT: Copyright 2018 Pierre Schweitzer + */ + +#include <apitest.h> + +#define WIN32_NO_STATUS +#include <iphlpapi.h> +#include <winsock2.h> + +static DWORD GetExtendedTcpTableWithAlloc(PVOID *TcpTable, BOOL Order, DWORD Family, TCP_TABLE_CLASS Class) +{ + DWORD ret; + DWORD Size = 0; + + *TcpTable = NULL; + + ret = GetExtendedTcpTable(*TcpTable, &Size, Order, Family, Class, 0); + if (ret == ERROR_INSUFFICIENT_BUFFER) + { + *TcpTable = HeapAlloc(GetProcessHeap(), 0, Size); + if (*TcpTable == NULL) + { + return ERROR_OUTOFMEMORY; + } + + ret = GetExtendedTcpTable(*TcpTable, &Size, Order, Family, Class, 0); + if (ret != NO_ERROR) + { + HeapFree(GetProcessHeap(), 0, *TcpTable); + *TcpTable = NULL; + } + } + + return ret; +} + +START_TEST(GetOwnerModuleFromTcpEntry) +{ + WSADATA wsaData; + SOCKET sock; + SOCKADDR_IN server; + PMIB_TCPTABLE_OWNER_MODULE TcpTableOwnerMod; + DWORD i; + BOOLEAN Found; + FILETIME Creation; + LARGE_INTEGER CreationTime; + DWORD Pid = GetCurrentProcessId(); + + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) + { + skip("Failed to init WS2\n"); + return; + } + + GetSystemTimeAsFileTime(&Creation); + CreationTime.LowPart = Creation.dwLowDateTime; + CreationTime.HighPart = Creation.dwHighDateTime; + + sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock == INVALID_SOCKET) + { + skip("Cannot create socket\n"); + goto quit; + } + + ZeroMemory(&server, sizeof(SOCKADDR_IN)); + server.sin_family = AF_INET; + server.sin_addr.s_addr = htonl(INADDR_ANY); + server.sin_port = htons(9876); + + if (bind(sock, (SOCKADDR*)&server, sizeof(SOCKADDR_IN)) == SOCKET_ERROR) + { + skip("Cannot bind socket\n"); + goto quit2; + } + + if (listen(sock, SOMAXCONN) == SOCKET_ERROR) + { + skip("Cannot listen on socket\n"); + goto quit2; + } + + if (GetExtendedTcpTableWithAlloc((PVOID *)&TcpTableOwnerMod, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER) == ERROR_SUCCESS) + { + ok(TcpTableOwnerMod->dwNumEntries > 0, "No TCP connections?!\n"); + + Found = FALSE; + for (i = 0; i < TcpTableOwnerMod->dwNumEntries; ++i) + { + if (TcpTableOwnerMod->table[i].dwState == MIB_TCP_STATE_LISTEN && + TcpTableOwnerMod->table[i].dwLocalAddr == 0 && + TcpTableOwnerMod->table[i].dwLocalPort == htons(9876) && + TcpTableOwnerMod->table[i].dwRemoteAddr == 0) + { + Found = TRUE; + break; + } + } + + if (!Found) + { + skip("Our socket wasn't found!\n"); + } + else + { + DWORD Size = 0; + PTCPIP_OWNER_MODULE_BASIC_INFO BasicInfo = NULL; + + ok(TcpTableOwnerMod->table[i].dwOwningPid == Pid, "Invalid owner\n"); + + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart >= CreationTime.QuadPart, "Invalid time\n"); + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart <= CreationTime.QuadPart + 60000000000LL, "Invalid time\n"); + + if (GetOwnerModuleFromTcpEntry(&TcpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size) == ERROR_INSUFFICIENT_BUFFER) + { + BasicInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size); + ok(BasicInfo != NULL, "HeapAlloc failed\n"); + + if (GetOwnerModuleFromTcpEntry(&TcpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size) == ERROR_SUCCESS) + { + WCHAR CurrentModule[MAX_PATH]; + PWSTR FileName; + + if (GetModuleFileNameW(NULL, CurrentModule, MAX_PATH) != 0) + { + FileName = wcsrchr(CurrentModule, L'\\'); + ++FileName; + + ok(_wcsicmp(CurrentModule, BasicInfo->pModulePath) == 0, "Mismatching names (%S, %S)\n", CurrentModule, BasicInfo->pModulePath); + ok(_wcsicmp(FileName, BasicInfo->pModuleName) == 0, "Mismatching names (%S, %S)\n", FileName, BasicInfo->pModuleName); + } + else + { + skip("GetModuleFileNameW failed\n"); + } + } + else + { + skip("GetOwnerModuleFromTcpEntry failed\n"); + } + } + else + { + skip("GetOwnerModuleFromTcpEntry failed\n"); + } + } + + HeapFree(GetProcessHeap(), 0, TcpTableOwnerMod); + } + else + { + skip("GetExtendedTcpTableWithAlloc failure\n"); + } + +quit2: + closesocket(sock); +quit: + WSACleanup(); +} diff --git a/modules/rostests/apitests/iphlpapi/testlist.c b/modules/rostests/apitests/iphlpapi/testlist.c index fb2e999445..4f56d9da55 100644 --- a/modules/rostests/apitests/iphlpapi/testlist.c +++ b/modules/rostests/apitests/iphlpapi/testlist.c @@ -6,16 +6,18 @@ extern void func_GetExtendedTcpTable(void); extern void func_GetInterfaceName(void); extern void func_GetNetworkParams(void); +extern void func_GetOwnerModuleFromTcpEntry(void); extern void func_icmp(void); extern void func_SendARP(void); const struct test winetest_testlist[] = { - { "GetExtendedTcpTable", func_GetExtendedTcpTable }, - { "GetInterfaceName", func_GetInterfaceName }, - { "GetNetworkParams", func_GetNetworkParams }, - { "icmp", func_icmp }, - { "SendARP", func_SendARP }, + { "GetExtendedTcpTable", func_GetExtendedTcpTable }, + { "GetInterfaceName", func_GetInterfaceName }, + { "GetNetworkParams", func_GetNetworkParams }, + { "GetOwnerModuleFromTcpEntry", func_GetOwnerModuleFromTcpEntry }, + { "icmp", func_icmp }, + { "SendARP", func_SendARP }, { 0, 0 } };
6 years
1
0
0
0
← Newer
1
2
3
4
...
25
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
Results per page:
10
25
50
100
200