|
@@ -125,43 +125,32 @@ namespace Shadowsocks.Controller |
|
|
|
|
|
|
|
|
private static bool IsChildProcess(Process process)
|
|
|
private static bool IsChildProcess(Process process)
|
|
|
{
|
|
|
{
|
|
|
if (Utils.IsPortableMode())
|
|
|
|
|
|
|
|
|
try
|
|
|
{
|
|
|
{
|
|
|
/*
|
|
|
|
|
|
* Under PortableMode, we could identify it by the path of ss_privoxy.exe.
|
|
|
|
|
|
*/
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
|
if (Utils.IsPortableMode())
|
|
|
{
|
|
|
{
|
|
|
/*
|
|
|
/*
|
|
|
* Sometimes Process.GetProcessesByName will return some processes that
|
|
|
|
|
|
* are already dead, and that will cause exceptions here.
|
|
|
|
|
|
* We could simply ignore those exceptions.
|
|
|
|
|
|
|
|
|
* Under PortableMode, we could identify it by the path of ss_privoxy.exe.
|
|
|
*/
|
|
|
*/
|
|
|
string path = process.MainModule.FileName;
|
|
|
|
|
|
|
|
|
var path = process.MainModule.FileName;
|
|
|
|
|
|
|
|
|
return Utils.GetTempPath("ss_privoxy.exe").Equals(path);
|
|
|
return Utils.GetTempPath("ss_privoxy.exe").Equals(path);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Logging.LogUsefulException(ex);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
|
else
|
|
|
{
|
|
|
{
|
|
|
var cmd = process.GetCommandLine();
|
|
|
var cmd = process.GetCommandLine();
|
|
|
|
|
|
|
|
|
return cmd.Contains(UniqueConfigFile);
|
|
|
return cmd.Contains(UniqueConfigFile);
|
|
|
}
|
|
|
}
|
|
|
catch (Win32Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((uint) ex.ErrorCode != 0x80004005)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Sometimes Process.GetProcessesByName will return some processes that
|
|
|
|
|
|
* are already dead, and that will cause exceptions here.
|
|
|
|
|
|
* We could simply ignore those exceptions.
|
|
|
|
|
|
*/
|
|
|
|
|
|
Logging.LogUsefulException(ex);
|
|
|
return false;
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|