public void Setup() { mr = new MockRepository(); var 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); tlSvc.Stub(t => t.LoadLibrary(null, null)).IgnoreArguments() .Do(new Func<IProcessorArchitecture, string, TypeLibrary>((a, n) => { var lib = TypeLibrary.Load(a, Path.ChangeExtension(n, ".xml")); return lib; })); services.Replay(); tlSvc.Replay(); configSvc.Replay(); arch = new IntelArchitecture(ProcessorMode.Protected32); win32 = new Reko.Environments.Win32.Win32Platform(services, arch); }
public short ReadCoffHeader(ImageReader rdr) { ushort 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(); short fileFlags = rdr.ReadLeInt16(); rvaSectionTable = (uint) ((int)rdr.Offset + optionalHeaderSize); return expectedMagic; }
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); }
public void Setup() { arch = new IntelArchitecture(ProcessorMode.Protected32); platform = new Win32Platform(null, arch); }
private void CreateDefFileLoader(string filename, string contents) { this.platform = new Win32Platform(null, new X86ArchitectureFlat32()); dfl = new ModuleDefinitionLoader(null, filename, Encoding.ASCII.GetBytes(contents)); }
private void When_Creating_Win32_Platform() { win32 = new Win32Platform(sc, arch); }