-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwindows_api.h
39 lines (32 loc) · 972 Bytes
/
windows_api.h
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
#pragma once
#include <stdint.h>
#include <string>
#include <unordered_map>
// Tell the compiler to compile functions with WINAPI with the Windows ABI
#define WINAPI __attribute__((ms_abi))
typedef int32_t BOOL;
typedef uint32_t DWORD;
#define DLL_PROCESS_DETACH 0
#define DLL_PROCESS_ATTACH 1
typedef struct _TIB {
void* ExceptionList;
void* StackBase;
void* StackLimit;
void* SubSystemTib;
void* FiberData;
void* ArbitraryUserPointer;
void* Self;
} TIB;
class WindowsAPI {
public:
static WindowsAPI& GetInstance();
void* GetFunction(const std::string& moduleName, const std::string& funcName);
private:
WindowsAPI();
~WindowsAPI() = default;
WindowsAPI(const WindowsAPI&) = delete;
WindowsAPI(WindowsAPI&&) = delete;
WindowsAPI& operator=(const WindowsAPI&) = delete;
WindowsAPI& operator=(WindowsAPI&&) = delete;
std::unordered_map<std::string, std::unordered_map<std::string, void*>> m_apiMap;
};