From 4bd9e8dfd6858cd2019d993f2a7682ea0e21ea4d Mon Sep 17 00:00:00 2001 From: eliboa Date: Thu, 17 May 2018 19:46:51 +0200 Subject: [PATCH] Fixed libusbK.dll not found error --- TegraRcmGUIDlg.cpp | 17 ++++++++++++++++- TegraRcmGUIDlg.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/TegraRcmGUIDlg.cpp b/TegraRcmGUIDlg.cpp index c3ba047..ea66a89 100644 --- a/TegraRcmGUIDlg.cpp +++ b/TegraRcmGUIDlg.cpp @@ -74,6 +74,9 @@ BOOL CTegraRcmGUIDlg::OnInitDialog() RCM_BITMAP2.SetBitmap(DRIVER_KO); RCM_BITMAP3.SetBitmap(RCM_DETECTED); + BOOL isDriverInstalled = LookForDriver(); + if (!isDriverInstalled) InstallDriver(); + string value = GetPreset("AUTO_INJECT"); if (value == "TRUE") { @@ -222,12 +225,15 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent) this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE); this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE); s = "lbusbK driver is needed !"; + + /* if (!ASK_FOR_DRIVER) { ASK_FOR_DRIVER = TRUE; InstallDriver(); } + */ } else { @@ -244,7 +250,7 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent) DELAY_AUTOINJECT = TRUE; } } - + if (rc != RCM_STATUS) { CStatic*pCtrl0 = (CStatic*)GetDlgItem(RCM_PIC_4); @@ -534,3 +540,12 @@ void CTegraRcmGUIDlg::InstallDriver() } } } +typedef int(__cdecl *MYPROC)(LPWSTR); + +BOOL CTegraRcmGUIDlg::LookForDriver() +{ + CString LIBUSBKDLL = _T("C:\\Windows\\System32\\libusbK.dll"); + std::ifstream infile(LIBUSBKDLL); + BOOL file_exists = infile.good(); + return file_exists; +} \ No newline at end of file diff --git a/TegraRcmGUIDlg.h b/TegraRcmGUIDlg.h index c0843e4..605dca7 100644 --- a/TegraRcmGUIDlg.h +++ b/TegraRcmGUIDlg.h @@ -63,4 +63,5 @@ public: afx_msg string GetPreset(string param); afx_msg void SetPreset(string param, string value); afx_msg void InstallDriver(); + afx_msg BOOL LookForDriver(); };