Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: daryo en 29 Junio 2013, 18:57 pm



Título: [c][aporte]simulacion pantallazo azul de windows BSOD
Publicado por: daryo en 29 Junio 2013, 18:57 pm
hice este programa hace tiempo pero no lo habia posteado aca  ;D
(http://i44.tinypic.com/mtbfo7.png)
Código
  1. #include <windows.h>
  2. //#include <winable.h>
  3. HINSTANCE miinstance;
  4. // int bloqueo=0;
  5.  
  6. /*  Declare Windows procedure  */
  7. LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
  8.  
  9.  
  10.  
  11. /*  Make the class name into a global variable  */
  12. char szClassName[ ] = "WindowsApp";
  13.  
  14. int WINAPI WinMain (HINSTANCE hThisInstance,
  15.                    HINSTANCE hPrevInstance,
  16.                    LPSTR lpszArgument,
  17.                    int nFunsterStil)
  18.  
  19. {
  20.  
  21.    HWND hwnd;               /* This is the handle for our window */
  22.    MSG messages;            /* Here messages to the application are saved */
  23.    WNDCLASSEX wincl;        /* Data structure for the windowclass */
  24.    miinstance=hThisInstance;
  25.  
  26.    /* The Window structure */
  27.    wincl.hInstance = hThisInstance;
  28.    wincl.lpszClassName = szClassName;
  29.    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
  30.    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
  31.    wincl.cbSize = sizeof (WNDCLASSEX);
  32.  
  33.    /* Use default icon and mouse-pointer */
  34.    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
  35.    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
  36.    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
  37.    wincl.lpszMenuName = NULL;                 /* No menu */
  38.    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
  39.    wincl.cbWndExtra = 0;                      /* structure or the window instance */
  40.    /* Use Windows's default color as the background of the window */
  41.    wincl.hbrBackground = CreateSolidBrush( RGB(0x00, 0x00, 0xFF) );
  42.  
  43.    /* Register the window class, and if it fails quit the program */
  44.    if (!RegisterClassEx (&wincl))
  45.        return 0;
  46.  
  47.    /* The class is registered, let's create the program*/
  48.    hwnd = CreateWindowEx (
  49.           0,                   /* Extended possibilites for variation */
  50.           szClassName,         /* Classname */
  51.           "Windows App",       /* Title Text */
  52.           WS_POPUP, /* default window */
  53.           CW_USEDEFAULT,       /* Windows decides the position */
  54.           CW_USEDEFAULT,       /* where the window ends up on the screen */
  55.           544,                 /* The programs width */
  56.           375,                 /* and height in pixels */
  57.           HWND_DESKTOP,        /* The window is a child-window to desktop */
  58.           NULL,                /* No menu */
  59.           hThisInstance,       /* Program Instance handler */
  60.           NULL                 /* No Window Creation data */
  61.           );
  62.  
  63.    /* Make the window visible on the screen */
  64.    ShowWindow(hwnd, SW_SHOWMAXIMIZED);
  65.    ShowCursor(FALSE);
  66.  
  67.    /* Run the message loop. It will run until GetMessage() returns 0 */
  68.    while (GetMessage (&messages, NULL, 0, 0))
  69.    {
  70.        /* Translate virtual-key messages into character messages */
  71.        TranslateMessage(&messages);
  72.        /* Send message to WindowProcedure */
  73.        DispatchMessage(&messages);
  74.    }
  75.  
  76.    /* The program return-value is 0 - The value that PostQuitMessage() gave */
  77.    return messages.wParam;
  78. }
  79.  
  80.  
  81. /*  This function is called by the Windows function DispatchMessage()  */
  82.  
  83.  
  84. HWND label;
  85. LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  86. {
  87.    switch (message)                  /* handle the messages */
  88.    {
  89.        case WM_CREATE:
  90. //             if (bloqueo==0){
  91. //               BlockInput(true);
  92. //               bloqueo=1;
  93. //             }
  94.             static HBRUSH pincel=CreateSolidBrush(RGB(192,192,192));
  95.             static HBRUSH pincel2=CreateSolidBrush(RGB(0,0,255));
  96.             static HWND etiqueta = CreateWindowEx(0,"STATIC", "   WINDOWS", WS_CHILD|WS_VISIBLE, 600, 150, 100, 18, hwnd, 0, miinstance, NULL);
  97.             static HWND etiqueta2 = CreateWindowEx(0,"STATIC", "Se ha encontrado un problema y windows ha sido apagado para evitar daños al equipo.\n MACHINE_CHECK_EXCEPTION\nSi esta es la primera vez que se ve esta pantalla de error de detención, reinicie su equipo. Si esta pantalla aparece otra vez, siga los siguientes pasos:\nComprueba que cualquier hardware o software esta correctamente instalado, si es una nueva instalación, contacte con su proveedor de hardware o software para obtener actualizaciones de windows que pueda necesitar.\n", WS_CHILD|WS_VISIBLE, 250, 200, 600, 408, hwnd, 0, miinstance, NULL);
  98.             static HWND etiqueta3 = CreateWindowEx(0,"STATIC", " *** STOP: 0x0000009C (0X00000004, 0X8054D570,0B2000000,0X00070F0F)", WS_CHILD|WS_VISIBLE,550,500,600,408, hwnd, 0, miinstance, NULL);
  99.  
  100.             break;
  101.        case WM_CTLCOLORSTATIC:
  102.        if(lParam==(LPARAM)etiqueta){
  103.            SetBkColor((HDC)wParam, RGB(192,192,192));
  104.            SetTextColor((HDC)wParam, RGB(0,0,255));
  105.            return (LRESULT)pincel;
  106.            }
  107.        if(lParam==(LPARAM)etiqueta2 || lParam==(LPARAM)etiqueta3){
  108.            SetBkColor((HDC)wParam, RGB(0,0,255));
  109.            SetTextColor((HDC)wParam, RGB(255,255,255));
  110.            return (LRESULT)pincel2;
  111.            }
  112.            break;
  113.        case WM_DESTROY:
  114.            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
  115.            break;
  116.        default:                      /* for messages that we don't deal with */
  117.            return DefWindowProc (hwnd, message, wParam, lParam);
  118.    }
  119.  
  120.    return 0;
  121. }
  122.  
  123.  


Título: Re: [c][aporte]simulacion pantallazo azul de windows BSOD
Publicado por: pacoperico en 29 Junio 2013, 20:47 pm
jajaja hacia siglos que no lo veia