Java Code Examples for ghidra.program.model.listing.Program#release()

The following examples show how to use ghidra.program.model.listing.Program#release() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrontEndTestEnv.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public FrontEndTestEnv(boolean isRemote) throws Exception {

		env = new TestEnv();
		frontEndTool = env.getFrontEndTool();
		env.showFrontEndTool();

		if (isRemote) {
			startServer();
		}

		tree = AbstractGenericTest.findComponent(frontEndTool.getToolFrame(), DataTree.class);
		Project project = frontEndTool.getProject();
		rootFolder = project.getProjectData().getRootFolder();

		Program p = buildProgram(this);
		rootFolder.createFile(PROGRAM_A, p, TaskMonitor.DUMMY);
		p.release(this);

		rootNode = tree.getViewRoot();
		waitForTree();
	}
 
Example 2
Source File: MultiProgramManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
void dispose() {
	tool.getProject().getProjectData().removeDomainFolderChangeListener(folderListener);
	fireActivatedEvent(null);
	Iterator<Program> it = programMap.keySet().iterator();
	while (it.hasNext()) {
		Program p = it.next();
		p.removeListener(this);
		p.removeTransactionListener(this);
		fireCloseEvents(p);
		p.release(tool);
	}
	programMap.clear();
	openProgramList.clear();
	tool.setSubTitle("");
	tool.removeStatusComponent(txMonitor);
	tool = null;
	plugin = null;
}
 
Example 3
Source File: IntelHexLoader.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Program> loadProgram(ByteProvider provider, String programName,
		DomainFolder programFolder, LoadSpec loadSpec, List<Option> options, MessageLog log,
		Object consumer, TaskMonitor monitor) throws IOException, CancelledException {
	LanguageCompilerSpecPair pair = loadSpec.getLanguageCompilerSpec();
	Language importerLanguage = getLanguageService().getLanguage(pair.languageID);
	CompilerSpec importerCompilerSpec =
		importerLanguage.getCompilerSpecByID(pair.compilerSpecID);

	Program prog = createProgram(provider, programName, null, getName(), importerLanguage,
		importerCompilerSpec, consumer);
	boolean success = false;
	try {
		success = loadInto(provider, loadSpec, options, log, prog, monitor);
		if (success) {
			createDefaultMemoryBlocks(prog, importerLanguage, log);
		}
	}
	finally {
		if (!success) {
			prog.release(consumer);
			prog = null;
		}
	}
	List<Program> results = new ArrayList<Program>();
	if (prog != null) {
		results.add(prog);
	}
	return results;
}
 
Example 4
Source File: MotorolaHexLoader.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Program> loadProgram(ByteProvider provider, String programName,
		DomainFolder programFolder, LoadSpec loadSpec, List<Option> options, MessageLog log,
		Object consumer, TaskMonitor monitor) throws IOException, CancelledException {
	LanguageCompilerSpecPair pair = loadSpec.getLanguageCompilerSpec();
	Language importerLanguage = getLanguageService().getLanguage(pair.languageID);
	CompilerSpec importerCompilerSpec =
		importerLanguage.getCompilerSpecByID(pair.compilerSpecID);

	Program prog = createProgram(provider, programName, null, getName(), importerLanguage,
		importerCompilerSpec, consumer);
	boolean success = false;
	try {
		success = loadInto(provider, loadSpec, options, log, prog, monitor);
		if (success) {
			createDefaultMemoryBlocks(prog, importerLanguage, log);
		}
	}
	finally {
		if (!success) {
			prog.release(consumer);
			prog = null;
		}
	}
	List<Program> results = new ArrayList<Program>();
	if (prog != null) {
		results.add(prog);
	}
	return results;
}
 
Example 5
Source File: AddressEvaluatorTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Test
   public void testEval() throws Exception {
	Program p = createDefaultProgram("Test", ProgramBuilder._TOY_LE, this);
	addrFactory = p.getAddressFactory();
	int txId = p.startTransaction("Test");
	try {
		assertEquals(addr("0x19"), AddressEvaluator.evaluate(p, "(2+3)*5"));
		assertEquals(addr("0x11"), AddressEvaluator.evaluate(p, "2+3*5"));
		assertEquals(addr("0x11"), AddressEvaluator.evaluate(p, "2+(3*5)"));
		assertEquals(addr("0x11"), AddressEvaluator.evaluate(p, "(2+3*5)"));
		assertEquals(addr("0x16"), AddressEvaluator.evaluate(p, "0x11+5"));
		assertEquals(addr("0x5"), AddressEvaluator.evaluate(p, "5"));
		assertEquals(addr("0x3"), AddressEvaluator.evaluate(p, "0-5+8"));
		assertEquals(addr("0x3"), AddressEvaluator.evaluate(p, "-5+8"));
		assertEquals(addr("0xfffffffB"), AddressEvaluator.evaluate(p, "-5"));
		assertEquals(addr("0x11"), AddressEvaluator.evaluate(p, "3+(5+(3*2)+(3))"));
		assertEquals(addr("0xff00"), AddressEvaluator.evaluate(p, "0xffff ^ 0xff"));
		assertEquals(addr("0x123f"), AddressEvaluator.evaluate(p, "0xffff & 0x123f"));
		assertEquals(addr("0x1234"), AddressEvaluator.evaluate(p, "0x1200 | 0x0034"));
		assertEquals(addr("0xffffffff"), AddressEvaluator.evaluate(p, "~ 0x0"));
		assertEquals(addr("0x1201"), AddressEvaluator.evaluate(p, "0x1200 | ~(0xfffffffe)"));
		Symbol s = p.getSymbolTable().createLabel(addr("0x100"), "entry", SourceType.IMPORTED);
		Address a = s.getAddress();
		a = a.add(10);
		assertEquals(a, AddressEvaluator.evaluate(p, "entry+5*2"));
	}
	finally {
		p.endTransaction(txId, true);
		p.release(this);
	}
}
 
Example 6
Source File: SwitchLoader.java    From Ghidra-Switch-Loader with ISC License 5 votes vote down vote up
@Override
protected List<Program> loadProgram(ByteProvider provider, String programName,
        DomainFolder programFolder, LoadSpec loadSpec, List<Option> options, MessageLog log,
        Object consumer, TaskMonitor monitor)
                throws IOException, CancelledException 
{
    LanguageCompilerSpecPair pair = loadSpec.getLanguageCompilerSpec();
    Language importerLanguage = getLanguageService().getLanguage(pair.languageID);
    CompilerSpec importerCompilerSpec = importerLanguage.getCompilerSpecByID(pair.compilerSpecID);

    Address baseAddr = importerLanguage.getAddressFactory().getDefaultAddressSpace().getAddress(0);
    Program prog = createProgram(provider, programName, baseAddr, getName(), importerLanguage, importerCompilerSpec, consumer);
    boolean success = false;

    try 
    {
        success = this.loadInto(provider, loadSpec, options, log, prog, monitor);
    }
    finally 
    {
        if (!success) 
        {
            prog.release(consumer);
            prog = null;
        }
    }

    List<Program> results = new ArrayList<Program>();
    if (prog != null) results.add(prog);
    return results;
}
 
Example 7
Source File: TestProgramManager.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public void release(Program program) {

		List<Object> consumers = program.getConsumerList();
		if (consumers.contains(this)) {
			program.release(this);
		}

		if (!program.isClosed()) {
			return;
		}

		openTestPrograms.remove(program);
	}
 
Example 8
Source File: MultipleProgramsStrategy.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public List<Program> handlePrograms(List<Program> programs,
        Object consumer) {
    if (programs != null && programs.size() > 1) {
        for (Program program : programs) {
            program.release(consumer);
        }
        return null;
    }
    return programs;
}
 
Example 9
Source File: GenerateLotsOfProgramsScript.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createPrograms(DomainFolder parent, int count)
		throws IOException, InvalidNameException, CancelledException {
	Processor processor = Processor.toProcessor("x86");
	Language language = getDefaultLanguage(processor);
	Program program = new ProgramDB("dummy", language, language.getDefaultCompilerSpec(), this);
	for (int i = 0; i < count; i++) {
		parent.createFile("Prog_" + i, program, monitor);
	}
	program.release(this);
}
 
Example 10
Source File: BinaryLoader.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Program> loadProgram(ByteProvider provider, String programName,
		DomainFolder programFolder, LoadSpec loadSpec, List<Option> options, MessageLog log,
		Object consumer, TaskMonitor monitor) throws IOException, CancelledException {
	LanguageCompilerSpecPair pair = loadSpec.getLanguageCompilerSpec();
	Language importerLanguage = getLanguageService().getLanguage(pair.languageID);
	CompilerSpec importerCompilerSpec =
		importerLanguage.getCompilerSpecByID(pair.compilerSpecID);

	Address baseAddr =
		importerLanguage.getAddressFactory().getDefaultAddressSpace().getAddress(0);
	Program prog = createProgram(provider, programName, baseAddr, getName(), importerLanguage,
		importerCompilerSpec, consumer);
	boolean success = false;
	try {
		success = loadInto(provider, loadSpec, options, log, prog, monitor);
		if (success) {
			createDefaultMemoryBlocks(prog, importerLanguage, log);
		}
	}
	finally {
		if (!success) {
			prog.release(consumer);
			prog = null;
		}
	}
	List<Program> results = new ArrayList<Program>();
	if (prog != null) {
		results.add(prog);
	}
	return results;
}
 
Example 11
Source File: FSBActionManager.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private boolean doOpenProgramFromFile(FSRL fsrl, String suggestedDestinationPath,
		ProgramManager programManager, TaskMonitor monitor) {

	Object consumer = new Object();
	Program program = ProgramMappingService.findMatchingProgramOpenIfNeeded(fsrl, consumer,
		programManager, ProgramManager.OPEN_CURRENT);

	if (program == null) {
		return searchProjectForMatchingFileOrFail(fsrl, suggestedDestinationPath,
			programManager, monitor);
	}

	program.release(consumer);
	return true;
}
 
Example 12
Source File: MultipleProgramsStrategy.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public List<Program> handlePrograms(List<Program> programs,
        Object consumer) {
    if (programs != null && programs.size() > 1) {
        for (Program program : programs) {
            program.release(consumer);
        }
        throw new MultipleProgramsException();
    }
    return programs;
}
 
Example 13
Source File: MultiProgramManager.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
		public void domainFileObjectReplaced(DomainFile file, DomainObject oldObject) {

			/** 
			 * Special handling for when a file is checked-in.  The existing program has be moved
			 * to a proxy file (no longer in the project) so that it can be closed and the program
			 * re-opened with the new version after the check-in merge.
			 */

			if (!programMap.containsKey(oldObject)) {
				return;
			}
			Element dataState = null;
			if (currentInfo != null && currentInfo.program == oldObject) {
				// save dataState as though the project state was saved and re-opened to simulate
				// recovering after closing the program during this swap
				dataState = tool.saveDataStateToXml(true);
			}
			OpenProgramTask openTask = new OpenProgramTask(file, -1, this);
			openTask.setSilent();
//			OpenDomainFileTask openTask = new OpenDomainFileTask(file, -1, tool, 
//					plugin, true, dataState != null ? ProgramManager.OPEN_CURRENT : ProgramManager.OPEN_VISIBLE);
			new TaskLauncher(openTask, tool.getToolFrame());
			Program openProgram = openTask.getOpenProgram();
			plugin.openProgram(openProgram,
				dataState != null ? ProgramManager.OPEN_CURRENT : ProgramManager.OPEN_VISIBLE);
			openProgram.release(this);
			removeProgram((Program) oldObject);
			if (dataState != null) {
				tool.restoreDataStateFromXml(dataState);
			}
		}
 
Example 14
Source File: VersionControlAction2Test.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindCheckoutsInSubFolder() throws Exception {

	DomainFolder rootFolder = frontEnd.getRootFolder();
	DomainFolder folder = rootFolder.createFolder("myFolder_1");
	folder = folder.createFolder("myFolder_2");

	Program p = frontEnd.buildProgram(this);
	folder.createFile("My_Program", p, TaskMonitor.DUMMY);
	p.release(this);
	waitForSwing();

	GTreeNode node = getFolderNode("myFolder_1");
	assertNotNull(node);
	node = node.getChild("myFolder_2");
	assertNotNull(node);
	node = node.getChild("My_Program");
	assertNotNull(node);
	addToVersionControl(node, true);

	selectNode(getFolderNode("myFolder_1"));
	DockingActionIf action = getAction("Find Checkouts");
	performFrontEndAction(action);

	FindCheckoutsDialog dialog = waitForDialogComponent(FindCheckoutsDialog.class);
	assertNotNull(dialog);

	final GTable table = findComponent(dialog.getComponent(), GTable.class);
	assertNotNull(table);
	waitForBusyTable(table);

	FindCheckoutsTableModel model = (FindCheckoutsTableModel) table.getModel();

	assertEquals(1, model.getRowCount());
	CheckoutInfo checkoutInfo = model.getRowObject(0);
	DomainFile file = checkoutInfo.getFile();
	DomainFolder parent = file.getParent();
	assertEquals("/myFolder_1/myFolder_2", parent.getPathname());
	pressButtonByText(dialog, "Dismiss");
}
 
Example 15
Source File: PrelinkFileSystem.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public Program getProgram(GFile file, LanguageService languageService, TaskMonitor monitor,
		Object consumer) throws Exception {
	Long offset = fileToMachoOffsetMap.get(file);
	if (offset == null) {
		return null;
	}
	MachHeader machHeader =
		MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider, offset, true);
	LanguageCompilerSpecPair lcs = MacosxLanguageHelper.getLanguageCompilerSpecPair(
		languageService, machHeader.getCpuType(), machHeader.getCpuSubType());
	Program program =
		new ProgramDB(file.getName(), lcs.getLanguage(), lcs.getCompilerSpec(), consumer);
	int id = program.startTransaction(getName());
	boolean success = false;
	try {
		FileBytes fileBytes = MemoryBlockUtils.createFileBytes(program, provider, offset,
			provider.length() - offset, monitor);
		ByteProvider providerWrapper =
			new ByteProviderWrapper(provider, offset, provider.length() - offset);
		MachoProgramBuilder.buildProgram(program, providerWrapper, fileBytes, new MessageLog(),
			monitor);
		program.setExecutableFormat(MachoLoader.MACH_O_NAME);
		program.setExecutablePath(file.getPath());

		if (file.equals(systemKextFile)) {
			processSystemKext(languageService, program, monitor);
		}

		success = true;
	}
	catch (Exception e) {
		throw e;
	}
	finally {
		program.endTransaction(id, success);
		if (!success) {
			program.release(consumer);
		}
	}
	return program;
}
 
Example 16
Source File: CreateDomainObjectTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private static void buildTree(Project proj, String folderName) throws Exception {
	DomainFolder df = proj.getProjectData().getRootFolder();

	DomainFolder f = df.createFolder(folderName);
	DomainFolder f2 = f.createFolder("X");
	DomainFolder f3 = f.createFolder("Y");
	DomainFolder f4 = f.createFolder("Z");

	PluginTool t = new DummyTool("Tool1");

	Program p1 = null;
	Program p2 = null;
	Program p3 = null;
	Program p4 = null;
	Program p5 = null;
	try {

		p1 = createDefaultProgram("Test", ProgramBuilder._TOY, t);
		p2 = createDefaultProgram("Test", ProgramBuilder._TOY, t);
		p3 = createDefaultProgram("Test", ProgramBuilder._TOY, t);
		p4 = createDefaultProgram("Test", ProgramBuilder._TOY, t);
		p5 = createDefaultProgram("Test", ProgramBuilder._TOY, t);

		f.createFile("AAA", p1, null);
		f.createFile("BBB", p2, null);
		f2.createFile("CCC", p3, null);
		f3.createFile("DDD", p4, null);
		f4.createFile("EEE", p5, null);
	}
	finally {
		if (p1 != null) {
			p1.release(t);
		}
		if (p2 != null) {
			p2.release(t);
		}
		if (p3 != null) {
			p3.release(t);
		}
		if (p4 != null) {
			p4.release(t);
		}
		if (p5 != null) {
			p5.release(t);
		}
	}
}
 
Example 17
Source File: VersionControlAction1Test.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Test
public void testFindMyCheckouts() throws Exception {
	doCreateVersions();

	DomainFolder rootFolder = frontEnd.getRootFolder();
	DomainFolder folder = rootFolder.createFolder("myFolder_1");
	folder = folder.createFolder("myFolder_2");
	Program p = frontEnd.buildProgram(this);
	folder.createFile("My_Program", p, TaskMonitor.DUMMY);
	p.release(this);

	GTreeNode node = getFolderNode("myFolder_1");
	assertNotNull(node);
	node = node.getChild("myFolder_2");
	assertNotNull(node);
	node = node.getChild("My_Program");
	assertNotNull(node);
	addToVersionControl(node, true);

	GTreeNode rootNode = frontEnd.getRootNode();
	selectNode(rootNode);
	DockingActionIf action = getAction("Find Checkouts");
	performFrontEndAction(action);

	FindCheckoutsDialog dialog = waitForDialogComponent(FindCheckoutsDialog.class);
	assertNotNull(dialog);

	final GTable table = findComponent(dialog.getComponent(), GTable.class);
	assertNotNull(table);
	waitForBusyTable(table);

	FindCheckoutsTableModel model = (FindCheckoutsTableModel) table.getModel();

	assertEquals(2, model.getRowCount());
	assertEquals(4, model.getColumnCount());

	DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
	DockingActionIf checkInAction = getAction("CheckIn");
	assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
	assertFalse(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));

	// make a selection in the table
	selectInTable(table, node);
	assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
	assertTrue(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));

	CheckoutInfo checkoutInfo = model.getRowObject(0);
	DomainFile file = checkoutInfo.getFile();
	DomainFolder parent = file.getParent();
	assertEquals("/myFolder_1/myFolder_2", parent.getPathname());
	pressButtonByText(dialog, "Dismiss");
}
 
Example 18
Source File: MSLibBatchImportWorker.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void importLibrary(DomainFolder currentLibraryFolder, File file, MessageLog log)
		throws CancelledException, DuplicateNameException, InvalidNameException,
		VersionException, IOException {
	try (RandomAccessByteProvider provider = new RandomAccessByteProvider(file)) {
		if (!CoffArchiveHeader.isMatch(provider)) {
			return;
		}
		CoffArchiveHeader coffArchiveHeader =
			CoffArchiveHeader.read(provider, TaskMonitor.DUMMY);
		HashSet<Long> offsetsSeen = new HashSet<Long>();
		for (CoffArchiveMemberHeader archiveMemberHeader : coffArchiveHeader.getArchiveMemberHeaders()) {
			if (offsetsSeen.contains(archiveMemberHeader.getPayloadOffset())) {
				continue;
			}
			offsetsSeen.add(archiveMemberHeader.getPayloadOffset());
			if (archiveMemberHeader.isCOFF()) {
				try (ByteProvider coffProvider = new ByteProviderWrapper(provider,
					archiveMemberHeader.getPayloadOffset(), archiveMemberHeader.getSize())) {
					CoffFileHeader header = new CoffFileHeader(coffProvider);
					if (CoffMachineType.isMachineTypeDefined(header.getMagic())) {
						String preferredName = archiveMemberHeader.getName();

						Pair<DomainFolder, String> pair =
							getFolderAndUniqueFile(currentLibraryFolder, preferredName);

						List<Program> programs = AutoImporter.importFresh(coffProvider,
							pair.first, this, log, monitor, LOADER_FILTER, LOADSPEC_CHOOSER,
							pair.second, OptionChooser.DEFAULT_OPTIONS,
							MultipleProgramsStrategy.ONE_PROGRAM_OR_EXCEPTION);

						if (programs != null) {
							for (Program program : programs) {
								println("Imported " + program.getDomainFile().getPathname());
								DomainFile progFile = program.getDomainFile();

								program.release(this);

								if (!progFile.isVersioned()) {
									progFile.addToVersionControl(initalCheckInComment, false,
										monitor);
								}

							}
						}
					}
				}
			}
		}
	}
	catch (CoffException e) {
		//TODO
	}
}
 
Example 19
Source File: AbstractProgramLoader.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public final List<DomainObject> load(ByteProvider provider, String name, DomainFolder folder,
		LoadSpec loadSpec, List<Option> options, MessageLog messageLog, Object consumer,
		TaskMonitor monitor) throws IOException, CancelledException, InvalidNameException,
		DuplicateNameException, VersionException {

	List<DomainObject> results = new ArrayList<>();

	if (!loadSpec.isComplete()) {
		return results;
	}

	List<Program> programs =
		loadProgram(provider, name, folder, loadSpec, options, messageLog, consumer, monitor);

	boolean success = false;
	try {
		monitor.checkCanceled();
		List<Program> programsToFixup = new ArrayList<>();
		for (Program loadedProgram : programs) {
			monitor.checkCanceled();

			applyProcessorLabels(options, loadedProgram);

			loadedProgram.setEventsEnabled(true);

			// TODO: null should not be used as a determinant for saving; don't allow null 
			// folders?
			if (folder == null) {
				results.add(loadedProgram);
				continue;
			}

			if (createProgramFile(loadedProgram, folder, loadedProgram.getName(), messageLog,
				monitor)) {
				results.add(loadedProgram);
				programsToFixup.add(loadedProgram);
			}
			else {
				loadedProgram.release(consumer); // some kind of exception happened; see MessageLog
			}
		}

		// Subclasses can perform custom post-load fix-ups
		postLoadProgramFixups(programsToFixup, folder, options, messageLog, monitor);

		success = true;
	}
	finally {
		if (!success) {
			release(programs, consumer);
		}
	}

	return results;
}
 
Example 20
Source File: GFileSystemLoadKernelTask.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void loadKext(GFile file, TaskMonitor monitor) throws Exception {
	if (file.getLength() == 0) {
		return;
	}
	if (!file.getName().endsWith(".kext")) {
		return;
	}
	monitor.setMessage("Opening " + file.getName());

	Program program = ProgramMappingService.findMatchingProgramOpenIfNeeded(file.getFSRL(),
		this, programManager, ProgramManager.OPEN_VISIBLE);
	if (program != null) {
		program.release(this);
		return;
	}

	//File cacheFile = FileSystemService.getInstance().getFile(file.getFSRL(), monitor);

	if (file.getFilesystem() instanceof GFileSystemProgramProvider) {
		LanguageService languageService = DefaultLanguageService.getLanguageService();

		GFileSystemProgramProvider fileSystem =
			(GFileSystemProgramProvider) file.getFilesystem();
		program = fileSystem.getProgram(file, languageService, monitor, this);
	}

	if (program != null) {
		try {
			DomainFolder folder = ProjectDataUtils.createDomainFolderPath(
				AppInfo.getActiveProject().getProjectData().getRootFolder(),
				file.getParentFile().getPath());
			String fileName = ProjectDataUtils.getUniqueName(folder, program.getName());

			GhidraProgramUtilities.setAnalyzedFlag(program, true);
			ImporterUtilities.setProgramProperties(program, file.getFSRL(), monitor);

			folder.createFile(fileName, program, monitor);

			programManager.openProgram(program);
			ProgramMappingService.createAssociation(file.getFSRL(), program);
		}
		finally {
			program.release(this);
		}
	}
}