1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +00:00
6502bench/SourceGen/SGTestData/FunkyProjects/BadExt.cs
Andy McFadden a395909574 Add a couple of funky projects
Added a project with a few bad address region definitions, and one to
exercise the security sandbox.

Also, fiddled with the documentation a little.
2021-10-08 08:36:44 -07:00

48 lines
1.4 KiB
C#

// Copyright 2021 faddenSoft. All Rights Reserved.
// See the LICENSE.txt file for distribution terms (Apache 2.0).
using System;
//using System.Collections.Generic;
using System.IO;
using PluginCommon;
namespace FunkyTest {
/// <summary>
/// Extension script that tries to violate the security sandbox.
/// </summary>
public class BadExt: MarshalByRefObject, IPlugin {
private IApplication mAppRef;
private byte[] mFileData;
public string Identifier {
get {
return "Bad test";
}
}
public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans) {
mAppRef = appRef;
mFileData = fileData;
mAppRef.DebugLog("BadTest(id=" + AppDomain.CurrentDomain.Id + "): prepare()");
// The behavior should be either "found" or "not found" depending on whether or
// not the security sandbox is enabled. The output is visible in the analyzer
// output window.
mAppRef.DebugLog("Testing file access...");
string testDir = @"C:\";
if (Directory.Exists(testDir)) {
mAppRef.DebugLog("Found " + testDir);
} else {
mAppRef.DebugLog("No such file " + testDir);
}
}
public void Unprepare() {
mAppRef = null;
mFileData = null;
}
}
}