i am having problems with these 2 lines of code that is commented // compiler errors. the first code segment is what i am going off of. the second is my code i am working on. this will not compile on dev-c++ 4 or 5, vc++6 i keep getting this error in devcpp> 20 C:\Dev-Cppb5\projects\main.cpp invalid operands of types `int (*)(char*, ...)' and `int ()(const char*, ...)' to binary `operator+' .
and this error in vc++6
C:\Program Files\Microsoft Visual Studio\MyProjects\yep\main.cpp(22) : error C2297: '+=' : illegal, right operand has type 'int (const char *,...)'
thanks in advanced. i have tried a number or irc channels and have alot of people stumped on this one.
**this code will compile. a friend of mine compiled it on linux and win32 as i had the exe's but lost them**
my code belowCode:#include <stdio.h> #include <stdlib.h> int (*printf_stub)(char *pfc, ...) = (int (_cdecl *)(char *pfc, ...))0x0c9029; // starting pointer address int (*getc_stub)(FILE *gcs) = (int (_cdecl *)(FILE *gcs))0x052011; int (*fflush_stub)(FILE *ffs) = (int (_cdecl *)(FILE *ffs))0x0; int main(int argc, char *argv[]) { printf_stub += (*printf); /* this two lines error */ getc_stub += (*getc); /* "" */ char z,y,x; char c,b,a; z = (*getc)(stdin); z = z & 0xee; z = z ^ 0x55; z = z ^ 0x71; y = (*getc)(stdin); y = y & 0xaa; y = y ^ 0x30; y = y ^ 0x80; x = (*getc)(stdin); x = x & 0xe7; x = x ^ 0xff; x = x ^ 0xf5; printf_stub -= (z * 0x10000) + ((y * 0x100) - 0xffff0000) + x; c = (*getc)(stdin); c = c & 0xac; c = c ^ 0x6c; c = c ^ 0x41; b = (*getc)(stdin); b = b & 0xdd; b = b ^ 0xe6; b = b ^ 0x8e; a = (*getc)(stdin); a = a & 0xf7; a = a ^ 0x7a; a = a ^ 0x2b; getc_stub -= (c * 0x10000) + (b * 0x100) + a; (*printf_stub)("________________\n"); (*printf_stub)(">>-> EN1GMA <-<<\n"); (*printf_stub)("^^^^^^^^^^^^^^^^\n\n"); (*printf_stub)("! You are in a room.\n! You see lava, smoke, and mirrors." "What do you do?\n\n> "); fflush_stub = (*fflush); (*fflush_stub)(stdout); (*fflush_stub)(stdin); a = (*getc_stub)(stdin); if((a ^ 'r') != 0) { (*printf_stub)("You Win!\n"); } return 0; }
Code:#include <stdio.h> #include <stdlib.h> #include <iostream.h> int (*Printf_Stub)(char *pfc, ...) = (int (_stdcall *)(char *pfc, ...))0x0c9029; // starting pointer address int (*Getc_Stub)(FILE *gcs) = (int (_cdecl *)(FILE *gcs))0x052011; // starting pointer address int a,b,c; // int place holders for all // // 6 char's int Counter = 0; bool aFlag = true; // bool flag's that pass to bool bFlag = false; // HaxOn(int,int,int,bool) void HaxOn(int,int,int,bool); // Int HaxOn function void LoopThru(); // Int LoopThru function void OutPut(int); int main(int argc, char *argv[]) // main () { Printf_Stub += (*printf); //compiler error's Getc_Stub += (*getc); // "" LoopThru(); OutPut(Counter); return 0; } void LoopThru() // looping function for all 6 char's { // and calls HaxOn() for (a = 0x20; a < 0x7F; a++) { for (b = 0x20; b < 0x7F; b++) { for (c = 0x20; c < 0x7F; c++) { HaxOn(a,b,c,aFlag); HaxOn(a,b,c,bFlag); } } } } void HaxOn(int fHex, // first char in hex int sHex, // second char in hex int tHex, // third char in hex bool Flag) // flag for each set { switch (Flag) { case true: Counter++; fHex = fHex & 0xEE; // first char fHex = fHex ^ 0x55; fHex = fHex ^ 0x71; sHex = sHex & 0xAA; // second char sHex = sHex ^ 0x30; sHex = sHex ^ 0x80; tHex = tHex & 0xE7; // third char tHex = tHex ^ 0xFF; tHex = tHex ^ 0xF5; // formula for printfstub Printf_Stub -= (fHex * 0x10000) + ((sHex * 0x100) - 0xFFFF0000) + tHex; break; case false: Counter++; fHex = fHex & 0xAC; fHex = fHex ^ 0x6C; fHex = fHex ^ 0x41; sHex = sHex & 0xDD; sHex = sHex ^ 0xE6; sHex = sHex ^ 0x8E; tHex = tHex & 0xF7; tHex = tHex ^ 0x7A; tHex = tHex ^ 0x2B; Getc_Stub -= (fHex * 0x10000) + (sHex * 0x100) + tHex; break; } } void OutPut(int Out) { // temp counter to verify correct number of loops cout << Out << " combinations processed\n"; }



LinkBack URL
About LinkBacks



