SORU
19 Ocak 2009, PAZARTESİ


Alıcı erişim ihlali özel durumlar?

Örnek

int *ptr;
*ptr = 1000;

herhangi bir microsoft belirli kullanmadan bellek erişim ihlali özel durum standart C kullanılarak binebilirim.

CEVAP
28 Mayıs 2009, PERŞEMBE


Okuyun ve ağlayın!

Anladım. Eğer işleyicisi atmak yok eğer doğru değilse, işleyici devam edecek ve çok özel olacak.

Sihirli istisna sen kendi attığın zaman olur onu kullanabilir.

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <tchar.h>

void SignalHandler(int signal)
{
    printf("Signal %d",signal);
    throw "!Access Violation!";
}

int main()
{
    typedef void (*SignalHandlerPointer)(int);

    SignalHandlerPointer previousHandler;
    previousHandler = signal(SIGSEGV , SignalHandler);
    try{
        *(int *) 0 = 0;// Baaaaaaad thing that should never be caught. You should write good code in the first place.
    }
    catch(char *e)
    {
        printf("Exception Caught: %s\n",e);
    }
    printf("Now we continue, unhindered, like the abomination never happened. (I am an EVIL genius)\n");
    printf("But please kids, DONT TRY THIS AT HOME ;)\n");

}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Bennythecoder

    Bennythecode

    25 Mart 2008
  • Hak5DarrensVlog

    Hak5DarrensV

    11 EYLÜL 2009
  • 趣味そうこ♪

    趣味そう

    3 Mart 2010