summaryrefslogtreecommitdiffhomepage
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/KernelKit/PermissionSelector.hxx57
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx2
-rw-r--r--Kernel/KernelKit/User.hxx65
-rw-r--r--Kernel/NewKit/ApplicationInterface.hxx31
-rw-r--r--Kernel/Sources/Main.cxx6
-rw-r--r--Kernel/Sources/User.cxx (renamed from Kernel/Sources/PermissionSelector.cxx)25
6 files changed, 87 insertions, 99 deletions
diff --git a/Kernel/KernelKit/PermissionSelector.hxx b/Kernel/KernelKit/PermissionSelector.hxx
deleted file mode 100644
index 309e260a..00000000
--- a/Kernel/KernelKit/PermissionSelector.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies
-
-------------------------------------------- */
-
-#ifndef _INC_PERMISSION_SEL_HXX_
-#define _INC_PERMISSION_SEL_HXX_
-
-#include <CompilerKit/CompilerKit.hxx>
-#include <NewKit/Defines.hpp>
-
-// super admin mode user.
-#define kMachineUser "Machine"
-
-// user mode users.
-#define kSuperUser "Admin"
-#define kGuestUser "Guest"
-
-// hash 'user@host:password' -> base64 encoded data
-// use this data to then fetch specific data.
-
-namespace Kernel
-{
- enum class RingKind
- {
- kRingUser = 3,
- kRingDriver = 2,
- kRingKernel = 0,
- kRingUnknown = -1,
- kRingCount = 4,
- };
-
- class PermissionSelector final
- {
- private:
- explicit PermissionSelector(const Int32& sel);
- explicit PermissionSelector(const RingKind& kind);
-
- ~PermissionSelector();
-
- public:
- NEWOS_COPY_DEFAULT(PermissionSelector)
-
- public:
- bool operator==(const PermissionSelector& lhs);
- bool operator!=(const PermissionSelector& lhs);
-
- public:
- const RingKind& Ring() noexcept;
-
- private:
- RingKind fRing;
- };
-} // namespace Kernel
-
-#endif /* ifndef _INC_PERMISSION_SEL_HXX_ */
diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx
index e5368201..4f9f99f6 100644
--- a/Kernel/KernelKit/ProcessScheduler.hxx
+++ b/Kernel/KernelKit/ProcessScheduler.hxx
@@ -9,7 +9,7 @@
#include <ArchKit/ArchKit.hpp>
#include <KernelKit/LockDelegate.hpp>
-#include <KernelKit/PermissionSelector.hxx>
+#include <KernelKit/User.hxx>
#include <KernelKit/ProcessHeap.hxx>
#include <NewKit/MutableArray.hpp>
diff --git a/Kernel/KernelKit/User.hxx b/Kernel/KernelKit/User.hxx
new file mode 100644
index 00000000..aa0901ac
--- /dev/null
+++ b/Kernel/KernelKit/User.hxx
@@ -0,0 +1,65 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#ifndef _INC_PERMISSION_SEL_HXX_
+#define _INC_PERMISSION_SEL_HXX_
+
+#include <CompilerKit/CompilerKit.hxx>
+#include <NewKit/String.hpp>
+#include <NewKit/Defines.hpp>
+
+// user mode users.
+#define kSuperUser "Admin"
+#define kGuestUser "Guest"
+
+#define kUsersDir "\\Users\\Store\\"
+
+#define kMaxUserNameLen (255)
+
+// hash 'password' -> base64+md5 encoded data
+// use this data to then fetch specific data of the user..
+
+namespace Kernel
+{
+ enum class RingKind
+ {
+ kRingStdUser = 1,
+ kRingSuperUser = 2,
+ kRingGuestUser = 5,
+ kRingCount = 5,
+ };
+
+ class User final
+ {
+ public:
+ explicit User() = default;
+
+ User(const Int32& sel, const Char* userName);
+ User(const RingKind& kind, const Char* userName);
+
+ ~User();
+
+ public:
+ NEWOS_COPY_DEFAULT(User)
+
+ public:
+ bool operator==(const User& lhs);
+ bool operator!=(const User& lhs);
+
+ public:
+ const RingKind& Ring() noexcept;
+ const StringView Name() noexcept;
+
+ private:
+ RingKind fRing{RingKind::kRingStdUser};
+ StringView fUserName{kMaxUserNameLen};
+
+ };
+
+ inline User* cRootUser = nullptr;
+} // namespace Kernel
+
+#endif /* ifndef _INC_PERMISSION_SEL_HXX_ */
diff --git a/Kernel/NewKit/ApplicationInterface.hxx b/Kernel/NewKit/ApplicationInterface.hxx
deleted file mode 100644
index 31da9aa3..00000000
--- a/Kernel/NewKit/ApplicationInterface.hxx
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies
-
-------------------------------------------- */
-
-#pragma once
-
-///
-/// @brief Application object, given by the OS to the process. interact with the OS.
-/// @file ApplicationInterface.hxx
-/// @author Amlal EL Mahrouss
-///
-
-#include <NewKit/Defines.hpp>
-#include <CFKit/GUIDWrapper.hpp>
-
-/// \brief Application Interface.
-/// \author Amlal El Mahrouss
-typedef struct _ApplicationInterface final
-{
- /// @brief Releases the object exit the process on main object.
- Kernel::Void (*Release)(struct _Application* Self, Kernel::Int32 ExitCode);
- /// @brief Invoke a function from the application object.
- Kernel::IntPtr (*Invoke)(struct _Application* Self, Kernel::Int32 Sel, ...);
- /// @brief Query a new application object from a GUID.
- /// @note this doesn't query a process, it query a registered object withtin that app.
- Kernel::Void (*Query)(struct _Application* Self, Kernel::VoidPtr* Dst, Kernel::SizeT SzDst, Kernel::XRN::GUIDSequence GuidOf);
-} ApplicationInterface, *ApplicationInterfaceRef;
-
-#define app_cast reinterpret_cast<ApplicationInterfaceRef>
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/User.cxx
index 726f34e1..1deac5be 100644
--- a/Kernel/Sources/PermissionSelector.cxx
+++ b/Kernel/Sources/User.cxx
@@ -4,43 +4,50 @@
* Kernel
* Copyright ZKA Technologies, all rights reserved.
*
- * File: PermissionSelector.cpp
+ * File: User.cpp
* Purpose: Permission selectors.
*
* ========================================================
*/
-#include <KernelKit/PermissionSelector.hxx>
+#include <KernelKit/User.hxx>
#include <NewKit/KernelCheck.hpp>
/// bugs 0
namespace Kernel
{
- PermissionSelector::PermissionSelector(const Int32& sel)
+ User::User(const Int32& sel, const Char* userName)
: fRing((RingKind)sel)
{
- MUST_PASS(sel > 0);
+ MUST_PASS(sel >= 0);
+ this->fUserName += userName;
}
- PermissionSelector::PermissionSelector(const RingKind& ringKind)
+ User::User(const RingKind& ringKind, const Char* userName)
: fRing(ringKind)
{
+ this->fUserName += userName;
}
- PermissionSelector::~PermissionSelector() = default;
+ User::~User() = default;
- bool PermissionSelector::operator==(const PermissionSelector& lhs)
+ bool User::operator==(const User& lhs)
{
return lhs.fRing == this->fRing;
}
- bool PermissionSelector::operator!=(const PermissionSelector& lhs)
+ bool User::operator!=(const User& lhs)
{
return lhs.fRing != this->fRing;
}
- const RingKind& PermissionSelector::Ring() noexcept
+ const StringView User::Name() noexcept
+ {
+ return this->fUserName;
+ }
+
+ const RingKind& User::Ring() noexcept
{
return this->fRing;
}