File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ namespace TaskSched
351351 CSimpleXML xml;
352352 xml.LoadXMLContentDirect (std::wstring (xml_buff));
353353 // 获得配置中的执行路径
354- const std::wstring command_path = xml.GetNode (L" Command" , L" Exec" );
354+ std::wstring command_path = xml.GetNode (L" Command" , L" Exec" );
355355 if (path != nullptr )
356356 {
357357 *path = command_path;
@@ -360,7 +360,13 @@ namespace TaskSched
360360 std::wstring exec_path;
361361 exec_path.resize (MAX_PATH);
362362 GetModuleFileName (NULL , exec_path.data (), MAX_PATH);
363+
364+ // 利用const wchat *的构造方法字符串截断'\0'
365+ command_path = std::wstring (command_path.c_str ());
366+ exec_path = std::wstring (exec_path.c_str ());
367+
363368 command_path_match = (command_path == exec_path);
369+
364370 SysFreeString (xml_buff);
365371 if (SUCCEEDED (hr))
366372 {
You can’t perform that action at this time.
0 commit comments