added check

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3120 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2010-05-09 11:50:10 +00:00
parent 2ef49a227b
commit 02b963a7c7
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -80,6 +80,12 @@ typedef INT (WSAAPI *_GetNameInfoW)(
__in INT Flags
);
typedef struct hostent *(WSAAPI *_gethostbyaddr)(
__in_bcount(len) const char *addr,
__in int len,
__in int type
);
VOID NTAPI PhpNetworkItemDeleteProcedure(
__in PVOID Object,
__in ULONG Flags
@@ -129,6 +135,7 @@ static PH_QUEUED_LOCK PhpResolveCacheHashtableLock = PH_QUEUED_LOCK_INIT;
static _GetExtendedTcpTable GetExtendedTcpTable_I;
static _GetExtendedUdpTable GetExtendedUdpTable_I;
static _GetNameInfoW GetNameInfoW_I;
static _gethostbyaddr gethostbyaddr_I;
BOOLEAN PhInitializeNetworkProvider()
{
@@ -327,6 +334,9 @@ PPH_STRING PhGetHostNameFromAddress(
socklen_t length;
PPH_STRING hostName;
if (!GetNameInfoW_I)
return NULL;
if (Address->Type == PH_IPV4_NETWORK_TYPE)
{
ipv4Address.sin_family = AF_INET;
@@ -377,6 +387,7 @@ PPH_STRING PhGetHostNameFromAddress(
) != 0)
{
PhDereferenceObject(hostName);
return NULL;
}
}
@@ -500,6 +511,7 @@ VOID PhNetworkProviderUpdate(
GetExtendedUdpTable_I = PhGetProcAddress(L"iphlpapi.dll", "GetExtendedUdpTable");
LoadLibrary(L"ws2_32.dll");
GetNameInfoW_I = PhGetProcAddress(L"ws2_32.dll", "GetNameInfoW");
gethostbyaddr_I = PhGetProcAddress(L"ws2_32.dll", "gethostbyaddr");
}
if (!PhGetNetworkConnections(&connections, &numberOfConnections))
+1
View File
@@ -23,6 +23,7 @@ typedef struct _PH_IP_ADDRESS
ULONG Type;
union
{
ULONG Address[4];
ULONG Ipv4;
struct in_addr InAddr;
UCHAR Ipv6[16];