https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58799a0ceb752aa9403b6…
commit 58799a0ceb752aa9403b6d92e9d0f442c20916f3
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Nov 25 12:19:44 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Nov 25 12:19:44 2018 +0100
[IPHLPAPI] Implement AllocateAndGetTcpExTableFromStack()
---
dll/win32/iphlpapi/iphlpapi.spec | 2 +-
dll/win32/iphlpapi/iphlpapi_main.c | 45 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/dll/win32/iphlpapi/iphlpapi.spec b/dll/win32/iphlpapi/iphlpapi.spec
index ee112c6c91..f31d3d67cb 100644
--- a/dll/win32/iphlpapi/iphlpapi.spec
+++ b/dll/win32/iphlpapi/iphlpapi.spec
@@ -5,7 +5,7 @@
@ stdcall AllocateAndGetIpForwardTableFromStack( ptr long long long )
@ stdcall AllocateAndGetIpNetTableFromStack( ptr long long long )
@ stub AllocateAndGetTcpExTable2FromStack
-@ stub AllocateAndGetTcpExTableFromStack
+@ stdcall AllocateAndGetTcpExTableFromStack( ptr long long long long )
@ stdcall AllocateAndGetTcpTableFromStack( ptr long long long )
@ stub AllocateAndGetUdpExTable2FromStack
@ stub AllocateAndGetUdpExTableFromStack
diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c
index 299a29a238..db9bb6b494 100644
--- a/dll/win32/iphlpapi/iphlpapi_main.c
+++ b/dll/win32/iphlpapi/iphlpapi_main.c
@@ -304,6 +304,51 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE
*ppTcpTable,
}
+/******************************************************************
+ * AllocateAndGetTcpExTableFromStack (IPHLPAPI.@)
+ *
+ *
+ * PARAMS
+ *
+ * ppTcpTable [Out]
+ * bOrder [In] -- passed to GetExtendedTcpTable to order the table
+ * heap [In] -- heap from which the table is allocated
+ * flags [In] -- flags to HeapAlloc
+ * family [In] -- passed to GetExtendedTcpTable to select INET family
+ *
+ * RETURNS
+ *
+ * DWORD
+ *
+ */
+DWORD WINAPI AllocateAndGetTcpExTableFromStack(PMIB_TCPTABLE_OWNER_PID *ppTcpTable,
+ BOOL bOrder, HANDLE heap, DWORD flags, DWORD family)
+{
+ DWORD ret;
+
+ TRACE("ppTcpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx, family
0x%08lx\n",
+ ppTcpTable, (DWORD)bOrder, (DWORD)heap, flags, family);
+ if (!ppTcpTable)
+ ret = ERROR_INVALID_PARAMETER;
+ else {
+ DWORD dwSize = 0;
+
+ *ppTcpTable = NULL;
+ ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family,
TCP_TABLE_OWNER_PID_ALL, 0);
+ if (ret == ERROR_INSUFFICIENT_BUFFER) {
+ *ppTcpTable = (PMIB_TCPTABLE_OWNER_PID)HeapAlloc(heap, flags, dwSize);
+ ret = GetExtendedTcpTable(*ppTcpTable, &dwSize, bOrder, family,
TCP_TABLE_OWNER_PID_ALL, 0);
+ if (ret != NO_ERROR) {
+ HeapFree(heap, flags, *ppTcpTable);
+ *ppTcpTable = NULL;
+ }
+ }
+ }
+ TRACE("returning %ld\n", ret);
+ return ret;
+}
+
+
/******************************************************************
* AllocateAndGetUdpTableFromStack (IPHLPAPI.@)
*