Get current process if the Parent is null

This commit is contained in:
Alex 2022-10-26 21:55:54 +03:00
parent 581638c256
commit 7aced25dd5
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -377,6 +377,9 @@ namespace Tasking
TCB *Thread = new TCB;
Thread->ID = this->NextTID++;
strcpy(Thread->Name, Parent->Name);
if (Parent == nullptr)
Thread->Parent = this->GetCurrentProcess();
else
Thread->Parent = Parent;
Thread->EntryPoint = EntryPoint;
Thread->Offset = Offset;
@ -477,6 +480,9 @@ namespace Tasking
PCB *Process = new PCB;
Process->ID = this->NextPID++;
strcpy(Process->Name, Name);
if (Parent == nullptr)
Process->Parent = this->GetCurrentProcess();
else
Process->Parent = Parent;
Process->ExitCode = 0xdeadbeef;
Process->Status = TaskStatus::Ready;
@ -484,6 +490,8 @@ namespace Tasking
Process->Security.TrustLevel = TrustLevel;
Process->Security.UniqueToken = SecurityManager.CreateToken();
Process->IPCHandles = new HashMap<InterProcessCommunication::IPCPort, uint64_t>;
switch (TrustLevel)
{
case TaskTrustLevel::System: