JoeCitizen
JoeCitizen

Reputation: 41

Windows 8 store app C++ file access

I'm working on a Windows 8 store app which uses C# for the GUI and C++ (as another project in the same solution, set to make a DLL) for image processing and am trying to open a .png image in the C++ from a path specified from the C#. This works fine when the images are located in the Apps asset folder i.e .\\Assets\\image.png but when I try to access an image in the Pictures library I get E_ACCESSDENIED in the C++ code. I have specified the Documents and Pictures library capabilities in the c# project manifest but the C++ still gets access denied. Anyone know how to give the C++ code access rights to certain folders?

e.g calling the function defined in wincodec.h, if 'filename' is somthing like "C:\Users\Name\Pictures\image0.png" hr will have the result E_ACCESSDENIED

if (SUCCEEDED(hr))
{
    hr = pFactory->CreateDecoderFromFilename(
        filename,
        NULL,
        GENERIC_READ,
        WICDecodeMetadataCacheOnDemand,
        &pDecoder);


}

Upvotes: 2

Views: 1057

Answers (1)

Howard Kapustein
Howard Kapustein

Reputation: 527

when I try to access an image in the Pictures library I get E_ACCESSDENIED

Yes, that's a feature. You need to declare the picturesLibrary capability in your application's manifest to be allowed access to the pictures library.

See this post for more details.

Upvotes: 1

Related Questions