FMX.Decompiler.1

Currently I work on a decompiler for .fmx files, which are compiled Oracle Forms applications. Such applications can be built by Oracle Form Builder, which stores .fmb files (uncompiled) and .fmx files (compiled).

Why I need that? We use Oracle Forms since a lot of years (Forms6 ++) and we have thousends of commits within our Subversion for our Forms applications. But for some old applications we only have the .fmx files and we cannot find the associated .fmb. The application can still be used, but it is not possible to enhance or bugfix it. To rescue such applications, it would be helpful to get the definitions from the .fmx.

Search

Google returns only posts, where people need such a decompiler too, but nobody has a solution. Seems to be undiscovered country. Or, Oracle suppress such a knowledge. Hm, seems to be a home improvement project.

Idea

FMX files are used by the Oracle Forms Runtime but also by an Java based client/server architecture. So I think, the .fmx files contain the description of the application, but no executable code for a specific platform. So it should be possible to decompile it and restore the former .fmb.

Show it in Hex

I have load a simple .fmx file into a hex-editor. Currently I use DHex. The file contains plaintext structures like names for windows, canvases, recordgroups and so on. So the first try confirms my presumption, there are descriptions and no executable code.

Install GXT Development Environment

1. Download and install an JDK7+
2. Download Eclipse 4.5 (Mars) as J2EE bundle
3. uncompress the TAR into a folder, where the developer has access
4. start Eclipse

Maven

1. Download and install Maven in the same version as delivered with Eclipse
2. add M2_HOME, MAVEN_OPTS and JAVA_HOME to ~/.profile
3. create a file settings.xml within ~/.m2 folder

Within Eclipse:

1. Open Marketplace and install Subversive 3.0.0 and Eclipse Color Theme 1.0.0
2. Open Marketplace and install Google Plugin for Eclipse 4.3 (4.5 doesn’t exist?)
3. open SVN perspective and download all SVN Connectors
4. Install SCM connectors in the m2e Marketplace (i.e. m2e for Subversive)

I use Native JavaHL 1.8.14 as connector, you have to install “javahl” on your operating system. Set the connector within the Preferences->Team->SVN. Set svn+ssh, which will use the local .ssh/config file.

5. Configure your SVN repository within Eclipse
6. checkout the Master project as Maven project
7. Checkout the Server parent project as Maven project (you need the m2e connector to get the context menu item)
8. Checkout the UI parent project

9. change the presentation of the Project Explorer content to hierarchical.

Operating System

1. Download Glassfish 3.1
2. Install it into an empty folder, which is user-accessible

Eclipse

1. Create a new server
2. Server-Type Glassfish 3.1 (download additional server adapters if necessary, Preferences->Server->Runtime-Environments)
3. Use settings from Glassfish installation (admin, domain, ports)

Operating System

1. Download the GXT version which match the current GWT plugin version (GWT 2.6.0 -> GXT 2.3.1.a)
2. create a named user library for the GXT version and link it to the downloaded JAR files
3. add the user library to the project build path (UI project)

Using tcpdump to check network traffic


tcpdump -nnvvS host <ip-address>

To look into the data packet add the -X switch:


tcpdump -nnvvXS host <ip-address>

Convert DVDs

A nice tutorial in German is available on http://www.selflinux.org/selflinux/html/dvd-rippen.html.

Use SSH keys

To access an SSH server you should always use keys instead of simple passwords. Generate your keypair with PuttyGen and save your private and public key part. On Windows you can use the private part with PageAnt to provide access to the SSH server without entering a passphrase. On the SSH server store your public part within the .ssh/authorized_keys file. But don’t use the Putty-generated public part, you have to copy and paste the OpenSSH format of the public key from the PuttyGen window.

If you need your private key on a Linux client to access the SSH server, you cannot use the Putty-generated private part. You will also need an OpenSSH format. This format you can export with the menu Conversions -> Export OpenSSH key. Store your OpenSSH key as id_rsa or id_dsa file and put it into the .ssh folder of the user. Both files will be used by the SSH client (the possible file names you can find on /etc/ssh/ssh_config as IdentityFile property). If you cannot use these file names, you can also store the private key with another name, but you have to define a config section for the SSH server in ~/.ssh/config:


#
# default:
# .ssh/identity
# .ssh/id_rsa
# .ssh/id_dsa
#
host name_ssh_server
Hostname full-qualified.ssh.server.name
Port 22
IdentityFile ~/.ssh/you_own_private_key_name
ForwardX11 no

You can now access the server “name_ssh_server” with

ssh username@name_ssh_server

which will use “full-qualified.ssh.server.name” on port 22. The private key file is accessible on ~/.ssh/you_own_private_key_name (file permissions 600!) and should match with an authorized public key on the SSH server.

Access to Ant properties from IzPack XML

Inside the installation XML the access to Ant properties per

@{ant.property.name}

will only work, if you insert the whole XML content as CDATA into the build.xml

<IzPack output="${dist.dir}/IzPack-install.jar"
        installerType="standard"
        basedir="${dist.dir}"
        IzPackDir="${dist.dir}/">
        <config><![CDATA[
<installation version="1.0">
   <info>
      <appname>@{my.app.name.defined.in.build.xml}</appname>
      ...
   </info>
...
        ]]></config>
</IzPack>

If you use different files, the properties are unknown within the IzPack file. But there is a simple solution: Copy the install.xml into a temporary file and expand the properties during this step.

<target name="installer" depends="jar" description="compiles the IzPack installer">
	<copy overwrite="yes" verbose="yes" file="${dir.install}/izpack/install-definition.xml" tofile="${java.io.tmpdir}/install-definition.xml">
		<filterchain>
			<expandproperties />
		</filterchain>
	</copy>
	<IzPack input="${java.io.tmpdir}/install-definition.xml" output="${dir.dest}/${app.name}-install.jar" installerType="standard" basedir="${basedir}" />
</target>

So you can use ${app.name} inside the install.xml (don’t use @{app.name}). But you shouldn’t use Ant properties, which are redefined by IzPack itself or in a <variable> tag section. These properties are expanded before Ant calls IzPack and could contain the wrong values.

Special characters within IzPack XML

If you need some defined XML entities like é within the IzPack installation XML, you can’t use it there. The reason: they aren’t defined. But you can define a subset within your XML:

  <?xml version="1.0" encoding="iso-8859-1" ?>
  <!DOCTYPE installation [
  <!ENTITY % iso-lat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
                    "http://www.oasis-open.org/docbook/xmlcharent/0.3/iso-lat1.ent">
  %iso-lat1;
  ]>
  <installation version="1.0">
    <!-- start here -->
  </installation>

These additional lines include the usual entities. It is now possible to use:

  <authors>
    <author name="Andr&eacute; Rothe" email="andre.rothe@domain.local" />
  </authors>

Safe copy of directories

Use


rsync -avx --progress /source/ /dest

to copy the complete content of /source into /dest, the source folder itself wont be copied (trailing /). Remove the slash and you will copy the /source folder and its content into /dest.

Use


rsync -avx --progress /source/ user@remote-host:port/dest

for syncronization between workstations.

Code Formatter Eclipse

Today I had the problem, that I had installed a new Eclipse on my workstation, but I forgot the code style configuration at home. I tried to connect per SSH, but I have no X server on the machine at home. So I cannot run Eclipse to export the configuration as XML. But there is a simple solution for that, copy the information from the right configuration file.

You can find the formatter profiles in the file

/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

There is a very long line starting with org.eclipse.jdt.ui.formatterprofiles, which you can copy to your local installation. Close your Eclipse and restart it after the change and you will find the new formatter in the drop-down-list within the preferences.

The better way would be to export the formatter definitions as XML within Eclipse and check-in the file into your Subversion/Git.

A two way sync between Git and SVN

  • Create a GIT repository on GitHub.com.
  • Create a local repository from the GitHub repository

Use your SSH-Key (uploaded to GitHub.com)!

$ git clone git@github.com:witchi/PHP-SQL-Parser.git

  • switch to the new repository directory
  • Create a SVN tracking branch, which contains all the SVN changes


$ cd PHP-SQL-Parser
$ git branch --no-track svnsync
$ git checkout svnsync
$ git svn init -s https://php-sql-parser.googlecode.com/svn

  • write a file which contains all SVN authors and store it as svn-authors.txt into the Git repository directory
  • fetch all revisions from SVN
  • set the HEAD of the svnsync GIT branch to the latest SVN revision


phosco@gmx.de = André Rothe <phosco@gmx.de>
greenlion = Justin Swanhart <greenlion@gmail.com>
greenlion@gmail.com = Justin Swanhart <greenlion@gmail.com>
Justin Swanhart = Justin Swanhart <greenlion@gmail.com>
(no author) = Justin Swanhart <greenlion@gmail.com>


$ git svn fetch -A svn-authors.txt
$ git reset --hard remotes/trunk

Merge changes from SVN into Git

  • go to the svnsync branch
  • get all the new revisions from the SVN repository
  • go to the master branch (Git)
  • merge all changes from svnsync into the master
  • use meld to solve merge conflicts
  • upload all changes to the GitHub repository


$ git checkout svnsync
$ git svn rebase -A svn-authors.txt
$ git checkout master
$ git merge svnsync
$ git mergetool
$ git push origin master

Merge changes from Git into SVN

  • go to the master branch of Git
  • get all changes from the Github repository
  • go to the svnsync branch
  • get all new revisions from the SVN
  • merge all Git changes from master into the svnsync branch (without fast-forward, it creates a new commit point)
  • use meld to solve merge conflicts
  • commit the changes into svnsync branch (local)
  • commit the changes to the SVN repository server (remote)


$ git checkout master
$ git pull origin master
$ git checkout svnsync
$ git svn rebase -A svn-authors.txt
$ git merge --no-ff master
$ git mergetool
$ git commit
$ git svn dcommit