mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
WIP
This commit is contained in:
parent
a1dc137c1a
commit
4b2142ed99
@ -331,11 +331,11 @@ namespace Wabbajack.Common
|
|||||||
await fs.WriteAsync(data);
|
await fs.WriteAsync(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task WriteAllAsync(Stream data, bool disposeAfter = true)
|
public async Task WriteAllAsync(Stream data, bool disposeDataAfter = true)
|
||||||
{
|
{
|
||||||
await using var fs = await Create();
|
await using var fs = await Create();
|
||||||
await data.CopyToAsync(fs);
|
await data.CopyToAsync(fs);
|
||||||
if (disposeAfter) await data.DisposeAsync();
|
if (disposeDataAfter) await data.DisposeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
|
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
|
||||||
|
38
Wabbajack.Lib/VirusScanner.cs
Normal file
38
Wabbajack.Lib/VirusScanner.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Wabbajack.Common;
|
||||||
|
|
||||||
|
namespace Wabbajack.Lib
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper around Windows Defender's commandline tool
|
||||||
|
/// </summary>
|
||||||
|
public class VirusScanner
|
||||||
|
{
|
||||||
|
public enum Result : int
|
||||||
|
{
|
||||||
|
NotMalware = 0,
|
||||||
|
Malware = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<Result> ScanStream(Stream stream)
|
||||||
|
{
|
||||||
|
await using var file = new TempFile();
|
||||||
|
await file.Path.WriteAllAsync(stream);
|
||||||
|
|
||||||
|
var process = new ProcessHelper()
|
||||||
|
{
|
||||||
|
Path =
|
||||||
|
(AbsolutePath)@"C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2006.10-0\X86\MpCmdRun.exe",
|
||||||
|
Arguments = new object[] {"-Scan", "-ScanType", "3", "-DisableRemediation", "-File", file.Path},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (Result)await process.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<bool> ShouldScan(AbsolutePath path)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,11 +46,13 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
Size = br.ReadInt64(),
|
Size = br.ReadInt64(),
|
||||||
};
|
};
|
||||||
var lst = new List<IndexedVirtualFile>();
|
var lst = new List<IndexedVirtualFile>();
|
||||||
|
ivf.Children = lst;
|
||||||
var count = br.ReadInt32();
|
var count = br.ReadInt32();
|
||||||
for (int x = 0; x < count; x++)
|
for (int x = 0; x < count; x++)
|
||||||
{
|
{
|
||||||
lst.Add(Read(br));
|
lst.Add(Read(br));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ivf;
|
return ivf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user