1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-11-24 19:22:04 +00:00

added APX driver install

This commit is contained in:
eliboa 2018-05-15 20:42:54 +02:00
parent da19dd05d1
commit e1fae125e2
3 changed files with 37 additions and 9 deletions

Binary file not shown.

View file

@ -21,6 +21,7 @@ BOOL WAITING_RECONNECT = FALSE;
BOOL AUTOINJECT_CURR= FALSE; BOOL AUTOINJECT_CURR= FALSE;
BOOL PREVENT_AUTOINJECT= TRUE; BOOL PREVENT_AUTOINJECT= TRUE;
BOOL DELAY_AUTOINJECT = FALSE; BOOL DELAY_AUTOINJECT = FALSE;
BOOL ASK_FOR_DRIVER = FALSE;
CString csPath; CString csPath;
// CTegraRcmGUIDlg dialog // CTegraRcmGUIDlg dialog
@ -59,6 +60,8 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
EnableActiveAccessibility();
TCHAR szPath[_MAX_PATH]; TCHAR szPath[_MAX_PATH];
VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szPath, _MAX_PATH)); VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szPath, _MAX_PATH));
CString csPathf(szPath); CString csPathf(szPath);
@ -100,20 +103,14 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
} }
} }
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CTegraRcmGUIDlg::StartTimer(); CTegraRcmGUIDlg::StartTimer();
return TRUE; // return TRUE unless you set the focus to a control return TRUE;
} }
void CTegraRcmGUIDlg::OnSysCommand(UINT nID, LPARAM lParam) void CTegraRcmGUIDlg::OnSysCommand(UINT nID, LPARAM lParam)
{ {
CDialog::OnSysCommand(nID, lParam); CDialog::OnSysCommand(nID, lParam);
@ -224,9 +221,14 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent)
pCtrl3->ShowWindow(SW_HIDE); pCtrl3->ShowWindow(SW_HIDE);
this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE); this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE);
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE); this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE);
s = "Install lbusbK driver (download Zadig)"; s = "lbusbK driver is needed !";
if (!ASK_FOR_DRIVER)
{
ASK_FOR_DRIVER = TRUE;
InstallDriver();
} }
}
else else
{ {
pCtrl1->ShowWindow(SW_SHOW); pCtrl1->ShowWindow(SW_SHOW);
@ -507,3 +509,28 @@ void CTegraRcmGUIDlg::SetPreset(string param, string value)
remove(rfile_c); remove(rfile_c);
rename(wfile_c, rfile_c); rename(wfile_c, rfile_c);
} }
void CTegraRcmGUIDlg::InstallDriver()
{
CString message = _T("APX device driver is missing. Do you want to install it now ?");
const int result = MessageBox(message, _T("APX driver not found !"), MB_YESNOCANCEL | MB_ICONQUESTION);
if (result == IDYES)
{
SHELLEXECUTEINFO shExInfo = { 0 };
shExInfo.cbSize = sizeof(shExInfo);
shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shExInfo.hwnd = 0;
shExInfo.lpVerb = _T("runas");
CString exe_file = csPath + _T("\\apx_driver\\InstallDriver.exe");
shExInfo.lpFile = exe_file;
shExInfo.lpDirectory = 0;
shExInfo.nShow = SW_SHOW;
shExInfo.hInstApp = 0;
if (ShellExecuteEx(&shExInfo))
{
CloseHandle(shExInfo.hProcess);
}
}
}

View file

@ -62,4 +62,5 @@ public:
afx_msg void OnBnClickedShofel2(); afx_msg void OnBnClickedShofel2();
afx_msg string GetPreset(string param); afx_msg string GetPreset(string param);
afx_msg void SetPreset(string param, string value); afx_msg void SetPreset(string param, string value);
afx_msg void InstallDriver();
}; };