77#include < filesystem>
88#include < optional>
99#include < iostream>
10+ #include < format>
11+ #include < cstdio>
1012
1113#include < boost/optional.hpp>
1214#include < boost/algorithm/string.hpp>
@@ -1474,15 +1476,15 @@ void CMainFrame::Resume()
14741476 {
14751477 m_pKernelReader = m_logSources.AddKernelReader ();
14761478 }
1477- catch (std::exception&)
1479+ catch (std::exception& e )
14781480 {
1479- MessageBox ( L " Unable to capture Kernel Messages.\n "
1480- L" \n "
1481- L " Make sure you have appropriate permissions.\n "
1482- L "\n "
1483- L " You may need to start this application by right-clicking it and selecting\n "
1484- L " 'Run As Administator' even if you have administrator rights." ,
1485- m_applicationName.c_str (), MB_ICONERROR | MB_OK);
1481+ const auto message = std::format ( " Unable to capture Kernel Messages.\n "
1482+ " ({}) \n \n"
1483+ " Make sure you have appropriate permissions.\n "
1484+ " \n "
1485+ " You may need to start this application by right-clicking it and selecting\n "
1486+ " 'Run As Administator' even if you have administrator rights." , e. what ());
1487+ MessageBox ( WStr (message), m_applicationName.c_str (), MB_ICONERROR | MB_OK);
14861488 m_tryKernel = false ;
14871489 }
14881490 }
@@ -1517,11 +1519,9 @@ void CMainFrame::OnLogGlobal(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl
15171519 UpdateTitle ();
15181520}
15191521
1520- static const auto driver_name = " C:\\ Windows\\ System32\\ drivers\\ dbgvpp.sys" ;
1521-
1522- void WriteDriverFromResource ()
1522+ void CMainFrame::WriteDriverFromResource ()
15231523{
1524- if (std::filesystem::exists (driver_name ))
1524+ if (std::filesystem::exists (m_driverLocation ))
15251525 {
15261526 return ;
15271527 }
@@ -1535,18 +1535,18 @@ void WriteDriverFromResource()
15351535 void * pLockedRes = LockResource (hLoadedRes);
15361536 if (pLockedRes)
15371537 {
1538- std::cout << " write to " << driver_name << " \n " ;
1539- std::ofstream outFile (driver_name, std::ios::binary);
1538+ std::ofstream outFile (m_driverLocation.c_str (), std::ios::binary);
15401539 outFile.write (static_cast <const char *>(pLockedRes), dwSize);
15411540 outFile.close ();
15421541 }
15431542 }
15441543 }
15451544}
15461545
1547- void RemoveDriver ()
1546+ void CMainFrame:: RemoveDriver ()
15481547{
1549- std::filesystem::remove (driver_name);
1548+ // can fail silently
1549+ std::remove (m_driverLocation.c_str ());
15501550}
15511551
15521552void CMainFrame::OnLogKernel (UINT /* uNotifyCode*/ , int /* nID*/ , CWindow /* wndCtl*/ )
0 commit comments