RSS FEED

3 nov. 2010

Broma-BSOD

Pues estuve trabajando hace unas semanas antes de irme, en una especie de broma muy sencilla, que te saca la BSOD.

No tiene nada especial solo jugar un poco con Windows.

Aperitivo:


 



Comida:

#include <windows.h>


#define SCREEN(x) GetSystemMetrics(*x == 'X' ? SM_CXSCREEN : SM_CYSCREEN)
/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "CodeBlocksWindowsApp";

const char * texto[] = {
     "-A problem has been detected and Windous has been shut down to prevent damage",
     "-to your computer.",
     "*The problem seems to have been caused by the following file: MSNMSGR.EXE",
     "*A_LOT_OF_PORN_PHOTOS",
     "*If this is the first time you've seen this Stop error screen,",
     "-restart your computer. If this screen appears again, follow",
     "-these steps:",
     "*Check to make sure any new porn video is not viewed.",
     "*If this is a new installation of YouPornDownloader, ask your friends if ",
     "-they have any problem with any PornDownloader",
     "*If problems continue, disable or remove any newly porn video",
     "-or software downloader. ",
     "*If you need to use Safe Mode to remove or disable components, restart",
     "-your computer, press F8 to select Advanced Startup Options, and then",
     "-select Safe Mode.",
     "*Technical Information:",
     "**** MSNMSGR.EXE - Address: pnf13@hotmail.com Author: P4|3L0 ***"
};

void dalealtextoLOL(HDC hDC){
    unsigned short na = 30;
     unsigned char bs = 0;

     while(bs <= 16){
             if(texto[bs][0] == '*') na += 23;
             TextOut(hDC,10,na+(bs*23),texto[bs]+1,lstrlen(texto[bs])-1);
             bs++;
     }
}

int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)
{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default colour as the background of the window */
    wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0x77));


    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "BSOD",       /* Title Text */
           WS_POPUP,
           0,
           0,      /* where the window ends up on the screen */
           SCREEN("X"),                 /* The programs width */
           SCREEN("Y"),                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nCmdShow);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

HDC hDC;
PAINTSTRUCT ps;
HFONT hFont;
/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {

        case WM_DESTROY:

            break;
          case WM_PAINT:
             hDC = BeginPaint(hwnd,&ps);

             hFont = CreateFont(
                   19, 12, 0, 0,FW_NORMAL, FALSE, FALSE, FALSE,
                   ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
                   DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,"Verdana"
             );

             SelectObject(hDC, hFont);
             SetTextColor(hDC,RGB(0xFF,0xFF,0xFF));
             SetBkColor(hDC,RGB(0,0,0x77));

             dalealtextoLOL(hDC);

             DeleteObject(hFont);

             EndPaint(hwnd, &ps);
             break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

Como se ve, aun hay cosas por defecto de codeblocks..porque solo he tocado algunas cosas, a partir de la GUI de windows que me daba code::blocks

No hay comentarios:

Publicar un comentario en la entrada

Arriba