MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / WildCardMatch

Function WildCardMatch

Drivers/Driver-SRC/setup/devcon/devcon.cpp:622–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622BOOL WildCardMatch(_In_ LPCTSTR Item, _In_ const IdEntry & MatchEntry)
623/*++
624
625Routine Description:
626
627 Compare a single item against wildcard
628 I'm sure there's better ways of implementing this
629 Other than a command-line management tools
630 it's a bad idea to use wildcards as it implies
631 assumptions about the hardware/instance ID
632 eg, it might be tempting to enumerate root\* to
633 find all root devices, however there is a CfgMgr
634 API to query status and determine if a device is
635 root enumerated, which doesn't rely on implementation
636 details.
637
638Arguments:
639
640 Item - item to find match for eg a\abcd\c
641 MatchEntry - eg *\*bc*\*
642
643Return Value:
644
645 TRUE if any match, otherwise FALSE
646
647--*/
648{
649 LPCTSTR scanItem;
650 LPCTSTR wildMark;
651 LPCTSTR nextWild;
652 size_t matchlen;
653
654 //
655 // before attempting anything else
656 // try and compare everything up to first wild
657 //
658 if(!MatchEntry.Wild) {
659 return _tcsicmp(Item,MatchEntry.String) ? FALSE : TRUE;
660 }
661 if(_tcsnicmp(Item,MatchEntry.String,MatchEntry.Wild-MatchEntry.String) != 0) {
662 return FALSE;
663 }
664 wildMark = MatchEntry.Wild;
665 scanItem = Item + (MatchEntry.Wild-MatchEntry.String);
666
667 for(;wildMark[0];) {
668 //
669 // if we get here, we're either at or past a wildcard
670 //
671 if(wildMark[0] == WILD_CHAR) {
672 //
673 // so skip wild chars
674 //
675 wildMark = CharNext(wildMark);
676 continue;
677 }
678 //
679 // find next wild-card

Callers 2

WildCompareHwIdsFunction · 0.85
EnumerateDevicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected