aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitignore29
-rw-r--r--Main.vcxproj.filters14
-rw-r--r--Main/Main.cpp11
-rw-r--r--Makefile34
-rw-r--r--NT.slnx8
-rw-r--r--NT.vcxproj166
-rw-r--r--NT.vcxproj.filters39
-rw-r--r--NT.vcxproj.user4
-rw-r--r--NtDll.cpp17
-rw-r--r--RelationalNT.sln27
-rw-r--r--RelationalNT.vcxproj (renamed from Main.vcxproj)72
-rw-r--r--RelationalNT.vcxproj.filters31
-rw-r--r--Runtime/NtContext.cpp10
-rw-r--r--framework.h5
-rw-r--r--include/NT.h (renamed from Runtime/NtContext.h)114
-rw-r--r--pch.cpp5
-rw-r--r--pch.h13
-rw-r--r--src/NT.cpp29
18 files changed, 255 insertions, 373 deletions
diff --git a/.gitignore b/.gitignore
index f2fd3ed..4f6d968 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,33 @@
.vs
+build
out
x64
+Debug
+Release
+Win32
+[Bb]in
+[Oo]bj
+*.aps
+*.db
+*.ipch
+*.iobj
+*.ipdb
+*.ilk
+*.lastbuildstate
+*.log
+*.obj
+*.opendb
+*.pdb
+*.recipe
+*.sdf
+*.suo
+*.tlog
+*.user
*.vcxproj.user
+RNT
+RNT.exe
+RNT.dll
+RNT.exp
+RNT.lib
+libRNT.so
+libRNT.dylib
diff --git a/Main.vcxproj.filters b/Main.vcxproj.filters
deleted file mode 100644
index 153390a..0000000
--- a/Main.vcxproj.filters
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4fc737f1-c7a5-4376-a066-2a32d752a2ff}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Main\Main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
diff --git a/Main/Main.cpp b/Main/Main.cpp
deleted file mode 100644
index 5eb314e..0000000
--- a/Main/Main.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <iostream>
-
-#include "Runtime/NtContext.h"
-
-int main()
-{
- nt::NtContext nt;
-
- std::cout << "NT context running: " << (nt.IsRunning() ? "yes" : "no") << '\n';
- return nt.IsRunning() ? 0 : 1;
-}
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5ab688b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+CXX = cl
+TARGET = RNT.exe
+OBJECT = NT.obj
+SOURCE = src\NT.cpp
+INCDIR = include
+DEFINES = /DNT_CONSOLE_APP /DNT_WAIT_ON_EXIT
+INCLUDE_FLAG = /I$(INCDIR)
+COMPILE_FLAGS = /std:c++17 /W4 /EHsc
+COMPILE_ONLY = /c
+OBJECT_OUT = /Fo:$(OBJECT)
+LINK_FLAGS =
+TARGET_OUT = /Fe:$(TARGET)
+REMOVE = del /Q
+
+all: $(TARGET)
+
+windows: all
+
+unix:
+ $(MAKE) CXX=c++ TARGET=RNT OBJECT=NT.o SOURCE=src/NT.cpp DEFINES=-DNT_CONSOLE_APP INCLUDE_FLAG=-Iinclude COMPILE_FLAGS="-std=c++17 -Wall -Wextra" COMPILE_ONLY=-c OBJECT_OUT="-o NT.o" LINK_FLAGS= TARGET_OUT="-o RNT" REMOVE="rm -f" all
+
+linux: unix
+
+macos:
+ $(MAKE) CXX=c++ TARGET=RNT OBJECT=NT.o SOURCE=src/NT.cpp DEFINES=-DNT_CONSOLE_APP INCLUDE_FLAG=-Iinclude COMPILE_FLAGS="-std=c++17 -Wall -Wextra" COMPILE_ONLY=-c OBJECT_OUT="-o NT.o" LINK_FLAGS= TARGET_OUT="-o RNT" REMOVE="rm -f" all
+
+$(TARGET): $(OBJECT)
+ $(CXX) $(LINK_FLAGS) $(OBJECT) $(TARGET_OUT)
+
+$(OBJECT): $(SOURCE)
+ $(CXX) $(DEFINES) $(INCLUDE_FLAG) $(COMPILE_FLAGS) $(COMPILE_ONLY) $(SOURCE) $(OBJECT_OUT)
+
+clean:
+ -$(REMOVE) RNT.exe RNT $(OBJECT) NT.o RNT.exp RNT.lib
diff --git a/NT.slnx b/NT.slnx
deleted file mode 100644
index b41bc87..0000000
--- a/NT.slnx
+++ /dev/null
@@ -1,8 +0,0 @@
-<Solution>
- <Configurations>
- <Platform Name="x64" />
- <Platform Name="x86" />
- </Configurations>
- <Project Path="Main.vcxproj" Id="ea0ab0d0-241f-4bd0-aefe-28d42bd6cf1d" />
- <Project Path="NT.vcxproj" Id="28338d4e-8618-418d-8728-f71ffaaf5c4e" />
-</Solution>
diff --git a/NT.vcxproj b/NT.vcxproj
deleted file mode 100644
index 5bdceff..0000000
--- a/NT.vcxproj
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>18.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
- <ProjectGuid>{28338d4e-8618-418d-8728-f71ffaaf5c4e}</ProjectGuid>
- <RootNamespace>NT</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v145</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v145</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v145</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v145</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <TargetName>nt</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;NT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp20</LanguageStandard>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;NT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp20</LanguageStandard>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_DEBUG;NT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp20</LanguageStandard>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>NDEBUG;NT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp20</LanguageStandard>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="framework.h" />
- <ClInclude Include="pch.h" />
- <ClInclude Include="Runtime\NtContext.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="NtDll.cpp" />
- <ClCompile Include="pch.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="Runtime\NtContext.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
diff --git a/NT.vcxproj.filters b/NT.vcxproj.filters
deleted file mode 100644
index ff46ef1..0000000
--- a/NT.vcxproj.filters
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="framework.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="pch.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Runtime\NtContext.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="NtDll.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Runtime\NtContext.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="pch.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
diff --git a/NT.vcxproj.user b/NT.vcxproj.user
deleted file mode 100644
index 88a5509..0000000
--- a/NT.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup />
-</Project> \ No newline at end of file
diff --git a/NtDll.cpp b/NtDll.cpp
deleted file mode 100644
index 160b970..0000000
--- a/NtDll.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// NtDll.cpp : Defines the entry point for nt.dll.
-#include "pch.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
diff --git a/RelationalNT.sln b/RelationalNT.sln
new file mode 100644
index 0000000..aa88815
--- /dev/null
+++ b/RelationalNT.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 18
+VisualStudioVersion = 18.0.35730.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{BC8A1FFA-BEE3-4634-8014-F334798102B3}") = "RelationalNT", "RelationalNT.vcxproj", "{FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Debug|x64.ActiveCfg = Debug|x64
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Debug|x64.Build.0 = Debug|x64
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Debug|x86.ActiveCfg = Debug|Win32
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Debug|x86.Build.0 = Debug|Win32
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Release|x64.ActiveCfg = Release|x64
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Release|x64.Build.0 = Release|x64
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Release|x86.ActiveCfg = Release|Win32
+ {FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Main.vcxproj b/RelationalNT.vcxproj
index 2bfa6bd..8176edc 100644
--- a/Main.vcxproj
+++ b/RelationalNT.vcxproj
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -18,45 +19,44 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
+
<PropertyGroup Label="Globals">
<VCProjectVersion>18.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
- <ProjectGuid>{ea0ab0d0-241f-4bd0-aefe-28d42bd6cf1d}</ProjectGuid>
- <RootNamespace>Main</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ <ProjectGuid>{FBC1C0B4-8B54-4A18-A91E-8A72767C5AE7}</ProjectGuid>
+ <RootNamespace>RelationalNT</RootNamespace>
+ <Keyword>MakeFileProj</Keyword>
</PropertyGroup>
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
+ <ConfigurationType>Makefile</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
+ <ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
+ <ConfigurationType>Makefile</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
+ <ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
- <ImportGroup Label="Shared">
+
+ <ImportGroup Label="Shared" >
</ImportGroup>
+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -69,29 +69,33 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
+
<PropertyGroup Label="UserMacros" />
- <ItemDefinitionGroup>
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp20</LanguageStandard>
- <AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
+ <PropertyGroup>
+ <NMakeBuildCommandLine>nmake /f "$(ProjectDir)Makefile" windows</NMakeBuildCommandLine>
+ <NMakeReBuildCommandLine>nmake /f "$(ProjectDir)Makefile" clean &amp;&amp; nmake /f "$(ProjectDir)Makefile" windows</NMakeReBuildCommandLine>
+ <NMakeCleanCommandLine>nmake /f "$(ProjectDir)Makefile" clean</NMakeCleanCommandLine>
+ <NMakeOutput>$(ProjectDir)RNT.exe</NMakeOutput>
+ <NMakePreprocessorDefinitions>NT_CONSOLE_APP;NT_WAIT_ON_EXIT;_CONSOLE</NMakePreprocessorDefinitions>
+ <NMakeIncludeSearchPath>$(ProjectDir)include</NMakeIncludeSearchPath>
+ <LocalDebuggerCommand>$(ProjectDir)RNT.exe</LocalDebuggerCommand>
+ <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>
+ <LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
+ </PropertyGroup>
+
+ <ItemDefinitionGroup></ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="src\NT.cpp" />
+ </ItemGroup>
<ItemGroup>
- <ClCompile Include="Main\Main.cpp" />
+ <ClInclude Include="include\NT.h" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="NT.vcxproj">
- <Project>{28338d4e-8618-418d-8728-f71ffaaf5c4e}</Project>
- </ProjectReference>
+ <None Include="Makefile" />
</ItemGroup>
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
diff --git a/RelationalNT.vcxproj.filters b/RelationalNT.vcxproj.filters
new file mode 100644
index 0000000..c942ddf
--- /dev/null
+++ b/RelationalNT.vcxproj.filters
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{76F32F28-90C1-4399-9DA9-BAA6B807C2C8}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{0F8561B5-9FD4-4E00-AEDB-9630D26B0C4E}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx</Extensions>
+ </Filter>
+ <Filter Include="Build Files">
+ <UniqueIdentifier>{21EA6EE4-A66E-43F8-843B-F8E25DFF8E5F}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\NT.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\NT.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Makefile">
+ <Filter>Build Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/Runtime/NtContext.cpp b/Runtime/NtContext.cpp
deleted file mode 100644
index 248fdaf..0000000
--- a/Runtime/NtContext.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "pch.h"
-#include "Runtime/NtContext.h"
-
-namespace nt
-{
- bool NtContext::IsRunning() const
- {
- return true;
- }
-}
diff --git a/framework.h b/framework.h
deleted file mode 100644
index 54b83e9..0000000
--- a/framework.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-// Windows Header Files
-#include <windows.h>
diff --git a/Runtime/NtContext.h b/include/NT.h
index 4e28f9f..a24d9d4 100644
--- a/Runtime/NtContext.h
+++ b/include/NT.h
@@ -4,10 +4,14 @@
#include <vector>
#include <string>
-#ifdef NT_EXPORTS
+#if defined(_WIN32) && defined(NT_CONSOLE_APP)
+#define NT_API
+#elif defined(_WIN32) && defined(NT_EXPORTS)
#define NT_API __declspec(dllexport)
-#else
+#elif defined(_WIN32)
#define NT_API __declspec(dllimport)
+#else
+#define NT_API
#endif
enum OBJECT_TYPE {
@@ -37,12 +41,13 @@ enum AUTH_METHOD {
namespace nt
{
- class NT_API ObjectManager
- {
- public:
- class IObject {
- virtual ~IObject() {}
- };
+ class NT_API ObjectManager
+ {
+ public:
+ class IObject {
+ public:
+ virtual ~IObject() = default;
+ };
class Multigroup : IObject {};
class Relation : IObject {};
class Tuple : IObject {};
@@ -66,25 +71,26 @@ namespace nt
// TODO: Treat as a list for now, but ideally it's a tree
struct registry* next;
};
- struct registry** registry;
+ struct registry** entries;
// Looks into this registry and attempts to retrieve the entry
- struct registry* Find(const std::vector<std::string> object_path){}
- };
+ struct registry* Find(const std::vector<std::string> object_path) { return nullptr; }
+ };
class NT_API PermissionsManager
{
public:
// For validating connections at login
- std::set<AUTH_CLAIM> Firewall(AUTH_METHOD method) {}
- // For validating permission to an object
- const bool Access(const std::vector<std::string> object_path, const void* connection_context) {
- // Checks the security descriptor on the head of the object we find in the ObjectManager::registry
- // Then additionally check other metadata yet to be defined in the connection_context,
- // like user group, policy, etc.
- // Yet to decide if this should be summoned at every attempt to get ahold of an object,
- // that might produce significant overhead. How can we solve this?
- }
- };
+ std::set<AUTH_CLAIM> Firewall(AUTH_METHOD method) { return {}; }
+ // For validating permission to an object
+ const bool Access(const ObjectManager::registry* object, const void* connection_context) {
+ // Checks the security descriptor on the head of the object we find in the ObjectManager::registry
+ // Then additionally check other metadata yet to be defined in the connection_context,
+ // like user group, policy, etc.
+ // Yet to decide if this should be summoned at every attempt to get ahold of an object,
+ // that might produce significant overhead. How can we solve this?
+ return object != nullptr && connection_context != nullptr;
+ }
+ };
class NT_API NamespaceReferenceManager
{
@@ -98,8 +104,9 @@ namespace nt
{
public:
// Looks into the methods of the object type and asserts if it can be opened
- const bool CanOpen(struct ObjectManager::registry* object) {}
- };
+ const bool CanOpen(ObjectManager::registry* object) { return object != nullptr; }
+ const bool CanClose(ObjectManager::registry* object) { return object != nullptr; }
+ };
class NT_API LifecycleManager
{
@@ -107,7 +114,7 @@ namespace nt
// If object is not being monitored already, monitors the lifecycle by updating the handle count.
// Maybe also look at the reference count and kill some categories of disposable objects no longer referenced by other objects, like transactions.
// Think of other use cases later.
- void Monitor(struct ObjectManager::registry* object) {}
+ void Monitor(ObjectManager::registry* object) {}
// Serializes contention for the change of a mutable reference.
// This can be used in, for example, the HEAD of a branch to serialize the access.
// If the object does not causes contention, like a relation (since they are immutable, just like multigroups, all snapshots)
@@ -116,10 +123,10 @@ namespace nt
// for example: the HEAD of a branch, namespace collisions (creating two branches with the same name, or two multigroups with the same name from the same state, etc),
// multi-branch atomic commits (which I wish to not have as it damages isolation),
// garbage collection of old state (as in, we want to delete an old-enough history to save up space), etc.
- const bool Contention(struct ObjectManager::registry* object){}
+ const bool Contention(ObjectManager::registry* object){ return object != nullptr; }
// The inverse of `Monitor`, stops monitoring.
// Maybe garbage collect here also if the counters goes to zero.
- void Unmonitor(struct ObjectManager::registry* object) {}
+ void Unmonitor(ObjectManager::registry* object) {}
};
class NT_API HandlerManager
@@ -128,36 +135,49 @@ namespace nt
// This is supposed to represent an authorized access to a certain object in the registry
// This increases the handle count in the object manager
// We should consider adding on the object manager a vector of all the handles that refer to an object
- struct handle {};
- void DeallocateHandle(struct handle* handle) {}
- struct handle Open(std::vector<std::string> object_path, void* connection_context) {
- struct ObjectManager::registry* retrieved_object = ObjectManager::Find((const std::vector<std::string>)object_path);
- if (PermissionsManager::Access(retrieved_object, (const void*)connection_context)
- && IdentityManager::CanOpen(retrieved_object)
- && LifecycleManager::Contention(retrieved_object)) {
- // Starts monitoring this guy
- LifecycleManager::Monitor(retrieved_object);
- return {}; // Return a successful handle
+ struct handle {
+ ObjectManager::registry* object = nullptr;
+ void* connection_context = nullptr;
+ };
+ void DeallocateHandle(struct handle* handle) {}
+ struct handle Open(std::vector<std::string> object_path, void* connection_context) {
+ ObjectManager objects;
+ PermissionsManager permissions;
+ IdentityManager identities;
+ LifecycleManager lifecycles;
+ ObjectManager::registry* retrieved_object = objects.Find((const std::vector<std::string>)object_path);
+ if (permissions.Access(retrieved_object, (const void*)connection_context)
+ && identities.CanOpen(retrieved_object)
+ && lifecycles.Contention(retrieved_object)) {
+ // Starts monitoring this guy
+ lifecycles.Monitor(retrieved_object);
+ return { retrieved_object, connection_context }; // Return a successful handle
}
else {
// Return something more algebraic instead of null or an int
return {};
};
}
- bool Close(struct handle *handle) {
- // Somehow grab the object pointer and connection (maybe drop it...) from the handle
- struct ObjectManager::registry* object = handle->object;
- void* connection_context = handle->connection_context;
- // Checking for permissions here may be relevant.
- // What if we have a handle but no permission? Spooky
- if (PermissionsManager::Access(object, connection_context)
- && IdentityManager::CanClose(object)
+ bool Close(struct handle *handle) {
+ if (handle == nullptr) {
+ return false;
+ }
+ PermissionsManager permissions;
+ IdentityManager identities;
+ LifecycleManager lifecycles;
+ // Somehow grab the object pointer and connection (maybe drop it...) from the handle
+ ObjectManager::registry* object = handle->object;
+ void* connection_context = handle->connection_context;
+ // Checking for permissions here may be relevant.
+ // What if we have a handle but no permission? Spooky
+ if (permissions.Access(object, connection_context)
+ && identities.CanClose(object)
// TODO: I think that in this case we do not need to worry about contention.
// But be careful to evaluate this scenario later.
//&& LifecycleManager::Contention(retrieved_object)
- ) {
- // Stops monitoring this guy
- LifecycleManager::Unmonitor(object);
+ ) {
+ // Stops monitoring this guy
+ lifecycles.Unmonitor(object);
DeallocateHandle(handle);
return true; // Return a successful handle
}
diff --git a/pch.cpp b/pch.cpp
deleted file mode 100644
index 64b7eef..0000000
--- a/pch.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// pch.cpp: source file corresponding to the pre-compiled header
-
-#include "pch.h"
-
-// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
diff --git a/pch.h b/pch.h
deleted file mode 100644
index 885d5d6..0000000
--- a/pch.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// pch.h: This is a precompiled header file.
-// Files listed below are compiled only once, improving build performance for future builds.
-// This also affects IntelliSense performance, including code completion and many code browsing features.
-// However, files listed here are ALL re-compiled if any one of them is updated between builds.
-// Do not add files here that you will be updating frequently as this negates the performance advantage.
-
-#ifndef PCH_H
-#define PCH_H
-
-// add headers that you want to pre-compile here
-#include "framework.h"
-
-#endif //PCH_H
diff --git a/src/NT.cpp b/src/NT.cpp
new file mode 100644
index 0000000..15bf63d
--- /dev/null
+++ b/src/NT.cpp
@@ -0,0 +1,29 @@
+#include "NT.h"
+
+#ifdef NT_CONSOLE_APP
+#include <iostream>
+#endif
+
+namespace nt
+{
+ bool NT::IsRunning() const
+ {
+ return true;
+ }
+}
+
+#ifdef NT_CONSOLE_APP
+int main()
+{
+ const nt::NT runtime;
+ std::cout << "RNT running: " << (runtime.IsRunning() ? "yes" : "no") << '\n';
+ const int exit_code = runtime.IsRunning() ? 0 : 1;
+
+#ifdef NT_WAIT_ON_EXIT
+ std::cout << "Press Enter to exit...";
+ std::cin.get();
+#endif
+
+ return exit_code;
+}
+#endif