mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 09:56:10 +00:00
f2ac1ece55
add
115 lines
4.0 KiB
C#
115 lines
4.0 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.ExportFileRequest
|
|
// 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.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Xml;
|
|
using System.Xml.Schema;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class ExportFileRequest : UIAgentRequest
|
|
{
|
|
private string m_filename;
|
|
private string m_passphrase;
|
|
private string[] m_cardIds;
|
|
|
|
public ExportFileRequest(
|
|
IntPtr rpcHandle,
|
|
Stream inArgs,
|
|
Stream outArgs,
|
|
ClientUIRequest parent)
|
|
: base(rpcHandle, inArgs, outArgs, parent)
|
|
{
|
|
}
|
|
|
|
protected override void OnMarshalInArgs()
|
|
{
|
|
BinaryReader reader = (BinaryReader) new InfoCardBinaryReader(this.InArgs, Encoding.Unicode);
|
|
this.m_filename = Utility.DeserializeString(reader);
|
|
this.m_passphrase = Utility.DeserializeString(reader);
|
|
uint length = reader.ReadUInt32();
|
|
this.m_cardIds = new string[(IntPtr) length];
|
|
for (uint index = 0; index < length; ++index)
|
|
this.m_cardIds[(IntPtr) index] = Utility.DeserializeString(reader);
|
|
}
|
|
|
|
protected override void OnProcess()
|
|
{
|
|
InfoCardTrace.Assert(!string.IsNullOrEmpty(this.m_filename), "No file name was specified");
|
|
InfoCardTrace.Assert(!string.IsNullOrEmpty(this.m_passphrase), " No passphrase specified for the file");
|
|
StoreConnection connection = StoreConnection.GetConnection();
|
|
try
|
|
{
|
|
RoamingStoreFile roamingStoreFile = new RoamingStoreFile();
|
|
try
|
|
{
|
|
for (int index = 0; index < this.m_cardIds.Length; ++index)
|
|
{
|
|
InfoCard infoCard = new InfoCard(new Uri(this.m_cardIds[index]));
|
|
infoCard.Get(connection);
|
|
infoCard.GetMasterKey(connection);
|
|
roamingStoreFile.Cards.Add(infoCard);
|
|
}
|
|
using (FileStream output = new FileStream(this.m_filename, FileMode.Create))
|
|
{
|
|
using (XmlWriter writer = XmlWriter.Create((Stream) output, new XmlWriterSettings()
|
|
{
|
|
CloseOutput = false
|
|
}))
|
|
{
|
|
roamingStoreFile.WriteTo(this.m_passphrase, writer);
|
|
writer.Flush();
|
|
}
|
|
output.Flush();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
foreach (InfoCard card in (IEnumerable<InfoCard>) roamingStoreFile.Cards)
|
|
card.ClearSensitiveData();
|
|
}
|
|
AuditLog.AuditStoreExport();
|
|
}
|
|
catch (XmlSchemaValidationException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("SchemaValidationFailed"), (Exception) ex));
|
|
}
|
|
catch (XmlException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("InvalidImportFile"), (Exception) ex));
|
|
}
|
|
catch (UnauthorizedAccessException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("ImportInaccesibleFile"), (Exception) ex));
|
|
}
|
|
catch (IOException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("InvalidImportFile"), (Exception) ex));
|
|
}
|
|
catch (ArgumentException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("ImportInaccesibleFile"), (Exception) ex));
|
|
}
|
|
catch (SerializationIncompleteException ex)
|
|
{
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new ExportException(SR.GetString("FailedToSerializeObject", (object) ex.ObjectType), (Exception) ex));
|
|
}
|
|
finally
|
|
{
|
|
connection.Close();
|
|
}
|
|
}
|
|
|
|
protected override void OnMarshalOutArgs()
|
|
{
|
|
}
|
|
}
|
|
}
|