mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Add user name to IPC channel name
Make IPC channel name unique per user to fix access denied problems on multiuser systems. Fixes #1994. May also fix #1462 and #1509
This commit is contained in:
parent
d89dd984f4
commit
2d64a1960d
1 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ public class ApplicationInstanceManager : IDisposable
|
|||
{
|
||||
private static readonly string MutexName = "82E6AC09-0FEF-4390-AD9F-0DD3F5561EFC";
|
||||
private static readonly string AppName = "ShareX";
|
||||
private static readonly string EventName = string.Format("{0}-{1}", Environment.MachineName, AppName);
|
||||
private static readonly string EventName = string.Format("{0}-{1}-{2}", Environment.MachineName, Environment.UserName, AppName);
|
||||
private static readonly string SemaphoreName = string.Format("{0}{1}", EventName, "Semaphore");
|
||||
|
||||
public bool IsSingleInstance { get; private set; }
|
||||
|
@ -151,7 +151,7 @@ private void UpdateRemoteObject(string uri)
|
|||
IpcClientChannel clientChannel = new IpcClientChannel();
|
||||
ChannelServices.RegisterChannel(clientChannel, true);
|
||||
|
||||
InstanceProxy proxy = Activator.GetObject(typeof(InstanceProxy), string.Format("ipc://{0}{1}/{1}", Environment.MachineName, uri)) as InstanceProxy;
|
||||
InstanceProxy proxy = Activator.GetObject(typeof(InstanceProxy), string.Format("ipc://{0}{1}{2}/{2}", Environment.MachineName, Environment.UserName, uri)) as InstanceProxy;
|
||||
|
||||
if (proxy != null)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ private void UpdateRemoteObject(string uri)
|
|||
|
||||
private void RegisterRemoteType(string uri)
|
||||
{
|
||||
serverChannel = new IpcServerChannel(Environment.MachineName + uri);
|
||||
serverChannel = new IpcServerChannel(Environment.MachineName + Environment.UserName + uri);
|
||||
ChannelServices.RegisterChannel(serverChannel, true);
|
||||
|
||||
RemotingConfiguration.RegisterWellKnownServiceType(typeof(InstanceProxy), uri, WellKnownObjectMode.Singleton);
|
||||
|
|
Loading…
Reference in a new issue