MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d/Microsoft/InfoCards/ImportRequest.cs
2022-08-18 06:28:56 -05:00

92 lines
3.1 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.ImportRequest
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d.exe
using Microsoft.InfoCards.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Principal;
using System.Text;
namespace Microsoft.InfoCards
{
internal class ImportRequest : ClientUIRequest
{
private FileStream m_importFile;
private string m_filename;
public ImportRequest(
Process callingProcess,
WindowsIdentity callingIdentity,
InfoCardUIAgent uiAgent,
IntPtr rpcHandle,
Stream inArgs,
Stream outArgs)
: base(callingProcess, callingIdentity, uiAgent, rpcHandle, inArgs, outArgs, InfoCardUIAgent.CallMode.Import, ExceptionList.AllNonFatal)
{
}
public string ImportedFile => this.m_filename;
protected override void OnMarshalInArgs()
{
string path = Utility.DeserializeString((BinaryReader) new InfoCardBinaryReader(this.InArgs, Encoding.Unicode));
if (string.IsNullOrEmpty(path) || path.Length > 259)
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("InvalidImportFileName")));
if (!Path.IsPathRooted(path))
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("InvalidImportFileName")));
try
{
this.m_filename = path;
this.m_importFile = new FileStream(this.m_filename, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch (ArgumentException ex)
{
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("CannotOpenImportFile"), (Exception) ex));
}
catch (IOException ex)
{
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("CannotOpenImportFile"), (Exception) ex));
}
catch (NotSupportedException ex)
{
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("CannotOpenImportFile"), (Exception) ex));
}
catch (UnauthorizedAccessException ex)
{
throw InfoCardTrace.ThrowHelperError((Exception) new ImportException(SR.GetString("CannotOpenImportFile"), (Exception) ex));
}
}
protected override void OnProcess() => this.StartAndWaitForUIAgent();
protected override void OnMarshalOutArgs()
{
}
protected override void OnDisposeAsUser()
{
base.OnDisposeAsUser();
if (this.m_importFile == null)
return;
this.m_importFile.Dispose();
this.m_importFile = (FileStream) null;
}
protected override bool OnHandleException(Exception e, out int errorCode)
{
errorCode = 0;
bool flag = false;
if (e is UserCancelledException)
{
errorCode = (e as UserCancelledException).NativeHResult;
flag = true;
}
return flag;
}
}
}