Exemplo n.º 1
0
 public void Setup()
 {
     mr = new MockRepository();
     mockFactory = new MockFactory(mr);
     arch = new X86ArchitectureFlat32();
     platform = new Win32Platform(null, arch);
 }
Exemplo n.º 2
0
 public void Setup()
 {
     mr = new MockRepository();
     this.services = mr.Stub<IServiceProvider>();
     var tlSvc = new TypeLibraryLoaderServiceImpl(services);
     var configSvc = mr.StrictMock<IConfigurationService>();
     var win32env = new OperatingEnvironmentElement
     {
         TypeLibraries = 
         {
             new TypeLibraryElement {  Name= "msvcrt.xml" },
             new TypeLibraryElement {  Name= "windows32.xml" },
         }
     };
     configSvc.Stub(c => c.GetEnvironment("win32")).Return(win32env);
     configSvc.Stub(c => c.GetInstallationRelativePath(null)).IgnoreArguments()
         .Do(new Func<string[], string>(s => string.Join("/", s)));
     services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tlSvc);
     services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(configSvc);
     services.Stub(s => s.GetService(typeof(DecompilerEventListener))).Return(new FakeDecompilerEventListener());
     services.Stub(s => s.GetService(typeof(CancellationTokenSource))).Return(null);
     services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(new FileSystemServiceImpl());
     services.Stub(s => s.GetService(typeof(IDiagnosticsService))).Return(new FakeDiagnosticsService());
     services.Replay();
     configSvc.Replay();
     arch = new X86ArchitectureFlat32();
     win32 = new Reko.Environments.Windows.Win32Platform(services, arch);
 }
 public void Setup()
 {
     mr = new MockRepository();
     mockFactory = new MockFactory(mr);
     arch = new IntelArchitecture(ProcessorMode.Protected32);
     platform = new Win32Platform(null, arch);
 }
 public void Setup()
 {
     proc = new Procedure_v1();
     var arch = new X86ArchitectureFlat32();
     var platform = new Win32Platform(null, arch);
     var program = new Program
     {
         Architecture = arch,
         Platform = platform
     };
     interactor = new ProcedureDialogInteractor(program, proc);
 }
Exemplo n.º 5
0
 public void Setup()
 {
     sc = new ServiceContainer();
     mr = new MockRepository();
     addrLoad = Address.Ptr32(0x00100000);
     fileImage = new byte[0x4000];
     writer = new LeImageWriter(fileImage);
     var cfgSvc = mr.StrictMock<IConfigurationService>();
     Given_i386_Architecture();
     var win32 = new Win32Platform(sc, arch_386);
     var win32Env = mr.Stub<OperatingEnvironment>();
     cfgSvc.Stub(c => c.GetArchitecture("x86-protected-32")).Return(arch_386);
     cfgSvc.Stub(c => c.GetEnvironment("win32")).Return(win32Env);
     win32Env.Stub(w => w.Load(null, null)).IgnoreArguments().Return(win32);
     sc.AddService<IConfigurationService>(cfgSvc);
 }
Exemplo n.º 6
0
 public void Setup()
 {
     sc = new ServiceContainer();
     mr = new MockRepository();
     addrLoad = Address.Ptr32(0x00100000);
     fileImage = new byte[0x4000];
     writer = new LeImageWriter(fileImage);
     var cfgSvc = mr.StrictMock<IConfigurationService>();
     var dcSvc = mr.Stub<DecompilerEventListener>();
     Given_i386_Architecture();
     this.win32 = mr.PartialMock<Win32Platform>(sc, arch_386);
     // Avoid complications with the FindMainProcedure call.
     this.win32.Stub(w => w.FindMainProcedure(null, null)).IgnoreArguments().Return(null);
     var win32Env = mr.Stub<OperatingEnvironment>();
     cfgSvc.Stub(c => c.GetArchitecture("x86-protected-32")).Return(arch_386);
     cfgSvc.Stub(c => c.GetEnvironment("win32")).Return(win32Env);
     win32Env.Stub(w => w.Load(null, null)).IgnoreArguments().Return(win32);
     sc.AddService<IConfigurationService>(cfgSvc);
     sc.AddService<DecompilerEventListener>(dcSvc);
 }
Exemplo n.º 7
0
 private void When_Creating_Win32_Platform()
 {
     win32 = new Win32Platform(sc, arch);
 }
Exemplo n.º 8
0
 public void Setup()
 {
     mr = new MockRepository();
     this.services = mr.Stub<IServiceProvider>();
     var tlSvc = mr.Stub<ITypeLibraryLoaderService>();
     var configSvc = mr.StrictMock<IConfigurationService>();
     var win32env = new OperatingEnvironmentElement
     {
         TypeLibraries =
         {
             new TypeLibraryElement {  Name= "msvcrt.xml" },
             new TypeLibraryElement {  Name= "windows32.xml" },
         }
     };
     configSvc.Stub(c => c.GetEnvironment("win32")).Return(win32env);
     configSvc.Stub(c => c.GetPath(null)).IgnoreArguments()
         .Do(new Func<string, string>(s => s));
     services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tlSvc);
     services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(configSvc);
     services.Stub(s => s.GetService(typeof(DecompilerEventListener))).Return(new FakeDecompilerEventListener());
     services.Stub(s => s.GetService(typeof(CancellationTokenSource))).Return(null);
     tlSvc.Stub(t => t.LoadLibrary(null, null)).IgnoreArguments()
         .Do(new Func<Platform, string, TypeLibrary>((p, n) =>
         {
             var lib = TypeLibrary.Load(p, Path.ChangeExtension(n, ".xml"));
             return lib;
         }));
     services.Replay();
     tlSvc.Replay();
     configSvc.Replay();
     arch = new IntelArchitecture(ProcessorMode.Protected32);
     win32 = new Reko.Environments.Windows.Win32Platform(services, arch);
 }
Exemplo n.º 9
0
		public short ReadCoffHeader(ImageReader rdr)
		{
			this.machine = rdr.ReadLeUInt16();
            short expectedMagic = GetExpectedMagic(machine);
            arch = CreateArchitecture(machine);
			platform = CreatePlatform(machine, Services, arch);
            innerLoader = CreateInnerLoader(machine);

			sections = rdr.ReadLeInt16();
			rdr.ReadLeUInt32();		// timestamp.
			rdr.ReadLeUInt32();		// COFF symbol table.
			rdr.ReadLeUInt32();		// #of symbols.
			optionalHeaderSize = rdr.ReadLeInt16();
			this.fileFlags = rdr.ReadLeUInt16();
			rvaSectionTable = (uint) ((int)rdr.Offset + optionalHeaderSize);
            return expectedMagic;
		}
        private readonly string nl = "\r\n";    // DEF files are from the Windows world, and have CR-LFs in them.

        private void CreateDefFileLoader(string filename, string contents)
        {
            this.platform = new Win32Platform(null, new X86ArchitectureFlat32());
            dfl = new ModuleDefinitionLoader(null, filename, Encoding.ASCII.GetBytes(contents));
        }
Exemplo n.º 11
0
 public void Setup()
 {
     arch = new IntelArchitecture(ProcessorMode.Protected32);
     platform = new Win32Platform(null, arch);
 }