Start Driver.
285{
286 SC_HANDLE SchService;
289
290
291
292
293 SchService = OpenService(SchSCManager, DriverName, SERVICE_ALL_ACCESS);
294
295 if (SchService == NULL)
296 {
297 ShowMessages(
"err, OpenService failed (%x)\n", GetLastError());
298
299
300
301
303 }
304
305
306
307
308 if (!StartService(SchService,
309 0,
310 NULL
311 ))
312 {
313 LastError = GetLastError();
314
315 if (LastError == ERROR_SERVICE_ALREADY_RUNNING)
316 {
317
318
319
320 }
321 else if (LastError == ERROR_PATH_NOT_FOUND)
322 {
323
324
325
326 ShowMessages(
"err, path to the driver not found, or the access to the driver file is limited\n");
327
328 ShowMessages(
"most of the time, it's because anti-virus software is not finished scanning the drivers, so, if you try to load the driver again (re-enter the previous command), the problem will be solved\n");
329
330
331
332
334 }
335 else if (LastError == ERROR_INVALID_IMAGE_HASH)
336 {
338 "err, failed loading driver\n"
339 "it's because either the driver signature enforcement is enabled or HVCI prevents the driver from loading\n"
340 "you should disable the driver signature enforcement by attaching WinDbg or from the boot menu\n"
341 "if the driver signature enforcement is disabled, HVCI might prevent the driver from loading\n"
342 "HyperDbg is not compatible with Virtualization Based Security (VBS)\n"
343 "please follow the instructions from: https://docs.hyperdbg.org/getting-started/build-and-install \n");
344
345
346
347
349 }
350 else
351 {
352 ShowMessages(
"err, StartService failure (%x)\n", LastError);
353
354
355
356
358 }
359 }
360
361
362
363
364 if (SchService)
365 {
366 CloseServiceHandle(SchService);
367 }
368
369 return Status;
370}