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