|
-
Sep 29th, 2000, 10:40 AM
#1
Seems to me that you should be able to initialize a string variable with a distinctive string set, then be able to change the string with relative impunity in the .exe
Since you know the path to the executable (app.path) getting the exe file to read in is not a problem. I don't have any idea what will happen when you re-write the the string back out.....
Care must be taken however:
1. You must have the exact same number of characters after the change as before
2. You have to be able to find the string in the executable
3. You have to know lots of high-level curses for when you screw it up.
In the DOS days, people would change the command.com using a hex editor. They did this to get distinctive (usually obscene) error messages. Same principle.
Good Luck
DerFarm
-
Sep 29th, 2000, 10:44 AM
#2
Fanatic Member
I think I can do it, if I don't modify the legth, but I need to modify the length.
-
Sep 29th, 2000, 10:47 AM
#3
If you have to modify the length of the program, then you're SOL.
You'll have to use an outside file to communicate from one session to another.
In actuality, while the scheme of using the .exe to hold data changes is intriguing, it isn't worth the effort for the return.
Good Luck
DefFarm
-
Sep 29th, 2000, 11:05 AM
#4
Frenzied Member
as far as I know, its not possible to do what you're describing. if the length is constant, it is easy, but with flexible lengths its not possible. only thing I know of is to store it in an external file.
-
Sep 29th, 2000, 12:32 PM
#5
Monday Morning Lunatic
Here's how:
1. Copy the stub exe into a new file
2. Store current offset
3. Append your data
4. At the end of the file, write the offset
Then, when the stub loads, it reads the last few bytes from the file, seeks to that offset, and loads the data. Depending on how you load it, you may need to chop the offset bytes off.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 29th, 2000, 12:39 PM
#6
Fanatic Member
Lets say you want to write the user registered to the program into the exe file.
Code:
Type reg_t
Name as string * 15
ID as string * 5
End Type
Dim reg as reg_t
Open App.Path & "\" App.ExeName for binary as #1
Seek #1, LOF(1) - 21 'Go to end of file munus
our type struct + 1 for the seek
Get #1, reg
If reg.ID <> "REGID" Then
'Not registered
MsgBox "Program not registered!"
'Now promped the user to type in there name
'and just seek back to where you saved the type
'at the end of the file and save it using Put
Else
'Registered
Msgbox "Thank you " & reg.name
End If
Close #1
[Edited by nkad on 09-29-2000 at 02:58 PM]
-
Sep 29th, 2000, 02:28 PM
#7
Fanatic Member
So you can just append it at the end of the file?
-
Sep 29th, 2000, 03:45 PM
#8
Monday Morning Lunatic
Yes, although I would suggest (to help discourage fiddling), that some kind of processing be done on the data. (Also, surrounding it in an arbitrary length of random data is often helpful).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 29th, 2000, 04:11 PM
#9
Fanatic Member
Thanks for the help.
-
Sep 29th, 2000, 10:36 PM
#10
Frenzied Member
Does this really work?!?!?!? COOOLLL!!!
-
Sep 30th, 2000, 04:06 AM
#11
Monday Morning Lunatic
Yeah, I've used it in some of my software.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 30th, 2000, 05:43 AM
#12
Hyperactive Member
Sure it works
I posted a reply to a similar question a couple of days ago. The other question was about storing company logog in the exe, but the principal is the same.
The program should never ever get to your data so there would be no problem.
Virus checkers or innoculators are likely to pick up on the change and complain however. Also, in a LAN distribution (or any multi-user situation), such a thing is not recommended at all.
Cheers
-
Sep 30th, 2000, 08:11 AM
#13
Monday Morning Lunatic
In that situation, then it's not a good idea. In fact, I think I would probably say - never change the executable. You just can't tell if someone else is running it from somewhere else. There are usually much better ways of storing the data. (Unless the data will be inserted into the EXE statically)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 2nd, 2000, 08:18 AM
#14
Frenzied Member
ok, that's what I thought. I had read up on it and got a similar idea, so it seemed kind of interesting to me to think that it might work.
its still a cool technique tho. anybody know if you can use VS98 to edit resources (pics/strings/etc) in a compiled program (non vb)?
-
Oct 2nd, 2000, 11:08 AM
#15
Fanatic Member
Originally posted by mlewis
ok, that's what I thought. I had read up on it and got a similar idea, so it seemed kind of interesting to me to think that it might work.
its still a cool technique tho. anybody know if you can use VS98 to edit resources (pics/strings/etc) in a compiled program (non vb)?
You will get more views (and more answers to your question) if you open a new thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|