public static void TestScanContent() { try { Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty)); } finally { AmsiUtils.Uninitialize(); } }
/// <summary> /// Constructor to initialize both Runspace and Command to invoke. /// Caller should make sure that "command" is not null. /// </summary> /// <param name="runspace"> /// Runspace to use for the command invocation. /// </param> /// <param name="command"> /// command to Invoke. /// Caller should make sure that "command" is not null. /// </param> internal Pipeline(Runspace runspace, CommandCollection command) { if (runspace == null) { PSTraceSource.NewArgumentNullException(nameof(runspace)); } // This constructor is used only internally. // Caller should make sure the input is valid Dbg.Assert(command != null, "Command cannot be null"); InstanceId = runspace.GeneratePipelineId(); Commands = command; // Reset the AMSI session so that it is re-initialized // when the next script block is parsed. AmsiUtils.CloseSession(); }
public static void TestUninitialize() { AmsiUtils.Uninitialize(); }
public static void TestCloseSession() { AmsiUtils.CloseSession(); }
public static void TestCurrentDomain_ProcessExit() { Assert.Throws <PlatformNotSupportedException>(delegate { AmsiUtils.CurrentDomain_ProcessExit(null, EventArgs.Empty); }); }
public static void TestScanContent() { Assert.Equal(AmsiUtils.ScanContent("", ""), AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED); }
public static void TestScanContent() { Assert.Equal(AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED, AmsiUtils.ScanContent(string.Empty, string.Empty)); }