I've noticed that CreateProcess is part of the Universal Windows Platform API since version 16299.
To test it, I've made a quick UWP app based on the Blank App template (C++/WinRT) and wired up a button event handler to call this piece of code:
void StartNotepad()
{
STARTUPINFO startupInfo;
ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
PROCESS_INFORMATION processInformation;
ZeroMemory(&processInformation, sizeof(processInformation));
if (!CreateProcess(
const_cast<LPWSTR>(L"C:\\Windows\\notepad.exe"), //app name
nullptr,
nullptr,
nullptr,
FALSE,
0,
nullptr,
nullptr,
&startupInfo,
&processInformation
))
{
OutputDebugString(L"CreateProcess failed");
DWORD err = GetLastError();
}
else
{
WaitForSingleObject(processInformation.hProcess, INFINITE);
}
}
The API call itself succceeds, but the process doesn't seem to be started. The STARTUPINFO and PROCESS_INFORMATION structs do contain info like the PID and TID of the new process and its main thread, but it's not showing up in task manager and there's no window showing up either (obviously).
I'm pretty sure this is somehow related to security, i.e. UWP app cannot start non-UWP app or something like that. However, it is not documented anywhere, which is why I'm asking here.
Has anyone figured this out, or could somebody from Microsoft provide more info?
CreateProcessfrom a UWP only to launch another EXE in your own package and it runs with the same AppContainer privileges of your main executable. It can't be used to launch arbitrary EXEs.