| 54 | {BACKEND_DRIVER_BLOCKLIST_TYPE_VENDOR, {26, 20, 100, 7800}, {27, 20, 100, 8853}, "Intel", 2, 0, 0, "This Intel driver version can cause crashes, please update it to a newer version.", false, "windows"}}; |
| 55 | |
| 56 | const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr, int &BlocklistMajor, int &BlocklistMinor, int &BlocklistPatch, bool &RequiresWarning) |
| 57 | { |
| 58 | if(str_find_nocase(pVendorStr, "Intel") == nullptr) |
| 59 | return nullptr; |
| 60 | |
| 61 | const char *pVersionStrStart = str_find_nocase(pVersionStr, "Build "); |
| 62 | if(pVersionStrStart == nullptr) |
| 63 | return nullptr; |
| 64 | |
| 65 | // ignore "Build ", after that, it should directly start with the driver version |
| 66 | pVersionStrStart += (ptrdiff_t)str_length("Build "); |
| 67 | |
| 68 | char aVersionStrHelper[512]; // the size is random, but shouldn't be too small probably |
| 69 | |
| 70 | SVersion Version; |
| 71 | for(int &VersionPart : Version.m_aParts) |
| 72 | { |
| 73 | pVersionStrStart = str_next_token(pVersionStrStart, ".", aVersionStrHelper, sizeof(aVersionStrHelper)); |
| 74 | if(pVersionStrStart == nullptr) |
| 75 | return nullptr; |
| 76 | |
| 77 | VersionPart = str_toint(aVersionStrHelper); |
| 78 | } |
| 79 | |
| 80 | for(const auto &BlockListItem : gs_aBlockList) |
| 81 | { |
| 82 | if(str_comp(BlockListItem.m_pOSName, CONF_FAMILY_STRING) == 0) |
| 83 | { |
| 84 | bool DriverBlocked = false; |
| 85 | if(BlockListItem.m_BlockListType == BACKEND_DRIVER_BLOCKLIST_TYPE_VENDOR) |
| 86 | { |
| 87 | if(str_find_nocase(pVendorStr, BlockListItem.m_pVendorName) != nullptr) |
| 88 | { |
| 89 | DriverBlocked = true; |
| 90 | } |
| 91 | } |
| 92 | else if(BlockListItem.m_BlockListType == BACKEND_DRIVER_BLOCKLIST_TYPE_VERSION) |
| 93 | { |
| 94 | if(BlockListItem.m_VersionMin <= Version && Version <= BlockListItem.m_VersionMax) |
| 95 | { |
| 96 | DriverBlocked = true; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | if(DriverBlocked) |
| 101 | { |
| 102 | RequiresWarning = BlockListItem.m_DisplayReason; |
| 103 | BlocklistMajor = BlockListItem.m_AllowedMajor; |
| 104 | BlocklistMinor = BlockListItem.m_AllowedMinor; |
| 105 | BlocklistPatch = BlockListItem.m_AllowedPatch; |
| 106 | return BlockListItem.m_pReason; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | return nullptr; |
| 112 | } |