mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 09:56:10 +00:00
109 lines
3.7 KiB
C#
109 lines
3.7 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: Microsoft.InfoCards.UIAgentAsyncBeginRequest
|
|||
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|||
|
// MVID: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.exe
|
|||
|
|
|||
|
using Microsoft.InfoCards.Diagnostics;
|
|||
|
using Microsoft.Win32.SafeHandles;
|
|||
|
using System;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.IO;
|
|||
|
using System.Text;
|
|||
|
using System.Threading;
|
|||
|
|
|||
|
namespace Microsoft.InfoCards
|
|||
|
{
|
|||
|
internal abstract class UIAgentAsyncBeginRequest : UIAgentRequest
|
|||
|
{
|
|||
|
private SafeWaitHandle m_agentEventHandle;
|
|||
|
private int m_asyncHandle;
|
|||
|
|
|||
|
public UIAgentAsyncBeginRequest(
|
|||
|
IntPtr rpcHandle,
|
|||
|
Stream inArgs,
|
|||
|
Stream outArgs,
|
|||
|
ClientUIRequest parent)
|
|||
|
: base(rpcHandle, inArgs, outArgs, parent)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected override sealed void OnMarshalInArgs()
|
|||
|
{
|
|||
|
IntPtr zero = IntPtr.Zero;
|
|||
|
BinaryReader binaryReader = (BinaryReader) new InfoCardBinaryReader(this.InArgs, Encoding.Unicode);
|
|||
|
using (SafeWaitHandle hRemote = new SafeWaitHandle(Utility.ReadHandle(binaryReader), false))
|
|||
|
this.m_agentEventHandle = Utility.GetLocalHandleFromRemoteHandle(hRemote, this.ParentRequest.UIAgentPid);
|
|||
|
this.OnMarshalAsyncInArgs(binaryReader);
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void OnMarshalAsyncInArgs(BinaryReader reader)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnProcess()
|
|||
|
{
|
|||
|
AsyncParams asyncParams = this.CreateAsyncParams();
|
|||
|
asyncParams.AsyncResult.CancelCallback = new RpcAsyncResult.AsyncCancelCallback(this.AsyncCancel);
|
|||
|
InfoCardTrace.Assert(null != asyncParams, "Null AsyncParams");
|
|||
|
try
|
|||
|
{
|
|||
|
this.m_asyncHandle = asyncParams.AsyncResult.Handle;
|
|||
|
InfoCardTrace.Assert(0 != this.m_asyncHandle, "null async context handle");
|
|||
|
if (!ThreadPool.QueueUserWorkItem(InfoCardTrace.ThunkCallback(new WaitCallback(this.AsyncEntry)), (object) asyncParams))
|
|||
|
throw InfoCardTrace.ThrowHelperError((Exception) new CommunicationException(SR.GetString("UnableToQueueThreadpool")));
|
|||
|
}
|
|||
|
catch
|
|||
|
{
|
|||
|
asyncParams.AsyncResult.Dispose();
|
|||
|
throw;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnMarshalOutArgs()
|
|||
|
{
|
|||
|
BinaryWriter binaryWriter = new BinaryWriter(this.OutArgs, Encoding.Unicode);
|
|||
|
InfoCardTrace.Assert(0 != this.m_asyncHandle, "null async handle");
|
|||
|
binaryWriter.Write(this.m_asyncHandle);
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnDisposeAsUser()
|
|||
|
{
|
|||
|
if (this.m_agentEventHandle == null)
|
|||
|
return;
|
|||
|
this.m_agentEventHandle.Dispose();
|
|||
|
this.m_agentEventHandle = (SafeWaitHandle) null;
|
|||
|
}
|
|||
|
|
|||
|
protected virtual AsyncParams CreateAsyncParams()
|
|||
|
{
|
|||
|
AsyncParams asyncParams = (AsyncParams) new UIAgentAsyncParams(this.GetType().Name, (ClientRequest) this.ParentRequest, this.m_agentEventHandle, (UIAgentRequest) this);
|
|||
|
this.m_agentEventHandle = (SafeWaitHandle) null;
|
|||
|
return asyncParams;
|
|||
|
}
|
|||
|
|
|||
|
protected abstract object AsyncExecute(AsyncParams asyncParam);
|
|||
|
|
|||
|
protected abstract void AsyncCancel();
|
|||
|
|
|||
|
private void AsyncEntry(object state)
|
|||
|
{
|
|||
|
AsyncParams asyncParam = (AsyncParams) state;
|
|||
|
try
|
|||
|
{
|
|||
|
if (asyncParam.AsyncResult.IsCanceled)
|
|||
|
asyncParam.AsyncResult.Exception = (Exception) new Win32Exception(1223);
|
|||
|
else
|
|||
|
asyncParam.AsyncResult.Result = this.AsyncExecute(asyncParam);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (InfoCardTrace.IsFatal(ex))
|
|||
|
InfoCardService.Crash(ex);
|
|||
|
asyncParam.AsyncResult.Exception = ex;
|
|||
|
}
|
|||
|
asyncParam.AsyncResult.Complete();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|