|
@@ -1100,6 +1100,7 @@ namespace GLOBAL
|
|
|
void WriteTextLog(const TCHAR* format, ...)
|
|
|
{
|
|
|
AutoThreadSection aSection(&g_csTextLog);
|
|
|
+#ifndef RTEST
|
|
|
// 解析出日志路径;
|
|
|
TCHAR szlogpath[MAX_PATH] = { 0 };
|
|
|
_stprintf_s(szlogpath, _T("%s%s.txt"), g_szCurModuleDir, g_szFna);
|
|
@@ -1122,7 +1123,7 @@ namespace GLOBAL
|
|
|
// 格式化前设置语言区域;
|
|
|
TCHAR* old_locale = _tcsdup(_tsetlocale(LC_CTYPE, NULL));
|
|
|
_tsetlocale(LC_CTYPE, _T("chs"));//设定中文;
|
|
|
-
|
|
|
+#endif
|
|
|
// 格式化日志内容;
|
|
|
va_list args = NULL;
|
|
|
int len = 0;
|
|
@@ -1137,6 +1138,8 @@ namespace GLOBAL
|
|
|
__time64_t gmt = time(NULL);// 获取当前日历时间(1900-01-01开始的Unix时间戳);
|
|
|
struct tm gmtm = { 0 };
|
|
|
localtime_s(&gmtm, &gmt); // 时间戳转成本地时间;
|
|
|
+
|
|
|
+#ifndef RTEST
|
|
|
_ftprintf(fp, _T("%04d-%02d-%02d %02d:%02d:%02d %s\n"), gmtm.tm_year + 1990, gmtm.tm_mon + 1, gmtm.tm_mday, gmtm.tm_hour, gmtm.tm_min, gmtm.tm_sec, buffer);
|
|
|
|
|
|
// 关闭文件,释放资源并设置回原语言区域;
|
|
@@ -1144,6 +1147,10 @@ namespace GLOBAL
|
|
|
fclose(fp);
|
|
|
_tsetlocale(LC_CTYPE, old_locale);
|
|
|
free(old_locale);//还原区域设定;
|
|
|
+#else
|
|
|
+ printf(_T("%04d-%02d-%02d %02d:%02d:%02d %s\n"), gmtm.tm_year + 1990, gmtm.tm_mon + 1, gmtm.tm_mday, gmtm.tm_hour, gmtm.tm_min, gmtm.tm_sec, buffer);
|
|
|
+ free(buffer);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
void WritePythonLog(LPCTSTR file, const TCHAR* msg)
|
|
@@ -1395,8 +1402,15 @@ namespace GLOBAL
|
|
|
|
|
|
BOOL Python27Dir()
|
|
|
{
|
|
|
+ BOOL bIsWow64 = FALSE;
|
|
|
+ std::string strPython27Reg = "SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath";
|
|
|
+ IsWow64Process(GetCurrentProcess(), &bIsWow64);
|
|
|
+ if ( bIsWow64 ){
|
|
|
+ strPython27Reg = "SOFTWARE\\WOW6432Node\\Python\\PythonCore\\2.7\\InstallPath";
|
|
|
+ }
|
|
|
+
|
|
|
HKEY hKey;
|
|
|
- int ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\WOW6432Node\\Python\\PythonCore\\2.7\\InstallPath"), 0, KEY_QUERY_VALUE, &hKey);
|
|
|
+ int ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strPython27Reg.c_str(), 0, KEY_QUERY_VALUE, &hKey);
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
return FALSE;
|
|
|
|