From 85c0837a02d4b309b3686fcc8871326c4e397dd3 Mon Sep 17 00:00:00 2001 From: Too-Naive Date: Tue, 30 Aug 2016 15:51:01 +0800 Subject: [PATCH] Improve user experience and program performance. --- tool.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tool.cpp b/tool.cpp index a1e7b9b..47a2c05 100644 --- a/tool.cpp +++ b/tool.cpp @@ -57,7 +57,7 @@ #define objectwebsite _T("https:\x2f\x2fgithub.com/HostsTools/Windows") //end. -#define ConsoleTitle _T("racaljk-host tool v2.1.12 Build time:Aug. 26nd, '16") +#define ConsoleTitle _T("racaljk-host tool v2.1.12 Build time:Aug. 30th, '16") #define CASE(x,y) case x : y; break; #define pWait _T("\n \ @@ -508,12 +508,14 @@ Error code:(%ld)\n"),GetLastError()); } //short path if str has ".." +//Should we need check "\\..\\" ? TCHAR * dotdotcheck(TCHAR * str){ TCHAR * _; TCHAR *_tmp=new TCHAR[100]; memset(_tmp,0,sizeof(_tmp)); if ((_=_tcsstr(str,_T("..")))){ _stscanf(_+2,_T("%100s"),_tmp); - while ((*(--_))!='\\'); +// while ((*(--_))!='\\'); + --_; while ((*(--_))!='\\'); _stprintf(_,_T("%s"),_tmp); } @@ -706,6 +708,7 @@ void Func_CallCopyHostsFile(SYSTEMTIME & st){ _fputts(_T(""),_); if (!(fp=_tfopen(ChangeCTLR,_T("rb")))) throw ChangeCTLR; + _ftprintf(_,_T("\n")); size_t readbyte=0; while ((readbyte=fread(iobuffer,sizeof(char),localbufsize,fp))) fwrite(iobuffer,sizeof(char),readbyte,_);