예제 #1
0
파일: outer.c 프로젝트: Distrotech/indent
main ()
{
  var1 = 33;
  while (grop ())
    {
      foob ();
      turds ();
    }

  exit ();
}
int main(void)
{
	/* just using global values so they don't get optimized away */
	ubyteValue = ubyteValue;
	byteValue = byteValue;
	wordValue = wordValue;
	uwordValue = uwordValue;
	udwordValue = udwordValue;
	dwordValue = dwordValue;
	ulongLongValue = ulongLongValue;
	longLongValue = longLongValue;
	floatValue = floatValue;

	thinStringP = thinStringP;
	if (thinStringA){}
	wideStringP = wideStringP;
	if (wideStringA){}

	/* printing addresses so we can easily find the dumps */
	printf("0x%x : ubyteValue\n", &ubyteValue);
	printf("0x%x : thinStringP\n", &thinStringP);

	/* showing structure arrangement */
	MyStruct* m = 0;
	printf("Offsets: %d,%d,%d,%d,%d,%d,%d,%d,%d\n",
			&m->ubyteValue, &m->byteValue,
			&m->uwordValue, &m->wordValue,
			&m->udwordValue, &m->dwordValue,
			&m->ulongLongValue, &m->longLongValue,
			&m->floatValue);

	/* union stuff */
	union {
		BYTE byteValue;
		struct {
			WORD first;
			WORD second;
		} words;
		DWORD value;
	} dwValue;
	dwValue.value = 0xDEADBEEF;
	printf("Size %d; Addresses 0x%x,0x%x; Values 0x%x,0x%x\n",
		sizeof(dwValue), &dwValue.value, &dwValue.words,
		dwValue.words.first, dwValue.words.second);

	/* classes with no VF tables */
	bar _bar = bar();
	printf("Size %d; Address 0x%x : _bar\n", sizeof(_bar), &_bar);

	/* class VF call */
	foo* _testfoo = (foo*)new fooa();
	_testfoo->bar();

	/* classes with VF tables */
	foo _foo = foo();
	fooa _fooa = fooa();
	foob _foob = foob();
	printf("0x%x : _foo\n", &_foo);
	printf("0x%x : _fooa\n", &_fooa);
	printf("0x%x : _foob\n", &_foob);
	
	_foo.barbaz();
	_fooa.bar();
	_foob.baz();

	/* class protection */
	baz* _baz = 0;
	_baz->printStuff();

	system("pause");
}