MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07/Microsoft/InfoCards/ImportRequest.cs

92 lines
3.1 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.ImportRequest
// 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 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;
}
}
}