-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathpopup_arr.cpp
32 lines (27 loc) · 956 Bytes
/
popup_arr.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
31
32
#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;
wchar_t* temp[] = { L"123", L"xxx", L"bbb" };
for (size_t i = 0; i < _countof(temp); i++) {
_MessageBoxW(0, temp[i], L"Demo", MB_OK);
}
return 0;
}