Access Status VERY Illegally

This commit is contained in:
Matti 2024-12-12 00:01:55 +01:00
parent bbad0349e4
commit 50e86d6ed5

View File

@ -33,10 +33,21 @@ void Aufg9Main() {
char *fuckery = (char *)test; char *fuckery = (char *)test;
printf("Fuckery: %X\n", fuckery); printf("Fuckery: %X\n", fuckery);
char *bit20 = &dest[20]; // Name
char *byte20 = &dest[20];
std::cout << "Name: ";
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
std::cout << bit20[i]; std::cout << byte20[i];
} }
std::cout << std::endl;
char* byte36 = &dest[36];
std::cout << "Status: " << (((int)(*((bool *)byte36)))%8)/4 << std::endl; // geh zu Byte 36, lies genau 1 byte (da sizeOf(bool) = 1), interpretier es als int, berechner mod 8 -> wegwerfen der linken Bits, /4 -> wegwerfen der rechten beiden Bits -> Tada, nur das 3. Bit von Rechts bleibt übrig
// Klasse
bool *byte40 = (bool*) &dest[40];
std::cout << "Klasse: " << byte40[0] << std::endl;
// 2 -> Necromancer
} catch (const std::exception &e) { } catch (const std::exception &e) {