-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDKExplorer.cpp
More file actions
69 lines (56 loc) · 2.4 KB
/
Copy pathSDKExplorer.cpp
File metadata and controls
69 lines (56 loc) · 2.4 KB
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
#include <windows.h>
#include <iostream>
#include <fstream>
#include "CUESDK/include/CUESDK.h"
#define CUESDK_DLL_PATH "C:\\Users\\T4g1\\Documents\\Projets\\TerrariaRGB\\CUESDK\\bin\\i386\\CUESDK_2015.dll"
#define CUESDK_INJECTED_DLL_PATH "C:\\Users\\T4g1\\Documents\\Projets\\TerrariaRGB\\CUESDK_2015.dll"
typedef CorsairProtocolDetails (__stdcall *f_CorsairPerformProtocolHandshake)();
void ErrorExit()
{
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
std::cout << "Error code: " << dw << std::endl;
if (FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL) == 0
) {
std::cout << "FormatMessage failed" << std::endl;
ExitProcess(dw);
}
std::cout << "Error message: " << (LPTSTR) lpMsgBuf << std::endl;
LocalFree(lpMsgBuf);
ExitProcess(dw);
}
int main()
{
std::cout << "Loading CUE SDK DLL..." << std::endl;
HINSTANCE hGetProcIDDLL = LoadLibrary(CUESDK_INJECTED_DLL_PATH);
if (!hGetProcIDDLL) {
ErrorExit();
}
std::cout << "Loading CUE SDK CorsairPerformProtocolHandshake..." << std::endl;
f_CorsairPerformProtocolHandshake CorsairPerformProtocolHandshake = (f_CorsairPerformProtocolHandshake)GetProcAddress(hGetProcIDDLL, "CorsairPerformProtocolHandshake");
if (!CorsairPerformProtocolHandshake) {
std::cout << "could not locate the function" << std::endl;
return EXIT_FAILURE;
}
std::cout << "Calling CUE SDK CorsairPerformProtocolHandshake..." << std::endl;
CorsairProtocolDetails protocolDetails = CorsairPerformProtocolHandshake();
std::cout << "SDK version is " << protocolDetails.sdkVersion << std::endl;
if (protocolDetails.serverVersion != NULL) {
std::cout << "Server version is " << protocolDetails.serverVersion << std::endl;
}
std::cout << "SDK protocol version is " << protocolDetails.sdkProtocolVersion << std::endl;
std::cout << "Server protocol version is " << protocolDetails.serverProtocolVersion << std::endl;
if (protocolDetails.breakingChanges) {
std::cout << "Breaking changfes occured" << std::endl;
}
return 0;
}