https://git.reactos.org/?p=reactos.git;a=commitdiff;h=291a58951f5e8f8e69dd4…
commit 291a58951f5e8f8e69dd4d7eff5f80eb71677559
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Nov 25 12:23:27 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Nov 25 12:23:27 2018 +0100
[IPHLPAPI] Implement AllocateAndGetUdpExTableFromStack()
---
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 f31d3d67cb..742f87ab47 100644
--- a/dll/win32/iphlpapi/iphlpapi.spec
+++ b/dll/win32/iphlpapi/iphlpapi.spec
@@ -8,7 +8,7 @@
@ stdcall AllocateAndGetTcpExTableFromStack( ptr long long long long )
@ stdcall AllocateAndGetTcpTableFromStack( ptr long long long )
@ stub AllocateAndGetUdpExTable2FromStack
-@ stub AllocateAndGetUdpExTableFromStack
+@ stdcall AllocateAndGetUdpExTableFromStack( ptr long long long long )
@ stdcall AllocateAndGetUdpTableFromStack( ptr long long long )
@ stdcall CancelIPChangeNotify(ptr)
@ stub CancelSecurityHealthChangeNotify
diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c
index db9bb6b494..26423b9f5e 100644
--- a/dll/win32/iphlpapi/iphlpapi_main.c
+++ b/dll/win32/iphlpapi/iphlpapi_main.c
@@ -393,6 +393,51 @@ DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE
*ppUdpTable,
}
+/******************************************************************
+ * AllocateAndGetUdpExTableFromStack (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
+ *
+ * RETURNS
+ *
+ * DWORD
+ *
+ */
+DWORD WINAPI AllocateAndGetUdpExTableFromStack(PMIB_UDPTABLE_OWNER_PID *ppUdpTable,
+ BOOL bOrder, HANDLE heap, DWORD flags, DWORD family)
+{
+ DWORD ret;
+
+ TRACE("ppUdpTable %p, bOrder %ld, heap 0x%08lx, flags 0x%08lx, family
0x%08lx\n",
+ ppUdpTable, (DWORD)bOrder, (DWORD)heap, flags, family);
+ if (!ppUdpTable)
+ ret = ERROR_INVALID_PARAMETER;
+ else {
+ DWORD dwSize = 0;
+
+ *ppUdpTable = NULL;
+ ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family,
UDP_TABLE_OWNER_PID, 0);
+ if (ret == ERROR_INSUFFICIENT_BUFFER) {
+ *ppUdpTable = (PMIB_UDPTABLE_OWNER_PID)HeapAlloc(heap, flags, dwSize);
+ ret = GetExtendedUdpTable(*ppUdpTable, &dwSize, bOrder, family,
UDP_TABLE_OWNER_PID, 0);
+ if (ret != NO_ERROR) {
+ HeapFree(heap, flags, *ppUdpTable);
+ *ppUdpTable = NULL;
+ }
+ }
+ }
+ TRACE("returning %ld\n", ret);
+ return ret;
+}
+
+
/******************************************************************
* CreateIpForwardEntry (IPHLPAPI.@)
*