|
|
@@ -100,7 +100,22 @@ namespace Shadowsocks.Controller.Service |
|
|
|
_pluginProcess.StartInfo.Environment["SS_LOCAL_HOST"] = LocalEndPoint.Address.ToString(); |
|
|
|
_pluginProcess.StartInfo.Environment["SS_LOCAL_PORT"] = LocalEndPoint.Port.ToString(); |
|
|
|
_pluginProcess.StartInfo.Arguments = ExpandEnvironmentVariables(_pluginProcess.StartInfo.Arguments, _pluginProcess.StartInfo.EnvironmentVariables); |
|
|
|
_pluginProcess.Start(); |
|
|
|
try
|
|
|
|
{
|
|
|
|
_pluginProcess.Start();
|
|
|
|
} |
|
|
|
catch (System.ComponentModel.Win32Exception ex) |
|
|
|
{
|
|
|
|
// do not use File.Exists(...), it can not handle the scenarios when the plugin file is in system environment path.
|
|
|
|
// https://docs.microsoft.com/en-us/windows/win32/seccrypto/common-hresult-values
|
|
|
|
//if ((uint)ex.ErrorCode == 0x80004005)
|
|
|
|
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
|
|
|
|
if (ex.NativeErrorCode == 0x00000002)
|
|
|
|
{
|
|
|
|
throw new FileNotFoundException(I18N.GetString("Cannot find the plugin program file"), _pluginProcess.StartInfo.FileName, ex);
|
|
|
|
}
|
|
|
|
throw new ApplicationException(I18N.GetString("Plugin Program"), ex);
|
|
|
|
} |
|
|
|
_pluginJob.AddProcess(_pluginProcess.Handle); |
|
|
|
_started = true; |
|
|
|
} |
|
|
|