Re[6]: Как вызвать синий экран смерти?
От: Alex_Mistery Беларусь  
Дата: 13.11.03 13:43
Оценка:
Здравствуйте, Hacker_Delphi, Вы писали:

H_D>Здравствуйте, Kluge, Вы писали:


K>>Здравствуйте, Hacker_Delphi, Вы писали:


K>>Забавно. И как это его так?


H_D>в Direct3D выполняем такой вот код:

H_D>
H_D>VertexBuffer vb;
H_D>//...
H_D>vb = null;
H_D>device.DrawPrimitive(..., vb);
H_D>

H_D>все, слет гарантирован... локализовал ошибку с четвертой попытки...


Братва — все очень просто на самом деле

Делаете так: пишете простейший драйвер, одна функция DriverEntry — а в теле тоже одна функция KeBugCheckEx — она то и вызывает Blue Screen Of Death

Потом пишете w32 приложение которое динамически загружает этот драйвер и запускает его!

Привожу свой собственны код, под платформой NT работает гарантированно!!!

ДРАЙВЕР:

#include <ntddk.h>

NTSTATUS DriverEntry( IN PDRIVER_OBJECT  pDriverObject, IN PUNICODE_STRING pRegistryPath )
{

    //  Oups!!! We have just sent our belowed Windows to death. :-)))
    KeBugCheckEx( ( ULONG ) NULL, ( ULONG_PTR ) NULL, ( ULONG_PTR ) NULL, ( ULONG_PTR ) NULL, ( ULONG_PTR ) NULL );

};



Win32 ПРИЛОЖЕНИЕ:



#include <windows.h>
#include <assert.h>


static const char* m_DriverName = "oups.sys";

/***********************************************************************************************************
Name:            LoadDriver

Description:    This function is to load driver dinamically and start it. This procedure should send our
        Windows to blue screen of death!!!
Note:
Arguments:        
Return Value:    
***********************************************************************************************************/
void __declspec( noreturn ) LoadDriver() throw()
{
    SC_HANDLE hSCManager    = NULL; 
    SC_HANDLE hService        = NULL; 

    //  The OpenSCManager function establishes a connection to the service control manager on the 
    //  specified computer and opens the specified service control manager database
    hSCManager = OpenSCManager ( NULL, NULL, SC_MANAGER_ALL_ACCESS ); 
    assert( hSCManager != NULL || hSCManager != INVALID_HANDLE_VALUE );

    //  Compile full name of the driver oups.sys, it is assumed to be placed in the oups.exe directory
    LPTSTR m_FullDriverName = static_cast< LPTSTR > ( malloc( sizeof( TCHAR ) * 256 ) ); 

    GetCurrentDirectory( 256, m_FullDriverName ); 

    strcat( m_FullDriverName, "\\" ); 
    strcat( m_FullDriverName, m_DriverName ); 

    //  The CreateService function creates a service object and adds it to the specified service 
    //    control manager database
    hService = CreateService( hSCManager, m_DriverName, m_DriverName, SERVICE_ALL_ACCESS, 
        SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, m_FullDriverName, 
        NULL, NULL, NULL, NULL, NULL ); 
    
    if ( hService != NULL || hService != INVALID_HANDLE_VALUE ) 
    {
        //  The OpenService function opens an existing service, it means that The CreateService function
        //  has been failed
        hService = OpenService( hSCManager, m_DriverName, SERVICE_ALL_ACCESS ); 
        assert( hService != NULL || hService != INVALID_HANDLE_VALUE );
    };

    //  When a driver service is started, the StartService function does not return until the device driver 
    //    has finished initializing. Oups! - our driver will never finish its initialization! :-)))
    StartService( hService, 0, NULL );

    //  It's a pitty that the system will never reach this line! :-)))
    //  and will never get out of this routine! :-)

    free( m_FullDriverName ); 

    CloseServiceHandle ( hService ); 
    CloseServiceHandle ( hSCManager );

};


INT WINAPI WinMain( IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
{

    LoadDriver();

    return ( TRUE );

};
Мы — маньяки, должны помогать друг другу!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.