BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
+ WSADATA wsaData;
+
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hinstDLL );
interfaceMapInit();
+ WSAStartup(MAKEWORD(2, 2), &wsaData);
break;
case DLL_PROCESS_DETACH:
+ WSACleanup();
interfaceMapFree();
break;
}
*
* NOTES
*/
+
DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, TCP_TABLE_CLASS TableClass, ULONG Reserved)
{
DWORD ret = NO_ERROR;
- UNIMPLEMENTED;
- return ret;
+
+ if (TableClass == TCP_TABLE_OWNER_PID_ALL) {
+ if (*pdwSize == 0) {
+ *pdwSize = sizeof(MIB_TCPTABLE_OWNER_PID);
+ return ERROR_INSUFFICIENT_BUFFER;
+ } else {
+ ZeroMemory(pTcpTable, sizeof(MIB_TCPTABLE_OWNER_PID));
+ return NO_ERROR;
+ }
+ }
+
+
+ UNIMPLEMENTED;
+ return ret;
}
return ret;
}
-
-/******************************************************************
- * GetPerAdapterInfo (IPHLPAPI.@)
- *
- *
- * PARAMS
- *
- * IfIndex [In]
- * pPerAdapterInfo [In/Out]
- * pOutBufLen [In/Out]
- *
- * RETURNS
- *
- * DWORD
- *
- */
static void CreateNameServerListEnumNamesFunc( PWCHAR Interface, PWCHAR Server, PVOID Data)
{
IP_ADDR_STRING *pNext;
Context->NumServers++;
}
+/******************************************************************
+ * GetPerAdapterInfo (IPHLPAPI.@)
+ *
+ *
+ * PARAMS
+ *
+ * IfIndex [In]
+ * pPerAdapterInfo [In/Out]
+ * pOutBufLen [In/Out]
+ *
+ * RETURNS
+ *
+ * DWORD
+ *
+ */
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
{
HKEY hkey;
return ERROR_NOT_SUPPORTED;
}
-
/******************************************************************
* SendARP (IPHLPAPI.@)
*
* RETURNS
* Success: NO_ERROR
* Failure: error code from winerror.h
- *
- * FIXME
- * Stub, returns ERROR_NOT_SUPPORTED.
*/
DWORD WINAPI SendARP(IPAddr DestIP, IPAddr SrcIP, PULONG pMacAddr, PULONG PhyAddrLen)
{
- FIXME("(DestIP 0x%08x, SrcIP 0x%08x, pMacAddr %p, PhyAddrLen %p): stub\n",
- DestIP, SrcIP, pMacAddr, PhyAddrLen);
- return ERROR_NOT_SUPPORTED;
+ IPAddr IPs[2];
+ ULONG Size;
+
+ if (IsBadWritePtr(pMacAddr, sizeof(ULONG)) || IsBadWritePtr(PhyAddrLen, sizeof(ULONG)))
+ return ERROR_INVALID_PARAMETER;
+
+ IPs[0] = DestIP;
+ IPs[1] = SrcIP;
+ Size = sizeof(IPs);
+ return TCPSendIoctl(INVALID_HANDLE_VALUE, IOCTL_QUERY_IP_HW_ADDRESS, IPs, &Size, pMacAddr, PhyAddrLen);
}
if (!pArpEntry)
return ERROR_INVALID_PARAMETER;
- if (!NT_SUCCESS(openTcpFile( &tcpFile )))
+ if (!NT_SUCCESS(openTcpFile( &tcpFile, FILE_READ_DATA | FILE_WRITE_DATA )))
return ERROR_NOT_SUPPORTED;
if (!NT_SUCCESS(getNthIpEntity( tcpFile, pArpEntry->dwIndex, &id )))
/*
* @implemented
*/
-#if 0
+#ifdef GetAdaptersAddressesV1
DWORD WINAPI DECLSPEC_HOTPATCH GetAdaptersAddresses(ULONG Family,ULONG Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen)
{
InterfaceIndexTable *indexTable;
if (!pOutBufLen) return ERROR_INVALID_PARAMETER;
if (Reserved) return ERROR_INVALID_PARAMETER;
- indexTable = getNonLoopbackInterfaceIndexTable(); //I think we want non-loopback here
+ indexTable = getInterfaceIndexTable();
if (!indexTable)
return ERROR_NOT_ENOUGH_MEMORY;
- ret = openTcpFile(&tcpFile);
+ ret = openTcpFile(&tcpFile, FILE_READ_DATA);
if (!NT_SUCCESS(ret))
return ERROR_NO_DATA;
/* We're only going to implement what's required for XP SP0 */
}
}
-
- if (*pOutBufLen < requiredSize)
+ TRACE("size: %d, requiredSize: %d\n", *pOutBufLen, requiredSize);
+ if (!pAdapterAddresses || *pOutBufLen < requiredSize)
{
*pOutBufLen = requiredSize;
closeTcpFile(tcpFile);
currentLocation += sizeof(WCHAR);
currentAddress->Next = (PVOID)currentLocation;
+ /* Terminate the last address correctly */
+ if(i==0)
+ currentAddress->Next = NULL;
/* We're only going to implement what's required for XP SP0 */
}
}
- /* Terminate the last address correctly */
- if (currentAddress)
- currentAddress->Next = NULL;
-
/* Now again, for real this time */
currentAddress = pAdapterAddresses;
currentAddress->IfType = ifInfo.if_info.ent.if_type;
/* Operational status */
- currentAddress->OperStatus = ifInfo.if_info.ent.if_operstatus;
+ if(ifInfo.if_info.ent.if_operstatus >= IF_OPER_STATUS_CONNECTING)
+ currentAddress->OperStatus = IfOperStatusUp;
+ else
+ currentAddress->OperStatus = IfOperStatusDown;
/* We're only going to implement what's required for XP SP0 */
DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX pStats,DWORD dwFamily)
{
FIXME(":stub\n");
+
+ if (!pStats)
+ return ERROR_INVALID_PARAMETER;
+
+ if (dwFamily != AF_INET && dwFamily != AF_INET6)
+ return ERROR_INVALID_PARAMETER;
+
return 0L;
}