Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // loader.cpp : Defines the entry point for the application.
- //
- #define StartInjection 1
- #include "stdafx.h"
- #include "loader.h"
- #include <windows.h>
- #include <stdlib.h>
- #include <string.h>
- #include <tchar.h>
- #include <CommCtrl.h>
- // Global variables
- static TCHAR szWindowClass[] = _T("win32app");
- static TCHAR szTitle[] = _T("cpriv");
- HINSTANCE hInst;
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- HWND InjectionButton(HWND hWnd)
- {
- return CreateWindow(WC_BUTTON, ("Inject"),
- WS_CHILD | WS_VISIBLE | BS_FLAT | BS_PUSHBUTTON, // Styles
- 100, // x position
- 100, // y position
- 150, // Button width
- 30, // Button height
- hWnd, // Parent window
- (HMENU)InjectionButton, // hMenu
- NULL, // hInstance
- NULL); // Pointer not needed.
- }
- int CALLBACK WinMain(
- _In_ HINSTANCE hInstance,
- _In_ HINSTANCE hPrevInstance,
- _In_ LPSTR lpCmdLine,
- _In_ int nCmdShow
- )
- {
- WNDCLASSEX wcex;
- wcex.cbSize = sizeof(WNDCLASSEX);
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.lpfnWndProc = WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- wcex.lpszMenuName = NULL;
- wcex.lpszClassName = szWindowClass;
- wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
- if (!RegisterClassEx(&wcex))
- {
- MessageBox(NULL,
- _T("Call to RegisterClassEx failed!"),
- _T("cpriv"),
- NULL);
- return 1;
- }
- hInst = hInstance;
- HWND hWnd = CreateWindow(
- szWindowClass,
- szTitle,
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- 500, 500,
- NULL,
- NULL,
- hInstance,
- NULL
- );
- if (!hWnd)
- {
- MessageBox(NULL,
- _T("Call to CreateWindow failed!"),
- _T("cpriv"),
- NULL);
- return 1;
- }
- ShowWindow(hWnd,
- nCmdShow);
- UpdateWindow(hWnd);
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return (int)msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- PAINTSTRUCT ps;
- HDC hdc;
- TCHAR greeting[] = _T("testing text welcome");
- TCHAR InjectionButton[] = _T("");
- switch (message)
- {
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- TextOut(hdc,
- 5, 5,
- greeting, _tcslen(greeting));
- case WM_CREATE:
- {
- HWND InjectionButton(HWND hWnd);
- }
- // End application-specific layout section.
- EndPaint(hWnd, &ps);
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement