Author Topic: How Can You Lose Source Code?  (Read 366 times)

StephenArdrey

  • Guest
How Can You Lose Source Code?
« on: May 15, 2012, 08:31:06 AM »
I am not talkin about the Akella V. RWS problem. I am more or less talking about games like Leisure Suit Larry and Panzer Dragoon Saga. Understand, that programming isn't my medium. I can understand how film can be lost, unsaved documents can be lost, so why can't you pull the source code from an existing copy of a game?

MrDownerup

  • Administrator
  • God Like
  • *****
  • Posts: 654
  • Also? I can kill you with my brain.
    • View Profile
    • RWS
Re: How Can You Lose Source Code?
« Reply #1 on: May 15, 2012, 09:39:54 AM »
could be a few variables. engine may not be designed to reverse compile,and sometimes source is hidden for security reasons.(protect from hackers,cheaters,etc)
-MrD

StephenArdrey

  • Guest
Re: How Can You Lose Source Code?
« Reply #2 on: May 15, 2012, 10:53:59 AM »
could be a few variables. engine may not be designed to reverse compile,and sometimes source is hidden for security reasons.(protect from hackers,cheaters,etc)

Alright, I can understand that but I guess the missing componant in my mind is that if you have something, a game for instance, and why would you put such complex security in a game before hackers and security was an issue?

FaTony

  • God Like
  • *****
  • Posts: 561
  • Criticus
    • View Profile
Re: How Can You Lose Source Code?
« Reply #3 on: May 15, 2012, 10:55:57 AM »
Assembly language and high level languages are very different from each other.

Assembly languages are tied to specific processor architecture (registers, stack, instruction set).

High level languages usually operate on the concept of Turing complete virtual machine which usually has gaps in terms of low level processing. This allows high level languages to be independent from hardware and the code to be able to run on different operating systems without change.

During the compilation most abstractions are broken and converted into specifics of hardware. This operation is irreversible.

Therefore, by careful analysis of binary you can get a basic idea of how code operates but it will never give you a clean source code (except of very trivial cases).

Think of source code as a sheet music for orchestra with lots of composer's remarks in it and exe as a particular recording. It will take a lot of hours of talented musician to "reverse engineer" recording into clean sheets. And it will probably miss a few instruments in it. Sometimes, it's not worth it.

Some example would be this:
Code: [Select]
//Some very important constants:
#define MY_FIRST_CONSTANT 5
#define MY_SECOND_CONSTANT 2

...

a = a + MY_FIRST_CONSTANT + MY_SECOND_CONSTANT;

...

When compiled for x86 this may produce something like:
Code: [Select]
add eax, 7
Whoever will try to reverse engineer this will probably scratch his head and ask "What the hell does 7 mean? Where did it come from?"
« Last Edit: May 15, 2012, 11:20:28 AM by FaTony »

StephenArdrey

  • Guest
Re: How Can You Lose Source Code?
« Reply #4 on: May 15, 2012, 12:18:43 PM »
Assembly language and high level languages are very different from each other.

Assembly languages are tied to specific processor architecture (registers, stack, instruction set).

High level languages usually operate on the concept of Turing complete virtual machine which usually has gaps in terms of low level processing. This allows high level languages to be independent from hardware and the code to be able to run on different operating systems without change.

During the compilation most abstractions are broken and converted into specifics of hardware. This operation is irreversible.

Therefore, by careful analysis of binary you can get a basic idea of how code operates but it will never give you a clean source code (except of very trivial cases).

Think of source code as a sheet music for orchestra with lots of composer's remarks in it and exe as a particular recording. It will take a lot of hours of talented musician to "reverse engineer" recording into clean sheets. And it will probably miss a few instruments in it. Sometimes, it's not worth it.

Some example would be this:
Code: [Select]
//Some very important constants:
#define MY_FIRST_CONSTANT 5
#define MY_SECOND_CONSTANT 2

...

a = a + MY_FIRST_CONSTANT + MY_SECOND_CONSTANT;

...

When compiled for x86 this may produce something like:
Code: [Select]
add eax, 7
Whoever will try to reverse engineer this will probably scratch his head and ask "What the hell does 7 mean? Where did it come from?"

Oddly enough, this makes sense to me. It's kind of like the difference between a rough cut, directors cut, and theatrical cuts on films and in writing except it's more structured.

 

Username:
Password:
Session: