BBS: Inland Empire Archive Date: 09-09-92 (08:28) Number: 218 From: LUIS ESPINOZA Refer#: NONE To: SUNNY HUGHES Recvd: NO Subj: modified EXE's Conf: (2) Quik_Bas
On (07 Sep 92) Sunny Hughes wrote to All...
SH> If I was to modify an exe in the manner that everyone has been talking
SH> about..(merging 2 EXE files) what has to be done to get the second to
SH> run
SH> once the first one has finished? Is there any extra coding needed to
SH> command the second to run? Can different languages be merged? if so
SH> what or which ones?
Now listen here Sunny,
You don't need a second EXE file to modify your program.
I posted a program a while back that demonstarted how to do this (buy
displaying how many times it has been executed). From this it would be
rather easy to add other variables, such as screen colors, User Name,
etc etc etc. I will use the same program but throw in a very good
example of how to store other variables (and make them into SUBS so
you can call them).
Luis
TYPE ExeData
Foreground as INTEGER 'You can stick other
Background as INTEGER 'variables here
Counter AS LONG
Signature AS STRING * 9 'Don't add any variables
END TYPE 'After Signature
CONST MySig$ = "LVE123168" 'Change this signature
'to suit your needs, try
'to use characters that
'are unque. But keep the
'length the same unless
'you know how to modify
'the code.
CONST ProgramName$="TEST.EXE" 'This is the name of the
'program itself. I know
'there are otherwayz of
'getting the Filename
'from the PSP, but this
'is a simple example,
'so why make it bigger?
DIM ModData AS ExeData 'make space for us
DIM SHARED Frg%,Bkg%,Cntr& 'These are the variables
'to hold the modified
'variables
GetModVariables 'Get our variables from
'the file
COLOR Frg%,Bkg%
Cntr&=Cntr&+1 'Change of counter
? ProgramName$;" has been executed ";Cntr& 'self explanatory
RANDOMIZE TIMER
Frg%=int(rnd*16 ) 'Change our other
Bkg%=int(rnd*8) 'variables.
PutModvariables
END
SUB GetModVariables 'Yes, the MEAT of it all
SHARED ModData
Fn = FREEFILE
OPEN ProgramName$ FOR BINARY AS fn
a& = LOF(1) - LEN(ModData) + 1
SEEK Fn, a&
GET Fn, , ModData
IF ModData.Signature = MySig$ THEN 'Is my signature there?
Frg% = ModData.ForeGround 'Yes, then read the data
Bkg% = ModData.BackGround ' into the variables
Cntr& = ModData.Counter
ELSE
Frg% = 7 'No, Then set the
Bkg% = 1 'variables to defaults
Cntr&= 0
ENDIF
CLOSE Fn
END SUB
SUB PutModVariables
SHARE ModData
Fn = FREEFILE
OPEN ProgramName$ FOR BINARY AS fn
a& = LOF(1) - LEN(ModData) + 1
SEEK Fn, a&
PUT Fn,,ModData
CLOSE Fn
END SUB
--- PPoint 1.33
* Origin: The Rubber Room (1:207/213.5)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET