summaryrefslogtreecommitdiffhomepage
path: root/Kernel/CFKit
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/CFKit')
-rw-r--r--Kernel/CFKit/GUIDWizard.hpp8
-rw-r--r--Kernel/CFKit/GUIDWrapper.hpp4
-rw-r--r--Kernel/CFKit/LoaderUtils.hxx54
-rw-r--r--Kernel/CFKit/Property.hpp21
-rw-r--r--Kernel/CFKit/URL.hpp6
5 files changed, 75 insertions, 18 deletions
diff --git a/Kernel/CFKit/GUIDWizard.hpp b/Kernel/CFKit/GUIDWizard.hpp
index 6fd747e9..609b0d46 100644
--- a/Kernel/CFKit/GUIDWizard.hpp
+++ b/Kernel/CFKit/GUIDWizard.hpp
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright Zeta Electronics Corporation
+ Copyright ZKA Technologies
------------------------------------------- */
@@ -11,12 +11,12 @@
#include <NewKit/ArrayList.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/ErrorOr.hpp>
-#include <NewKit/Ref.hpp>
+#include <NewKit/Ref.hxx>
#include <NewKit/Stream.hpp>
#include <NewKit/String.hpp>
namespace Kernel::XRN::Version1
{
- Ref<GUIDSequence*> make_sequence(const ArrayList<UShort>& seq);
- ErrorOr<Ref<Kernel::StringView>> try_guid_to_string(Ref<GUIDSequence*>& guid);
+ Ref<GUIDSequence*> cf_make_sequence(const ArrayList<UInt32>& seq);
+ ErrorOr<Ref<Kernel::StringView>> cf_try_guid_to_string(Ref<GUIDSequence*>& guid);
} // namespace Kernel::XRN::Version1
diff --git a/Kernel/CFKit/GUIDWrapper.hpp b/Kernel/CFKit/GUIDWrapper.hpp
index f8f08591..fe9e373b 100644
--- a/Kernel/CFKit/GUIDWrapper.hpp
+++ b/Kernel/CFKit/GUIDWrapper.hpp
@@ -1,13 +1,13 @@
/* -------------------------------------------
- Copyright Zeta Electronics Corporation
+ Copyright ZKA Technologies
------------------------------------------- */
#pragma once
#include <NewKit/Defines.hpp>
-#include <NewKit/Ref.hpp>
+#include <NewKit/Ref.hxx>
#include <NewKit/Stream.hpp>
/* GUID for C++ Components */
diff --git a/Kernel/CFKit/LoaderUtils.hxx b/Kernel/CFKit/LoaderUtils.hxx
new file mode 100644
index 00000000..3edacc67
--- /dev/null
+++ b/Kernel/CFKit/LoaderUtils.hxx
@@ -0,0 +1,54 @@
+#ifndef __CFKIT_LOADER_UTILS_HXX__
+#define __CFKIT_LOADER_UTILS_HXX__
+
+#include <KernelKit/PE.hxx>
+#include <KernelKit/MSDOS.hxx>
+
+namespace Kernel
+{
+ /// @brief Find the PE header inside the blob.
+ inline auto ldr_find_exec_header(DosHeaderPtr ptrDos) -> ExecHeaderPtr
+ {
+ if (!ptrDos)
+ return nullptr;
+
+ if (ptrDos->eMagic[0] != kMagMz0)
+ return nullptr;
+
+ if (ptrDos->eMagic[1] != kMagMz1)
+ return nullptr;
+
+ return (ExecHeaderPtr)(VoidPtr)(&ptrDos->eLfanew + 1);
+ }
+
+ /// @brief Find the PE optional header inside the blob.
+ inline auto ldr_find_opt_exec_header(DosHeaderPtr ptrDos) -> ExecOptionalHeaderPtr
+ {
+ if (!ptrDos)
+ return nullptr;
+
+ auto exec = ldr_find_exec_header(ptrDos);
+
+ if (!exec)
+ return nullptr;
+
+ return (ExecOptionalHeaderPtr)(VoidPtr)(&exec->mCharacteristics + 1);
+ }
+
+ /// @brief Find the PE header inside the blob.
+ /// @note overloaded function.
+ inline auto ldr_find_exec_header(const Char* ptrDos) -> ExecHeaderPtr
+ {
+ return ldr_find_exec_header((DosHeaderPtr)ptrDos);
+ }
+
+
+ /// @brief Find the PE header inside the blob.
+ /// @note overloaded function.
+ inline auto ldr_find_opt_exec_header(const Char* ptrDos) -> ExecOptionalHeaderPtr
+ {
+ return ldr_find_opt_exec_header((DosHeaderPtr)ptrDos);
+ }
+} // namespace Kernel
+
+#endif // ifndef __CFKIT_LOADER_UTILS_HXX__
diff --git a/Kernel/CFKit/Property.hpp b/Kernel/CFKit/Property.hpp
index f75e7f95..519f486e 100644
--- a/Kernel/CFKit/Property.hpp
+++ b/Kernel/CFKit/Property.hpp
@@ -1,17 +1,19 @@
/* -------------------------------------------
- Copyright Zeta Electronics Corporation
+ Copyright ZKA Technologies
------------------------------------------- */
-#ifndef __INC_PLIST_HPP__
-#define __INC_PLIST_HPP__
+#ifndef __INC_PROPS_HPP__
+#define __INC_PROPS_HPP__
#include <NewKit/Array.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/Function.hpp>
#include <NewKit/String.hpp>
+#define cMaxPropLen 4096
+
namespace Kernel
{
/// @brief handle to anything (number, ptr, string...)
@@ -22,23 +24,24 @@ namespace Kernel
class Property
{
public:
- explicit Property(const StringView& sw);
+ Property() = default;
virtual ~Property();
public:
Property& operator=(const Property&) = default;
Property(const Property&) = default;
- bool StringEquals(StringView& name);
- const PropertyId& GetPropertyById();
+ bool StringEquals(StringView& name);
+ PropertyId& GetValue();
+ StringView& GetKey();
private:
- Ref<StringView> fName;
- PropertyId fAction;
+ StringView fName{cMaxPropLen};
+ PropertyId fAction{No};
};
template <SizeT N>
using PropertyArray = Array<Property, N>;
} // namespace Kernel
-#endif // !__INC_PLIST_HPP__
+#endif // !__INC_PROPS_HPP__
diff --git a/Kernel/CFKit/URL.hpp b/Kernel/CFKit/URL.hpp
index 049e1194..61c08d0f 100644
--- a/Kernel/CFKit/URL.hpp
+++ b/Kernel/CFKit/URL.hpp
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright Zeta Electronics Corporation
+ Copyright ZKA Technologies
------------------------------------------- */
@@ -26,8 +26,8 @@ namespace Kernel
Ref<StringView> fUrlView;
};
- ErrorOr<StringView> url_extract_location(const char* url);
- ErrorOr<StringView> url_extract_protocol(const char* url);
+ ErrorOr<StringView> url_extract_location(const Char* url);
+ ErrorOr<StringView> url_extract_protocol(const Char* url);
} // namespace Kernel
#endif /* ifndef _INC_URL_HPP_ */