A Coding Challenge - Write An Absolutely USELESS Program

I win. Find a use for this code and you will recieve absolutely nothing.
Code:
#include <iostream.h>
int main()
{	
	for (int i=0;i>1337;i++){
	__asm{
		nop
	}
    }
	return 0;
}
 
__declspec(naked) means the the compiler adds absolutely nothing to the function so
Code:
int __declspec(naked) Blah(){
	_asm{
		xor eax, eax [COLOR=Green]//return 0[/COLOR]
		retn
	}
}
would turn out as
Code:
xor eax, eax
retn
after compiling while not using __declspec(naked) would make the compiler add some stuff like stack pointer saving (prolog, epilog) and some junk.

Here's a link with more informations http://msdn.microsoft.com/library/d...vclang/html/_pluslang_the_naked_attribute.asp
 
A very rudimentary C# function for determining whether a port is open. Just creates a TCP connection to the host and checks whether it was sucessful. Obivously most firewalls will detect a port scan using this method, but it works pretty well anyway.

Then again, SP2 has all sorts of things to slow down outgoing TCP connections which causes problems too...

Code:
private bool PortExists(IPAddress ip, int port)
{
    try
    {
        TcpClient client = new TcpClient( ip.ToString(), port );

        if ( client.Connected )
        {
            client.Close();
            return true;
        }
        else
            return false;
    }
    catch ( System.Exception )
    {
        return false;
    }
}
 
Back
Top