So, environment functions are available to UWP Apps after all. It's a shame Microsoft didn't bother to update their documentation to reflect these changes. Needless to say it's gonna save me a lot of troubles :).
I guess, from now on, I better rely on .xml files under C:/Program Files/Windows Kits/10/App Certification Kit instead of Microsoft docs. Now that I think of it, it seems like Microsoft's header files are a decent source of information as well, since, for example, they do not guard declarations of environment functions with WINAPI_FAMILY checks. - Kirill Makurin ________________________________ From: Pali Rohár <[email protected]> Sent: Tuesday, December 30, 2025 8:06 PM To: Martin Storsjö <[email protected]> Cc: [email protected] <[email protected]>; Kirill Makurin <[email protected]> Subject: Re: Should be libapi-ms-win-crt-environment-l1-1-0.dll in libucrtapp.a? On Tuesday 30 December 2025 11:23:02 Pali Rohár wrote: > On Monday 29 December 2025 14:23:46 Martin Storsjö wrote: > > On Tue, 23 Dec 2025, Pali Rohár wrote: > > > > > Hello, according to the information on Microsoft website > > > https://learn.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps > > > Environment variables functions are not available for UWP applications. > > > > > > But currently mingw-w64 puts libapi-ms-win-crt-environment-l1-1-0.a > > > import library into the final libucrtapp.a library. > > > > > > I have feeling that this is incorrect and import library > > > libapi-ms-win-crt-environment-l1-1-0.a should not be present in the > > > mingw-w64-crt/lib-common/ucrtapp.mri. > > > > > > Just to note that in msvcr120_app.dll are missing all env functions. > > > There is just _environ symbol but it is NULL, same as 3rd argument > > > passed to main(). As the msvcr120_app.dll is another library specially > > > for Store / UWP apps, this can be an another proof that env functions > > > are not available. > > > > > > Could you check if the api-ms-win-crt-environment-l1-1-0.dll is allowed > > > to use in UWP and if it should be part of our libucrtapp.a library? > > > > I think the page you're linking to is outdated. > > > > The exact set of allowed functions has changed over time. It's not a > > technical limitation (it's not that the earlier versions of Windows 10 would > > refuse to run an UWP app that used such APIs), but it would be that > > Microsoft would reject such an app in the Store submission process, as far > > as I know. Therefore it's technically ok to widen the set of permitted APIs > > over time. > > > > When looking at "App Certification Kit/SupportedAPIs-x64.xml" in an old > > (10.0.10586.0) version of the Windows 10 SDK, only very few functions are > > allowed from api-ms-win-crt-environment-l1-1-0.dll. With a newer version of > > the Windows 10 SDK (10.0.17763.0), many more functions from > > api-ms-win-crt-environment-l1-1-0.dll are allowed. > > > > So I see no reason to remove it from libucrtapp.a. For msvcr120_app.dll, > > that's from an earlier time when those functions indeed were not available. > > > > // Martin > > Thank you for clarification. I did not know how exactly is validation > check working and MS website did not help. > > Maybe it could make sense to include information from some new Windows > 10 SDK (e.g. 10.0.17763.0) into our def files that particular function > is not allowed in UWP? Because currently it is hard to figure out from > mingw-w64 project what is possible to use and what not, even when > information on the MS website is outdated. > > Otherwise it is also hard to figure out if mingw-w64 runtime can use > some of the CRT or WinAPI function without affecting the libucrtapp.a > support. Just for information how to quickly access the latest SupportedAPIs XML file without need to install full Windows SDK of particular version. Entry point Visual Studio is: https://aka.ms/vs/17/release/channel Find a VisualStudio.vsman link in it. Currently it is: https://download.visualstudio.microsoft.com/download/pr/a80deb24-6a28-4d30-b99f-13b6e89c9727/cd752233e77a8cf93a6b83ca3be9d3b8b78f030bfc4abc774c774f64284c8844/VisualStudio.vsman Find there "supportedapilist" msi files. There 3 for x86 in different SDK sections. First one in SDK section 10.0.19041.4, second in 10.0.22621.7 and third in 10.0.26100.14. Download links for the latest one 10.0.26100.14 is: https://download.visualstudio.microsoft.com/download/pr/3afa4e72-d57a-4ebb-93c5-e7962e7b633b/7bdb723afa51fa8d0c1a84921508e9c1/windows%20app%20certification%20kit%20supportedapilist%20x86-x86_en-us.msi After inspecting the msi file, it reads data from external CAB files: https://download.visualstudio.microsoft.com/download/pr/3afa4e72-d57a-4ebb-93c5-e7962e7b633b/4a8608b4bc3a15aaec125c8bfc8d593b/e3bfdbe21d5f48f62e6347294e6e8492.cab https://download.visualstudio.microsoft.com/download/pr/3afa4e72-d57a-4ebb-93c5-e7962e7b633b/b5e42a5b6c1b87637ec3154540a2a049/ec9ab4bbb809719605d27da343b909e8.cab With the msi file and those 2 cab files, it is possible to unpack it. Program Files/Windows Kits/10/Catalogs/cate3bfdbe21d5f48f62e6347294e6e8492.cat Program Files/Windows Kits/10/App Certification Kit/SupportedAPIs-x86.xml Program Files/Windows Kits/10/Catalogs/catec9ab4bbb809719605d27da343b909e8.cat Program Files/Windows Kits/10/App Certification Kit/SupportedAPIs-x64.xml I checked api-ms-win-crt-environment-l1-1-0.dll and all functions from mingw-w64-crt/lib-common/api-ms-win-crt-environment-l1-1-0.def are in SupportedAPIs-x86.xml and SupportedAPIs-x64.xml. So it means that all api-ms-win-crt-environment-l1-1-0 functions are now supported. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
