|
-
Jan 2nd, 2007, 09:57 PM
#1
Thread Starter
Fanatic Member
how does this work
hey guys i was expermenting a while ago to see if it were even possable to make a file replicate itself at run time (mainly because it doesnt seem possible) and i found a method on how to do it in vb using the following code
VB Code:
FileCopy App.Path + "\" + App.Title + ".exe", "C:\myapp.exe"
but i cant for the life of me undstand how it does it :/ any idea how this is possible ?
-
Jan 2nd, 2007, 10:09 PM
#2
Re: how does this work
Files can be read from the disk at any time. Writing into active files might be locked/prevented, but reading is often possible (as reading is rarely locked).
-
Jan 2nd, 2007, 10:12 PM
#3
Re: how does this work
Its better to use App.ExeName as title can be changed at runtime. Also i can't understand why it doesn't seem possible... could you explain?
-
Jan 2nd, 2007, 10:26 PM
#4
Thread Starter
Fanatic Member
Re: how does this work
i thought it wouldnt be possible to copy it because its in use
-
Jan 2nd, 2007, 10:43 PM
#5
Re: how does this work
Nah as Merri said, although it is in use, it can still be read. Its the same as opening 2 instances of the same exe. If it was in use, then the second instance would not be able to open.
-
Jan 2nd, 2007, 11:04 PM
#6
Re: how does this work
Executables are (mostly) read (= copied) to memory.
-
Jan 2nd, 2007, 11:26 PM
#7
Thread Starter
Fanatic Member
Re: how does this work
so that explains why if i change the app.title to app.exename as Andrew suggested and try to run the copy i get a permission denied error?
-
Jan 2nd, 2007, 11:39 PM
#8
Re: how does this work
 Originally Posted by dark_shadow
so that explains why if i change the app.title to app.exename as Andrew suggested and try to run the copy i get a permission denied error?
If you run the copy (which will be named "myapp.exe" ) it will try to copy this exe to the C drive and name it "myapp.exe", which is the same file so hence you can't copy the exe and overwrite it with itself....
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
|