forked from Skewjo/SysLat_Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRTSSProfileInterface.cpp
More file actions
143 lines (129 loc) · 4.7 KB
/
RTSSProfileInterface.cpp
File metadata and controls
143 lines (129 loc) · 4.7 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// RTSSProfileInterface.cpp : header file
//
// created by Unwinder
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RTSSProfileInterface.h"
#include <shlwapi.h>
/////////////////////////////////////////////////////////////////////////////
CRTSSProfileInterface::CRTSSProfileInterface()
{
m_hRTSSHooksDLL = NULL;
m_pFnEnumProfiles = NULL;
m_pFnLoadProfile = NULL;
m_pFnSaveProfile = NULL;
m_pFnGetProfileProperty = NULL;
m_pFnSetProfileProperty = NULL;
m_pFnDeleteProfile = NULL;
m_pFnResetProfile = NULL;
m_pFnUpdateProfiles = NULL;
}
/////////////////////////////////////////////////////////////////////////////
CRTSSProfileInterface::~CRTSSProfileInterface()
{
Uninit();
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::Uninit()
{
if (m_hRTSSHooksDLL)
FreeLibrary(m_hRTSSHooksDLL);
m_hRTSSHooksDLL = NULL;
m_pFnEnumProfiles = NULL;
m_pFnLoadProfile = NULL;
m_pFnSaveProfile = NULL;
m_pFnGetProfileProperty = NULL;
m_pFnSetProfileProperty = NULL;
m_pFnDeleteProfile = NULL;
m_pFnResetProfile = NULL;
m_pFnUpdateProfiles = NULL;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CRTSSProfileInterface::Init(LPCSTR lpInstallPath)
{
Uninit();
char szLibraryPath[MAX_PATH];
strcpy_s(szLibraryPath, sizeof(szLibraryPath), lpInstallPath);
PathRemoveFileSpec(szLibraryPath);
strcat_s(szLibraryPath, sizeof(szLibraryPath), "\\RTSSHooks.dll");
m_hRTSSHooksDLL = LoadLibrary(szLibraryPath);
if (m_hRTSSHooksDLL)
{
m_pFnEnumProfiles = (PFNENUMPROFILES )GetProcAddress(m_hRTSSHooksDLL, "EnumProfiles" );
m_pFnLoadProfile = (PFNLOADPROFILE )GetProcAddress(m_hRTSSHooksDLL, "LoadProfile" );
m_pFnSaveProfile = (PFNSAVEPROFILE )GetProcAddress(m_hRTSSHooksDLL, "SaveProfile" );
m_pFnGetProfileProperty = (PFNGETPROFILEPROPERTY)GetProcAddress(m_hRTSSHooksDLL, "GetProfileProperty" );
m_pFnSetProfileProperty = (PFNSETPROFILEPROPERTY)GetProcAddress(m_hRTSSHooksDLL, "SetProfileProperty" );
m_pFnDeleteProfile = (PFNDELETEPROFILE )GetProcAddress(m_hRTSSHooksDLL, "DeleteProfile" );
m_pFnResetProfile = (PFNRESETPROFILE )GetProcAddress(m_hRTSSHooksDLL, "ResetProfile" );
m_pFnUpdateProfiles = (PFNUPDATEPROFILES )GetProcAddress(m_hRTSSHooksDLL, "UpdateProfiles" );
if (m_pFnEnumProfiles &&
m_pFnLoadProfile &&
m_pFnSaveProfile &&
m_pFnGetProfileProperty &&
m_pFnSetProfileProperty &&
m_pFnDeleteProfile &&
m_pFnResetProfile &&
m_pFnUpdateProfiles)
return TRUE;
Uninit();
}
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CRTSSProfileInterface::IsInitialized()
{
return (m_hRTSSHooksDLL != NULL);
}
/////////////////////////////////////////////////////////////////////////////
DWORD CRTSSProfileInterface::EnumProfiles(LPSTR lpProfilesList, DWORD dwProfilesListSize)
{
if (m_pFnEnumProfiles)
return m_pFnEnumProfiles(lpProfilesList, dwProfilesListSize);
return 0;
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::LoadProfile(LPCSTR lpProfile)
{
if (m_pFnLoadProfile)
m_pFnLoadProfile(lpProfile);
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::SaveProfile(LPCSTR lpProfile)
{
if (m_pFnSaveProfile)
m_pFnSaveProfile(lpProfile);
}
/////////////////////////////////////////////////////////////////////////////
BOOL CRTSSProfileInterface::GetProfileProperty(LPCSTR lpPropertyName, LPBYTE lpPropertyData, DWORD dwPropertySize)
{
if (m_pFnGetProfileProperty)
return m_pFnGetProfileProperty(lpPropertyName, lpPropertyData, dwPropertySize);
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
BOOL CRTSSProfileInterface::SetProfileProperty(LPCSTR lpPropertyName, LPBYTE lpPropertyData, DWORD dwPropertySize)
{
if (m_pFnSetProfileProperty)
return m_pFnSetProfileProperty(lpPropertyName, lpPropertyData, dwPropertySize);
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::DeleteProfile(LPCSTR lpProfile)
{
if (m_pFnDeleteProfile)
m_pFnDeleteProfile(lpProfile);
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::ResetProfile(LPCSTR lpProfile)
{
if (m_pFnResetProfile)
m_pFnResetProfile(lpProfile);
}
/////////////////////////////////////////////////////////////////////////////
void CRTSSProfileInterface::UpdateProfiles()
{
if (m_pFnUpdateProfiles)
m_pFnUpdateProfiles();
}
/////////////////////////////////////////////////////////////////////////////