Replies: 14 comments 16 replies
-
No, it doesn't, I can see several ways this can go wrong.
Well, TBH, we already have build scripts for desktop. And for desktop we could do stuff like encoders, which aren't allowed in appcontainer. |
Beta Was this translation helpful? Give feedback.
-
LOL, didn't my sentence continue saying just the same ("but I'm sure there will a lot of pitfalls in the way.")?
Yes, but they are not working. My PR fixes that. I needed to make some adjustments to the sub-repos as well. If there's interest, I can submit PRs for those fixes. |
Beta Was this translation helpful? Give feedback.
-
I don' think that this approach is helpful. If we really need a Desktop FFmpeg build, we just make one. What really makes me wonder: These 12 functions are all threading related. Nothing in there is a critical or forbidden API. I really don't understand why they are not allowed. If this was a file open or something like that, I would understand (for apps, they would need to insert app permission checks). But for threading? It's strange. Could it not be that these are unintended, false alerts? Things like that have happened in the past. For me, "DesktopCompatible" still sounds like the result should be compatible with desktop, while still targeting AppStore. Besides that, if we really want/have to go for a Desktop build, we absolutely must make sure that such a build is WACK compatible. And with the solution you have done @softworkz, I have doubts about that. What you do is not a StoreApp build with DesktopCompatible. This is a full-blown Win32 Desktop build. I am really not sure if such a build could be uploaded to Windows Store. As I said, I failed to create a package of the WinUI sample. If you have a running WinUI app where you can build packages, have you tried running WACK on such an app, using your Desktop ffmpeg build? |
Beta Was this translation helpful? Give feedback.
-
I just mentioned it because you seemed to be so keen on avoiding a separate build ;-)
I'm not sure which 12 functions you have seen, but the one I'm referring to are not about threading - they are about memory manipulation: And those are quite sensitive in terms of security so I do not wonder that they are restricted.
Yes, that's what it does. It's compatible with desktop and AppStore. But AppStore for Desktop, not for devices, i.e. not for xbox and not for HoloLens.
After the failure of the store as it had been planned originally, the failure of the "Windows runs everywhere" strategy and the failure of the UWP reception at the developer side, they fundamentally changed strategy: The created DesktopBridge with which you can even bring a Windows Forms app into the store. They dropped all restrictions to get apps into the store - but ONLY for desktop apps in the store. Those super-strict store restrictions exist for UWP only not for Win AppSDK. |
Beta Was this translation helpful? Give feedback.
-
The test is still running - but I can already guarantee you that it won't fail that test... ...and that's because this test is not even included for WinUI3/WinAppSDK apps. In fact, there's quite a different set of tests for each case: Left WinAppSDK, right UWP |
Beta Was this translation helpful? Give feedback.
-
That's a very good point actually. Interestingly, both the C# and the C++ VS templates for WinUI3 are declaring runFullTrust in the appxmanifest. So I researched on whether it's even possible to distribute a WinUI3 app without runFullTrust and the answer is: yes it is. For reference, the procedure is as follows:
|
Beta Was this translation helpful? Give feedback.
-
I did the above for our WinUI3 app and the observations are as follows:
As usual, always when you try to find an answer that is expected to be simple, it's getting more and more complicated. Here's a conversation with really good information on the details around packaging and trust levels: microsoft/WindowsAppSDK#410 (comment) |
Beta Was this translation helpful? Give feedback.
-
When I add runFullTrust to a UWP app, then I get the same set of tests in WACK like for the WinUI3 app - i.e. it doesn't test for forbidden APIs: |
Beta Was this translation helpful? Give feedback.
-
I also tried to package the WinUI3 app with the same settings like for UWP apps, but this failed (more or less as expected). To do this, I specified "windowsApp" and the App class as entrypoint: This caused the app to fail startup due to "not activatable class 'App' could be found". I actually got this working and came one step further. The App class got loaded indeed but then it errored due to threading (something like the application object must only be accessed from the main thread) - even though it was on the main thread. By setting the entrypoint to MtaThread, (just for fun) I even got a tiny bit further, but then it errored like this:
It's clear that this cannot work. That probably the reason why they dropped UWP support from WindowsAppSDK. (Project Reunion 0.5) still had it. I would guess they had to make a decision towards STA as MTA would have disabled too many use cases. |
Beta Was this translation helpful? Give feedback.
-
Things are getting more clear now. While the AppCointainer concept exists for both, UWP and WinUI3, it's not the same thing: They are calling the WinUI3 one "AppContainer Light". In a UWP AppContainer, the app is fully isolated and all API calls are brokered between the container and the OS via an Out-of-Process COM server (one of the oldest Windows concepts btw.). This requires a lot of marshalling of invocations between inside and outside. Since UWP is multi-threaded (not quite, but MTA), the communication can happen on multiple threads simultaneously, which keeps the impact at least moderate. But with a single-threaded model, like they chose (or had to choose) for WinUI3, all this communication would have had to be marshalled to the main application thread. And doing so, can severely affect application performance and behavior, especially blocking the UI. That's why they invented "AppContainer Light", which still does virtualization for file system and registry access (and devices, iirc). The bottom line is that they were essentially forced to do so, and the direct result of that is that there doesn't exist an equally restricted environment for WinUI3 like there is for UWP. |
Beta Was this translation helpful? Give feedback.
-
I didn't know that it was slow. I never even got that far that I could have noticed ;-) - I've been on the MS/Windows side of things ever since and I've gone through almost everything that MSDN had to offer (had a collection of MSDN deliveries going over almost 20 years, full of CDs and DVDs, the first two years even 3.5" floppy disks).
With UWP, they have built their own little island which was isolated and didn't need to interact with anything else, That's why they could go by that different - in theory better - but harder to develop - multi-threading model. The problem is that it's relatively easy to host a MTA UI component in an STA framework (that's why you can have UWP components in a WinUI app. But it doesn't work the other way round. And I think that's what they realized when they were at v0.5 of Project Reunion.
Most definitely. And the successors didn't do much better, since they even got until v0.5 when they realized that there's nothing to re-unite. Because essentially, they didn't re-unite with UWP. It's quite funny that WinUI2 came to UWP even after they had started WinUI3. Since the developers are the same, they must have somehow slowed down WinUI3 to deliver WinUI2. |
Beta Was this translation helpful? Give feedback.
-
Mobile was their biggest mistake from which that series of failure had begun. MS was ahead of all others with Windows CE and Windows Phone edition. No Apple, no Android in sight. |
Beta Was this translation helpful? Give feedback.
-
I have a addressed that idea right in the first message of this conversation:
|
Beta Was this translation helpful? Give feedback.
-
You missed the important sentence:
In case you wonder why would we would end up with a dependency on kernel32 (or kernelbase), that's quite simple: Because that's what msvcruntime140_app (and friends) are doing eventually. The functions they provide are not all self-contained. Doing something like memset requires calling into the kernel and potentially additional layers in-between. The app-local function are providing such kind of in-between layer to provide isolation and enforce restrictions. Clear now? |
Beta Was this translation helpful? Give feedback.
-
I didn't say the following earlier, because I wanted to wait until the situation has cleared up a bit and would be understood at least roughly. Now that this is achieved:
If you really really really really want to have just a single FFmpeg build for UWP and Desktop, then it could probably, maybe, perhaps and possibly be done as follows:
We're talking about like 12 functions only which are causing the dependency on the one app-local lib.
If we want to be able to use the UWP build for both, uwp and win32 targets, then it would go only by eliminating those dependencies from the ffmpeg dlls. The first and easiest thought would be to statically link these functions into the ffmpeg libs.
But those functions are: memset, memmove, strchr and the likes. If we would (even manage to) statically link them into the ffmpeg libs, then we would end up with a dependency on kernel32.dll in exchange - which is probably the most forbidden dependency you can even have ;-)
But it might be possible like this:
As a result, you would have a single set of ffmpeg dlls for each platform and only exchange the ffbridge.dll depending on whether it's for UWP or WinUI.
This sounds simple, but I'm sure there will a lot of pitfalls in the way. Maybe it doesn't work out, at all. I have no motivation to even think about it. For what anyway? For the 30 NB output size per platform? For the 10 minutes which it takes to build another version of ffmpeg?
Our ffmpeg build (+MPV) takes 50min for only x86 and x64 - it's no big deal - and here it's just 10 minutes. I would even wait for 100 minutes rather than messing with ffmpeg's build system...
Beta Was this translation helpful? Give feedback.
All reactions