Exemple #1
0
        public void SserStackValues()
        {
            var xml = new MemoryStream(
                Encoding.Unicode.GetBytes(
                    "<?xml version=\"1.0\"?>\r\n" +
                    "<library xmlns=\"http://schemata.jklnet.org/Decompiler\">" +
                    "  <service name=\"test\">" +
                    "    <syscallinfo>" +
                    "      <vector>10</vector>" +
                    "      <stackvalue offset=\"0c\">2a</stackvalue>" +
                    "    </syscallinfo>" +
                    "  </service>" +
                    "</library>"
                    ));
            var slib = SerializedLibrary.LoadFromStream(xml);

            Assert.AreEqual(1, slib.Procedures.Count);
            var ssvc = (SerializedService)slib.Procedures[0];

            Assert.AreEqual(1, ssvc.SyscallInfo.StackValues.Length);

            var svc = ssvc.Build(platform, new TypeLibrary());

            Assert.AreEqual(0, svc.SyscallInfo.RegisterValues.Length);
            Assert.AreEqual(1, svc.SyscallInfo.StackValues.Length);
            Assert.AreEqual(0x0C, svc.SyscallInfo.StackValues[0].Offset);
            Assert.AreEqual(0x2A, svc.SyscallInfo.StackValues[0].Value);
        }
Exemple #2
0
        public void LoadRealmodeServices(IProcessorArchitecture arch)
        {
            var prefix  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var libPath = Path.Combine(prefix, "realmodeintservices.xml");

            if (!File.Exists(libPath))
            {
                libPath = Path.Combine(Directory.GetCurrentDirectory(), "realmodeintservices.xml");
            }

            SerializedLibrary lib;

            using (FileStream stm = new FileStream(libPath, FileMode.Open))
            {
                lib = SerializedLibrary.LoadFromStream(stm);
            }

            realModeServices = lib.Procedures
                               .Cast <SerializedService>()
                               .Select(s => s.Build(this))
                               .ToArray();
        }
Exemple #3
0
        public void LoadInterruptServices(IProcessorArchitecture arch)
        {
            var prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var libPath = Path.Combine(prefix, "realmodeintservices.xml");
            if (!File.Exists(libPath))
            {
                libPath = Path.Combine(Directory.GetCurrentDirectory(), "realmodeintservices.xml");
            }

            SerializedLibrary lib;
            var fsSvc = Services.RequireService<IFileSystemService>();
            using (Stream stm = fsSvc.CreateFileStream(libPath, FileMode.Open, FileAccess.Read))
            {
                lib = SerializedLibrary.LoadFromStream(stm);
            }

            this.interruptServices = lib.Procedures
                .Cast<SerializedService>()
                .Select(s => ExtendRegisters(s))
                .Select(s => s.Build(this, Metadata))
                .ToArray();
        }