use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLSectionFunctionsTests method testSetSectionName4.
@Test
public void testSetSectionName4() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final String newName = " NEW SECTION NAME ";
final INaviModule module = getKernel32Module();
final Map<Section, Integer> sections = getProvider().loadSections(module);
final Section section = sections.keySet().iterator().next();
getProvider().setSectionName(module.getConfiguration().getId(), section.getId(), newName);
module.close();
module.load();
final Section section2 = module.getContent().getSections().getSection(section.getId());
Assert.assertEquals(newName, section2.getName());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLSectionFunctionsTests method testDeleteSection1.
@Test
public void testDeleteSection1() throws CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getKernel32Module();
final Map<Section, Integer> sections = getProvider().loadSections(module);
final int numberOfSections = sections.size();
final Section section = sections.keySet().iterator().next();
getProvider().deleteSection(section);
module.close();
module.load();
final Map<Section, Integer> sections2 = getProvider().loadSections(module);
Assert.assertEquals(numberOfSections - 1, sections2.size());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLSectionFunctionsTests method testCreateSection6.
@Test
public void testCreateSection6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getKernel32Module();
final String sectionName = " SECTION NAME ";
final BigInteger startAddress = new BigInteger("10000", 16);
final BigInteger endAddress = new BigInteger("20000", 16);
final int sectionId = getProvider().createSection(module.getConfiguration().getId(), sectionName, null, startAddress, endAddress, SectionPermission.READ_WRITE_EXECUTE, new byte[] {});
module.close();
module.load();
final Section section = module.getContent().getSections().getSection(sectionId);
Assert.assertEquals(section.getName(), sectionName);
Assert.assertEquals(section.getStartAddress().toBigInteger(), startAddress);
Assert.assertEquals(section.getEndAddress().toBigInteger(), endAddress);
Assert.assertEquals(section.getSectionPermission(), SectionPermission.READ_WRITE_EXECUTE);
module.close();
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLProviderTest method testSetImageBase1.
@Test
public void testSetImageBase1() throws CouldntSaveDataException, CouldntLoadDataException {
final CProject project = getProvider().createProject("SOME_TEST_PROJECT");
getProvider().createAddressSpace(project, "SOME_ADDRESS_SPACE");
final CAddressSpace addressSpace = getProvider().loadAddressSpaces(project).get(0);
final INaviModule module = getProvider().loadModules().get(0);
getProvider().setImageBase(addressSpace, module, new CAddress(BigInteger.valueOf(0)));
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLProviderTest method testAddModule1.
@Test
public void testAddModule1() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException {
final INaviModule module = getProvider().loadModules().get(0);
final CProject project = getProvider().createProject("FOOBAR_PROJECT");
getProvider().createAddressSpace(project, "FOOBAR_ADDRESS_SPACE");
final CAddressSpace as = getProvider().loadAddressSpaces(project).get(0);
getProvider().addModule(as, module);
try {
getProvider().addModule(as, module);
fail();
} catch (final CouldntSaveDataException exception) {
getProvider().removeModule(as, module);
}
}
Aggregations