mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-23 03:46:10 +00:00
f2ac1ece55
add
77 lines
2.8 KiB
C#
77 lines
2.8 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.UIAgentMonitor
|
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|
// MVID: 1D4D5564-A025-490C-AF1D-DF4FBB709D1F
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-f8f9f26e940480624825f6bddbea86e70fc4aa746c4dd8efa7d98dcb477000ed.exe
|
|
|
|
using Microsoft.InfoCards.Diagnostics;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class UIAgentMonitor
|
|
{
|
|
private static UIAgentMonitor s_singleton = (UIAgentMonitor) null;
|
|
private static object s_syncRoot = new object();
|
|
private Dictionary<string, UIAgentMonitorHandle> m_currentCallingUsers;
|
|
private Dictionary<int, UIAgentMonitorHandle> m_currentTSSessions;
|
|
|
|
private UIAgentMonitor()
|
|
{
|
|
this.m_currentCallingUsers = new Dictionary<string, UIAgentMonitorHandle>();
|
|
this.m_currentTSSessions = new Dictionary<int, UIAgentMonitorHandle>();
|
|
}
|
|
|
|
public static UIAgentMonitor Instance()
|
|
{
|
|
if (UIAgentMonitor.s_singleton == null)
|
|
{
|
|
lock (UIAgentMonitor.s_syncRoot)
|
|
{
|
|
if (UIAgentMonitor.s_singleton == null)
|
|
UIAgentMonitor.s_singleton = new UIAgentMonitor();
|
|
}
|
|
}
|
|
return UIAgentMonitor.s_singleton;
|
|
}
|
|
|
|
public void AddNewClient(UIAgentMonitorHandle handle)
|
|
{
|
|
lock (UIAgentMonitor.s_syncRoot)
|
|
{
|
|
string userName = handle.UserName;
|
|
int tsSessionId = handle.TsSessionId;
|
|
if (this.m_currentCallingUsers.ContainsKey(userName))
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ServiceBusyException(SR.GetString("ServiceInUseOnAnotherSession")));
|
|
if (this.m_currentTSSessions.ContainsKey(tsSessionId))
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ServiceBusyException(SR.GetString("ServiceInUseOnAnotherSession")));
|
|
this.m_currentCallingUsers.Add(userName, handle);
|
|
try
|
|
{
|
|
this.m_currentTSSessions.Add(tsSessionId, handle);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.m_currentCallingUsers.Remove(userName);
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void RemoveClient(UIAgentMonitorHandle handle)
|
|
{
|
|
lock (UIAgentMonitor.s_syncRoot)
|
|
{
|
|
string userName = handle.UserName;
|
|
int tsSessionId = handle.TsSessionId;
|
|
if (!string.IsNullOrEmpty(userName) && this.m_currentCallingUsers.ContainsKey(userName) && handle == this.m_currentCallingUsers[userName])
|
|
this.m_currentCallingUsers.Remove(userName);
|
|
if (!this.m_currentTSSessions.ContainsKey(tsSessionId) || handle != this.m_currentTSSessions[tsSessionId])
|
|
return;
|
|
this.m_currentTSSessions.Remove(tsSessionId);
|
|
}
|
|
}
|
|
}
|
|
}
|