下载地址链接: https://pan.baidu.com/s/1UH4IfKqxcwJyharcgEqz1Q?pwd=t327(包含源码演示,仅17KB)
FBCN.EXE 1.0 (FAST BCN TOOL BY HAPPY)
摘要:
====================================================
FBCN快速第三方包管理工具,完全颠覆你对包管理的认识。内存运算查表,速度秒杀一
切类似工具。 独创YUM云序列号,每个第三方拥有唯一的云序列YUM-SN,依靠YUM-SN序
列号去管理本地包。如果已下载unrar,那么针对rar类型的包,会自动解压安装到本地
目录。爽快的击键查询让你终生难忘。
备注:个别电脑如无法运行,请下载msvcr100.dll放入fbcn.exe所在目录即可。
====================================================
传参:
----------------------------------------------------------------------------------
fbcn -y[下载源地址] -t[列表地址] -m[最大行数]
----------------------------------------------------------------------------------
-h 获取帮助信息
-y 指定下载源地址
-t 指定第三方列表地址
-m 指定最大展示行数目
----------------------------------------------------------------------------------
示例:
----------------------------------------------------------------------------------
fbcn -m20 -yhttp://batch-cn.qiniudn.com/tool/ -thttp://batch-cn.qiniudn.com/list/tool.@version.txt
----------------------------------------------------------------------------------
搜索:
(任意位置匹配)直接输入sed,将采取任意位置匹配模式,之会列出下表
>>sed
====================================================
NAME YUM-SN VERSION SIZE DESCRIPTION
====================================================
csed [0332] @2003-09-13 32KB 更小更快更轻量的sed
ESEDatabaseView [0485] @nircmd,1.37 94KB 读取并显示存储的可扩展存储引擎(ESE)数据库.edb文件中的数据(GUI)
minised [0958] @1.12 24KB 体积小巧的sed
onigsed [1103] @4.15 272KB 支持Oniguruma(ver.2.5.0)和Perl5正则表达式的sed
sed [1442] 4.0.7 92KB 流文本处理工具(此版本换行不含回车符)
sed [1443] GnuWin32,4.2.1 672KB 流文本处理工具
sed [1444] 4.2.2 150KB 流文本处理工具
sed [1445] msys2,4.2.2 1468KB 流文本处理工具
sed [1446] 4.3 204KB 流文本处理工具
sed [1447] @4.4 203KB 流文本处理工具
sedsed [1448] sedsed,1.0 1609KB 强大的sed调试工具,Python脚本打包exe
sedsed [1449] @pyinstaller,1.0 3873KB 强大的sed调试工具,pyinstaller打包exe
ssed [1534] @2.59 81KB super_sed,支持Perl正则
tr [1675] @5.97 26KB sed简化版
====================================================
下载:
(首位置匹配)输入^sed,会列出如下表,继续输入 :1446 下载对应的sed4.3版。
>>^sed:1446
====================================================
NAME YUM-SN VERSION SIZE DESCRIPTION
====================================================
sed [1442] 4.0.7 92KB 流文本处理工具(此版本换行不含回车符)
sed [1443] GnuWin32,4.2.1 672KB 流文本处理工具
sed [1444] 4.2.2 150KB 流文本处理工具
sed [1445] msys2,4.2.2 1468KB 流文本处理工具
sed [1446] 4.3 204KB 流文本处理工具
sed [1447] @4.4 203KB 流文本处理工具
====================================================
原创开源- /*
- THE FAST BCN TOOL, COPYRIGHT@2017~2019 BY HAPPY, VERSION 1.0
- FBCN.EXE
- -----------------------------------------------------------------
-
- _ _ _ _ | The Batch Online Fast BCN Tool,
- \ | | | \ / | | Copyright@2017~2019 By Happy, fbcn.exe
- \ \| |_ _| |\ /| | | Type "-h" for help.
- \_| | | | | | \/ | | |
- | | |_| | |\ /| | | Version 1.0 (2017-04-26 21:15 UTC)
- _/ |\__'_|_| VV |_| | Officil http://www.bathome.net/thread-
- |__/ | 43961-1-1.html
-
- -----------------------------------------------------------------
- . .7 .,;;;::
- v; 7u ..:;UMBM7::,,,.
- ;, ;, . .BMsr7r7vL7r,
- , , ;0 ER7uuLLJ1SKKU;
- .:xJx;. . ; ;B. .B7JSSu33FUPGRZL,
- :uDBGs:. : . :.rP.. BRiJaS11UHUHKOOOP;
- :FMBRZJr. PU.r7,MBMBM0; uMU:LaaUFHGPHUKEORX:
- 7OMBMOPr.M1:MWRBOWMBBBMWi 31 BMx;71PaXKDEEP00WRBP:
- ;3RBOsZX:sBOKUaWBMBBBMBMc,.:aM, ;BOsrrJPXZEWORDDERRMR3
- .7rir,EMRDXRR3;rJRBBMBMa::. xBELrr7UXEGGZDEDDWORMWi
- : DMXBMBDu::.,:3OBBBBP: JBKvrirx1KEWZZZEZKPRRRF:
- .,.GBuSRiLF3Us:.i:iDBMBMF LBD7;ric2GDWEZ0EKXXWWRDJ
- irGBWURS.:1ZPEGc:. :MBMBM; MBMrii;L2ZDOGZZEKDGWWOW0.
- :7BRaOBK. .sHPMU ..aBBMBJ;::7x .MBKir7:r3KDOEZED0ZZWDOWR:
- uLSZXBL. ,,i1ZMH ,,.sRRBMa::r7 BRMcii7:ruKDOZEDWEGEGDOGRr
- ,2EKxB7 , ;EB: . vPBMBu MMMJr;ir:iJKWOEDDOEWDGGOEOi
- JRBMRM : 3P ..;HRBBu iBMB2ii;ii:;LZOOZGDGEODOWD0Dr
- :0GZu :;; ..;ir1RMBF.r7 .BBBDBi:;;ii:;vEOWZOGDDOWWZZ0Dr
- :. .r.;::.;7URBR0 .rKBMB2LMW::;iii:7JDODGOEWEWWOKE0W:
- . . : ,7PBMWZ;;uOBMBRBZr;cMK:;;;irr11WWODWDWGOOGZGKH
- . . ,:vDMRZMODMBMWMBRL:;:rGS::r277U0SODODWGWDODDE0FO
- c ..,:LrPMOSKOORBMXKBDLir:::;22:H LKKWGWGWDOWWEDDPua
- .xr:::i:cRJsL1R0DMBEPXvir..:,..:7U: 3EZDGODWGOGWEWD7,3
- G: r ,JWGxrOMDRRRRDOG1;7SWRBPHMBMBJ; ;KEPOGWDWDDGDZWs :: 7
- ;B: . ;MWOaGRRMMGRRROBMBMBMBMBMBBBBBMBPSZPZDDOGOEDDZKU. c .7B
- ;MM7 :.;,1; 7RBRORWRRBMRDBBBMMMRZZERMBMBMBUPXGGWGOWDGWPUUR1xJ:,.
- 7MBi::r71r .7ZOEBORMRMRGMMWBMWSKGRRRMBMBMK1ZZWEDDOZOZXJSMBWa0Xc U:
- ;BBc.7r.s: ;J1MORDMMBM0DBMMMBHEGMMBMBW0OBS1ZEGWEWEDDZHJaBMBMOMBMF:.:
- rvUMBM7:i:rKcxS1EMMWOWMOPGBMBO1RBMBMBRMMs :.rHGKWGDEDEEXK3URBMBMBMMMB7
- MMMBOBMOSucZMMORMBWRMWDRRBMO7 RBBBMRRB; ,ZGZGODDKWPZHF..;c3WBBMMWBWa
- MMBMBMBMMJv;uMBBBMEDBMRu7Lcr iRMBRBMB7Z . OKDGOZ0KKKPJ ;2BMBZB0:
- MBMBMBE ,:: .SBMBRMMBMWSL.. OBRBMBM .OEKDGGPKXXH7 ,WMBO3M
- .0BMBMW: :rr. :OBBBORMBM7 rsOMBMO :ZEZEKXXKUG, RMMuBr
- ;PRBBMD .i: :FRMOMBM. 2MMBRO ;EZDHZHZSHu cBJRMU
- 7OBBBBMX i, L7DBMBMR :BMBMBZ ;ZOZ0HXHH2. ,.rMB;
- sMBBWHs: : ;iLaMH:ZOBMM ZBMO7,OB .OOEPHaPS: . .7BBM
- ,cJ7LXMBMs ,rZuH3:.rMBB: 7MBBBD .u aWOXXSPXL O. XMBM.
- 7BOBM0M2. cxOBM 7BMBMBBBJ .GWZX1KO ;.,a OMBR
- : :;, i7vSJrFMRMBWX .L:Far :OE0UaIF .X ; OMBs
- HMBMBMHMBML vEKSaZ; R iBBB.
- v Pai. .EESSQ rr uBMr
- . ;DHDF; L WBR
- .SRGA: ::OBx
- .;DX. .WGB;
- ;DW: SGB.
- ;SM ;XZ;
- :J B;
- : ;
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- #include <wininet.h>
- #include<shellapi.h>
- #include <direct.h>
- #include <conio.h>
- #include <time.h>
- #include <math.h>
- #include <io.h>
- #pragma comment(lib, "wininet.lib")
-
- /*************宏量定义*************/
- #define SAFE_SIZE 512
- #define FILE_EXIST 0
-
- //定义帮助说明
- #define HELP_INFORMATION "\
- -----------------------------------------------------------------\n\
- fbcn -y[yumsrc] -t[tabsrc] -m[maxlist]\n\
- -----------------------------------------------------------------\n\
- -h Show help information\n\
- -y Set the yumsrc url\n\
- -t Set the tabsrc url\n\
- -m Set The max length of the list\n\
- -----------------------------------------------------------------\n\
- version 1.0\n"
-
- #define SEARCH_HEAD "\
- =====================================================================================================================\n\
- NAME YUM-SN VERSION SIZE DESCRIPTION\n\
- ====================================================================================================================="
-
- #define SEARCH_LOGO "\
- -----------------------------------------------------------------\n\
- \n\
- _ _ _ _ | The Batch Online Fast BCN Tool,\n\
- \\ | | | \\ / | | Copyright@2017~2019 By Happy, fbcn.exe\n\
- \\ \\| |_ _| |\\ /| | | Type \"-h\" for help.\n\
- \\_| | | | | | \\/ | | |\n\
- | | |_| | |\\ /| | | Version 1.0 (2017-04-26 21:15 UTC)\n\
- _/ |\\__'_|_| VV |_| | Officil http://www.bathome.net/thread-\n\
- |__/ | 43961-1-1.html\n\
- \n\
- -----------------------------------------------------------------\n"
-
- /*************全局变量*************/
- //主窗句柄
- HWND hWND=NULL;
-
- //OPT开关变量
- char* OPTARG;
- int OPTIND=1, OPTOPT;
-
- //分配表格容器
- static char tmpp[6][SAFE_SIZE]= {0};
-
- //分配缓存区、行容器
- static char tlist [SAFE_SIZE*SAFE_SIZE];
- static char LCache[SAFE_SIZE*2];
-
- //分配YUM-URL下载源
- static char yumsrcURL[SAFE_SIZE*2];
- static char tabsrcURL[SAFE_SIZE*2];
-
- //分配YUM序列容器
- static char yumSN[4];
- //分配YUM-URL容器
- static char yumURL[SAFE_SIZE*2];
- //Shell命令行容器
- static char shellTAI[SAFE_SIZE*2];
-
- //进度条变量
- static char proGRESS[64]= {0};
- clock_t preTime;
- ULONG preProgress;
-
- /*************类型定义*************/
- typedef HRESULT (WINAPI *PGETA)(LPUNKNOWN,LPCSTR,LPCSTR,DWORD,LPBINDSTATUSCALLBACK);
- PGETA PgetUrlToFileA;
-
- extern "C" HWND WINAPI GetConsoleWindow();
-
- /*************功能函数*************/
- //子串查找忽略大小写
- const char* stristr(const char* str, const char* subStr)
- {
- int len = strlen(subStr);
- if(len == 0)
- {
- return NULL;
- }
-
- while(*str)
- {
- if(_strnicmp(str, subStr, len) == 0)
- {
- return str;
- }
- str++;
- }
- return NULL;
- }
- //光标函数
- BOOL DispyCursor(int size, BOOL mode)
- {
- CONSOLE_CURSOR_INFO cinfo = {(DWORD)size, mode};
- return SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cinfo);
- }
- //清屏函数
- int ShellCls()
- {
- HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- COORD coPos;
- DWORD dwWritten;
-
- if (GetConsoleScreenBufferInfo(hOutput, &csbi))
- {
- coPos.X = 0;
- coPos.Y = 0;
- FillConsoleOutputAttribute (hOutput, csbi.wAttributes, csbi.dwSize.X*csbi.dwSize.Y, coPos, &dwWritten);
- FillConsoleOutputCharacterA(hOutput, ' ', csbi.dwSize.X*csbi.dwSize.Y, coPos, &dwWritten);
- SetConsoleCursorPosition(hOutput, coPos);
- }
-
- return 0;
- }
- //获取第三方列表
- void GetWebSrcCode(const char *Url, char* tainer)
- {
- *tainer='\0';
- HINTERNET hSession = InternetOpen("zwt", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
- if (hSession != NULL)
- {
- HINTERNET hURL = InternetOpenUrl(hSession, Url, NULL, 0, INTERNET_FLAG_DONT_CACHE, 0);
- if (hURL != NULL)
- {
- char Temp[SAFE_SIZE*2] = {0};
- ULONG Number = 1;
-
- while (Number >0)
- {
- InternetReadFile(hURL, Temp, SAFE_SIZE*2 - 1, &Number);
- strncat(tainer, Temp, Number);
- }
-
- InternetCloseHandle(hURL);
- hURL = NULL;
- }
- InternetCloseHandle(hSession);
- hSession = NULL;
- }
- return;
- }
- //进度回调
- class DownloadProgress :public IBindStatusCallback
- {
- public:
- HRESULT __stdcall QueryInterface(const IID &, void **)
- {
- return E_NOINTERFACE;
- }
- ULONG STDMETHODCALLTYPE AddRef(void)
- {
- return 1;
- }
- ULONG STDMETHODCALLTYPE Release(void)
- {
- return 1;
- }
- HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, IBinding *pib)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG *pnPriority)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved)
- {
- return S_OK;
- }
- virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD *grfBINDF, BINDINFO *pbindinfo)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, IUnknown *punk)
- {
- return E_NOTIMPL;
- }
- virtual HRESULT __stdcall OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
- {
- if (ulProgressMax != 0)
- {
-
- //进度百分数
- int downloadSpeed, restTime;
- int i=(int)ulProgress * 100.0 / (int)ulProgressMax;
- int j=i/2, disTime=(int)(clock()-preTime);
- if(disTime > 100)
- {
- downloadSpeed=((int)ulProgress-(int)preProgress) * CLOCKS_PER_SEC / disTime / 1000;
- restTime=(downloadSpeed!=0) ?((int)ulProgressMax-(int)ulProgress) / downloadSpeed :99999;
- preProgress=ulProgress, preTime+=disTime;
- }
- else if(i <100)
- {
- return S_OK;
- }
-
- if(i==100)
- {
- downloadSpeed=restTime=0;
- }
-
- for(int n=1; n<=j; n++)
- {
- proGRESS[n]='=';
- }
-
- //显示进度百分比
- fprintf(stdout, "\r%s%3d%% %3dKB/s,%3dm%02ds ", proGRESS, i, downloadSpeed, restTime/1000/60, restTime/1000%60);
- fflush(stdout);
- }
- return S_OK;
- }
- };
- //开关解析
- int GetOpt(int nargc, char *nargv[], char *ostr)
- {
- static char* place="";
- static char* lastostr=(char *) 0;
- register char* oli;
- char* index();
- if(ostr!=lastostr)
- {
- lastostr=ostr;
- place="";
- }
- if(!*place)
- {
- if(
- (OPTIND>=nargc) ||
- (*(place=nargv[OPTIND])!='-')||
- (!*(++place))
- )
- {
- place="";
- return(EOF);
- }
- if (*place == '-' && place[1] == 0)
- {
- ++OPTIND;
- return(EOF);
- }
- }
- if ((OPTOPT=(int)*place++)==(int)':' || !(oli=strchr(ostr, OPTOPT)))
- {
- if(!*place)
- {
- ++OPTIND;
- }
- }
-
- if (oli != NULL && *(++oli) != ':')
- {
- OPTARG=NULL;
- if(!*place)
- {
- ++OPTIND;
- }
- }
- else
- {
- if(*place)
- {
- OPTARG=place;
- }
- else if(nargc<=++OPTIND)
- {
- place="";
- }
- else
- {
- OPTARG=nargv[OPTIND];
- }
- place="";
- ++OPTIND;
- }
- return(OPTOPT);
- }
- //搜索函数
- int SearchStr(const char* tblist, const char* key, int maxLIST, int ynum)
- {
- BOOL kMARK=TRUE;
- int i=0, count=0, mode=0, kl=strlen(key);
- char* keywords=NULL;
-
- if(*key!='^' && *key!=0 && *(key+1)=='\0')
- {
- mode=1;
- keywords=(char*)key;
-
- }
- else if(*key=='^' && *(key+1)!='\0')
- {
- mode=2;
- keywords=(char*)key+1;
-
- }
-
- else if(*key!='^' && *key!='\0')
- {
- mode=4;
- keywords=(char*)key;
- }
-
- if(ynum>0)
- {
- mode=5;
- keywords=(char*)key;
- }
-
- //辅助行指针
- char* Line=NULL;
- char* p=(char*)tblist;
-
- //重置列表容器
- tlist[0]='\0';
- char* strliu=tlist;
-
- while(*p)
- {
- char* tp=LCache;
- while(*p!='\n' && *p!='\0')
- {
- *tp++=*p++;
- }
- if(*p=='\n')
- {
- p++;
- }
- *tp='\0';
-
- //指针置换
- Line=LCache;
-
- //过滤行TAB缩进或前空格
- while(*Line=='\t'|| *Line==' ')
- {
- Line++;
- }
-
- if(kMARK)
- {
- if(stristr(Line, "Rem ")==Line)
- {
- kMARK=FALSE;
- continue;
- }
- }
-
- if(!kMARK || *Line=='\0')
- {
- continue;
- }
-
- i++;
-
- if(
- (mode==5 && i==ynum) ||
- (mode==1 && *keywords==*Line) ||
- (mode==2 && stristr(Line, keywords)==Line) ||
- (mode==4 && stristr(Line, keywords))
- )
- {
- char* textstrp=NULL;
-
- if(textstrp=strtok(Line, " "))
- {
- strcpy(tmpp[0], textstrp);
- }
-
- for(int j=1; j<5; j++)
- {
- if(textstrp=strtok(NULL, " "))
- {
- strcpy(tmpp[j], textstrp);
- }
- else
- {
- tmpp[j][0]=0;
- }
- }
-
- if (mode==5 && i==ynum)
- {
- //进度回调入口
- DownloadProgress progress;
- IBindStatusCallback* callback=(IBindStatusCallback*)&progress;
-
- //进度归零
- memset(proGRESS, ' ', 51);
- proGRESS[0]='[', proGRESS[51]=']';
-
- preTime=clock();
- preProgress=(ULONG)0;
-
- strcpy(yumURL, yumsrcURL);
- strcat(yumURL, (tmpp[1][0]=='@')?tmpp[1]+1:tmpp[1]);
- strcat(yumURL, "/");
- strcat(yumURL, tmpp[0]);
-
-
- if(stricmp(strrchr(yumURL, '.'), ".rar"))
- {
- strcat(yumURL, ".exe");
- }
-
- //清除IE缓存
- DeleteUrlCacheEntryA(yumURL);
-
- //调用下载函数
- if (PgetUrlToFileA(NULL, yumURL, strrchr(yumURL, '/')+1, 0, static_cast<IBindStatusCallback*>(&progress)) != S_OK)
- {
-
- //进度归零
- memset(proGRESS, ' ', 51);
- proGRESS[0]='[', proGRESS[51]=']';
-
- preTime=clock();
- preProgress=(ULONG)0;
-
- strcpy(yumURL, yumsrcURL);
- strcat(yumURL, tmpp[0]);
-
- if(stricmp(strrchr(yumURL, '.'), ".rar"))
- {
- strcat(yumURL, ".exe");
- }
- //清除IE缓存
- DeleteUrlCacheEntryA(yumURL);
-
- if (PgetUrlToFileA(NULL, yumURL, strrchr(yumURL, '/')+1, 0, static_cast<IBindStatusCallback*>(&progress)) != S_OK)
- {
- fprintf(stdout, "DOWNLOAD \"%s\" ERROR.", tmpp[0]);
- Sleep(2800);
- return 0;
- }
- else
- {
- fprintf(stdout, "DOWNLOAD \"%s\" SUCCEED.", tmpp[0]);
- }
- }
- else
- {
- fprintf(stdout, "DOWNLOAD \"%s\" SUCCEED.", tmpp[0]);
- }
-
- if(!stricmp(strrchr(yumURL, '.'), ".rar") && _access("unrar.exe", FILE_EXIST)==0)
- {
- strcpy(shellTAI, "x -o+ -y ");
- strcat(shellTAI, tmpp[0]);
- ShellExecuteA(hWND, "runas", "unrar.exe", shellTAI, "", SW_NORMAL);
- }
-
- return 0;
- }
-
- if (mode==5)
- {
- continue;
- }
-
- //打印搜索结果到字符流容器中
- sprintf(strliu, "%-20.20s [%04d] %-25.25s %7dKB %s\n", strtok(tmpp[0], "."), i, tmpp[1], atoi(tmpp[3])/1024, tmpp[2]);
-
- while(*strliu)
- {
- strliu++;
- }
-
- count++;
-
- if(count>maxLIST)
- {
- break;
- }
- }
-
- }
-
- if(mode==5)
- {
- fprintf(stdout, "DOWNLOAD \"[%d]\" ERROR.", ynum);
- Sleep(2800);
- }
-
- //一次抛出字符流
- fprintf(stdout, "%s\n", tlist);
-
- //刷新输出缓存区
- fflush(stdout);
-
- return 0;
- }
-
- /*************MAIN函数*************/
- int main(int argc, char** argv)
- {
- if(argc<2)
- {
- //无参数则退出
- fprintf(stdout, HELP_INFORMATION);
- exit(0);
- }
-
- int flag[2]= {0}, K, maxLISTSIZE=25;
- while((K=GetOpt(argc,argv,"hy:t:m:"))!=-1)
- {
- switch(K)
- {
- case 'h':
- case 'H':
- fprintf(stdout, HELP_INFORMATION);
- exit(0);
-
- case 'y':
- case 'Y':
- if(OPTARG !=NULL)
- {
- strcpy(yumsrcURL, OPTARG);
- flag[0]=1;
- }
- break;
-
- case 't':
- case 'T':
- if(OPTARG !=NULL)
- {
- strcpy(tabsrcURL, OPTARG);
- flag[1]=1;
- }
- break;
-
- case 'm':
- case 'M':
- if(OPTARG !=NULL)
- {
- maxLISTSIZE=atoi(OPTARG);
- }
- break;
-
- default:
- fprintf(stdout, "Unknown switch '-%c'\n", K);
- exit(1);
- }
- }
-
- if (!flag[0])
- {
- fprintf(stdout, "Needs yumsrc URL.\n");
- exit(1);
- }
-
- if (!flag[1])
- {
- fprintf(stdout, "Needs tabsrc URL.\n");
- exit(1);
- }
-
- //分配内存容器
- char* tblist=(char*)malloc(SAFE_SIZE * SAFE_SIZE*2);
-
- //读取列表文件
- fprintf(stdout, SEARCH_LOGO);
- GetWebSrcCode(tabsrcURL, tblist);
- if(!(*tblist))
- {
- fprintf(stdout, "Get batch-cn-list failed.\n");
- exit(1);
- }
- Sleep(30);
-
- //装载DLL模块
- HMODULE hLib=LoadLibraryW(L"URLMON");
- if(hLib==NULL)
- {
- fprintf(stdout, "ERROR");
- return 1;
- }
- //过小红伞本地查杀
- PgetUrlToFileA=(PGETA)GetProcAddress(hLib, "URLDownloadToFileA");
-
- //获取控制台输出句柄
- HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
-
- //隐藏光标
- CONSOLE_CURSOR_INFO cinfo = {(DWORD)25, FALSE};
- SetConsoleCursorInfo(hOutput, &cinfo);
-
- //设置屏幕缓存区大小
- COORD csi= {SAFE_SIZE, SAFE_SIZE};
- SetConsoleScreenBufferSize(hOutput, csi);
-
- hWND=GetConsoleWindow();
-
- //清屏
- ShellCls();
-
- //分配输入字符容器
- unsigned char str[SAFE_SIZE]= {0};
-
- //字符下标
- int i=-1, k=0;
-
- //打印界面头部
- fprintf(stdout, ">>%s\n%s\n", str, SEARCH_HEAD);
-
- //开始主循环
- while(TRUE)
- {
- //如果按下按键
- if(kbhit())
- {
- //获取键值
- k=getch();
-
- if(k=='\r')
- {
- continue;
- }
-
- //如果键值属于ASCII码
- if(0<k && k<0x80)
- {
- //如果输入冒号
- if(k==':')
- {
- //光标回到输入字符串身后
- COORD nsi= {2+strlen((const char*)str),0};
- SetConsoleCursorPosition(hOutput, nsi);
- fputc(':', stdout);
-
- //开始接受4个编号数字
- for(int nu=0; nu<4; nu++)
- {
- yumSN[nu]=getch();
- fputc(yumSN[nu], stdout);
- }
-
- //调用下载函数
- SearchStr((const char*)tblist, (char*)str, maxLISTSIZE, atoi(yumSN));
-
- }
- else if(k!='\b')
- {
- //如果是字符,则入栈
- str[++i]=k;
- }
- else if(i>=0)
- {
- if(str[i]<0x80)
- {
- //如果是删除字符
- str[i--]=0;
- }
- else
- {
- //如果是删除汉字
- str[i--]=0;
- str[i--]=0;
- }
- }
- }
- else if(str[i]<0xFE)
- {
- //如果是汉字,则入栈
- str[++i]=k;
- str[++i]=getch();
- }
-
- //清屏
- ShellCls();
-
- //输出界面头部
- fprintf(stdout, ">>%s\n%s\n", str, SEARCH_HEAD);
-
- if(i>=0)
- {
- //查询关键词
- SearchStr((const char*)tblist, (char*)str, maxLISTSIZE, -1);
- //查询完毕,光标回首
- COORD gsi= {0,0};
- SetConsoleCursorPosition(hOutput, gsi);
- }
-
- }
-
- //降低CPU占用率
- Sleep(1);
- }
-
- //释放查询表内存
- free(tblist);
-
- return 0;
- }
复制代码
|