Skip to content

Commit

Permalink
Proxy presence and NT4 version check fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Falcosoft committed May 5, 2024
1 parent b706ec3 commit fdfa3f4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
45 changes: 32 additions & 13 deletions drivercfg/Views.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,31 @@ static void SaveDwordValue(LPCTSTR key, DWORD value)
reg.Close();
}
}

static TCHAR* getProxyPath(TCHAR* result, unsigned int length)
{
if (GetWindowsDirectory(result, length))
{
_tcscat_s(result, length, _T("\\SysWOW64\\vstmididrv\\vstmidiproxy.exe"));

if (GetFileAttributes(result) == INVALID_FILE_ATTRIBUTES)
{
if (GetWindowsDirectory(result, length))
{
_tcscat_s(result, length, _T("\\System32\\vstmididrv\\vstmidiproxy.exe"));

if (GetFileAttributes(result) == INVALID_FILE_ATTRIBUTES)
{
_tcscpy_s(result, length, _T(""));

}
}
}
}

return result;
}

#pragma endregion utility functions

#if _MSC_VER > 1000
Expand Down Expand Up @@ -1690,6 +1715,7 @@ class CView4 : public CDialogImpl<CView4>
chkPrivAsio = GetDlgItem(IDC_PRIVATEASIO);
chkKeepDriver = GetDlgItem(IDC_KEEPDRIVER);
cmbHighDpi = GetDlgItem(IDC_HIGHDPI);
btnProxy = GetDlgItem(IDC_PROXY);

cmbHighDpi.AddString(_T("System"));
cmbHighDpi.AddString(_T("System enhanced"));
Expand Down Expand Up @@ -1727,7 +1753,10 @@ class CView4 : public CDialogImpl<CView4>
else
chkPrivAsio.EnableWindow(false);

chkKeepDriver.SetCheck(keepDriverLoaded);
chkKeepDriver.SetCheck(keepDriverLoaded);

TCHAR tmpPath[MAX_PATH] = { 0 };
btnProxy.EnableWindow((BOOL)!!_tcslen(getProxyPath(tmpPath, MAX_PATH)));

return TRUE;
}
Expand Down Expand Up @@ -1793,18 +1822,8 @@ class CView4 : public CDialogImpl<CView4>
{
TCHAR tmpPath[MAX_PATH] = { 0 };

if (GetWindowsDirectory(tmpPath, MAX_PATH))
{
_tcscat_s(tmpPath, _T("\\SysWOW64\\vstmididrv\\vstmidiproxy.exe"));

if (GetFileAttributes(tmpPath) == INVALID_FILE_ATTRIBUTES)
{
if (GetWindowsDirectory(tmpPath, MAX_PATH))
{
_tcscat_s(tmpPath, _T("\\System32\\vstmididrv\\vstmidiproxy.exe"));
}
}

if (_tcslen(getProxyPath(tmpPath, MAX_PATH)))
{
ShellExecute(NULL, NULL, tmpPath, NULL, NULL, SW_SHOWNORMAL);
}

Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inline TCHAR* GetFileVersion(TCHAR* result)

inline bool IsWinNT4()
{
return (GetVersion() & 0x8000000F) == 4;
return (GetVersion() & 0x800000FF) == 4;
}


Expand Down

0 comments on commit fdfa3f4

Please sign in to comment.