fork download
  1. #include <windows.h>
  2. #include <string.h>
  3. #include "ui.h"
  4.  
  5. #define TEXTBOX_PROCESS 3000
  6. #define TEXTBOX_DLL 3001
  7. #define BUTTON_INJECT 3002
  8.  
  9. #define BUFFER_SIZE 128
  10.  
  11. TCHAR processName[BUFFER_SIZE];
  12. TCHAR dllName[BUFFER_SIZE];
  13.  
  14. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  15.  
  16. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  17. {
  18. HWND hMainWnd;
  19. MSG msg;
  20.  
  21. RegisterWndClass(WndProc, TEXT("Injector"), COLOR_WINDOW);
  22.  
  23. hMainWnd = CreateWindow(TEXT("Injector"), TEXT("Injector"),
  24. WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
  25. CW_USEDEFAULT, 0, 250, 130, (HWND)NULL, (HMENU)NULL,
  26. (HINSTANCE)hInstance, NULL);
  27.  
  28. if (!hMainWnd)
  29. {
  30. MessageBox(NULL, TEXT("Can\'t create main window."), TEXT("Error"), MB_OK);
  31. return GetLastError();
  32. }
  33.  
  34. ShowWindow(hMainWnd, nCmdShow);
  35.  
  36. while (GetMessage(&msg, NULL, 0, 0))
  37. {
  38. TranslateMessage(&msg);
  39. DispatchMessage(&msg);
  40. }
  41. }
  42.  
  43. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  44. {
  45. HDC hDC;
  46. PAINTSTRUCT ps;
  47. RECT rect;
  48. TCHAR buffer[BUFFER_SIZE];
  49.  
  50. switch (uMsg)
  51. {
  52. case WM_CREATE:
  53. /* Create text box containing process name */
  54. CreateWindow(TEXT("EDIT"), NULL, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_LEFT | ES_MULTILINE,
  55. 10, 10, 120, 20, hWnd, (HMENU)TEXTBOX_PROCESS, NULL, NULL);
  56. /* Create text box containing dll name */
  57. CreateWindow(TEXT("EDIT"), NULL, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_LEFT | ES_MULTILINE,
  58. 10, 35, 120, 20, hWnd, (HMENU)TEXTBOX_DLL, NULL, NULL);
  59. /* Create button to inject dll */
  60. CreateWindow(TEXT("BUTTON"), TEXT("Inject"), WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
  61. 150, 10, 60, 20, hWnd, (HMENU)BUTTON_INJECT, NULL, NULL);
  62. break;
  63. case WM_PAINT:
  64. hDC = BeginPaint(hWnd, &ps);
  65. GetClientRect(hWnd, &rect);
  66. EndPaint(hWnd, &ps);
  67. break;
  68. case WM_SIZE:
  69. break;
  70. case WM_CLOSE:
  71. DestroyWindow(hWnd);
  72. break;
  73. case WM_DESTROY:
  74. PostQuitMessage(0);
  75. break;
  76. case WM_COMMAND:
  77. switch (LOWORD(wParam))
  78. {
  79. case BUTTON_INJECT:
  80. GetWindowText(hWnd, buffer, sizeof(buffer));
  81. strncpy(processName, buffer, BUFFER_SIZE);
  82. break;
  83. default:
  84. break;
  85. }
  86. break;
  87. default:
  88. return DefWindowProc(hWnd, uMsg, wParam, lParam);
  89. }
  90. return 0;
  91. }
  92.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:21: fatal error: windows.h: No such file or directory
compilation terminated.
stdout
Standard output is empty