ret=readString(f, exeOffset, str);
}else if(ipFlag == 0x2) ...{ // 重定向模式2: 城市信息沒有隨國家信息定向
ipSeek=read3Bit(f);
tmpSeek=f.tellg();
f.seekg(exeOffset+ipSeek, ios_base::beg);
ret=readString(f, exeOffset, str);
f.seekg(exeOffset+tmpSeek, ios_base::beg);
} else ...{
f.seekg(-1, ios_base::cur);
ret=read2Zero(f, str);
}
return ret;
}
int read2Zero(ifstream& f, char*buf)...{
f.get(buf, 128, 0);
return strlen(buf);
}
void printHelp(char* exePath)...{
char *fileName;
fileName=strrchr(exePath,’\’);
if(fileName==NULL)...{
strcpy(fileName, exePath);
}else...{
fileName++;
}
cout<<endl
<<"Wry IP Search Beta by cangwu.lee@gmail.com "
<<"Usage:"
<<" "<<fileName<<"<ip address> <Path to wry.dat> "
<<endl;
free(fileName);
}
DWORD convertIP(char*sip)...{
char *c1, *c2, *c3, *c4;
DWORD i1, i2, i3, i4, dd;
#if defined _DEBUG_
cout<<" ip="<<sip<<endl;
#endif
c1 = strtok(sip, " ,.-");
if(c1==NULL)...{
cout<<"IP address incorrect."<<endl;
return 0;
}
c2 = strtok(NULL," ,.-");if(c2==NULL)c2="0";
c3 = strtok(NULL," ,.-");if(c3==NULL)c3="0";
c4 = strtok(NULL," ,.-");if(c4==NULL)c4="0";
i1=atol(c1); i2=atol(c2); i3=atol(c3); i4=atol(c4);
if(i1<0 || i2<0 || i3<0 || i4<0
|| i1>254 || i2>255 || i3>255 || i4>255)...{
cout<<"IP address incorrect."<<endl;
delete[]c1; delete[]c2; delete[]c3; delete[]c4;
return 0;
}