summaryrefslogtreecommitdiffhomepage
path: root/Public/SDK/System.Core
diff options
context:
space:
mode:
Diffstat (limited to 'Public/SDK/System.Core')
-rw-r--r--Public/SDK/System.Core/Headers/File.hxx50
-rw-r--r--Public/SDK/System.Core/Headers/Heap.hxx8
-rw-r--r--Public/SDK/System.Core/Sources/Heap.cxx6
3 files changed, 49 insertions, 15 deletions
diff --git a/Public/SDK/System.Core/Headers/File.hxx b/Public/SDK/System.Core/Headers/File.hxx
index 774a1424..4a8d57dd 100644
--- a/Public/SDK/System.Core/Headers/File.hxx
+++ b/Public/SDK/System.Core/Headers/File.hxx
@@ -10,6 +10,21 @@
#include <System.Core/Headers/Defs.hxx>
namespace System {
+class FileInterface;
+class DirectoryInterface;
+
+typedef IntPtrType SymlinkType;
+typedef IntPtrType FileType;
+typedef IntPtrType DirectoryType;
+
+enum {
+ kErrorNoSuchPath = -44,
+ kErrorNotAFile = -45,
+ kErrorNotADirectory = -46,
+ kErrorDirectory = -47,
+ kErrorBrokenSymlink = -48,
+};
+
/// @brief System file interface
class FileInterface final {
public:
@@ -27,13 +42,25 @@ class FileInterface final {
CA_COPY_DEFAULT(FileInterface);
public:
- PtrVoidType Read(UIntPtrType off, SizeType sz) { return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 2, off, sz); }
- PtrVoidType Read(SizeType sz) { return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 3, sz); }
+ PtrVoidType Read(UIntPtrType off, SizeType sz) {
+ return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 2,
+ off, sz);
+ }
+ PtrVoidType Read(SizeType sz) {
+ return (PtrVoidType)kInstanceObject->Invoke(kInstanceObject, mHandle, 3,
+ sz);
+ }
- void Write(PtrVoidType buf, UIntPtrType off, SizeType sz) { kInstanceObject->Invoke(kInstanceObject, mHandle, 4, buf, off, sz); }
- void Write(PtrVoidType buf, SizeType sz) { kInstanceObject->Invoke(kInstanceObject, mHandle, 5, buf, sz); }
-
- void Seek(UIntPtrType off) { kInstanceObject->Invoke(kInstanceObject, mHandle, 5); }
+ void Write(PtrVoidType buf, UIntPtrType off, SizeType sz) {
+ kInstanceObject->Invoke(kInstanceObject, mHandle, 4, buf, off, sz);
+ }
+ void Write(PtrVoidType buf, SizeType sz) {
+ kInstanceObject->Invoke(kInstanceObject, mHandle, 5, buf, sz);
+ }
+
+ void Seek(UIntPtrType off) {
+ kInstanceObject->Invoke(kInstanceObject, mHandle, 5);
+ }
void Rewind() { kInstanceObject->Invoke(kInstanceObject, mHandle, 6); }
public:
@@ -41,7 +68,7 @@ class FileInterface final {
void MIME(const char *mime);
private:
- IntPtrType mHandle;
+ FileType mHandle;
};
typedef FileInterface *FilePtr;
@@ -64,6 +91,13 @@ class FileException : public SystemException {
const char *mReason{"System.Core: FileException: Catastrophic failure!"};
};
+inline IntPtrType MakeSymlink(const char *from, const char *outputWhere) {
+ CA_MUST_PASS(from);
+ CA_MUST_PASS(outputWhere);
+
+ return kInstanceObject->Invoke(kInstanceObject, kProcessCallOpenHandle, 1,
+ from);
+}
} // namespace System
-#endif // ifndef __FILE_API__
+#endif // ifndef __FILE_API__
diff --git a/Public/SDK/System.Core/Headers/Heap.hxx b/Public/SDK/System.Core/Headers/Heap.hxx
index 43eaacab..5c93456e 100644
--- a/Public/SDK/System.Core/Headers/Heap.hxx
+++ b/Public/SDK/System.Core/Headers/Heap.hxx
@@ -11,7 +11,7 @@
namespace System {
class MemoryException;
-typedef PtrVoidType HeapPtr;
+typedef PtrVoidType PtrHeapType;
enum {
kHeapExpandable = 2,
@@ -35,9 +35,9 @@ class HeapInterface final {
static HeapInterface *Shared() noexcept;
public:
- void Delete(HeapPtr me) noexcept;
- SizeType Size(HeapPtr me) noexcept;
- HeapPtr New(const SizeType &sz,
+ void Delete(PtrHeapType me) noexcept;
+ SizeType Size(PtrHeapType me) noexcept;
+ PtrHeapType New(const SizeType &sz,
const DWordType flags = kHeapNoFlags);
};
diff --git a/Public/SDK/System.Core/Sources/Heap.cxx b/Public/SDK/System.Core/Sources/Heap.cxx
index b3f43ad3..3803af3a 100644
--- a/Public/SDK/System.Core/Sources/Heap.cxx
+++ b/Public/SDK/System.Core/Sources/Heap.cxx
@@ -65,17 +65,17 @@ HeapInterface::HeapInterface() {
HeapInterface::~HeapInterface() { delete this; }
-void HeapInterface::Delete(HeapPtr me) noexcept {
+void HeapInterface::Delete(PtrHeapType me) noexcept {
CA_MUST_PASS(me);
HcFreeProcessHeap(kInstanceObject, me);
}
-SizeType HeapInterface::Size(HeapPtr me) noexcept {
+SizeType HeapInterface::Size(PtrHeapType me) noexcept {
CA_MUST_PASS(me);
return HcProcessHeapSize(kInstanceObject, me);
}
-HeapPtr HeapInterface::New(const SizeType& sz, const DWordType flags) {
+PtrHeapType HeapInterface::New(const SizeType& sz, const DWordType flags) {
SizeType _sz = sz;
if (!_sz) ++_sz;