-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathpopup.cpp
30 lines (24 loc) · 852 Bytes
/
popup.cpp
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
#include <Windows.h>
#include "peb_lookup.h"
int main()
{
LPVOID base = get_module_by_name((const LPWSTR)L"kernel32.dll");
if (!base) {
return 1;
}
LPVOID load_lib = get_func_by_name((HMODULE)base, (LPSTR)"LoadLibraryA");
if (!load_lib) {
return 2;
}
LPVOID get_proc = get_func_by_name((HMODULE)base, (LPSTR)"GetProcAddress");
if (!get_proc) {
return 3;
}
auto _LoadLibraryA = reinterpret_cast<decltype(&LoadLibraryA)>(load_lib);
auto _GetProcAddress = reinterpret_cast<decltype(&GetProcAddress)>(get_proc);
LPVOID u32_dll = _LoadLibraryA("user32.dll");
auto _MessageBoxW = reinterpret_cast<decltype(&MessageBoxW)>(_GetProcAddress((HMODULE)u32_dll, "MessageBoxW"));
if (!_MessageBoxW) return 4;
_MessageBoxW(0, L"Hello World!", L"Demo!", MB_OK);
return 0;
}