Выполнить шелл-код путем приведения к указателю функции в Visual C++

В gcc это работает нормально. Код выглядит примерно так:

unsigned char b[50] = "\xda\xd1 ... \x0"; //some shellcode with terminating \x0
( (void(*)())b )(); //cast b to function pointer from void to void, then run it

Но когда это помещается в Visual C++, он выдает следующее сообщение об ошибке:

1>..\test.cpp(132): error C2440: 'type cast' : cannot convert from 'unsigned char [50]' to 'void (__cdecl *)(void)'
1>          There is no context in which this conversion is possible

Кто-нибудь знает, почему это так?

6
задан Ethan Heilman 20 March 2012 в 19:31
поделиться