Page 1 of 3 123>
Topic Options
#180062 - 2007-09-03 11:32 AM Most annoying 1-line code ever!
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Annoying code to test on someone else computer:
 Code:
SetConsole("Hide") RedirectOutput("c:\~") RedirectOutput("c:\~:~") While 1 @sid Loop


Best usage: put the .kx script in Startup.

Of course I will not spoil the fun by explaining what this is doing...

Top
#180063 - 2007-09-03 11:47 AM Re: Most annoying 1-line code ever! [Re: Flavien]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Code:
RedirectOutput("c:\~")
will redirect all output to a file called ~ on C:\
But I do not get the
 Code:
RedirectOutput("c:\~:~")
I presume the script will loop until it gets killed by someone or something and the user will be logged off.

Top
#180064 - 2007-09-03 11:53 AM Re: Most annoying 1-line code ever! [Re: Witto]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Tip: this does not work on FAT filesystem ;\)
Top
#180065 - 2007-09-03 11:57 AM Re: Most annoying 1-line code ever! [Re: Witto]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
The second Redirect will never kick in. And the script won't do anything at all cept writing a "0" for no error to the "~" file.
Top
#180066 - 2007-09-03 12:03 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Oh yes, it will kick in, and that's the tricky stuff.

As for the 1, it's for the never ending loop:
 Code:
While 1 ;is the same as While 1=1
...
Loop


Try it and see if the ~ file contains only 0.


Edited by Flavien (2007-09-03 01:03 PM)
Edit Reason: Replaced '1' by 'only 0'

Top
#180067 - 2007-09-03 12:24 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
like I said, file contains 0
Top
#180068 - 2007-09-03 12:45 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Sorry, I should have reviewed my reply.

Indeed, the file will contain 0. But it contains much more...

Top
#180069 - 2007-09-03 12:56 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
It contains nothing more. I don't see where you even get that idea.
Let's review your code shall we ?
 Code:
SetConsole("Hide")

That will hide the console screen. Nothing Important.
 Code:
RedirectOutput("c:\~")

This will redirect the output to the "~" file on the C: disk.
 Code:
RedirectOutput("c:\~:~")

This will do nothing since the first Redirect is in effect.
 Code:
While 1 @sid Loop

This creates an infinite loop where the @SID is constantly outputted to the "~" file.

Top
#180070 - 2007-09-03 01:01 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
As I wrote, RedirectOutput("c:\~:~") is the tricky part.

Spoiler: @SID is constantly outputted to the "~:~" stream of the "~" file...

Top
#180073 - 2007-09-03 01:58 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Warning, Spoiler:
 Code:
RedirectOutput("c:\~")
Will create file C:\~
0 is written to the file because you do not catch the return value, per example:
$ReturnValue = RedirectOutput("c:\~")

 Code:
RedirectOutput("c:\~:~")While 1
Redirects the code but I do not know where you are redirecting to
IMHO "c:\~:~" is an invalid file specification.
But As far as I can see, RedirectOutput() does not return an error.

 Code:
While 1
	@SID
Loop
Endless loop.
Because you do not catch the Return Value of "@SID", the output is redirected to "C:\~:~". But as I said, I do not know where that is.
I think the user will be logged of from his computer when the script is broken because I see no
Break On
or similar at top of the script

Top
#180074 - 2007-09-03 02:11 PM Re: Most annoying 1-line code ever! [Re: Witto]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
It wont error out, @SID always returns a proper value, however it isn't redirected to the output file.
RedirectOutput("C:\~:~") is invalid imo.
This script is completely useless.

Top
#180075 - 2007-09-03 02:24 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
No, it will not error out. No SID values are written nowhere, unless "C:\~:~" is doing something I am not aware of. But I presume the script should not be broken, to prevent the user from being logged off.
Top
#180076 - 2007-09-03 02:38 PM Re: Most annoying 1-line code ever! [Re: Witto]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
All I get is one file on c: called ~. There is only one 0 in this file. Nothing else happens. I have no idea what is supposed to happen.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#180077 - 2007-09-03 02:46 PM Re: Most annoying 1-line code ever! [Re: Witto]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
NTFS Alternate Data Streams (or ADS in short) entry in Wikipedia:
Alternate data streams allows files to be associated with more than one data stream. For example, a file such as text.txt can have an ADS with the name of text.txt:secret.txt (of form filename:ads) that can only be accessed by knowing the ADS name or by specialized directory browsing programs. Alternate streams are not detectable in the original file's size but are lost when the original file (i.e. text.txt) is deleted with a RemoveFile or RemoveFileTransacted call (or a call that uses those calls), or when the file is copied or moved to a partition that doesn't support ADS (e.g. a FAT partition, a floppy disk, or a network share). While ADS is a useful feature, it can also easily eat up hard disk space if unknown either through being forgotten or not being detected.

So, in my example, C:\~:~ is a alternate data stream of c:\~ containing many times the SID. The file will grow until the disk is full.

lads.exe - Useful command line to list ADS:
http://www.heysoft.de/Frames/f_sw_la_en.htm

NB: On my computer (XP x64) when I kill kix32.exe I don't get logged off.

Top
#180079 - 2007-09-03 02:54 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
 Originally Posted By: Flavien
So, in my example, C:\~:~ is a alternate data stream of c:\~ containing many times the SID. The file will grow until the disk is full.


No, your attempt, not your example. Because the example does not work.
Maybe it does on your x64 system but it does not work on x86.

Top
#180080 - 2007-09-03 03:04 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Besides, what your attempting to do is called "Forking"
Top
#180083 - 2007-09-03 03:18 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
In doubt I've tested this on x86 and it works as expected. Tested with KiXtart 4.53.

NB: Yes, it's called "forking" on the Mac, not that much within Windows professionals. I guess it's because no one is using ADS except Microsoft.

Top
#180084 - 2007-09-03 03:23 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
It is called "forking" because that is the name of what you are trying to do \:\)

Without any further discussion: Forking

Besides you could have just done:
 Code:
RedirectOutput("C:\~",0)
and be done with it :P

Top
#180086 - 2007-09-03 03:41 PM Re: Most annoying 1-line code ever! [Re: Arend_]
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
 Originally Posted By: apronk
Besides you could have just done:
 Code:
RedirectOutput("C:\~",0)
and be done with it :P

Why would you do that? That would recreate the file without increasing its size. Thus not annoying...

Top
#180087 - 2007-09-03 03:45 PM Re: Most annoying 1-line code ever! [Re: Flavien]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
No, that would "append" the file \:\)
Top
Page 1 of 3 123>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.114 seconds in which 0.068 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org