-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathhello.c
More file actions
47 lines (38 loc) · 969 Bytes
/
hello.c
File metadata and controls
47 lines (38 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @file hello.c
* @author Lucas Vieira (lucas.engen.cc@gmail.com)
* @brief MessageBox dll to be injected on a process
* @version 0.1
* @date 2020-09-16
*
* @copyright Copyright (c) 2020
*
*/
#include <windows.h>
#include "../../process.h"
static void __stdcall ShowMessage()
{
MessageBoxA(0, "Hello :)", "Message from hello.dll", MB_ICONINFORMATION);
}
static void SayHello()
{
HANDLE hThread;
DWORD threadId;
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ShowMessage, NULL, 0, &threadId);
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, void *reserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
SayHello();
return TRUE;
case DLL_PROCESS_DETACH:
return TRUE;
case DLL_THREAD_ATTACH:
return TRUE;
case DLL_THREAD_DETACH:
return TRUE;
}
return FALSE;
}