@@ -107,7 +107,8 @@ class Driver
107107 if (err == ERROR_SERVICE_ALREADY_RUNNING) return true ;
108108
109109 std::wcerr << " Starting MSR service failed with error " << err << " " ;
110- const TCHAR * errorStr = _com_error (err).ErrorMessage ();
110+ const _com_error comError{ (int )err };
111+ const TCHAR * errorStr = comError.ErrorMessage ();
111112 if (errorStr)
112113 std::wcerr << errorStr << " \n " ;
113114
@@ -120,7 +121,8 @@ class Driver
120121 else
121122 {
122123 std::wcerr << " Opening service manager failed with error " << GetLastError () << " " ;
123- const TCHAR * errorStr = _com_error (GetLastError ()).ErrorMessage ();
124+ const _com_error comError{ (int )GetLastError () };
125+ const TCHAR * errorStr = comError.ErrorMessage ();
124126 if (errorStr)
125127 std::wcerr << errorStr << " \n " ;
126128 }
@@ -130,7 +132,8 @@ class Driver
130132 else
131133 {
132134 std::wcerr << " Opening service manager failed with error " << GetLastError () << " " ;
133- const TCHAR * errorStr = _com_error (GetLastError ()).ErrorMessage ();
135+ const _com_error comError{ (int )GetLastError () };
136+ const TCHAR * errorStr = comError.ErrorMessage ();
134137 if (errorStr)
135138 std::wcerr << errorStr << " \n " ;
136139 }
@@ -169,7 +172,8 @@ class Driver
169172 else
170173 {
171174 std::wcerr << " Opening service manager failed with error " << GetLastError () << " " ;
172- const TCHAR * errorStr = _com_error (GetLastError ()).ErrorMessage ();
175+ const _com_error comError{ (int )GetLastError () };
176+ const TCHAR * errorStr = comError.ErrorMessage ();
173177 if (errorStr)
174178 std::wcerr << errorStr;
175179 }
@@ -197,7 +201,8 @@ class Driver
197201 else
198202 {
199203 std::wcerr << " Opening service manager failed with error " << GetLastError () << " " ;
200- const TCHAR * errorStr = _com_error (GetLastError ()).ErrorMessage ();
204+ const _com_error comError{ (int )GetLastError () };
205+ const TCHAR * errorStr = comError.ErrorMessage ();
201206 if (errorStr)
202207 std::wcerr << errorStr;
203208 }
0 commit comments