forked from fucan/hackshield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghp_WZAPI.hpp
80 lines (64 loc) · 1.67 KB
/
ghp_WZAPI.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef _GHP_WZAPI_HPP_
#define _GHP_WZAPI_HPP_
#include <Windows.h>
#ifdef WO_SERVER
#include "CkHttp.h"
#include "CkHttpResponse.h"
#include "CkHttpRequest.h"
#endif
typedef VOID (* GHPSetParam) (DWORD APIKey, UINT id, UCHAR * buffer, UINT size);
typedef VOID (* GHPGetParam) (DWORD APIKey, UINT id, UCHAR * buffer, UINT size);
inline bool GHP_Load()
{
if (LoadLibraryA("GHP.dll") != NULL)
return true;
else
return false;
}
inline bool GHP_SetCustomerID(DWORD APIKey, DWORD Time1, DWORD Time2, DWORD CustomerID)
{
HMODULE hGHP = GetModuleHandleA("GHP.dll");
if(hGHP != NULL)
{
GHPSetParam SetParam = (GHPSetParam)GetProcAddress(hGHP, "GHPSetParam");
GHPGetParam GetParam = (GHPGetParam)GetProcAddress(hGHP, "GHPGetParam");
if (SetParam != NULL && GetParam != NULL)
{
DWORD MyTime, GHPTime, diffTime;
MyTime = timeGetTime();
GetParam(APIKey, 0, (UCHAR*)&GHPTime, sizeof(GHPTime));
GHPTime ^= Time1;
GHPTime -= Time2;
diffTime = GHPTime - MyTime;
if (diffTime > 2000)
return false;
char buff[32];
memset(buff, 0, 32);
_itoa_s((int)CustomerID, buff, 10);
SetParam(APIKey, 0, (UCHAR*)buff, 32);
return true;
}
else
return false;
}
else
return false;
}
#ifdef WO_SERVER
inline bool GHP_CheckPlayer(DWORD CustomerID, const char * SRV_IP, long SRV_PORT, const char * C_REF)
{
char buff[32];
sprintf_s(buff, 32, "%d", CustomerID);
CkHttp http;
CkHttpResponse * resp = NULL;
CkHttpRequest req;
req.AddParam("pl_status", buff);
req.AddParam("key", C_REF);
resp = http.SynchronousRequest(SRV_IP, SRV_PORT, false, req);
if (strcmp(resp->bodyStr(), "1") != 0)
return false;
else
return true;
}
#endif
#endif