Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. //
  2. // loader.cpp : Defines the entry point for the application.
  3. //
  4. #define StartInjection 1
  5. #include "stdafx.h"
  6. #include "loader.h"
  7.  
  8. #include <windows.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <tchar.h>
  12. #include <CommCtrl.h>
  13.  
  14. // Global variables
  15. static TCHAR szWindowClass[] = _T("win32app");
  16. static TCHAR szTitle[] = _T("cpriv");
  17.  
  18. HINSTANCE hInst;
  19.  
  20. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  21.  
  22. HWND InjectionButton(HWND hWnd)
  23. {
  24.  
  25. return CreateWindow(WC_BUTTON, ("Inject"),
  26. WS_CHILD | WS_VISIBLE | BS_FLAT | BS_PUSHBUTTON, // Styles
  27. 100, // x position
  28. 100, // y position
  29. 150, // Button width
  30. 30, // Button height
  31. hWnd, // Parent window
  32. (HMENU)InjectionButton, // hMenu
  33. NULL, // hInstance
  34. NULL); // Pointer not needed.
  35. }
  36.  
  37. int CALLBACK WinMain(
  38. _In_ HINSTANCE hInstance,
  39. _In_ HINSTANCE hPrevInstance,
  40. _In_ LPSTR lpCmdLine,
  41. _In_ int nCmdShow
  42. )
  43.  
  44. {
  45. WNDCLASSEX wcex;
  46.  
  47. wcex.cbSize = sizeof(WNDCLASSEX);
  48. wcex.style = CS_HREDRAW | CS_VREDRAW;
  49. wcex.lpfnWndProc = WndProc;
  50. wcex.cbClsExtra = 0;
  51. wcex.cbWndExtra = 0;
  52. wcex.hInstance = hInstance;
  53. wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
  54. wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
  55. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
  56. wcex.lpszMenuName = NULL;
  57. wcex.lpszClassName = szWindowClass;
  58. wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
  59.  
  60. if (!RegisterClassEx(&wcex))
  61. {
  62. MessageBox(NULL,
  63. _T("Call to RegisterClassEx failed!"),
  64. _T("cpriv"),
  65. NULL);
  66.  
  67. return 1;
  68. }
  69.  
  70. hInst = hInstance;
  71.  
  72. HWND hWnd = CreateWindow(
  73. szWindowClass,
  74. szTitle,
  75. WS_OVERLAPPEDWINDOW,
  76. CW_USEDEFAULT, CW_USEDEFAULT,
  77. 500, 500,
  78. NULL,
  79. NULL,
  80. hInstance,
  81. NULL
  82. );
  83.  
  84. if (!hWnd)
  85. {
  86. MessageBox(NULL,
  87. _T("Call to CreateWindow failed!"),
  88. _T("cpriv"),
  89. NULL);
  90.  
  91. return 1;
  92. }
  93.  
  94. ShowWindow(hWnd,
  95. nCmdShow);
  96. UpdateWindow(hWnd);
  97.  
  98. MSG msg;
  99. while (GetMessage(&msg, NULL, 0, 0))
  100. {
  101. TranslateMessage(&msg);
  102. DispatchMessage(&msg);
  103. }
  104.  
  105. return (int)msg.wParam;
  106. }
  107.  
  108. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  109. {
  110. PAINTSTRUCT ps;
  111. HDC hdc;
  112. TCHAR greeting[] = _T("testing text welcome");
  113. TCHAR InjectionButton[] = _T("");
  114.  
  115. switch (message)
  116. {
  117. case WM_PAINT:
  118. hdc = BeginPaint(hWnd, &ps);
  119.  
  120. TextOut(hdc,
  121. 5, 5,
  122. greeting, _tcslen(greeting));
  123. case WM_CREATE:
  124. {
  125. HWND InjectionButton(HWND hWnd);
  126. }
  127.  
  128. // End application-specific layout section.
  129.  
  130. EndPaint(hWnd, &ps);
  131. break;
  132. case WM_DESTROY:
  133. PostQuitMessage(0);
  134. break;
  135. default:
  136. return DefWindowProc(hWnd, message, wParam, lParam);
  137. break;
  138. }
  139.  
  140. return 0;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement