IE 7 and 8 calls the ...Ex versions of the functions --which in this example are NULL-- because are supposed to work with IPv6, although you can set them as the same as nonEx, all but one: IsInNetEx() beacause it takes different parameters than IsInNet(). The result would be that it will work as long as you do not use IPv6.... Here is how you setup
AutoProxyHelperVtbl OurVtbl = {
IsResolvable,
GetIPAddress,
ResolveHostName,
IsInNet, IsResolvable,
GetIPAddress,
ResolveHostName,
IsInNetEx,
NULL // No need to set SortIPList()
};
Here is an implementation of IsInNetEx() that would work for IPv4.. ;-)
BOOL __stdcall jsIsInNetEx(LPSTR lpszIPAddress,LPSTR lpszPrefix) {
DWORD dst,src,msk=0xFFFFFFFF;
CHAR *ptr,lpszDest[256];
int shf=0;
if(lpszIPAddress==NULL || lpszPrefix==NULL)
return FALSE;
if(strchr(lpszIPAddress,':') || strchr(lpszPrefix,':')) {
// DOESN'T YET SUPPORT IPv6
return FALSE;
}
memset(lpszDest,0,sizeof(lpszDest));
strncpy(lpszDest,lpszPrefix,255);
ptr=(CHAR *)strchr(lpszDest,'/');
if(ptr!=NULL) {
*ptr++='\0';
shf=32 - atoi(ptr);
}
msk<<=shf;
src=inet_addr(lpszIPAddress);
dst=inet_addr(lpszDest);
return ((src & msk)==(dst & msk )) ? TRUE : FALSE;
}