System Access is Denied Code 5

Advertisement

krish
Guest

System Access is Denied Code 5

Dear team,

since our last security updates, i'm not able to use WinScp in our C# project. We are receiving following error when we open a session.

we are using FileZilla within a domain and using local ip. The error happens before connection is made to server.

C# code
try
{
    using (Session session = new Session())
    {
        session.FileTransferProgress += SessionFileTransferProgress;
 
        // Connect
        session.Open(sessionOptions); <--- HERE
Error:
session.Open(mSessionOptions);
'session.Open(mSessionOptions)' threw an exception of type 'System.ComponentModel.Win32Exception'
    Data: {System.Collections.ListDictionaryInternal}
    ErrorCode: -2147467259
    HResult: -2147467259
    HelpLink: null
    InnerException: null
    Message: "Access is denied"
    NativeErrorCode: 5
    Source: "System"
    StackTrace: "   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)\r\n   at System.Diagnostics.Process.Start()\r\n   at WinSCP.ExeSessionProcess.InitializeChild()\r\n   at WinSCP.ExeSessionProcess.Start()\r\n   at WinSCP.Session.Open(SessionOptions sessionOptions)"
    TargetSite: {Boolean StartWithCreateProcess(System.Diagnostics.ProcessStartInfo)}
here is the full log:
[2020-10-03 12:31:35.454] [0001] .NET Framework build
[2020-10-03 12:31:35.458] [0001] Executing assembly: WinSCPnet, Version=1.7.2.10640, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
[2020-10-03 12:31:35.458] [0001] Executing assembly codebase: file:///C:/Users/xxx/source/Workspaces/WLL/xxxProductName/ProductName/bin/x86/Debug/WinSCPnet.dll
[2020-10-03 12:31:35.458] [0001] Executing assembly location: C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\WinSCPnet.dll
[2020-10-03 12:31:35.458] [0001] Entry Assembly: unmanaged
[2020-10-03 12:31:35.458] [0001] Operating system: Microsoft Windows NT 10.0.19041.0
[2020-10-03 12:31:35.460] [0001] Timezone: +01:00; GMT Daylight Time
[2020-10-03 12:31:35.461] [0001] User: xxx@domain@LAP000405; Interactive: True
[2020-10-03 12:31:35.461] [0001] Runtime: 4.0.30319.42000
[2020-10-03 12:31:35.462] [0001] Console encoding: Input: Western European (Windows) (1252); Output: Western European (Windows) (1252)
[2020-10-03 12:31:35.462] [0001] Working directory: C:\Users\xxx\Documents
[2020-10-03 12:31:35.528] [0001] Assembly path: C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\WinSCPnet.dll
[2020-10-03 12:31:35.528] [0001] Assembly product version: 5.17.7.0
[2020-10-03 12:32:13.267] [0001] Session.Open entering
[2020-10-03 12:32:13.268] [0001]   Session.SetupTempPath entering
[2020-10-03 12:32:13.269] [0001]     Configured temporary file: C:\ccmsApps\WinScpXmlLog.log - Exists [False]
[2020-10-03 12:32:13.269] [0001]   Session.SetupTempPath leaving
[2020-10-03 12:32:13.269] [0001]   ExeSessionProcess..ctor entering
[2020-10-03 12:32:13.269] [0001]     ExeSessionProcess.GetExecutablePath entering
[2020-10-03 12:32:13.270] [0001]       Executable found in C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\winscp.exe
[2020-10-03 12:32:13.270] [0001]     ExeSessionProcess.GetExecutablePath leaving
[2020-10-03 12:32:13.270] [0001]     EXE executable path resolved to C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\winscp.exe
[2020-10-03 12:32:13.271] [0001]     ExeSessionProcess.CheckVersion entering
[2020-10-03 12:32:13.274] [0001]       Version of C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\winscp.exe is 5.17.7.10640, product WinSCP version is 5.17.7.0
[2020-10-03 12:32:13.274] [0001]     ExeSessionProcess.CheckVersion leaving
[2020-10-03 12:32:13.274] [0001]   ExeSessionProcess..ctor leaving
[2020-10-03 12:32:13.276] [0001]   ExeSessionProcess.Start entering
[2020-10-03 12:32:13.276] [0001]     ExeSessionProcess.InitializeConsole entering
[2020-10-03 12:32:13.276] [0001]       Trying event _15440_65204782_813
[2020-10-03 12:32:13.276] [0001]       Creating event WinSCPConsoleEventRequest_15440_65204782_813
[2020-10-03 12:32:13.277] [0001]       Created event WinSCPConsoleEventRequest_15440_65204782_813 with handle 6520 with security none, new True
[2020-10-03 12:32:13.277] [0001]       Event _15440_65204782_813 is unique
[2020-10-03 12:32:13.277] [0001]       Creating event WinSCPConsoleEventResponse_15440_65204782_813
[2020-10-03 12:32:13.277] [0001]       Created event WinSCPConsoleEventResponse_15440_65204782_813 with handle 6524 with security none, new True
[2020-10-03 12:32:13.277] [0001]       Creating event WinSCPConsoleEventCancel_15440_65204782_813
[2020-10-03 12:32:13.277] [0001]       Created event WinSCPConsoleEventCancel_15440_65204782_813 with handle 6992 with security none, new True
[2020-10-03 12:32:13.277] [0001]       Acquiring communication structure
[2020-10-03 12:32:13.277] [0001]       Acquired communication structure
[2020-10-03 12:32:13.277] [0001]       Releasing communication structure
[2020-10-03 12:32:13.277] [0001]       Released communication structure
[2020-10-03 12:32:13.277] [0001]       Job created
[2020-10-03 12:32:13.277] [0001]       Job set to kill all processes
[2020-10-03 12:32:13.277] [0001]     ExeSessionProcess.InitializeConsole leaving
[2020-10-03 12:32:13.277] [0001]     ExeSessionProcess.InitializeChild entering
[2020-10-03 12:32:13.277] [0001]       Starting "C:\Users\xxx\source\Workspaces\WLL\xxxProductName\ProductName\bin\x86\Debug\winscp.exe" /xmllog="C:\ccmsApps\WinScpXmlLog.log" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=5.17.7  /ini=nul /loglevel=1  /console /consoleinstance=_15440_65204782_813
[2020-10-03 12:32:13.468] [0001]     ExeSessionProcess.InitializeChild leaving
[2020-10-03 12:32:13.469] [0001]   ExeSessionProcess.Start leaving
[2020-10-03 12:32:13.469] [0001]   Exception: System.ComponentModel.Win32Exception (0x80004005): Access is denied
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at WinSCP.ExeSessionProcess.InitializeChild()
   at WinSCP.ExeSessionProcess.Start()
   at WinSCP.Session.Open(SessionOptions sessionOptions)
[2020-10-03 12:32:13.469] [0001]   Session.Cleanup entering
[2020-10-03 12:32:13.469] [0001]     Terminating process
[2020-10-03 12:32:13.469] [0001]     Command: [exit]
[2020-10-03 12:32:13.469] [0001]     ExeSessionProcess.ExecuteCommand entering
[2020-10-03 12:32:13.469] [0001]     ExeSessionProcess.ExecuteCommand leaving
[2020-10-03 12:32:13.470] [0001]     ExeSessionProcess.Close entering
[2020-10-03 12:32:13.470] [0001]       Waiting for process to exit (2000 ms)
[2020-10-03 12:32:13.470] [0001]     ExeSessionProcess.Close leaving
[2020-10-03 12:32:13.470] [0001]     ExeSessionProcess.Dispose entering
[2020-10-03 12:32:13.470] [0001]       Closing job
[2020-10-03 12:32:13.471] [0001]     ExeSessionProcess.Dispose leaving
[2020-10-03 12:32:13.472] [0001]     Process cleanup Exception: System.InvalidOperationException: No process is associated with this object.
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)
   at WinSCP.ExeSessionProcess.Close()
   at WinSCP.Session.Cleanup()
[2020-10-03 12:32:13.472] [0001]     Disposing log readers
[2020-10-03 12:32:13.472] [0001]   Session.Cleanup leaving
[2020-10-03 12:32:13.473] [0001] Session.Open leaving

Would be greatful if you could shed some light.
Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
35,415
Location:
Prague, Czechia

Re: System Access is Denied Code 5

All I can tell is that something prevents WinSCP .NET assembly from starting winscp.exe process. I do not know what security rules you have in place, so I cannot provide more information.

Reply with quote

Advertisement

You can post new topics in this forum