mirror of
https://github.com/eliboa/TegraRcmGUI.git
synced 2024-11-24 19:22:04 +00:00
Fixed driver install prompt at every startup
This commit is contained in:
parent
ecb7c2b50f
commit
eb672a9abf
2 changed files with 19 additions and 15 deletions
|
@ -73,10 +73,10 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
|
||||||
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
|
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
|
||||||
RCM_BITMAP2.SetBitmap(DRIVER_KO);
|
RCM_BITMAP2.SetBitmap(DRIVER_KO);
|
||||||
RCM_BITMAP3.SetBitmap(RCM_DETECTED);
|
RCM_BITMAP3.SetBitmap(RCM_DETECTED);
|
||||||
|
|
||||||
BOOL isDriverInstalled = LookForDriver();
|
BOOL isDriverInstalled = LookForDriver();
|
||||||
if (!isDriverInstalled) InstallDriver();
|
if (!isDriverInstalled) InstallDriver();
|
||||||
|
|
||||||
string value = GetPreset("AUTO_INJECT");
|
string value = GetPreset("AUTO_INJECT");
|
||||||
if (value == "TRUE")
|
if (value == "TRUE")
|
||||||
{
|
{
|
||||||
|
@ -226,14 +226,9 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent)
|
||||||
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE);
|
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE);
|
||||||
s = "lbusbK driver is needed !";
|
s = "lbusbK driver is needed !";
|
||||||
|
|
||||||
/*
|
|
||||||
if (!ASK_FOR_DRIVER)
|
if (!ASK_FOR_DRIVER) InstallDriver();
|
||||||
{
|
|
||||||
ASK_FOR_DRIVER = TRUE;
|
|
||||||
InstallDriver();
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -539,13 +534,21 @@ void CTegraRcmGUIDlg::InstallDriver()
|
||||||
CloseHandle(shExInfo.hProcess);
|
CloseHandle(shExInfo.hProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ASK_FOR_DRIVER = TRUE;
|
||||||
}
|
}
|
||||||
typedef int(__cdecl *MYPROC)(LPWSTR);
|
typedef int(__cdecl *MYPROC)(LPWSTR);
|
||||||
|
|
||||||
|
|
||||||
BOOL CTegraRcmGUIDlg::LookForDriver()
|
BOOL CTegraRcmGUIDlg::LookForDriver()
|
||||||
{
|
{
|
||||||
CString LIBUSBKDLL = _T("C:\\Windows\\System32\\libusbK.dll");
|
TCHAR system_dir[MAX_PATH];
|
||||||
std::ifstream infile(LIBUSBKDLL);
|
HRESULT result = SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, SHGFP_TYPE_CURRENT, system_dir);
|
||||||
BOOL file_exists = infile.good();
|
if (result != S_OK) return FALSE;
|
||||||
return file_exists;
|
PathAppend(system_dir, _T("\\libusbK.dll"));
|
||||||
}
|
|
||||||
|
|
||||||
|
std::ifstream infile32(system_dir);
|
||||||
|
BOOL file_exists32 = infile32.good();
|
||||||
|
if (!file_exists32) return FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CTegraRcmGUIDlg dialog
|
// CTegraRcmGUIDlg dialog
|
||||||
class CTegraRcmGUIDlg : public CDialog
|
class CTegraRcmGUIDlg : public CDialog
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue