|
@@ -63,6 +63,35 @@ BOOL GetSysSerialPort(std::vector<std::string>& vtports)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
+bool ReadKeyFromFile(std::string file, std::string &data)
|
|
|
+{
|
|
|
+ FILE* pf = NULL;
|
|
|
+ if (fopen_s(&pf, file.c_str(), _T("rb")) == 0)
|
|
|
+ {
|
|
|
+ if (pf)
|
|
|
+ {
|
|
|
+ fseek(pf, 0, SEEK_END);
|
|
|
+ size_t fs = ftell(pf);
|
|
|
+ fseek(pf, 0, SEEK_SET);
|
|
|
+
|
|
|
+ byte* pdata = (byte*)malloc(fs);
|
|
|
+ if (pdata)
|
|
|
+ {
|
|
|
+ fread(pdata, fs, 1, pf);
|
|
|
+ fclose(pf);
|
|
|
+
|
|
|
+ data.append((char*)pdata, fs);
|
|
|
+ free(pdata);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ fclose(pf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
CTCLToolsDlg::CTCLToolsDlg(CWnd* pParent /*=NULL*/)
|
|
|
: CDialog(CTCLToolsDlg::IDD, pParent)
|