Add custom tool entries
| 232 | |
| 233 | // Add custom tool entries |
| 234 | VOID AddCustomTool(VOID) |
| 235 | { |
| 236 | UINTN VolumeIndex; |
| 237 | REFIT_VOLUME *Volume; |
| 238 | CUSTOM_TOOL_ENTRY *Custom; |
| 239 | XIcon Image; |
| 240 | UINTN i = 0; |
| 241 | |
| 242 | // DBG("Custom tool start\n"); |
| 243 | DbgHeader("AddCustomTool"); |
| 244 | // Traverse the custom entries |
| 245 | for (Custom = gSettings.CustomTool; Custom; ++i, Custom = Custom->Next) { |
| 246 | if (OSFLAG_ISSET(Custom->Flags, OSFLAG_DISABLED)) { |
| 247 | DBG("Custom tool %llu skipped because it is disabled.\n", i); |
| 248 | continue; |
| 249 | } |
| 250 | // if (!gSettings.ShowHiddenEntries && OSFLAG_ISSET(Custom->Flags, OSFLAG_HIDDEN)) { |
| 251 | // DBG("Custom tool %llu skipped because it is hidden.\n", i); |
| 252 | // continue; |
| 253 | // } |
| 254 | |
| 255 | if (Custom->Volume.notEmpty()) { |
| 256 | DBG("Custom tool %llu matching \"%ls\" ...\n", i, Custom->Volume); |
| 257 | } |
| 258 | for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) { |
| 259 | Volume = &Volumes[VolumeIndex]; |
| 260 | |
| 261 | DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString); |
| 262 | |
| 263 | // Skip Whole Disc Boot |
| 264 | if (Volume->RootDir == NULL) { |
| 265 | DBG("skipped because volume is not readable\n"); |
| 266 | continue; |
| 267 | } |
| 268 | |
| 269 | // skip volume if its kind is configured as disabled |
| 270 | if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) |
| 271 | { |
| 272 | DBG("skipped because media is disabled\n"); |
| 273 | continue; |
| 274 | } |
| 275 | |
| 276 | if (Custom->VolumeType != 0) { |
| 277 | if (((1ull<<Volume->DiskKind) & Custom->VolumeType) == 0) { |
| 278 | DBG("skipped because media is ignored\n"); |
| 279 | continue; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | if (Volume->Hidden) { |
| 284 | DBG("skipped because volume is hidden\n"); |
| 285 | continue; |
| 286 | } |
| 287 | |
| 288 | // Check for exact volume matches |
| 289 | if (Custom->Volume.notEmpty()) { |
| 290 | if ((StrStr(Volume->DevicePathString.wc_str(), Custom->Volume.wc_str()) == NULL) && |
| 291 | ((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom->Volume.wc_str()) == NULL))) { |
no test coverage detected