Skip to content

Commit 084cc94

Browse files
committed
fix
1 parent 27cc783 commit 084cc94

1 file changed

Lines changed: 21 additions & 24 deletions

File tree

TOVR/C++/TOVR/TOVR.cpp

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typedef struct _Controller
3030
SHORT ThumbY;
3131
} TController, *PController;
3232

33-
typedef DWORD(_stdcall *_GetHMDData)(__out THMD* myHMD);
33+
typedef DWORD(__stdcall *_GetHMDData)(__out THMD* myHMD);
3434
typedef DWORD(__stdcall *_GetControllersData)(__out TController* MyController, __out TController* MyController2);
3535
typedef DWORD(__stdcall *_SetControllerData)(__in INT dwIndex, __in DWORD MotorSpeed);
3636
typedef DWORD(__stdcall *_SetCentering)(__in int dwIndex);
@@ -49,30 +49,30 @@ HMODULE hDll;
4949

5050
void DriverAttach() {
5151
CRegKey key;
52-
TCHAR driversPath[MAX_PATH];
53-
TCHAR driverName[MAX_PATH];
52+
TCHAR _driversPath[MAX_PATH];
53+
TCHAR _driverName[MAX_PATH];
5454

5555
LONG status = key.Open(HKEY_CURRENT_USER, _T("Software\\TrueOpenVR"));
5656
if (status == ERROR_SUCCESS)
5757
{
58-
ULONG regSize = sizeof(driverName);
59-
status = key.QueryStringValue(_T("Driver"), driverName, &regSize);
58+
ULONG regSize = sizeof(_driverName);
59+
status = key.QueryStringValue(_T("Driver"), _driverName, &regSize);
6060

6161
if (status == ERROR_SUCCESS)
6262
{
63-
regSize = sizeof(driversPath);
64-
status = key.QueryStringValue(_T("Drivers"), driversPath, &regSize);
63+
regSize = sizeof(_driversPath);
64+
status = key.QueryStringValue(_T("Drivers"), _driversPath, &regSize);
6565
}
6666
}
6767
key.Close();
6868

6969
if (status == ERROR_SUCCESS) {
70-
CString _driversPath(driversPath);
71-
CString _driverName(driverName);
70+
CString driversPath(_driversPath);
71+
CString driverName(_driverName);
7272

73-
if (PathFileExists(_driversPath + _driverName)) {
73+
if (PathFileExists(driversPath + driverName)) {
7474

75-
hDll = LoadLibrary(_driversPath + _driverName);
75+
hDll = LoadLibrary(driversPath + driverName);
7676

7777
if (hDll != NULL) {
7878

@@ -89,21 +89,18 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
8989
{
9090
switch (ul_reason_for_call)
9191
{
92-
case DLL_PROCESS_ATTACH: {
93-
DriverAttach();
94-
break;
95-
}
96-
97-
case DLL_PROCESS_DETACH: {
98-
if (hDll != NULL) {
99-
FreeLibrary(hDll);
100-
hDll = nullptr;
92+
case DLL_PROCESS_ATTACH: {
93+
DriverAttach();
94+
break;
10195
}
102-
break;
103-
}
10496

105-
//case DLL_THREAD_ATTACH:
106-
//case DLL_THREAD_DETACH:
97+
case DLL_PROCESS_DETACH: {
98+
if (hDll != NULL) {
99+
FreeLibrary(hDll);
100+
hDll = nullptr;
101+
}
102+
break;
103+
}
107104
}
108105
return TRUE;
109106
}

0 commit comments

Comments
 (0)