C++ 查詢wry.dat中的IP地址信息代码(2)_C/C++语言_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

C++ 查詢wry.dat中的IP地址信息代码(2)

作者:黑客防线网安C/C++教程基地 来源:黑客防线网安C/C++教程基地 浏览次数:0

本篇关键词:信息代码地址 
黑客防线网安网讯:    if(searchIpNum<0xFF)...{         return -1;     }    ifstream fs;     fs.open(dat, ios::binary | ios::in, 0);    if((!fs.is_open()) || (!fs.good())) ...{         return -2;...
    if(searchIpNum<0xFF)...{
        return -1;
    }
    ifstream fs;
    fs.open(dat, ios::binary | ios::in, 0);
    if((!fs.is_open()) || (!fs.good())) ...{
        return -2;
    }
#if defined _DEBUG_
    cout<<" searchIpNum="<<searchIpNum<<", exeOffset="<<exeOffset<<endl;
#endif
    fs.seekg(exeOffset, ios_base::beg);
    ipBeginPos=read4Bit(fs);
#if defined _DEBUG_
    cout<<" ipBeginPos="<<ipBeginPos<<endl;
#endif
    ipEndPos=read4Bit(fs);
#if defined _DEBUG_
    cout<<" ipEndPos="<<ipEndPos<<endl;
#endif
    totalNum = (ipEndPos - ipBeginPos) / 7;
#if defined _DEBUG_
    cout<<" totalNum="<<totalNum<<endl;
#endif
    if(totalNum<1)...{
        return -3;
    }
    beginNum = 0;
    endNum   = totalNum;
    while( 1 ) ...{ //IP的索引是有順序的,按照個數來二分查找.
        midNum= beginNum+(DWORD)((endNum - beginNum)/2);
        pos = ipBeginPos+midNum*7;
        fs.seekg(exeOffset+pos, ios_base::beg);
#if defined _DEBUG_
        cout<<"times="<<++times<<", beginNum="<<beginNum<<", endNum="<<endNum 
 
        <<", midNum="<<midNum<<", exeOffset+pos="<<exeOffset+pos
            <<endl;
#endif
        ip1Num=read4Bit(fs);
        if( ip1Num<1 ) ...{
            fs.close(); cout<<"[1]while(){...}"<<endl;
            return -2;
        }
#if defined _DEBUG_
        //printIpNum(ip1Num);
#endif
        fs.seekg(3, ios_base::cur);
        ip2Num=read4Bit(fs);
        if( ip2Num<1 ) ...{
            fs.close(); cout<<"[3]while(){...}"<<endl;
            return -2;
        }
#if defined _DEBUG_
        //printIpNum(ip2Num);
#endif
    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-15118-1.html
网站维护教程更新时间:2012-04-04 22:50:04  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer