Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FullPath in OriginalFileName and PublishedName shouldn't be used when comparing DismDriverPackage #221

Open
elf2k00 opened this issue Feb 6, 2024 · 0 comments

Comments

@elf2k00
Copy link

elf2k00 commented Feb 6, 2024

The Equals override implementation for DismDriverPackage uses all the properties to compare a DismDriverPackage object with another, but even when they are equal they might have been already installed (and these properties changed) or its files be located in another folder.

public bool Equals(DismDriverPackage? other)
        {
            return other != null
                   && BootCritical == other.BootCritical
                   && InBox == other.InBox
                   && CatalogFile == other.CatalogFile
                   && ClassDescription == other.ClassDescription
                   && ClassGuid == other.ClassGuid
                   && ClassName == other.ClassName
                   && Date == other.Date
                   && DriverSignature == other.DriverSignature
                   && OriginalFileName == other.OriginalFileName
                   && ProviderName == other.ProviderName
                   && PublishedName == other.PublishedName;
        }

For example a comparison for the same driver vm3d.inf, one read from an offline DriverStore and the other read from the downloaded driver returns false when they are the same driver.

DriverStore:

Original Filename: G:\Windows\System32\DriverStore\FileRepository\vm3d.inf_amd64_9d22a6e67525b799\vm3d.inf
Published Name: oem1.inf

Downloaded Driver:

Original Filename: C:\drivers\vmware3d\vm3d.inf
Published Name: vm3d.inf

Filename and not the Full Path should be used for comparing OriginalFilename, and PublishedName shouldn't be used at all because the .inf name changes when installed and might be different between installations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant