[IPHLPAPI] Implement GetOwnerModuleFromUdpEntry()
authorPierre Schweitzer <pierre@reactos.org>
Sat, 1 Dec 2018 13:49:00 +0000 (14:49 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 1 Dec 2018 13:49:38 +0000 (14:49 +0100)
dll/win32/iphlpapi/iphlpapi.spec
dll/win32/iphlpapi/iphlpapi_main.c

index 4a9cebc..9c9c25b 100644 (file)
@@ -61,7 +61,7 @@
 @ stub GetOwnerModuleFromTcp6Entry
 @ stdcall GetOwnerModuleFromTcpEntry ( ptr long ptr ptr )
 @ stub GetOwnerModuleFromUdp6Entry
 @ stub GetOwnerModuleFromTcp6Entry
 @ stdcall GetOwnerModuleFromTcpEntry ( ptr long ptr ptr )
 @ stub GetOwnerModuleFromUdp6Entry
-@ stub GetOwnerModuleFromUdpEntry
+@ stdcall GetOwnerModuleFromUdpEntry ( ptr long ptr ptr )
 @ stdcall GetPerAdapterInfo( long ptr ptr )
 @ stdcall GetRTTAndHopCount( long ptr long ptr )
 @ stub GetTcpExTable2FromStack
 @ stdcall GetPerAdapterInfo( long ptr ptr )
 @ stdcall GetRTTAndHopCount( long ptr long ptr )
 @ stub GetTcpExTable2FromStack
index 07b987e..162731c 100644 (file)
@@ -2286,38 +2286,19 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf)
 }
 
 
 }
 
 
-/******************************************************************
- *    GetOwnerModuleFromTcpEntry (IPHLPAPI.@)
- *
- * Get data about the module that issued the context bind for a specific IPv4 TCP endpoint in a MIB table row
- *
- * PARAMS
- *  pTcpEntry [in]    pointer to a MIB_TCPROW_OWNER_MODULE structure
- *  Class [in]         TCPIP_OWNER_MODULE_INFO_CLASS enumeration value
- *  Buffer [out]       pointer a buffer containing a TCPIP_OWNER_MODULE_BASIC_INFO structure with the owner module data. 
- *  pdwSize [in, out]  estimated size of the structure returned in Buffer, in bytes
- *
- * RETURNS
- *  Success: NO_ERROR
- *  Failure: ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY
- *            ERROR_NOT_FOUND or ERROR_PARTIAL_COPY
- *
- * NOTES
- * The type of data returned in Buffer is indicated by the value of the Class parameter.
- */
-DWORD WINAPI GetOwnerModuleFromTcpEntry( PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
+static DWORD GetOwnerModuleFromPidEntry(DWORD OwningPid, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
 {
     HANDLE Process;
     DWORD FileLen, PathLen;
     WCHAR File[MAX_PATH], Path[MAX_PATH];
     PTCPIP_OWNER_MODULE_BASIC_INFO BasicInfo;
 
 {
     HANDLE Process;
     DWORD FileLen, PathLen;
     WCHAR File[MAX_PATH], Path[MAX_PATH];
     PTCPIP_OWNER_MODULE_BASIC_INFO BasicInfo;
 
-    if (pTcpEntry->dwOwningPid == 0)
+    if (OwningPid == 0)
     {
         return ERROR_NOT_FOUND;
     }
 
     {
         return ERROR_NOT_FOUND;
     }
 
-    Process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pTcpEntry->dwOwningPid);
+    Process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, OwningPid);
     if (Process == NULL)
     {
         return GetLastError();
     if (Process == NULL)
     {
         return GetLastError();
@@ -2366,6 +2347,54 @@ DWORD WINAPI GetOwnerModuleFromTcpEntry( PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCP
     return NO_ERROR;
 }
 
     return NO_ERROR;
 }
 
+/******************************************************************
+ *    GetOwnerModuleFromTcpEntry (IPHLPAPI.@)
+ *
+ * Get data about the module that issued the context bind for a specific IPv4 TCP endpoint in a MIB table row
+ *
+ * PARAMS
+ *  pTcpEntry [in]    pointer to a MIB_TCPROW_OWNER_MODULE structure
+ *  Class [in]         TCPIP_OWNER_MODULE_INFO_CLASS enumeration value
+ *  Buffer [out]       pointer a buffer containing a TCPIP_OWNER_MODULE_BASIC_INFO structure with the owner module data. 
+ *  pdwSize [in, out]  estimated size of the structure returned in Buffer, in bytes
+ *
+ * RETURNS
+ *  Success: NO_ERROR
+ *  Failure: ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY
+ *            ERROR_NOT_FOUND or ERROR_PARTIAL_COPY
+ *
+ * NOTES
+ * The type of data returned in Buffer is indicated by the value of the Class parameter.
+ */
+DWORD WINAPI GetOwnerModuleFromTcpEntry( PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
+{
+    return GetOwnerModuleFromPidEntry(pTcpEntry->dwOwningPid, Class, Buffer, pdwSize);
+}
+
+/******************************************************************
+ *    GetOwnerModuleFromUdpEntry (IPHLPAPI.@)
+ *
+ * Get data about the module that issued the context bind for a specific IPv4 UDP endpoint in a MIB table row
+ *
+ * PARAMS
+ *  pUdpEntry [in]    pointer to a MIB_UDPROW_OWNER_MODULE structure
+ *  Class [in]         TCPIP_OWNER_MODULE_INFO_CLASS enumeration value
+ *  Buffer [out]       pointer a buffer containing a TCPIP_OWNER_MODULE_BASIC_INFO structure with the owner module data. 
+ *  pdwSize [in, out]  estimated size of the structure returned in Buffer, in bytes
+ *
+ * RETURNS
+ *  Success: NO_ERROR
+ *  Failure: ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY
+ *            ERROR_NOT_FOUND or ERROR_PARTIAL_COPY
+ *
+ * NOTES
+ * The type of data returned in Buffer is indicated by the value of the Class parameter.
+ */
+DWORD WINAPI GetOwnerModuleFromUdpEntry( PMIB_UDPROW_OWNER_MODULE pUdpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
+{
+    return GetOwnerModuleFromPidEntry(pUdpEntry->dwOwningPid, Class, Buffer, pdwSize);
+}
+
 static void CreateNameServerListEnumNamesFunc( PWCHAR Interface, PWCHAR Server, PVOID Data)
 {
   IP_ADDR_STRING *pNext;
 static void CreateNameServerListEnumNamesFunc( PWCHAR Interface, PWCHAR Server, PVOID Data)
 {
   IP_ADDR_STRING *pNext;