|
@@ -154,6 +154,7 @@ namespace Global
|
|
TCHAR g_szFna[MAX_PATH] = { 0 };
|
|
TCHAR g_szFna[MAX_PATH] = { 0 };
|
|
TCHAR g_szConfig[MAX_PATH] = { 0 };
|
|
TCHAR g_szConfig[MAX_PATH] = { 0 };
|
|
STConfig g_Config;
|
|
STConfig g_Config;
|
|
|
|
+ TCHAR g_szPython27Dir[MAX_PATH] = {0};
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// 全局函数;
|
|
// 全局函数;
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
@@ -245,9 +246,33 @@ namespace Global
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ BOOL Python27Dir()
|
|
|
|
+ {
|
|
|
|
+ HKEY hKey;
|
|
|
|
+ int ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\WOW6432Node\\Python\\PythonCore\\2.7\\InstallPath"), 0, KEY_QUERY_VALUE, &hKey);
|
|
|
|
+ if (ret != ERROR_SUCCESS)
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ //读取KEY
|
|
|
|
+ DWORD dwType = REG_SZ; //数据类型
|
|
|
|
+ DWORD cbData = 256;
|
|
|
|
+ ret = RegQueryValueEx(hKey, _T(""), NULL, &dwType, (LPBYTE)g_szPython27Dir, &cbData);
|
|
|
|
+ if (ret != ERROR_SUCCESS)
|
|
|
|
+ {
|
|
|
|
+ RegCloseKey(hKey);
|
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
|
|
|
+ RegCloseKey(hKey);
|
|
|
|
+
|
|
|
|
+ return TRUE;
|
|
|
|
+ }
|
|
|
|
+
|
|
// 读取配置文件-预留;
|
|
// 读取配置文件-预留;
|
|
void GetConfig()
|
|
void GetConfig()
|
|
{
|
|
{
|
|
|
|
+ // Python27安装目录;
|
|
|
|
+ Python27Dir();
|
|
|
|
+
|
|
TCHAR szConfigpath[MAX_PATH] = { 0 };
|
|
TCHAR szConfigpath[MAX_PATH] = { 0 };
|
|
_stprintf_s(szConfigpath, _T("%sConfig.ini"), Global::g_szCurModuleDir);
|
|
_stprintf_s(szConfigpath, _T("%sConfig.ini"), Global::g_szCurModuleDir);
|
|
_tcscpy_s(g_szConfig, szConfigpath);
|
|
_tcscpy_s(g_szConfig, szConfigpath);
|
|
@@ -256,9 +281,17 @@ namespace Global
|
|
// 读取配置内容;
|
|
// 读取配置内容;
|
|
g_Config.bGenerics = GetPrivateProfileInt(_T("ir-device"), _T("generics"), 0, szConfigpath);
|
|
g_Config.bGenerics = GetPrivateProfileInt(_T("ir-device"), _T("generics"), 0, szConfigpath);
|
|
|
|
|
|
- GetPrivateProfileString(_T("ir-device"), _T("redratpath"), NULL, szValue, MAX_PATH, szConfigpath);
|
|
|
|
- g_Config.redratpath = szValue;
|
|
|
|
- memset(szValue, 0, MAX_PATH);
|
|
|
|
|
|
+ if (PathFileExists(g_szPython27Dir))
|
|
|
|
+ {
|
|
|
|
+ g_Config.redratpath = g_szPython27Dir;
|
|
|
|
+ g_Config.redratpath.append("Tools\\RedRatHub-V4.28\\RedRatHubCmd.exe");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ GetPrivateProfileString(_T("ir-device"), _T("redratpath"), NULL, szValue, MAX_PATH, szConfigpath);
|
|
|
|
+ g_Config.redratpath = szValue;
|
|
|
|
+ memset(szValue, 0, MAX_PATH);
|
|
|
|
+ }
|
|
|
|
|
|
GetPrivateProfileString(_T("ir-device"), _T("signal"), NULL, szValue, MAX_PATH, szConfigpath);
|
|
GetPrivateProfileString(_T("ir-device"), _T("signal"), NULL, szValue, MAX_PATH, szConfigpath);
|
|
g_Config.signaldir = szValue;
|
|
g_Config.signaldir = szValue;
|