We have an outdated CRM system (Server) that uses a mapped network drive. The problem is that the disk is fully open for modification by all users.
I am trying to use user impersonation in a C # .net console application (client A).
Client A runs the .exe program (console application), which does the impersonation (domain, other user, password).
Then the console application displays the network folder on the disk:
NETRESOURCE nr = new NETRESOURCE();
nr.dwType = ResourceType.RESOURCETYPE_DISK;
nr.lpLocalName = "X:";
nr.lpRemoteName = @"\\x.x.x.x\folderx";
nr.lpProvider = null;
int result = WNetAddConnection2(nr, null, null, 0);
- Then the console application will try to open the .exe program located in the mapped network drive.
Process ExternalProcess = new Process();
ExternalProcess.StartInfo.FileName = @"X:\subfolder\APP\app.exe";
ExternalProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
ExternalProcess.Start();
ExternalProcess.WaitForExit();
But I get a Win32Exception:
Unknown error (0xfffffffe)
in System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
in System.Diagnostics.Process.Start()
in SecureApp.Program.Main(String[] args) en \\vmware-host\Shared Folders\Documents\Visual Studio 2010\Projects\SecureApp\SecureApp\Program.cs:línea 142
in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
Folder sharing properties use a user personifying himself as the only user who can read and write.
, , .
Edit
:
- Windows
- , , , , CRM- , , CRM.
: , , , Windows, ?