Fix an exception caused by process.MainModule.
Try to access a dead process's MainModule will cause "A 32 bit processes cannot access modules of a 64 bit process." exception on win7 x64. Simply ignore it. Signed-off-by: noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
@@ -122,6 +122,7 @@ namespace Shadowsocks.Controller
|
||||
* different instance will create their unique "privoxy_UID.conf" where
|
||||
* UID is hash of ss's location.
|
||||
*/
|
||||
|
||||
private static bool IsChildProcess(Process process)
|
||||
{
|
||||
if (Utils.IsPortableMode())
|
||||
@@ -129,8 +130,21 @@ namespace Shadowsocks.Controller
|
||||
/*
|
||||
* Under PortableMode, we could identify it by the path of ss_privoxy.exe.
|
||||
*/
|
||||
string path = process.MainModule.FileName;
|
||||
return Utils.GetTempPath("ss_privoxy.exe").Equals(path);
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Sometimes Process.GetProcessesByName will return some processes that
|
||||
* are already dead, and that will cause exceptions here.
|
||||
* We could simply ignore those exceptions.
|
||||
*/
|
||||
string path = process.MainModule.FileName;
|
||||
return Utils.GetTempPath("ss_privoxy.exe").Equals(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogUsefulException(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user