From 274cba18b8f1c255ddcff2f5c14aab4d0c846820 Mon Sep 17 00:00:00 2001 From: Amlal Date: Tue, 23 Jul 2024 12:02:10 +0200 Subject: [IMP] User class and current user global. [REMOVE] ApplicationInterface struct. [IMP] DDK_STATUS_STRUCT data structure for driver events. Signed-off-by: Amlal --- Kernel/Sources/Main.cxx | 6 +++- Kernel/Sources/PermissionSelector.cxx | 47 ------------------------------ Kernel/Sources/User.cxx | 54 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 48 deletions(-) delete mode 100644 Kernel/Sources/PermissionSelector.cxx create mode 100644 Kernel/Sources/User.cxx (limited to 'Kernel/Sources') diff --git a/Kernel/Sources/Main.cxx b/Kernel/Sources/Main.cxx index 92dac251..b0083730 100644 --- a/Kernel/Sources/Main.cxx +++ b/Kernel/Sources/Main.cxx @@ -63,7 +63,7 @@ namespace Kernel::Detail const auto cDirCount = 9; const char* cDirStr[cDirCount] = { "\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\", - "\\Users\\", "\\Library\\", "\\Mounted\\", "\\DCIM\\", "\\Applications\\Storage\\"}; + "\\Users\\", "\\Library\\", "\\Mounted\\", "\\DCIM\\", "\\Applications\\Store\\"}; for (Kernel::SizeT dirIndx = 0UL; dirIndx < cDirCount; ++dirIndx) { @@ -188,6 +188,10 @@ namespace Kernel::Detail /// @return void no return value. STATIC Kernel::Void ke_user_switch(Kernel::Void) { + + Kernel::cRootUser = new User(RingKind::kRingSuperUser, kSuperUser); + Kernel::kcout << "newoskrnl: logged in as: " << Kernel::cRootUser->Name().CData() << Kernel::endl; + Kernel::kcout << "newoskrnl: " << cKernelVersion.GetKey().CData() << ": " << Kernel::number(cKernelVersion.GetValue()) << Kernel::endl; } } // namespace Kernel::Detail diff --git a/Kernel/Sources/PermissionSelector.cxx b/Kernel/Sources/PermissionSelector.cxx deleted file mode 100644 index 726f34e1..00000000 --- a/Kernel/Sources/PermissionSelector.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ======================================================== - * - * Kernel - * Copyright ZKA Technologies, all rights reserved. - * - * File: PermissionSelector.cpp - * Purpose: Permission selectors. - * - * ======================================================== - */ - -#include -#include - -/// bugs 0 - -namespace Kernel -{ - PermissionSelector::PermissionSelector(const Int32& sel) - : fRing((RingKind)sel) - { - MUST_PASS(sel > 0); - } - - PermissionSelector::PermissionSelector(const RingKind& ringKind) - : fRing(ringKind) - { - } - - PermissionSelector::~PermissionSelector() = default; - - bool PermissionSelector::operator==(const PermissionSelector& lhs) - { - return lhs.fRing == this->fRing; - } - - bool PermissionSelector::operator!=(const PermissionSelector& lhs) - { - return lhs.fRing != this->fRing; - } - - const RingKind& PermissionSelector::Ring() noexcept - { - return this->fRing; - } -} // namespace Kernel diff --git a/Kernel/Sources/User.cxx b/Kernel/Sources/User.cxx new file mode 100644 index 00000000..1deac5be --- /dev/null +++ b/Kernel/Sources/User.cxx @@ -0,0 +1,54 @@ +/* + * ======================================================== + * + * Kernel + * Copyright ZKA Technologies, all rights reserved. + * + * File: User.cpp + * Purpose: Permission selectors. + * + * ======================================================== + */ + +#include +#include + +/// bugs 0 + +namespace Kernel +{ + User::User(const Int32& sel, const Char* userName) + : fRing((RingKind)sel) + { + MUST_PASS(sel >= 0); + this->fUserName += userName; + } + + User::User(const RingKind& ringKind, const Char* userName) + : fRing(ringKind) + { + this->fUserName += userName; + } + + User::~User() = default; + + bool User::operator==(const User& lhs) + { + return lhs.fRing == this->fRing; + } + + bool User::operator!=(const User& lhs) + { + return lhs.fRing != this->fRing; + } + + const StringView User::Name() noexcept + { + return this->fUserName; + } + + const RingKind& User::Ring() noexcept + { + return this->fRing; + } +} // namespace Kernel -- cgit v1.2.3