From e1fae125e21a77993d4cbadc3122736a0e2e7c00 Mon Sep 17 00:00:00 2001 From: eliboa Date: Tue, 15 May 2018 20:42:54 +0200 Subject: [PATCH] added APX driver install --- TegraRcmGUI.rc | Bin 13246 -> 15156 bytes TegraRcmGUIDlg.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- TegraRcmGUIDlg.h | 1 + 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/TegraRcmGUI.rc b/TegraRcmGUI.rc index 8890aa276533325ffc82cd60a22c125a2a9ff637..9caaf84b13a652842d6ac669de814d551817f00c 100644 GIT binary patch delta 1803 zcmcgszi-n}5IzUgCT>I3v?Qdis0lwrX(>+ZJSVDzKp-fhFfdoD2*hciA_x^!B&z%g z49C!c88$>^78XW^P7DmFe**&&Vq@UWFVB8Kpn|ASi9k>bS;4;0h!2&#_of6E#6}Si&U>UB#CHh|^`#M~O zGI>h07r-srYr{Rb8$~;?4i5Rs;72iX^}waQdbpLX8ySA(5C^{=nAWV$NHIJ+vXUCK zDf45nu{?SncSa|MT$rN+{FLxW{vdwI7dYV2c*gk#vv{DM)#~`6R+D z*mU6~qRJ6$SEFAL+k#?!sAzVLFq3$n(D+g3{U{?VXhRmv2(vNsplf+>ULgCy280^H~A)$X4kEU0u*Q z6(i|LQJgN(@yP9IpsbH<3YnDkQJ_*ICeeri`7*4VO2GOsF=aEh+p`rZ#^=1aWSRe1 z5}95~E=wv1IHBW{zB+xTqDmOi!Ee^_|Hwf}p!3+1I&hJzq^iVkAYCLAGvBG(4W|zWn4^_41mh+kvpY_mtQ8q)rUumKwV9N2p@PKeY zKZrxNoHFh>_NtDOHV+Vgh2;QwM6pT{%KjUTcI T_Z-s#lJ-$j^@g-oaBe`38{w!F6l$3l6o(bGRg!4HzsZ zZ|9N+^35jaaBwi1PA=ux2qe`x`+?+kFzL>v57d8Q@)z!;$pt)elhvg6O;+PC<1}E< zVE|#n$xHb)k$8#%lAAy9XE06vAZRjqfshnXN)M<|52*0Hpzh=kLRpiy2``&mAQFNi uBR=_?h|uP5B8Qk5jVFH;6rFrd+=JPi!F02v#B-+2O47HOHcP2Ui30#v4MimY diff --git a/TegraRcmGUIDlg.cpp b/TegraRcmGUIDlg.cpp index 04d123e..c3ba047 100644 --- a/TegraRcmGUIDlg.cpp +++ b/TegraRcmGUIDlg.cpp @@ -21,6 +21,7 @@ BOOL WAITING_RECONNECT = FALSE; BOOL AUTOINJECT_CURR= FALSE; BOOL PREVENT_AUTOINJECT= TRUE; BOOL DELAY_AUTOINJECT = FALSE; +BOOL ASK_FOR_DRIVER = FALSE; CString csPath; // CTegraRcmGUIDlg dialog @@ -59,6 +60,8 @@ BOOL CTegraRcmGUIDlg::OnInitDialog() { CDialog::OnInitDialog(); + EnableActiveAccessibility(); + TCHAR szPath[_MAX_PATH]; VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szPath, _MAX_PATH)); 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, FALSE); // Set small icon - // TODO: Add extra initialization here CTegraRcmGUIDlg::StartTimer(); - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; } - - - void CTegraRcmGUIDlg::OnSysCommand(UINT nID, LPARAM lParam) { CDialog::OnSysCommand(nID, lParam); @@ -224,8 +221,13 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent) pCtrl3->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_INJECT)->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 { @@ -507,3 +509,28 @@ void CTegraRcmGUIDlg::SetPreset(string param, string value) remove(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); + } + } +} diff --git a/TegraRcmGUIDlg.h b/TegraRcmGUIDlg.h index c91f754..c0843e4 100644 --- a/TegraRcmGUIDlg.h +++ b/TegraRcmGUIDlg.h @@ -62,4 +62,5 @@ public: afx_msg void OnBnClickedShofel2(); afx_msg string GetPreset(string param); afx_msg void SetPreset(string param, string value); + afx_msg void InstallDriver(); };