blob: 18e4ff9b1df6b628fa7ec595e86662326ddab130 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#undef __CRT__NO_INLINE
#define __CRT__NO_INLINE
#include <winsock2.h>
#include <wspiapi.h>
WINBOOL WINAPI
WspiapiParseV4Address (const char *pszAddress, PDWORD pdwAddress)
{
DWORD dwAddress = 0;
const char *h = NULL;
int cnt;
for (cnt = 0,h = pszAddress; *h != 0; h++)
if (h[0] == '.')
cnt++;
if (cnt != 3)
return FALSE;
dwAddress = inet_addr (pszAddress);
if (dwAddress == INADDR_NONE)
return FALSE;
*pdwAddress = dwAddress;
return TRUE;
}
|