-
Notifications
You must be signed in to change notification settings - Fork 325
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
StorageFile.GetFileFromPathAsync #4844
Comments
The But you seem to have an issue with Can you confirm the directory created by |
I dont think ref : #8 (comment) |
@mominshaikhdevs Folder access, such as ApplicationData, only require a package and they work perfectly fine outside of an AppContainer. This doesn't include UserDataPaths since this provide paths to the user profile and will work without a package. There is more here, but I haven't really dug into them properly. But they should all be usable if you just double check the documentation and avoid problematic things like app specific URIs. |
@whiskhub hmm, are you saying Windows.Storage API is not designed to be used outside the context of MSIX package app? @mominshaikhdevs |
@DarranRowe can you elaborate more on how i can use the Storage api outside the AppContainer? basically, my project set up is like this. I am using cldapi.dll to create a sync root for a cloud provider service that i built. |
Not really, since I have already stated the important points. I guess the only thing to mention is that getting a StorageFolder to the profile's temporary directory isn't obvious. An unpackaged application would normally use UserDataPaths. But like SHGetKnownFolderPath that it takes the naming pattern from, UserDataPaths doesn't expose a temporary directory. There are only two ways that I know how to make a StorageFolder to the temporary directory. The first is to query Windows (C++ GetTempPath) and then use that in GetFolderFromPathAsync.
The second would be to use UserDataPaths.LocalAppData and then use that. The user's temporary directory is normally Temp in the user's local appdata directory. |
@hu13 AppContainer and MSIX are totally two independent things. AppContainer is built on top of LowIL Process, where MediumIL is Full Trust Process, HighIL is Elevated/Admin Process. these are kernel-mode "processes integrity levels" deeply rooted into the kernel. Broker Processes for LowIL Processes are very poorly implemented in Windows (because targeted
|
Please provide a complete repro, that is a simple targeted one. |
@RDMacLachlan Action: https://github.com/hu13/winrt-go/actions/runs/11692496497/job/32561988370 this is the smallest reproducible test with the following set up:
if you checkout the branch and run this test locally on a windows machine, it will work. However, it does not work on github action windows VM. |
i got my set up to work now.
|
@hu13 I ask this because Go is using double backslashes for a reason, and a malformed path can cause problems. Besides this, making the assumption that the single backslash is a mistake, have you tried using the long filename version of the path for temp. For example, instead of using I will emphasise that these hardcoded paths would just be for testing purposes to understand why the calls are failing. This isn't a suggestion to use hardcoded paths as a solution to the problem. |
Not always. They're designed to work in an AppContainer and in MediumIL. These APIs often run inproc when called in a MediumIL process. That said, Win32 GetTempPath(), C++ std::filesystem::temp_directory_path(), C# System.IO.Path.GetTempPath(), Python tempfile.gettempdir(), etc all work just fine. Is there a reason this isn't sufficient? |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
I am have been trying to debug an issue i have with StorageFile.GetFileFromPathAsync.
In my use case, i am accessing this API via a winrt-go (https://github.com/hu13/winrt-go).
I have a test that creates the test file in a os.TempDir's location which belongs in:
~/AppData/Local/Temp/myDir/myTestFile.txt
, then i call the getfilepath api and it keeps returning UnauthorizedAccessException error aka 0x80070005.Some stacktrace:
Exception 0xc0000005 0x1 0x50 0x7ffe99921c58
PC=0x7ffe99921c58
runtime.cgocall(0x795080, 0xc00007a330)
C:/hostedtoolcache/windows/go/1.23.2/x64/src/runtime/cgocall.go:167 +0x3e fp=0xc000043c60 sp=0xc000043bf8 pc=0x78439e
syscall.SyscallN(0xc00003caa0?, {0xc00020e318?, 0xc00013f160?, 0xb4f765?})
C:/hostedtoolcache/windows/go/1.23.2/x64/src/runtime/syscall_windows.go:519 +0x46 fp=0xc000043c80 sp=0xc000043c60 pc=0x78f506
github.com/saltosystems/winrt-go/windows/storage.StorageFileGetFileFromPathAsync({0xc00003caa0, 0x53})
This only happens in github action VM that runs windows server 2022. The same test passes on my physical windows PC.
From my understanding, the StorageApi should have access to TemporaryFolder by default.
Any ideas? Thanks
The text was updated successfully, but these errors were encountered: