MCPcopy Create free account
hub / github.com/JHRobotics/softgpu / installVideoDriver

Function installVideoDriver

windrv.c:601–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601BOOL installVideoDriver(const char *szDriverDir, const char *infName)
602{
603 HDEVINFO hDevInfo;
604 SP_DEVINSTALL_PARAMS_A DeviceInstallParams = {0};
605 SP_DRVINFO_DATA_A drvInfoData = {0};
606 SP_DRVINFO_DETAIL_DATA_A DriverInfoDetailData = {0};
607 BOOL is_vesa = FALSE;
608
609 DWORD cbReqSize;
610
611 HINF hInf;
612
613 SP_DEVINFO_DATA deviceInfoData;
614 DWORD configFlags;
615
616 /* Enumerate all display adapters */
617 hDevInfo = DYN(SetupDiGetClassDevsA)(&GUID_DEVCLASS_DISPLAY, NULL, NULL, DIGCF_PRESENT);
618
619 if(hDevInfo == INVALID_HANDLE_VALUE)
620 {
621 REPORT("SetupDiCreateDeviceInfoList: %ld", GetLastError());
622 return FALSE;
623 }
624
625 memset(&DeviceInstallParams, 0, sizeof(SP_DEVINSTALL_PARAMS_A));
626 DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_A);
627
628 if(!DYN(SetupDiGetDeviceInstallParamsA)(hDevInfo, NULL, &DeviceInstallParams))
629 {
630 REPORT("SetupDiGetDeviceInstallParamsA: %ld", GetLastError());
631 return FALSE;
632 }
633
634 DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_A);
635 DeviceInstallParams.Flags |= DI_NOFILECOPY | // not copy here!
636 DI_DONOTCALLCONFIGMG |
637 DI_ENUMSINGLEINF; /* .DriverPath specifies an inf file */
638
639 /* Path to inf file */
640 strcpy(DeviceInstallParams.DriverPath, szDriverDir);
641 strcat(DeviceInstallParams.DriverPath, "\\");
642 strcat(DeviceInstallParams.DriverPath, infName);
643
644 if(!DYN(SetupDiSetDeviceInstallParamsA)(hDevInfo, NULL, &DeviceInstallParams))
645 {
646 REPORT("SetupDiSetDeviceInstallParamsA: %ld", GetLastError());
647 return FALSE;
648 }
649
650 /* Read the drivers from the inf file */
651 if (!DYN(SetupDiBuildDriverInfoList)(hDevInfo, NULL, SPDIT_CLASSDRIVER))
652 {
653 REPORT("SetupDiBuildDriverInfoList: %ld", GetLastError());
654 DYN(SetupDiDestroyDeviceInfoList)(hDevInfo);
655 return FALSE;
656 }
657
658 int drvIndex = -1;

Callers 1

driver_installFunction · 0.85

Calls 3

getVGAadapterFunction · 0.85
closeAndDestroyFunction · 0.85
setBPPFunction · 0.85

Tested by

no test coverage detected