[+] EStreamForward::eNewConsoleWindow

[*] NT: Improve the selection of flags used when spawning processes
[*] NT: Caught regression in NTs FS/generic transaction IsSignaled
This commit is contained in:
Reece Wilson 2023-07-06 13:44:32 +01:00
parent 62b41ff93e
commit 4d1201a4c1
3 changed files with 33 additions and 10 deletions

View File

@ -12,6 +12,7 @@ namespace Aurora::Processes
AUE_DEFINE(EStreamForward, (
eNull,
eCurrentProcess,
eAsyncPipe
eAsyncPipe,
eNewConsoleWindow
));
}

View File

@ -531,12 +531,6 @@ namespace Aurora::IO::FS
if (!completeRoutine)
{
if ((this->bHasFailed) ||
(this->dwLastBytes))
{
return true;
}
if (::GetOverlappedResult(this->pHandle_->handle,
&this->overlap,
&read,
@ -568,7 +562,8 @@ namespace Aurora::IO::FS
return true;
}
return false;
return bool(this->dwLastBytes) ||
this->Failed();
}
bool NtAsyncFileTransaction::Complete()

View File

@ -454,11 +454,38 @@ namespace Aurora::Processes
}
}
AuUInt32 uCreateFlags {};
if (this->startup_.type == ESpawnType::eSpawnThreadLeader)
{
uCreateFlags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP;
}
else
{
if (((this->startup_.fwdIn == EStreamForward::eNewConsoleWindow) ||
(this->startup_.fwdErr == EStreamForward::eNewConsoleWindow) ||
(this->startup_.fwdOut == EStreamForward::eNewConsoleWindow)) &&
(!this->startup_.bNoShowConsole))
{
uCreateFlags |= CREATE_NEW_CONSOLE;
}
}
if (this->startup_.bInDebugMode)
{
uCreateFlags |= CREATE_SUSPENDED;
}
if (this->startup_.bNoShowConsole)
{
// yea we can keep CREATE_NO_WINDOW on for non-console apps. its legal -> https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
uCreateFlags |= CREATE_NO_WINDOW;
}
auto result = CreateProcessW(Locale::ConvertFromUTF8(this->startup_.process).c_str(),
Locale::ConvertFromUTF8(this->windowsCli_).data(),
NULL, NULL, true,
(this->startup_.bNoShowConsole ? CREATE_NO_WINDOW : NULL) | // yea we can keep CREATE_NO_WINDOW on for non-console apps. its legal -> https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
(this->startup_.bInDebugMode ? CREATE_SUSPENDED : NULL),
uCreateFlags,
NULL, wcwd.size() ? wcwd.data() : nullptr, &startupInfo, &processInfo);
if (!result)