Core/Process: Add GetCurrentPid

This commit is contained in:
SirLynix
2024-01-23 10:26:22 +01:00
committed by Jérôme Leclercq
parent 9c102638c0
commit b0648918a7
6 changed files with 25 additions and 5 deletions

View File

@@ -85,6 +85,11 @@ namespace Nz::PlatformImpl
return commandLine;
}
Pid GetCurrentProcessId()
{
return ::GetCurrentProcessId();
}
Result<Pid, std::string> SpawnDetachedProcess(const std::filesystem::path& program, std::span<const std::string> arguments, const std::filesystem::path& workingDirectory)
{
DWORD creationFlags = CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS;
@@ -100,7 +105,7 @@ namespace Nz::PlatformImpl
};
PROCESS_INFORMATION processInfo;
BOOL success = CreateProcessW(
BOOL success = ::CreateProcessW(
nullptr, // Application name
commandLine.data(), // Command line
nullptr, // Process attributes

View File

@@ -12,7 +12,8 @@
namespace Nz::PlatformImpl
{
NAZARA_CORE_API Result<Pid, std::string> SpawnDetachedProcess(const std::filesystem::path& program, std::span<const std::string> arguments = {}, const std::filesystem::path& workingDirectory = {});
Pid GetCurrentProcessId();
Result<Pid, std::string> SpawnDetachedProcess(const std::filesystem::path& program, std::span<const std::string> arguments = {}, const std::filesystem::path& workingDirectory = {});
}
#endif // NAZARA_CORE_WIN32_PROCESSIMPL_HPP