[llvm] [Support] Add LLVM_WINDOWS_AVOID_SHELL32_APIS for shell32-free path lookups (PR #209448)
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 08:02:48 PDT 2026
compnerd wrote:
I'm rather uncomfortable with this change (only briefly having glanced through it). First of all, the libc functions should not be used, the win32 equivalents like `GetEnvironmentVariableW` and `SetEnvironmentVariableW` should be instead. The libc paths do not necessarily reflect in win32 but the vice versa does.
Furthermore, Microsoft explicitly recommends the use of the shell API for this, not environment (which was also prohibited in UWP and sandboxed applications).
The idea for UWP/LPAC is that you do not have an environment at all, and so using that is also not acceptable.
You should be working with the security APIs to determine the SID - don't assume a username at all. Similarly, assume no Unix concepts as home directory or temporary directory - you must use the `Windows.Storage.ApplicationData.Current.LocalFolder` APIs to get the `StorageFolder` to use rather than current directory. But then, would we use the `RoamingFolder` so that all content is backed up to one drive since the UWP model prefers a stateless local application. The `TempState` could allow the temporary storage,
https://learn.microsoft.com/en-us/cpp/c-runtime-library/windows-store-apps-the-windows-runtime-and-the-c-run-time?view=msvc-170
https://github.com/llvm/llvm-project/pull/209448
More information about the llvm-commits
mailing list