Page 1 of 1

Create EXE?

Posted: Thu Oct 30, 2008 6:26 pm
by sharkbate24
Hello everyone,

I want to have a go at making an Update Patcher, where the user can create patches for his program / game. I want to know how I can go abouts creating an EXE file from a program I create, after the user presses a button?

Thanks everyone.

Posted: Thu Oct 30, 2008 6:47 pm
by ts-soft

Code: Select all

OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 50, "PatchCreater", #PB_Window_SystemMenu)
CreateGadgetlist(WindowID(0))
ButtonGadget(0, 10, 10, 80, 30, "create")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow : Break
    Case #PB_Event_Gadget
      If EventGadget() = 0
        If CreateFile(0, "Patcher.exe")
          For i = 0 To 1000
            WriteLong(0, Random(999999))
          Next
          CloseFile(0)
          MessageRequester("PatchCreater", "Patch successfull created")
          End
        EndIf
      EndIf
  EndSelect
ForEver

Posted: Thu Oct 30, 2008 6:49 pm
by Kaeru Gaman
@ts

I thought tomorrow was All Hallows Eve, not April Foolz...

Posted: Thu Oct 30, 2008 10:14 pm
by DoubleDutch
sharkbate24:
I think this may solve the problem:
http://kobik.net/codefusion.asp

Posted: Fri Oct 31, 2008 4:16 am
by Rook Zimbabwe
Kaeru Gaman wrote:@ts

I thought tomorrow was All Hallows Eve, not April Foolz...
Not true... if he runs that code enough times... one time he will have FALLOUT 3 the complete version...

It may take a while what with the randomness and all... :D

Posted: Fri Oct 31, 2008 9:46 am
by DoubleDutch
Sorry Rook, your wrong...

Fallout3 will be larger than 4KB ;)

(plus a larger random number [-1?] would be needed)

Posted: Fri Oct 31, 2008 2:56 pm
by Joakim Christiansen
Well, he probably want to include a exe and then extract it...
Like this:

Code: Select all

DataSection
  ExeFile: IncludeBinary "whatever.exe"
  DataEnd:
EndDataSection 

If CreateFile(0,"whatever.exe")
  WriteData(0,?ExeFile,?DataEnd-?ExeFile)
  CloseFile(0)
EndIf

Posted: Fri Oct 31, 2008 3:17 pm
by DoubleDutch
After re-reading the first post I think your right - I though he wanted a system that could create the patch files (in which case http://kobik.net/codefusion.asp would do the job).

Posted: Fri Oct 31, 2008 3:38 pm
by rsts
Based on the announcement, that seems to be correct.

Posted: Fri Oct 31, 2008 5:32 pm
by sharkbate24
rsts wrote:Based on the announcement, that seems to be correct.
Yeah, basically I did it another way, rather than create an EXE. I'd like to know how to create an exe with the users input though, but I guess it would be hard?

Thanks.

Posted: Fri Oct 31, 2008 8:36 pm
by Rook Zimbabwe
OK 1 clue... LINKERs.

One way to make a program run in the old days was to use a LINKER at the end... OK my swiss cheese brain may be miscalling it but most BASIC compilers back in the day only had a small startup piece and then the basic code and then the tiny linker/COM runner at the end to run it!

If I am remembering correctly!

:D