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

Access denied (0xc0000005) when running under Windows 10 version 17763 #4574

Open
leberechtreinhold opened this issue Jun 21, 2024 · 2 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@leberechtreinhold
Copy link

leberechtreinhold commented Jun 21, 2024

Brief description of your issue

When running winget --list with scope machine on a Windows 10x86 build 17763, it crashes.

The reason is because PopulateIndexFromMSIX (

void PopulateIndexFromMSIX(SQLiteIndex& index, Manifest::ScopeEnum scope, SQLiteIndex* cacheData = nullptr)
) calls FindProvisionedPackages. This however seems to return a null value which is not catch by the catch hresult and is therefore a nullptr.

Looking at documentation, it does seem the minimum build would be 19041, not 17763, as stated in docs.

Windows 10, version 2004 (introduced in 10.0.19041.0)

https://learn.microsoft.com/en-us/uwp/api/windows.management.deployment.packagemanager.findprovisionedpackages?view=winrt-22621

MGdF9HpWoF

void PopulateIndexFromMSIX(SQLiteIndex& index, Manifest::ScopeEnum scope, SQLiteIndex* cacheData = nullptr)
{  
    //....
    AICLI_LOG(Repo, Verbose, << "Examining MSIX entries for " << ScopeToString(scope));

    IIterable<Package> packages;
    PackageManager packageManager;
    if (scope == Manifest::ScopeEnum::Machine)
    {
        packages = packageManager.FindProvisionedPackages();
    }

// --------------
template <typename D> auto consume_Windows_Management_Deployment_IPackageManager9<D>::FindProvisionedPackages() const
{
    void* packageCollection{};
    check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Management::Deployment::IPackageManager9)->FindProvisionedPackages(&packageCollection));
    return winrt::Windows::Foundation::Collections::IVector<winrt::Windows::ApplicationModel::Package>{ packageCollection, take_ownership_from_abi };
}

// -------------- 
int32_t __stdcall FindProvisionedPackages(void** packageCollection) noexcept final try
{
    clear_abi(packageCollection);
    typename D::abi_guard guard(this->shim());
    *packageCollection = detach_from<winrt::Windows::Foundation::Collections::IVector<winrt::Windows::ApplicationModel::Package>>(this->shim().FindProvisionedPackages());
    return 0;
}
catch (...) { return to_hresult(); }

Steps to reproduce

Run winget --list with scope machine

Expected behavior

Not crash, return the base products. Since that specific os didnt have MSStore, it should be empty.

Actual behavior

Crash

Environment

Compiled release-v1.7.11261


Machine:

![UEMi2ND62J](https://github.com/microsoft/winget-cli/assets/24320606/25a5fd83-cc93-42bf-8557-0d01a4d07b17)
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jun 21, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@leberechtreinhold
Copy link
Author

^ That crash happens with the package itself being null, here's the FindProvisionedPackages call.

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

2 participants