Some time ago I mentioned to Pali that my next goal for my "posix32" library 
would be to implement *environment* functions (getenv, setenv etc.).

Based on information pointed by the link, I concluded that CRT's *environment* 
functions cannot be used in UWP Apps and I planned to implement the whole 
subsystem around Win32 equivalents for UWP configuration of the library.

This is when Pali noted that libapi-ms-win-crt-environment-l1-1-0.dll is 
included in libucrtapp.a, and this raised some questions.

- Kirill Makurin
________________________________
From: Martin Storsjö <[email protected]>
Sent: Monday, December 29, 2025 9:23 PM
To: Pali Rohár <[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 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

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to