How launch external executable in uwp app - javascript

Here my problem, i create a couple mini game for windows 10 (PC, phone, Hololens UWP, ...), but now i would like to make a launcher to gather all my games, like steam (for example).
But, according to Microsoft, it's impossible to launch a .exe or even .msi from UWP app -> ("This API also imposes several restrictions on what types of files it can launch. Many file types that contain executable code, for example .exe, .msi, and .js files, are blocked from launching. This restriction protects users from potentially malicious files that could modify the system.
")
And now i search a solution, maybe with the Full​Trust​Process​Launcher Class but i dont know how its works :
https://learn.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher#Windows_ApplicationModel_FullTrustProcessLauncher_LaunchFullTrustProcessForCurrentAppAsync_System_String_
if you have an idea, a solution or even an exemple, I will be thankfull
Best regards
PS: sorry for the bad english, i'm french ^^

You can accomplish this by supporting a custom protocol in your games. Then your launcher app can launch them via that protocol by using the LaunchUriAsync API:
https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher#Windows_System_Launcher_LaunchUriAsync_Windows_Foundation_Uri_

Sorry, that is not going to work.
"Full​Trust​Process​Launcher Class
Activate the full-trust Win32 component of an application from a Universal Windows app component in the same application package."
In other words this is to run a Win32 component of the current application.
Since Microsoft wants UWP to be more secure, your best option is probably to bundle your games together in one bigger application. Have the start page / form be a menu of the games, then switch to another form for each game.
Name your classes, forms, resources carefully so you know what game they are for -- ChessMain, ChessForm, chess_logo.jpg; CheckersMain, CheckersForm, CheckersPlayerTurn.

I have a hack way that may help to launch the exe in uwp.
If you want to use the win32 dll that in other directory,please get the LoadLibrary that can use it.
You can use
MEMORY_BASIC_INFORMATION info = {};
if (VirtualQuery(VirtualQuery, &info, sizeof(info)))
{
auto kernelAddr = (HMODULE)info.AllocationBase;
auto loadlibraryPtr = GetProcAddress(kernelAddr, "LoadLibraryExW");
// load your library here ...
}
to get the loadlibrary and use to loadlibrary the dll.
See https://hjc.im/3-ways-to-bypass-wack/
Ms use the PE and P/Invoke to judge whether uwp use the not allowed dll.
So you can use the loadlibrary to load it.
You can launch the exe by win32.
But it may work today but it might break tomorrow.

Related

How do I use universal links with Expo?

We have the server set up and configured to return certain paths under /.well-known/apple-app-site-association. When we publish our app, the "associatedDomains" key in our app.json instructs iOS to give us a chance to open links in app.
That all, more or less, works. What we can't figure out is how to productively test universal links during local development. The expo app won't have our app.json and its a horrendous flow to make an independent build for this purpose (we lose hot reloading and frankly it just doesn't seem to work regardless)
This wouldn't be the end of the world if our product didn't require opening a link in email to log in, but it does and that requirement isn't going anywhere.
Expo does not support Universal links in development. They can only be tested in production and standalone builds. One work around for this is to use something like branch.io to conditionally send the user to a different url depending on the device they are using.

How to protect copyrighted multimedia files when downloading to android phone?

I'm building an application that allows users to upload multimedia files they create (audio, video, graphic) via my web frontend, and then other users can stream/download the files to their phone using my mobile app. I'm building the mobile app with react native. The problem is with the android platform-- when the files are downloaded, they show up in the Downloads folder, which means they can be copied, moved, and opened from other apps.
Since the file contents are copyrighted, I need to find a way to
prevent these files from being listed in the Downloads folder
and / or
prevent other apps from opening them.
Apps like Spotify and Netflix manage to do it (e.g. if you download a playlist from Spotify, you can't see them anywhere else on your phone). I believe some kind of encryption/decryption scheme is involved. But I don't know enough about it. Would appreciate any insight on how to go about this.
As Luke says, there is no 100% protection, but usual approach is to encrypt the files and to use a DRM system to manage the secure transition of the key from the server to the client Android device.
Android devices (generally) come with widevide DRM built in and this is probably the most common one used, but the system supports other DRMs also and device vendors may add different ones.
If you are prepared to accept a less secure encryption, but one which may be good enough for your needs, then MPEG DASH includes a 'clearkey' option which ExoPlayer supports. If you do go this way it is worth checking on the latest ExoPlayer status as this feature is being worked on at the moment:
https://github.com/google/ExoPlayer/issues/3178

Source visibility in ionic hybrid apps

I've just started learning ionic framework. It uses web browser capabilities for building apps.
These capabilities namely HTML, javascript and CSS are client side stuff. Which on browsers can be seen with view source.
My questions is how will be the visibility of the source? Will the end user be able to see the source of the app?
If yes, is it normal for any app? Shall one be worried about the security of the source?
The visibility of the source in chrome://inspect#device , is pretty much the whole application. And no, end user cannot see the source of your application once you set and push the project to production mode.
Well, since you are developing a hybrid application, there are of course, pros and cons for each. Security might not be as strong as native apps, but development time is greatly reduced to push the app to different platforms.
If you would to do something would requires high security and non-visibility of your source , then native is the way to go. As for hybrid apps,if you need somewhere to store your data securely, you will need plugins to communicate with native platform's secure storage which might pose a security risk. But then again, even native applications can be de-compiled. The way developers tries to make it harder is via obfuscation methods.
Once u set your application to production mode, you will not be able to inspect your application anymore.
To show your web-app on chrome://inspect/#devices :
1) Make sure your web-app is running and your phone is plugged into your computer via usb with USB debugging on and your PC is trusted by the phone.
2) Under device manager, you should not have missing phone drivers. (it would look something like this)
3) ADB should not be running co-currently. And you should be able to see something like this on ur inspect page:
4) Click on inspect button and you're done! (:
You have a signed apk, when you install it on a device and inspect the device on google chrome the inspect option will not be available. Theres an easy way to do that decompile the signed apk using apktools you will get the AndroidManifest.xml file. simply add android:debuggable="true" to the tag and recompile it resign it and you will be able to inspect it. If you check the main.js file in the inspect section the source code is visible.
Hence you can use Jscrambler to prevent this (Its a paid service i too am new to it)

App switching in UI Automation

Is there a way to switch between applications using UI Automation in instruments?. And also to change wifi settings using the same? Any help will be greatly appreciated.
There is not currently a way to change connection settings. Although, technically if you are using the simulator you could launch an external script using UIAHost.performTaskWithPathArgumentsTimeout to change the host computers internet settings.
Switching between apps is also not possible for the reason that they don't want you controlling apps that aren't yours. However, if you own both apps I suppose it'd be possible to launch an external script to launch one app in instruments and once that test is over launch the second one. This would only work in some cases though.

How to build & deploy a Samsung SmartTV app without the IDE (e.g: on Linux)

Problem:
I'd like to try building a proof-of-concept app using the Samsung SmartTV SDK 2.5 (I have a 2011 model TV - UA55D8000).
Unfortunaltely, the SDK comes in two varieties that only seem to work on Microsoft Windows. It's weird because there's no reason it should be the case: the televisions themselves run Linux and applications are written in JavaScript.
This presents two problems:
As I don't have Microsoft Windows at home, I can't use the build environment (nor the TV emulator) that come with the SDK. (The SDK files themselves are just JavaScript)
Even if I had access to Windows, it's very hard to automate building & testing of the Apps without access to traditional build tools (e.g: Make, Ant, Autotools, etc)
How can I build Samsung Smart TV Applications on Linux? (i.e: without using the Windows-based build tools that come with the SDK)
What I've figured out so far:
From what I can gather, a JavaScript-mode application is simply zip file containing an XML config file, one or more JavaScript files (including supplied JavaScript interface libraries for platform SDK functions), and any required assets (HTML, images, etc).
Also, from what I gather, deployment involves placing the zip file and an XML manifest file on a web-server network accessible to the TV, logging in as 'develop' on the TV and 'syncing' the application to the installed applications on the TV.
Could someone point me to a source for the full deployment requirements & app bundle requirements? Or even just a working sample?
I've had a reasonable amount of success setting up a development environment on my Ubuntu machine and I'd like to share my methods here for anyone looking to do the same. This answer is intended to be platform independent, so the same advice should work on any fully fledged operating system.
Introduction
First off, the question's assumptions regarding app structure are correct. A JavaScript application consists of the following items:
config.xml, a simple configuration file defining various settings and deployment information. See Writing the config.xml File on the official developer site.
widget.info, a very small file with a few lines used to define the opacity of the application's body. This may not be required for full-screen applications.
index.html, the main HTML file for your application.
Images, sounds and other resources.
You can write these files using your favourite editor. I'm happily using vim with linting plugins for my JS and CSS.
Testing
As of version 4.0 of the SDK, a Linux version of the emulator is now available. This allows you to test your apps as they would appear on 2011-2013 TVs. For older TVs, you can run SDK 1.5's emulator in Wine, but emulators belonging to SDK 2.0 and newer will not run.
It is possible to run the emulators in a Windows virtual machine, and, with a little bit of trickery, you can make the emulators use your own application folder to look for apps. This involves sharing your development folders with your virtual machine, then creating a symbolic link to those folders, replacing the "apps" folder inside the SDK's installation directory. A quick overview of this process is available in an article titled, Your Windows IDE sucks? Replace it with Your Favorite Editor on the Mac!
Deployment
Samsung Smart TVs have a built-in developer account that allows you to send an application over from your computer for live testing on the television itself. You enter the IP address of your deployment server and the TV will look for a file called widgetlist.xml on that server. An example of the format is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<list>
<widget id="MyTVApp">
<title>MyTVApp</title>
<compression size="3383543" type="zip"/>
<description>A basic application for Samsung TVs</description>
<download>http://192.168.1.83/Widget/MyTVApp_0.1_America_20120709.zip</download>
</widget>
</list>
</rsp>
After that, it will download each app listed using the URL in the <download> tag. All you have to do is zip up the files, modify the widgetlist.xml accordingly and make sure both files are hosted in a web server running on your machine. You can use Apache, lighttpd or anything. I have a small node.js/connect app that will build the widgetlist.xml dynamically based on the zip files I have in a directory labelled deploy.
So there you have it. Development of Samsung Smart TV apps is not impossible without Windows. In fact, there's quite a few options available. Hooray!
They have now released Smart TV SDK 4.0 which includes support for Linux & Mac OS X: http://www.samsungdforum.com/SamsungDForum/NewsView?newsID=27
"In addition to the Eclipse-based App Editor, a new Linux-based Emulator has been released.
This Emulator executes in an Ubuntu virtual machine that is run in the Virtual Box virtualization tool."
■ Features for 2013 Platform on Linux (First Release)
Apps Framework
App Engine / WebKit
UniPlayer
SEF (Service Extension Framework)
You need to register to Samsung D forum and then you can download the SDK from https://www.samsungdforum.com/Devtools/SdkDownload
One tip that I have not seen mentioned in any of the answers, is that the TV will attempt to open a socket connection on port 45634 of the machine where the app was downloaded from (the one with the widgetlist.xml).
All debugging (alerts() calls), will be sent over this port, allowing for remote debugging.
I use NetCat to open a port and dump all logs, like so:
nc -l 45634
I've created this Answer for a topic that I know nothing about, but nevertheless I did spot something that threw a red flag in my direction... bounty or not.
First, I looked at your WineHQ Bug Report to see if this issue was resolved, but it's still pending as of this writing. I noticed that bug report had a reference link to the discussion which I clicked and followed.
Looking at the machine-code generated dump-error in that discussion proved informative.
Reference:
Z:\home\andy.wine\drive_c\Program Files (x86)\Samsung\Samsung TV
SDK(3.5.2)\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
The above Path is the location of the file that caused the dump. That path is the red flag I mentioned.
Let me back up a tiny bit and explain about what I learned about Windows XP SP3 and IE8 which very well may apply here, or you can skip down to the line with the bold text.
I worked on a webpage project that used a lightbox plugin called Shadowbox. That project wasn't on a local server, just in a subfolder of a subfolder. It works fine in Firefox and Chrome but IE choked and didn't render any CSS from the plugins style sheet. Because I was very familiar with Shadowbox, I was 100% convinced it was not the plugin. So I started to think outside the box, and through trials and tribulations I discovered the culprit was just the actual path!
I had created a subfolder for the project that used /test(v1)/ in the Path and that's what broke IE8. Once I removed the parentheses, the CSS was loaded correctly. This same solution was also the cause of a CSS issue for a forum member who used Vista and IE9, so then it's conceivable these issues lie with Wine as well.
What issue is that? It's using illegal characters, the parentheses, in the path name. I will stop short and say the URL name only because it's the file path leading to the index.html file (and only relative paths were used in coding - parentheses could not be escaped - and base tag failed).
Firefox and Chrome were forgiving, but not IE. Even though you may not be using IE, it's possible that this issue extends outside of that.
My solution is not to use parentheses or whitespaces in any portion of your file path. While this may not solve this particular bug, at the very least you will not have sandbox Wine issues for when that file path becomes a URL path for whatever requirement (e.g., accessing a SWF object to be used as a video player). If IE browsers are unforgiving, so too can other embedded browsers or programing modules.
Recommended:
Z:\home\andy.wine\drive_c\Samsung\Samsung_TV
SDK_3.5.2\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
Notice the above does not use the Program Files (x86) folder since that can't be changed per OS requirements. Having such a path will surely reduce, if not eliminate, any unforeseen errors. Cheers!
I know it's an old question, but since I'm delving into the process, I figured I'd share some links. Enjoy!
Decent quick start guide on developing for the Smart TV platform: http://www.samsungdforum.com/Guide/c02/index.html.
These are the minimum project requirements and some example files: http://www.samsungdforum.com/Guide/art00011/index.html.
For people who like doing everything with command line, smarttvjs (http://smarttvjs.org) has made it very easy:
$smarttvjs init #create sample project
... do some development (IDE
is nor required)
$smarttvjs build samsung (create a package for
samsung)
$smarttvjs run samsung #launch simulator

Categories

Resources