|
-
Aug 2nd, 2001, 06:13 AM
#1
Thread Starter
New Member
Writing memory-resident program back to disc
I know this is probably an easy question for you gurus! but anyway:
I have a program running on a machine. I want the program to write itself (as in whatever.exe) back onto the machine. What would be the best/easiest or quickest way to achieve this?
Please help, I've looked through pages of examples and can't find anything on this.
-
Aug 2nd, 2001, 06:22 AM
#2
If I understand you correctly you want the program to copy itself.
If that is correct you can simply use the FileCopy statement.
Code:
Dim sApp As String
sApp = App.Path
sApp = sApp & IIf(Right$(sApp, 1) <> "\", "\" & App.EXEName & ".exe", App.EXEName & ".exe")
FileCopy sApp, "c:\MyApp.exe"
Best regards
-
Aug 2nd, 2001, 06:28 AM
#3
Can you do that when the file is open?
-
Aug 2nd, 2001, 06:29 AM
#4
Thread Starter
New Member
Urmm, does that AppPath mean it's copying the file from where it was run?
Say the .exe file doesn't exist (physically) on the machine it's running on. It's been executed and now it's in memory. can it write itself back to the disc someplace?
-
Aug 2nd, 2001, 06:41 AM
#5
Originally posted by chenko
Can you do that when the file is open?
Yes you can read and copy the file but you can't write to it.
Originally posted by spiritdmp
Urmm, does that AppPath mean it's copying the file from where it was run?
Say the .exe file doesn't exist (physically) on the machine it's running on. It's been executed and now it's in memory. can it write itself back to the disc someplace?
The EXE file must be somewhere otherwise it can't be executed in the first place, can it?
It doesn't matter if it's started from a server as long as you are still connected to that server, or if your able to reconnect to it.
Best regards
-
Aug 2nd, 2001, 06:46 AM
#6
Thread Starter
New Member
Lets say for the sake of argument you dont have any access to a physical copy of the executable. (at all)
Would I have to find the program's memory address/es and use them to create a file to save?
-
Aug 2nd, 2001, 06:46 AM
#7
oh i get it...
he means the program is in the memory... and he wants the orignal file that it started from, maybe its deleted after running...oh what the heck am i talking about now, lol
-
Aug 2nd, 2001, 06:48 AM
#8
I'm not sure, but I don't think this is possible because the program will not be stored in memory the same way as it's stored on disk.
It will normally actually use more memory, for stacks and things like that.
-
Aug 2nd, 2001, 06:50 AM
#9
well some virii are run in the memory, but I think things like that are out of VB's hands.
Whats your purpose for this spiritdmp?
-
Aug 2nd, 2001, 06:52 AM
#10
Originally posted by chenko
well some virii are run in the memory, but I think things like that are out of VB's hands.
Yes but they will still need to be saved on disk otherwise they would dissapear when you turn the computer off.
-
Aug 2nd, 2001, 07:18 AM
#11
...just like the code red virus which disappeared when the computer is restarted
-
Aug 2nd, 2001, 07:27 AM
#12
Thread Starter
New Member
Im making a very small program that I can start as a process remotely on a users machine, or they start themselves by going to a certain page (or whatever) which then monitors stuff - like network usage, system performance etc and passes that info back to a main database. The program itself has to be totally transparent to the user (already sussed how to do that bit). I want the program to be self-maintaining so that it can replicate to a certain degree (like virii - as you mentioned).
-
Aug 2nd, 2001, 07:30 AM
#13
I think using VB to do this is a bit outa the way really.
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
|