-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShareCode.h
50 lines (46 loc) · 1.11 KB
/
ShareCode.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
40
41
42
43
44
45
46
47
48
49
50
//********************************************************************
// filename: F:\mygit\python3x\ShareCode.h
// desc:
//
// created: wangdaye 26:7:2023 16:59
//********************************************************************
#ifndef ShareCode_h__
#define ShareCode_h__
#include <windows.h>
#include <string>
#include <set>
class CriticalHandle
{
public:
CriticalHandle(LPCRITICAL_SECTION _pCritical) noexcept;
~CriticalHandle() noexcept;
private:
LPCRITICAL_SECTION pCritical;
};
class VirtualProtectHandle
{
public:
VirtualProtectHandle(LPVOID _lpAddress, SIZE_T _dwSize, DWORD _flNewProtect) noexcept;
~VirtualProtectHandle() noexcept;
private:
LPVOID lpAddress;
SIZE_T dwSize;
DWORD flNewProtect;
DWORD flOldProtect;
};
struct TMODULE
{
HMODULE hModule;
std::string Name;
unsigned long instances; //ÒýÓüÆÊý
BOOL markedForDeletion;
std::set<HMODULE> subModules;
};
template<typename CONTAINER, typename T>
bool contain(const CONTAINER& c, const T& t)
{
return c.find(t) != c.end();
}
std::string stringToLower(const std::string& _str);
std::string& stringToLower(std::string& _str);
#endif // ShareCode_h__