flat assembler
Message board for the users of flat assembler.

Index > Main > OS-independant execution output?

Author
Thread Post new topic Reply to topic
DrenThales



Joined: 05 Sep 2006
Posts: 11
DrenThales 10 Sep 2006, 20:57
I'm new to fasm (and assebly programming).

I've been trying to figure out how I might write text to the end of the executing file's data, separate from the other file contents, in some way, so that, after execution, I can open the file to read the text I programmed it to write, thereby giving me execution information not dependant, as much, on the operating system. Its ok if the writing process makes the file un-executable (after execution), cause I could just recompile it without much trouble, but, still, if you have a method by which text may be appended to a file without ever affecting that file's ability to execute correctly, that may be even better (though not strictly necessary).
Post 10 Sep 2006, 20:57
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 10 Sep 2006, 21:22
sorry, i don't understand you, please try to rewrite it (with shorter sentences Wink )...
Post 10 Sep 2006, 21:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 10 Sep 2006, 22:47
There's no OS-independant way to do this. Writing to memory doesn't automatically write to disk. And under some operating systems you cannot even write to your exeuctable file while the program is running (windows*, to name one).

If you only want read-access to the data when the program is running, you can use another program to write the data there. But you still need OS-dependant way of reading the data. Pretty moot argument anyway, since executable files are os-dependant.

*) yes, it's possible to write to running-exe, but it's hacky. Even the cleanest way to do it (copy exe to temp, launch with special args, etc.)is cumbersome.
Post 10 Sep 2006, 22:47
View user's profile Send private message Visit poster's website Reply with quote
DrenThales



Joined: 05 Sep 2006
Posts: 11
DrenThales 11 Sep 2006, 16:24
I'm pretty sure I could write data during preprocessor and assembly time (but that would only let me document preprocessor and assembly passes, likewise), but, that too is OS dependant, because the compile is run via that particular OS version of FASM.

It would seem I was being somewhat naive when I originally posted the thread.

In any case though, I'll just use my current OS for output, for the time being. And because my current OS happens to be Linux, I can just use a redirect ( > ) or pipe ( | ) to store and/or process it
( Very Happy good ol' UNIX pipes).

Thanks for helping to alieve my temporary lapse into naivety, as it were.
Post 11 Sep 2006, 16:24
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 11 Sep 2006, 16:53
Quote:

In any case though, I'll just use my current OS for output, for the time being. And because my current OS happens to be Linux, I can just use a redirect ( > ) or pipe ( | ) to store and/or process it
( good ol' UNIX pipes).


Remember you can do that on Windows too Wink
Post 11 Sep 2006, 16:53
View user's profile Send private message Reply with quote
DrenThales



Joined: 05 Sep 2006
Posts: 11
DrenThales 11 Sep 2006, 21:24
You can?, I wasn't aware. Course, I never really used DOS-type commands and such much, besides for running a few compilers for certain programming languages. Which would probably explain me not having encountered it (seeing as most MS Windows apps have GUIs, recently).
Post 11 Sep 2006, 21:24
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 11 Sep 2006, 21:55
try "echo gmail.com | nslookup" and "echo gmail.com | nslookup > out.txt" or just "nslookup gmail.com > out.txt" (the last two produces different output each other)

[edit] Another example can be creating a file named hosts.txt like this:
Code:
gmail.com
hotmail.com
microsoft.com
    


And then using it like "type hosts.txt | nslookup" or "nslookup < hosts.txt" (since Windows supports stdin redirection too).

Sumarizing, in Windows you can redirect stdin, stdout and stderr and you can use pipes as well[/edit]
Post 11 Sep 2006, 21:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.