Start Driver.
314{
315 SC_HANDLE SchService;
318
319
320
321
322 SchService = OpenService(SchSCManager, DriverName, SERVICE_ALL_ACCESS);
323
324 if (SchService == NULL)
325 {
326 ShowMessages("err, OpenService failed (%x)\n", GetLastError());
327
328
329
330
332 }
333
334
335
336
337 if (!StartService(SchService,
338 0,
339 NULL
340 ))
341 {
342 LastError = GetLastError();
343
344 if (LastError == ERROR_SERVICE_ALREADY_RUNNING)
345 {
346
347
348
349 }
350 else if (LastError == ERROR_PATH_NOT_FOUND)
351 {
352
353
354
355 ShowMessages("err, path to the driver not found, or the access to the driver file is limited\n");
356
357 ShowMessages("most of the time, it's because anti-virus software is not finished scanning the drivers, "
358 "so, if you try to load the driver again (re-enter the previous command), the problem will be solved\n");
359
360
361
362
364 }
365 else if (LastError == ERROR_INVALID_IMAGE_HASH)
366 {
367 ShowMessages(
368 "err, failed loading driver\n"
369 "it's because either the driver signature enforcement is enabled or HVCI prevents the driver from loading\n"
370 "you should disable the driver signature enforcement by attaching WinDbg or from the boot menu\n"
371 "if the driver signature enforcement is disabled, HVCI might prevent the driver from loading\n"
372 "HyperDbg is not compatible with Virtualization Based Security (VBS)\n"
373 "please follow the instructions from: https://docs.hyperdbg.org/getting-started/build-and-install \n");
374
375
376
377
379 }
380 else
381 {
382 ShowMessages("err, StartService failure (%x)\n", LastError);
383
384
385
386
388 }
389 }
390
391
392
393
394 if (SchService)
395 {
396 CloseServiceHandle(SchService);
397 }
398
399 return Status;
400}