forked from leftspace89/pPlat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLSUtils.hpp
39 lines (37 loc) · 860 Bytes
/
LSUtils.hpp
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
#ifndef LSUtils
#define LSUtils
namespace LSUtils
{
DWORD curtickkey;
bool Mask(const BYTE * pData, const BYTE * bMask, const char * szMask)
{
for (; *szMask; ++szMask, ++pData, ++bMask)
if (*szMask == 'x' && *pData != *bMask)
return false;
return (*szMask) == NULL;
}
DWORD FindPattern(DWORD dwAddress, DWORD dwLen, BYTE * bMask, char * szMask)
{
for (DWORD i = 0; i < dwLen; i++)
if (Mask((BYTE*)(dwAddress + i), bMask, szMask))
return (DWORD)(dwAddress + i);
return 0;
}
DWORD CreateThreadA(void*ptr)
{
DWORD tid = 0;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ptr, 0, 0, &tid);
return tid;
}
bool GetKeyPressed(int vKey)
{
bool isPressed = GetAsyncKeyState(vKey) & 0x8000 && GetTickCount() - curtickkey > 300;
if (isPressed)
{
curtickkey = GetTickCount();
}
return isPressed;
}
}
#endif