Author Topic: Experience with decompilers with OS/2 programs  (Read 402 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 323
  • -Receive: 62
  • Posts: 2112
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Experience with decompilers with OS/2 programs
« on: January 10, 2019, 03:23:14 pm »
Hi

Does anybody has experience with decompiler software (under any platform) and trying to decompile OS/2 programs ?
I had found some developers that no longer has the source code (lost in HDD crash) of his OS/2 programs and game permission to release his binaries as public domain with permission to decompile.

But my question is if something useful or something that can help recreate the source code of the program can be produced with decompilers. Is there any experience ?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Ian Manners

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 36
  • -Receive: 25
  • Posts: 299
  • I am the computer, it is me.
    • View Profile
    • ComKal Networks Australia
Re: Experience with decompilers with OS/2 programs
« Reply #1 on: January 10, 2019, 05:09:04 pm »
Hi Martin,

I use to assemble assembly code, and disassemble binaries in the 80's and 90's to assembly language code, doing a quick search there appears to be binary disassemblers to .net and a few other languages but they would still likely require work on the produced code for data segments etc. They would certainly be better than nothing and give a good starting point to having code, even if it is a skeleton, that you could check and cleanup to produce a working compiled program again. Likely you would decompile under Linux or Windows, then compile under OS/2.
Cheers
Ian B Manners

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 117
  • Posts: 1730
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #2 on: January 10, 2019, 06:59:38 pm »
The NSA is supposed to be releasing quite a good disassembler. https://duckduckgo.com/?q=nsa+disassembler&t=seamonkey&ia=web.
There are some available for OS/2, http://hobbes.nmsu.edu/h-search.php?button=Search&key=disassembler&dir=%2F

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 323
  • -Receive: 62
  • Posts: 2112
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Experience with decompilers with OS/2 programs
« Reply #3 on: January 10, 2019, 10:10:27 pm »
Thanks for the replies.

I would like to see what does a decompile of a PM application looks like just to see if something useful can came out.
I prefer if C or C++ can be generated.  I want to try  "Vincent_Greene_Screen_Saver"  just as an experiment.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 117
  • Posts: 1730
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #4 on: January 10, 2019, 11:12:19 pm »
Unluckily, I can't imagine there is any disassemblers that will output C or CPLUS that is aware of the PM functions. Strictly speaking, a disassembler outputs assembly language, hopefully with generic labels and such. While possible to output C, it would probably take quite a bit of manual intervention by a knowledgeable programmer to get something that looks useful rather then just capable of being re-compiled. IDA does seem to have its own C type language that it uses.
The NSA tool could be pretty powerful and who knows, it might even support disassembling OS/2 as the NSA is interested in looking at everything.
Usually, I believe, disassemblers are mostly used for things like removing shareware limits and other types of copyright protection as well as fixing bugs. The more complex stuff you want to do, the more knowledgeable you need to be.

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 8
  • -Receive: 0
  • Posts: 194
  • Greetings. I come in peace (for OS/2 things only).
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #5 on: January 11, 2019, 04:31:18 am »
Unluckily, I can't imagine there is any disassemblers that will output C or CPLUS that is aware of the PM functions. Strictly speaking, a disassembler outputs assembly language, hopefully with generic labels and such. While possible to output C, it would probably take quite a bit of manual intervention by a knowledgeable programmer to get something that looks useful rather then just capable of being re-compiled. IDA does seem to have its own C type language that it uses.
The NSA tool could be pretty powerful and who knows, it might even support disassembling OS/2 as the NSA is interested in looking at everything.
Usually, I believe, disassemblers are mostly used for things like removing shareware limits and other types of copyright protection as well as fixing bugs. The more complex stuff you want to do, the more knowledgeable you need to be.

I agree.  I've worked on various disassembly / decompilation projects, and they require a degree of art.  For some things you can automate because you can examine the output of various compilers that would've been used and determine some patterns for things in the binary code, and back into what it would've been like in source code to make it be that way.  But you still need variable names, function names, assign meaning to things, and all of that is a comprehensive search for a mindset of the developer.

You must remember also that there are times we have the source code from a developer and it's still hard to follow along with what they were thinking... well how much moreso through an optimizing compiler's application.

Disassembly / decompilation / reverse engineering ... I'd say it's an art, nothing less.  I too am curious to see the NSA software.  It may have whole new techniques that would be wonderful.
--
Rick C. Hodgin

Lars

  • Sr. Member
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 33
  • Posts: 314
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #6 on: January 11, 2019, 08:09:35 am »
A disassembler that also exists as an OS/2 port is here:
http://hobbes.nmsu.edu/download/pub/os2/dev/asm/ida35b.zip

However, by now, the Windows Version of the same tool is much more sophisiticated:
https://www.hex-rays.com/products/ida/

I have used this tool in the past and it works. However, as its name says, it creates x86 assembler code from an object file/executable binary which is pretty straightforward as there is a 1:1 match between a machine instruction and an assembly instruction.

Martin, what you are asking for is a decompiler. The problem with that is that there is no 100 % reversal of the compilation process without any additional knowledge of the target OS and the object libraries used in the compilation process (for example, the names of the used API functions).
Also I can imagine, in particular for heavily optimized code, that it is difficult to reconstruct C/C++ code as for example variables might have been optimized away (placed into a register) etc. which often makes it difficult to understand what the code was supposed to do initially.
In other words: you might get C/C++ code out of a decompilation process but you will have no clue of what it is supposed to do.

I know of no decompiler for OS/2.
« Last Edit: January 11, 2019, 08:12:23 am by Lars »

Lars

  • Sr. Member
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 33
  • Posts: 314
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #7 on: January 11, 2019, 08:20:06 am »
Regarding decompiler, I found this:

https://www.hex-rays.com/products/decompiler/

While it only exists as a Windows program, it is still possible that it can decompile an OS/2 executable. It all depends on which object formats it supports. However it is not for free and I cannot say anything about the readability of the generated C/C++ source code.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 323
  • -Receive: 62
  • Posts: 2112
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Experience with decompilers with OS/2 programs
« Reply #8 on: January 11, 2019, 04:23:19 pm »
Thanks for your comments.

I understand better now what to expect of using a decompiler or dissasembler. It can be useful to get understand a behavior or have general information of the binary.  I will do some testing, but now I have a better understanding to what to expect.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Olafur Gunnlaugsson

  • Full Member
  • ***
  • Thank You
  • -Given: 28
  • -Receive: 8
  • Posts: 127
    • View Profile
Re: Experience with decompilers with OS/2 programs
« Reply #9 on: January 12, 2019, 05:34:09 pm »
Regarding decompiler, I found this:

https://www.hex-rays.com/products/decompiler/

While it only exists as a Windows program, it is still possible that it can decompile an OS/2 executable. It all depends on which object formats it supports. However it is not for free and I cannot say anything about the readability of the generated C/C++ source code.

This used to be a native OS/2 program originally (IDA pro), and is available for the Mac and Linux in addition to Windows. It has excellent OS/2 support still (decompilation that is, it no longer runs on OS/2), but keeps getting more expensive by the year. The starter package is now just under 1000 USD. I had a license at one point but let it lapse due to cost reasons.