Results 1 to 7 of 7

Thread: a 'small' problem with source code

  1. #1

    Thread Starter
    Addicted Member Icheb's Avatar
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    232

    a 'small' problem with source code

    A friend has asked me if it's possible to write a (.exe, compiled) program that has the ability to display its own source code (without putting it into a seperate file or into a variable that contains everything).

    I thought about it but i think if i would try it i'd still be storing everything into a variable or something...

    So is there a way to solve this ?
    The main VB routine in Windows XP (The don't admit it, they wrote it in VB)

    [vbcode]
    Public Sub Windows_Load()
    a = 1
    b = 2
    if not a + b = 2 then
    goto crash
    end if

    goto crash

    End Sub
    [/vbcode]

  2. #2
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    As you say the only way is to output every line to a file, basically duplicating your program size.

    The programs once compiled have no idea what source code created them, and does not contain the source code in any way, as the compiler rewrites them in assembler
    VB6 VS2005

  3. #3
    Lively Member ayyasaran's Avatar
    Join Date
    Feb 2001
    Location
    India
    Posts
    120

    Well...

    This is possible only in scripting languages (the love letter virus does it) such as vbscript, javascript, etc.

    In compiled programs it is not possible, I think.

    Saran.
    Keep breathing!

  4. #4

    Thread Starter
    Addicted Member Icheb's Avatar
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    232
    So then i need to make a vbscript file that displays it's source code because vbscript cannot be compiled ?

    But that is not what i was asked ...

    So do u think it's not possible ?
    The main VB routine in Windows XP (The don't admit it, they wrote it in VB)

    [vbcode]
    Public Sub Windows_Load()
    a = 1
    b = 2
    if not a + b = 2 then
    goto crash
    end if

    goto crash

    End Sub
    [/vbcode]

  5. #5
    Seth DK
    Guest

    Not possible

    I'm sorry to disappoint you, but what you are asking cannot be done!! (well - correct me if i'm wrong anyone)

    Compiled source code is ...well.... compiled and cannot be decompiled just like that.

    Some programs may partially translate the compiled code to VB code, but if this even can be done without loosing data and valuable routine data (which I doubt) it will never ever be the same as the source code you wrote yourself! All the goofy variable names and the set-up with loops etc. will be completely different and not recognisable by any means. It is also very doubtful that the functions etc. will be separated like before, if seperated at all.

    If you find out something please let me know, but I really(!!!!) doubt it!!

  6. #6

    Thread Starter
    Addicted Member Icheb's Avatar
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    232
    Ok...

    anyways... thanks for this information...

    Let's ask microsoft this :-)

    I would bet they don't know how to do it eighter ;-)
    The main VB routine in Windows XP (The don't admit it, they wrote it in VB)

    [vbcode]
    Public Sub Windows_Load()
    a = 1
    b = 2
    if not a + b = 2 then
    goto crash
    end if

    goto crash

    End Sub
    [/vbcode]

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    no need to ask MS. It is not possible.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width