mIRC Home    About    Download    Register    News    Help

Print Thread
#30515 18/06/03 01:22 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
can i use /write to write to an .exe file? and if i don't so can u explain me why?
i know that i can do that with /bwrite but i don't see any difference that will be if i use /write except that /write file.txt something will add a new line to the file which is a $crlf
before adding the line

#30516 18/06/03 03:20 AM
Joined: May 2003
Posts: 177
P
Vogon poet
Offline
Vogon poet
P
Joined: May 2003
Posts: 177
No you cannot use the /write command to write to an exe file. Doing so will most likely corrupt the .exe file. I think it has something to do with binary or something. That's why you're supposed to use the /bwrite command. I might be wrong. If I am, oh well. Just thought I'd take a guess anyway.

#30517 18/06/03 03:26 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
well, binary files means that u can write to a specific byte on the file i think, but i don't understand why it will corrupt if i write it with /write smirk



#30518 18/06/03 03:27 AM
Joined: May 2003
Posts: 177
P
Vogon poet
Offline
Vogon poet
P
Joined: May 2003
Posts: 177
Try it, and see what happens.

#30519 18/06/03 03:30 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
i don't really know what to write to check it

#30520 18/06/03 05:15 AM
Joined: Jun 2003
Posts: 195
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
the problem is the location in the write. no you cant use /write you would have to use /bwrite. you would need a pointer to the files data. you cant overwrite certain things however. I beleive the first long word in the file is its size and the exe's relocation table is located at the end of if. overwriting either of these areas (or the PE header) will surely corrupt the file. I may be wrong on the locations ill look it up


Have Fun smile
#30521 18/06/03 03:22 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well first thing is, writing to an exe file is most likely a violation of the program's EULA. Secondly you can't use /write because it appends a CRLF sequence, thirdly, if you are not the author of the exe, how are you going to know what to write and to where? Based on your comments here I'm going to assume you're not familiar with the internals of Windows executable files? And if you aren't, then why would you even try and mess with it?

#30522 18/06/03 06:18 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
just want to know if when i write to it with /write it's corrupted or not (like when i asked if i can write to an .ini with /write).


#30523 18/06/03 06:20 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well thats not really an answerable question. If you don't know what you're doing /bwrite will corrupt it as well.

#30524 18/06/03 06:22 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
and what if i know what i'm doing, can i do it with /write ??

#30525 18/06/03 06:23 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
It depends on what you are doing. If you want to write to the beginning or end of a file and write text with a trailing \r\n, then yes you can. But I doubt thats what you want to do.

#30526 18/06/03 06:30 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
i'm not trying to write anything, just want to know for the future cuz i thought it's different type when u write to a binary file or text, i know that binary file can control specific bytes in the file but that's not my question

#30527 18/06/03 06:31 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You're not making sense.

#30528 18/06/03 06:36 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
frown

#30529 27/06/03 05:35 PM
Joined: May 2003
Posts: 32
Q
Ameglian cow
Offline
Ameglian cow
Q
Joined: May 2003
Posts: 32
u can write 2 .exe file with /write.
as u, when I was much younger- I asked the same question, couldn't find now the script that examples it..
I was reading an exe file with $bread
then I used $bvar().text 2 /write to my new exe file.
after that I was scanning if $crlf ($chr(13) $+ $chr(10)) was added in the end, and if it was added in the beginning, and removing it- all using binary variables.
then I moved to the next block...
each block length was 440 bytes. mIRC early versions couldn't handle more than that.

and goes what? the exe file that I was coppied only with /write was working.

now I am trying 2 ask myself- what made me ask that stupid question? the fact that when I was using text editor 2 change a byte in exe file (and save it), and then change it back (and save it) always the new exe was crashing me- I suppose its becouse of the sucks text editors I was using.
is that answers ur question?

#30530 27/06/03 05:56 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
im sorry, i don't understand u
what's your point ?


Link Copied to Clipboard