Log in

View Full Version : Reversing few parts from a guitar program


opeth
April 4th, 2005, 00:15
Hello,

First time in here. Anyways, I've been a programmer by hobby for a few years and now I've got a new hobby - guitar playing and there's this program called XXXXXXXXX, which makes us all happy reading the guitar tablatures in it for the simplicity and midi playback. Having myself about 30,000+ tabs and knowing not 3% of them I would like to be able to write a program that would do this "Find all tabs that have a 3/6 time signature in it" or "All tabs that don't have percussion track" or even "All tabs that have 7 string guitars tuned woth F", etc. Since the tab format is not known to me (I've searched wotsit and other sources with no luck) I decided I'd go the hardway - Reverse the binary. Judging from the mistakes XXXXXXXX programmer did in earlier versions, I can only deduce he uses very simple file format containing a raw midi copy inside of the file and with guitar pro's specifics in the header. With a few searching, I was able to tell the binary was done with Delphi (or BCPPBuilder, I'm running to bed, will check it tomorrow for sure!). I also downloaded Dafixer's delphi decompiler (DeDe) version 3.50.04. However, it hangs during the extended analysis

I'm not trying to crack guitar pro's as I bought my copy....but since the author himself doesn't do the features I asked neither does he provided me a format spec for the tabs... I've to go the hardway... I've also roughly read the F.A.Q but I hope I'm not crossing the line with the questions I'm about to ask.

1. Where can I find decent information on examining delphi files?
2. I know I shouldn't ask this (or should I, in either way, you're free not to answer any questions - that's how boards work like =)), but is there any tool that works similar to DeDe? I've found DeDe a bit workdemanding to manage the binaries (not a lot of search options, for example)

Thanks for any info and keep rocking \m/

Kayaker
April 6th, 2005, 00:14
Hi

That's an ambitious project you've got there, adding some sort of search capabilities for tab files. As a long time fan of .tab files myself I can see that as being quite useful, even as a standalone app that recognizes this particular file format.

You might be able to use the fact that GP can convert its .G** tab files to raw MIDI format (I believe, it's been a while since I've used it so correct me if I'm wrong). I looked at a couple of the files, they may not follow the standard midi format at all, though some similar information must be encrypted in the patterns. If you can isolate the conversion of the unknown format to the -> known, defined, standard MIDI SMF format, you might have a way of identifying some of the bits and pieces.

You might look at the MIDI SMF file format at any good midi site for an overview. Briefly, MIDI files are organized into data chunks. The file begins with a Header Chunk, identified by "MThd" (0x4D546864), followed by variable sized offsets to data such as Format Type, Number of Tracks, Time Division. Then there follows 1 or more Track Chunks, "MTrk" (0x4D54726B). Each track contains more variable length data to MIDI Events, which define every other aspect of the tune being played, notes, tempo, pitch, controller effects, instrument name, copyright info., etc, etc.


There's probably a few ways to approach it. If GP can import raw MIDI files and convert to its own format, then you can create your own very small *known* .mid file and compare it to the .g** format(s). If you're keen you can "write" your own basic 1 track .mid file manually in a hex editor (or programatically). It's not that hard to do, you'd have complete control of the changes you make and you could create a basic skeleton, say a 4 note piano riff, in about 60 bytes. You could synth it live or with a program as well, also a good way to study the midi format.

If you can break and trace from when GP reads the raw midi file, you can pull out more information that way. When a *.g** file is opened, GetFilePointer might be used to offset where it should start reading the file for each type of output relevant to the music portion of the info, Filemon should clearly indicate this.


As for the rest, DeDe is what you want to use if you can, with or without IDA. If you can't use DeDe, then the other tools come into play, an API monitor, a good window spy (DPeeper used to be a very good Delphi spy, unfortunately never updated to new Delphi versions).

For Delphi specific reversing, in terms of understanding some of its structure, there are a couple of classic tuts on the old Fravia's site linked below.


Good luck with it and let us know what you discover.

Cheers,
Kayaker