https://git.reactos.org/?p=reactos.git;a=commitdiff;h=26415375e3c352ca10a21…
commit 26415375e3c352ca10a211d29014f9d98866f21b
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Nov 25 13:32:52 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Nov 25 13:32:52 2018 +0100
[IPHLPAPI] Implement AllocateAndGetUdpExTable2FromStack()
CORE-14391
---
dll/win32/iphlpapi/iphlpapi.spec | 2 +-
dll/win32/iphlpapi/iphlpapi_main.c | 46 ++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/dll/win32/iphlpapi/iphlpapi.spec b/dll/win32/iphlpapi/iphlpapi.spec
index 0de4711f4b..4a9cebcc61 100644
--- a/dll/win32/iphlpapi/iphlpapi.spec
+++ b/dll/win32/iphlpapi/iphlpapi.spec
@@ -7,7 +7,7 @@
@ stdcall AllocateAndGetTcpExTable2FromStack( ptr long long long long long )
@ stdcall AllocateAndGetTcpExTableFromStack( ptr long long long long )
@ stdcall AllocateAndGetTcpTableFromStack( ptr long long long )
-@ stub AllocateAndGetUdpExTable2FromStack
+@ stdcall AllocateAndGetUdpExTable2FromStack( ptr long long long long long )
@ stdcall AllocateAndGetUdpExTableFromStack( ptr long long long long )
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
@ stdcall CancelIPChangeNotify(ptr)
diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c
index 103f1a411a..cf89261517 100644
--- a/dll/win32/iphlpapi/iphlpapi_main.c
+++ b/dll/win32/iphlpapi/iphlpapi_main.c
@@ -484,6 +484,52 @@ DWORD WINAPI
AllocateAndGetUdpExTableFromStack(PMIB_UDPTABLE_OWNER_PID *ppUdpTab
}
+/******************************************************************
+ * AllocateAndGetUdpExTable2FromStack (IPHLPAPI.@)
+ *
+ *
+ * PARAMS
+ *
+ * ppUdpTable [Out]
+ * bOrder [In] -- passed to GetExtendedUdpTable to order the table
+ * heap [In] -- heap from which the table is allocated
+ * flags [In] -- flags to HeapAlloc
+ * family [In] -- passed to GetExtendedUdpTable to select INET family
+ * class [In] -- passed to GetExtendedUdpTable to select information
+ *
+ * RETURNS
+ *
+ * DWORD
+ *
+ */
+DWORD WINAPI AllocateAndGetUdpExTable2FromStack(PVOID *ppUdpTable,
+ BOOL bOrder, HANDLE heap, DWORD flags, DWORD family, UDP_TABLE_CLASS class)
+{
+ DWORD ret;
+
+ TRACE("ppUdpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx, family %ld, class
%ld\n",
+ ppUdpTable, (DWORD)bOrder, (DWORD)heap, flags, family, class);
+ if (!ppUdpTable)
+ ret = ERROR_INVALID_PARAMETER;
+ else {
+ DWORD dwSize = 0;
+
+ *ppUdpTable = NULL;
+ ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, class, 0);
+ if (ret == ERROR_INSUFFICIENT_BUFFER) {
+ *ppUdpTable = HeapAlloc(heap, flags, dwSize);
+ ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family, class, 0);
+ if (ret != NO_ERROR) {
+ HeapFree(heap, flags, *ppUdpTable);
+ *ppUdpTable = NULL;
+ }
+ }
+ }
+ TRACE("returning %ld\n", ret);
+ return ret;
+}
+
+
/******************************************************************
* CreateIpForwardEntry (IPHLPAPI.@)
*