Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
// Execution residue (ASCII, UNICODE), c++ exception, divide by zero
// Copyright (c) 2011 Memory Dump Analysis Services
// GNU GENERAL PUBLIC LICENSE
// http://www.gnu.org/licenses/gpl-3.0.txt
#include "stdafx.h"
#include <windows.h>
#include <process.h>
void bar()
{
char buffer1[100] = "";
char buffer[60] = "Interesting data! Even more interesting data";
char buffer2[100] = "";
wchar_t buffer3[60] = L"Interesting data! Even more interesting data!";
char buffer4[100] = "";
strcat(buffer, "!");
}
void foo()
{
char buffer[100] = "";
bar();
}
void thread_one(void *)
{
char buffer[100] = "";
foo();
Sleep(INFINITE);
}
void thread_two(void *)
{
throw 0x12345678;
}
void thread_three(void *)
{
int j = 0;
int i = 1 / j;
}
int main(int argc, WCHAR* argv[])
{
_beginthread(thread_three, 0, NULL);
_beginthread(thread_two, 0, NULL);
_beginthread(thread_one, 0, NULL);
Sleep(INFINITE);
return 0;
}