├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── azure-pipelines.yml ├── bvidcelo ├── bvidcelo.c ├── bvidcelo.rc ├── bvidcelo.vcxproj └── bvidcelo.vcxproj.filters ├── canter ├── canter.vcxproj ├── canter.vcxproj.filters ├── device.cpp ├── process.cpp └── string.cpp ├── inc ├── bootvid.h ├── canter │ ├── device.hpp │ ├── process.hpp │ └── string.hpp ├── platform.h ├── version.h └── version.rc ├── lib ├── x64 │ └── bootvid.lib └── x86 │ └── bootvid.lib ├── nt-native.sln ├── ntgfx ├── ntgfx.cpp ├── ntgfx.rc ├── ntgfx.vcxproj └── ntgfx.vcxproj.filters ├── nthello ├── nthello.c ├── nthello.rc ├── nthello.vcxproj └── nthello.vcxproj.filters └── ntkeybin ├── gs.c ├── ntkeybin.cpp ├── ntkeybin.rc ├── ntkeybin.vcxproj └── ntkeybin.vcxproj.filters /.gitattributes: -------------------------------------------------------------------------------- 1 | /inc/*.h linguist-language=C 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | .vscode/ 3 | *.user 4 | Debug/ 5 | Release/ 6 | /x86 7 | /x64 8 | /inc/_git.h 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "phnt"] 2 | path = phnt 3 | url = https://github.com/processhacker/phnt.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mateusz Karcz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NT Native API Graphical Application 2 | An example of Windows NT kernel driver exporting boot-time graphics and a Native API application utilizing it. 3 | 4 | [![Build Status](https://matriksoft.visualstudio.com/thecatkitty-gh-public/_apis/build/status/thecatkitty.nt-native?branchName=master)](https://matriksoft.visualstudio.com/thecatkitty-gh-public/_build/latest?definitionId=1&branchName=master) 5 | 6 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - master 3 | 4 | pool: 5 | vmImage: 'vs2017-win2016' 6 | 7 | strategy: 8 | matrix: 9 | Debug32: 10 | configuration: Debug 11 | platform: x86 12 | Debug64: 13 | configuration: Debug 14 | platform: x64 15 | 16 | steps: 17 | - task: VSBuild@1 18 | inputs: 19 | solution: '**\*.sln' 20 | vsVersion: '15.0' 21 | platform: '$(platform)' 22 | configuration: '$(configuration)' 23 | clean: true 24 | createLogFile: true 25 | 26 | - task: PublishBuildArtifacts@1 27 | inputs: 28 | PathtoPublish: '$(Build.SourcesDirectory)/$(platform)/$(configuration)' 29 | ArtifactName: 'nt-native-$(platform)-$(configuration)' 30 | publishLocation: 'Container' 31 | -------------------------------------------------------------------------------- /bvidcelo/bvidcelo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | typedef struct _BVID_DEVICE_EXTENSION { 6 | INT i; 7 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION; 8 | 9 | 10 | DRIVER_DISPATCH BVidCreate; 11 | NTSTATUS BVidCreate( 12 | IN PDEVICE_OBJECT DeviceObject, 13 | IN PIRP Irp) 14 | { 15 | UNREFERENCED_PARAMETER(DeviceObject); 16 | UNREFERENCED_PARAMETER(Irp); 17 | 18 | VidInitialize(TRUE); 19 | VidResetDisplay(FALSE); 20 | 21 | VidSolidColorFill(0, 0, 639, 479, VGA_COLOR_BLUE); 22 | VidSetTextColor(VGA_COLOR_BRIGHT_PURPLE); 23 | 24 | DbgPrint("BVidCelo got created\n"); 25 | return STATUS_SUCCESS; 26 | } 27 | 28 | 29 | DRIVER_DISPATCH BVidClose; 30 | NTSTATUS BVidClose( 31 | IN PDEVICE_OBJECT DeviceObject, 32 | IN PIRP Irp) 33 | { 34 | UNREFERENCED_PARAMETER(DeviceObject); 35 | UNREFERENCED_PARAMETER(Irp); 36 | 37 | VidCleanUp(); 38 | 39 | DbgPrint("BVidCelo got closed\n"); 40 | return STATUS_SUCCESS; 41 | } 42 | 43 | 44 | DRIVER_DISPATCH BVidWrite; 45 | NTSTATUS BVidWrite( 46 | IN PDEVICE_OBJECT DeviceObject, 47 | IN PIRP Irp) 48 | { 49 | NTSTATUS Status = STATUS_SUCCESS; 50 | PVOID UserData; 51 | ULONG DataSize; 52 | 53 | PIO_STACK_LOCATION IrpStack = IoGetCurrentIrpStackLocation(Irp); 54 | 55 | DataSize = IrpStack->Parameters.Write.Length; 56 | UserData = Irp->AssociatedIrp.SystemBuffer; 57 | 58 | VidDisplayString((PUCHAR)UserData); 59 | 60 | Irp->IoStatus.Status = Status; 61 | Irp->IoStatus.Information = DataSize; 62 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 63 | return Status; 64 | } 65 | 66 | 67 | DRIVER_UNLOAD BVidUnload; 68 | VOID BVidUnload( 69 | IN PDRIVER_OBJECT DriverObject) 70 | { 71 | DbgPrint("BVidCelo is being unloaded...\n"); 72 | IoDeleteDevice(DriverObject->DeviceObject); 73 | } 74 | 75 | 76 | NTSTATUS NTAPI DriverEntry( 77 | IN PDRIVER_OBJECT DriverObject, 78 | IN PUNICODE_STRING RegistryPath) 79 | { 80 | UNREFERENCED_PARAMETER(RegistryPath); 81 | DbgPrint("Hello, World! BVidCelo sends greetings...\n"); 82 | 83 | //PDEVICE_EXTENSION DeviceExtension; 84 | PDEVICE_OBJECT DeviceObject; 85 | UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BVidCelo"); 86 | NTSTATUS Status; 87 | 88 | Status = IoCreateDevice( 89 | DriverObject, 90 | sizeof(DEVICE_EXTENSION), 91 | &DeviceName, 92 | FILE_DEVICE_VIDEO, 93 | 0, 94 | FALSE, 95 | &DeviceObject); 96 | if (!NT_SUCCESS(Status)) 97 | { 98 | return Status; 99 | } 100 | 101 | DeviceObject->Flags |= DO_BUFFERED_IO; 102 | 103 | DriverObject->MajorFunction[IRP_MJ_CREATE] = BVidCreate; 104 | DriverObject->MajorFunction[IRP_MJ_CLOSE] = BVidClose; 105 | DriverObject->MajorFunction[IRP_MJ_WRITE] = BVidWrite; 106 | DriverObject->DriverUnload = BVidUnload; 107 | 108 | return STATUS_SUCCESS; 109 | } 110 | -------------------------------------------------------------------------------- /bvidcelo/bvidcelo.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/bvidcelo/bvidcelo.rc -------------------------------------------------------------------------------- /bvidcelo/bvidcelo.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445} 24 | nthello 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Application 30 | true 31 | WindowsKernelModeDriver10.0 32 | MultiByte 33 | 34 | 35 | <_NT_TARGET_VERSION> 36 | 37 | 38 | 39 | Application 40 | false 41 | WindowsKernelModeDriver10.0 42 | true 43 | MultiByte 44 | 45 | 46 | <_NT_TARGET_VERSION> 47 | 48 | 49 | 50 | Application 51 | true 52 | WindowsKernelModeDriver10.0 53 | MultiByte 54 | 55 | 56 | <_NT_TARGET_VERSION> 57 | 58 | 59 | 60 | Application 61 | false 62 | WindowsKernelModeDriver10.0 63 | true 64 | MultiByte 65 | 66 | 67 | <_NT_TARGET_VERSION> 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 89 | false 90 | false 91 | $(SolutionDir)lib\$(PlatformTarget);$(SDK_LIB_PATH)..\..\km\$(PlatformTarget);$(LibraryPath) 92 | .sys 93 | BuildGenerateSources 94 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 95 | $(PlatformTarget)\$(Configuration)\ 96 | 97 | 98 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 99 | false 100 | false 101 | $(SolutionDir)lib\$(PlatformTarget);$(SDK_LIB_PATH)..\..\km\$(PlatformTarget);$(LibraryPath) 102 | .sys 103 | BuildGenerateSources 104 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 105 | $(PlatformTarget)\$(Configuration)\ 106 | 107 | 108 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 109 | false 110 | false 111 | .sys 112 | BuildGenerateSources 113 | $(SolutionDir)lib\$(PlatformTarget);$(SDK_LIB_PATH)..\..\km\$(PlatformTarget);$(LibraryPath) 114 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 115 | $(PlatformTarget)\$(Configuration)\ 116 | 117 | 118 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 119 | false 120 | false 121 | .sys 122 | BuildGenerateSources 123 | $(SolutionDir)lib\$(PlatformTarget);$(SDK_LIB_PATH)..\..\km\$(PlatformTarget);$(LibraryPath) 124 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 125 | $(PlatformTarget)\$(Configuration)\ 126 | 127 | 128 | 129 | Level3 130 | Disabled 131 | 132 | 133 | true 134 | stdcpp17 135 | Default 136 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 137 | false 138 | false 139 | 140 | 141 | Native 142 | ntoskrnl.lib;bootvid.lib 143 | true 144 | Driver 145 | DriverEntry 146 | 147 | 148 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 149 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 150 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 151 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 152 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 153 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 154 | 155 | 156 | 157 | Saving git hash to file 158 | 159 | 160 | $(SolutionDir)inc\_git.h 161 | 162 | 163 | 164 | 165 | Level3 166 | Disabled 167 | 168 | 169 | true 170 | stdcpp17 171 | Default 172 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 173 | false 174 | false 175 | 176 | 177 | Native 178 | ntoskrnl.lib;bootvid.lib 179 | true 180 | Driver 181 | DriverEntry 182 | 183 | 184 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 185 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 186 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 187 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 188 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 189 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 190 | 191 | 192 | 193 | Saving git hash to file 194 | 195 | 196 | $(SolutionDir)inc\_git.h 197 | 198 | 199 | 200 | 201 | Level3 202 | MaxSpeed 203 | true 204 | true 205 | 206 | 207 | true 208 | stdcpp17 209 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 210 | false 211 | false 212 | 213 | 214 | Native 215 | true 216 | true 217 | ntoskrnl.lib;bootvid.lib 218 | true 219 | Driver 220 | DriverEntry 221 | 222 | 223 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 224 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 225 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 226 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 227 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 228 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 229 | 230 | 231 | 232 | Saving git hash to file 233 | 234 | 235 | $(SolutionDir)inc\_git.h 236 | 237 | 238 | 239 | 240 | Level3 241 | MaxSpeed 242 | true 243 | true 244 | 245 | 246 | true 247 | stdcpp17 248 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 249 | false 250 | false 251 | 252 | 253 | Native 254 | true 255 | true 256 | ntoskrnl.lib;bootvid.lib 257 | true 258 | Driver 259 | DriverEntry 260 | 261 | 262 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 263 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 264 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 265 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 266 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 267 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 268 | 269 | 270 | 271 | Saving git hash to file 272 | 273 | 274 | $(SolutionDir)inc\_git.h 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | -------------------------------------------------------------------------------- /bvidcelo/bvidcelo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source files 20 | 21 | 22 | 23 | 24 | Resource files 25 | 26 | 27 | -------------------------------------------------------------------------------- /canter/canter.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 16.0 28 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971} 29 | canter 30 | 10.0.17763.0 31 | 32 | 33 | 34 | StaticLibrary 35 | true 36 | v141 37 | MultiByte 38 | 39 | 40 | StaticLibrary 41 | false 42 | v141 43 | true 44 | MultiByte 45 | 46 | 47 | StaticLibrary 48 | true 49 | v141 50 | MultiByte 51 | 52 | 53 | StaticLibrary 54 | false 55 | v141 56 | true 57 | MultiByte 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 78 | false 79 | false 80 | $(LibraryPath) 81 | 82 | 83 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 84 | $(PlatformTarget)\$(Configuration)\ 85 | 86 | 87 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 88 | false 89 | false 90 | $(LibraryPath) 91 | 92 | 93 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 94 | $(PlatformTarget)\$(Configuration)\ 95 | 96 | 97 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 98 | false 99 | false 100 | 101 | 102 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 103 | $(PlatformTarget)\$(Configuration)\ 104 | 105 | 106 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 107 | false 108 | false 109 | 110 | 111 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 112 | $(PlatformTarget)\$(Configuration)\ 113 | 114 | 115 | 116 | Level3 117 | Disabled 118 | false 119 | true 120 | stdcpp17 121 | Default 122 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 123 | ProgramDatabase 124 | 125 | 126 | Native 127 | ntdll.lib 128 | true 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | Level3 146 | Disabled 147 | false 148 | true 149 | stdcpp17 150 | Default 151 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 152 | ProgramDatabase 153 | 154 | 155 | Native 156 | ntdll.lib 157 | true 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | Level3 175 | MaxSpeed 176 | true 177 | true 178 | false 179 | true 180 | stdcpp17 181 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 182 | 183 | 184 | Native 185 | true 186 | true 187 | ntdll.lib 188 | true 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | Level3 206 | MaxSpeed 207 | true 208 | true 209 | false 210 | true 211 | stdcpp17 212 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 213 | 214 | 215 | Native 216 | true 217 | true 218 | ntdll.lib 219 | true 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /canter/canter.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source files 20 | 21 | 22 | Source files 23 | 24 | 25 | Source files 26 | 27 | 28 | -------------------------------------------------------------------------------- /canter/device.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | canter::device::device( 5 | IN PCWSTR name, 6 | IN object_attribute attributes) 7 | : _hfile{ 0 } 8 | { 9 | RtlInitUnicodeString(&_name, const_cast(name)); 10 | InitializeObjectAttributes( 11 | &_oattrs, 12 | &_name, 13 | static_cast(attributes), 14 | NULL, 15 | NULL); 16 | } 17 | 18 | NTSTATUS canter::device::open( 19 | IN access access_mask, 20 | IN share_access share_access_mask, 21 | IN synchronous_io sync_io_type) 22 | { 23 | ACCESS_MASK DesiredAccess{ 24 | static_cast(access_mask) }; 25 | ULONG OpenOptions{ 0 }; 26 | 27 | if (_oattrs.Attributes & OBJ_OPENIF) 28 | { 29 | OpenOptions |= FILE_OPEN_IF; 30 | } 31 | else 32 | { 33 | OpenOptions |= FILE_OPEN; 34 | } 35 | 36 | if (sync_io_type != synchronous_io::none) 37 | { 38 | DesiredAccess |= SYNCHRONIZE; 39 | OpenOptions |= static_cast(sync_io_type); 40 | } 41 | 42 | return NtOpenFile( 43 | &_hfile, 44 | DesiredAccess, 45 | &_oattrs, 46 | &_iosb, 47 | static_cast(share_access_mask), 48 | OpenOptions); 49 | } 50 | 51 | NTSTATUS canter::device::close() 52 | { 53 | return NtClose(_hfile); 54 | } 55 | 56 | NTSTATUS canter::device::read( 57 | OUT PVOID buffer, 58 | IN ULONG count) 59 | { 60 | return NtReadFile( 61 | _hfile, 62 | NULL, 63 | NULL, 64 | NULL, 65 | &_iosb, 66 | buffer, 67 | count, 68 | NULL, 69 | NULL); 70 | } 71 | 72 | NTSTATUS canter::device::write( 73 | IN PVOID buffer, 74 | IN ULONG count) 75 | { 76 | LARGE_INTEGER offset; 77 | offset.QuadPart = 0; 78 | 79 | return NtWriteFile( 80 | _hfile, 81 | NULL, 82 | NULL, 83 | NULL, 84 | &_iosb, 85 | buffer, 86 | count, 87 | &offset, 88 | NULL); 89 | } 90 | 91 | NTSTATUS canter::device::control( 92 | IN ULONG code, 93 | IN PVOID in_buffer, 94 | IN ULONG in_count, 95 | OUT PVOID out_buffer, 96 | OUT ULONG out_count) 97 | { 98 | return NtDeviceIoControlFile( 99 | _hfile, 100 | NULL, 101 | NULL, 102 | NULL, 103 | &_iosb, 104 | code, 105 | in_buffer, 106 | in_count, 107 | out_buffer, 108 | out_count); 109 | } 110 | -------------------------------------------------------------------------------- /canter/process.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | NTSTATUS canter::process::delay( 5 | IN int64_t duration) 6 | { 7 | LARGE_INTEGER delay; 8 | delay.QuadPart = duration; 9 | return NtDelayExecution(FALSE, &delay); 10 | } 11 | 12 | NTSTATUS canter::process::terminate( 13 | IN NTSTATUS status) 14 | { 15 | return NtTerminateProcess(reinterpret_cast(-1), status); 16 | } 17 | 18 | PUNICODE_STRING canter::process::get_path( 19 | IN PVOID peb) 20 | { 21 | auto ppeb = reinterpret_cast(peb); 22 | return &ppeb->ProcessParameters->ImagePathName; 23 | } 24 | 25 | PUNICODE_STRING canter::process::get_command_line( 26 | IN PVOID peb) 27 | { 28 | auto ppeb = reinterpret_cast(peb); 29 | return &ppeb->ProcessParameters->CommandLine; 30 | } 31 | -------------------------------------------------------------------------------- /canter/string.cpp: -------------------------------------------------------------------------------- 1 | #define NTSTRSAFE_LIB 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | canter::string::string() 11 | { 12 | RtlZeroMemory(_buff, sizeof(_buff)); 13 | RtlInitEmptyUnicodeString(&_nts, _buff, sizeof(_buff)); 14 | } 15 | 16 | canter::string::string( 17 | IN PWSTR str) 18 | { 19 | RtlInitUnicodeString(&_nts, str); 20 | } 21 | 22 | canter::string::string( 23 | IN UNICODE_STRING& nts) 24 | { 25 | RtlCopyUnicodeString(&_nts, &nts); 26 | } 27 | 28 | canter::string& canter::string::operator=( 29 | IN PWSTR str) 30 | { 31 | RtlInitUnicodeString(&_nts, str); 32 | return *this; 33 | } 34 | 35 | canter::string& canter::string::operator=( 36 | IN UNICODE_STRING& nts) 37 | { 38 | RtlCopyUnicodeString(&_nts, &nts); 39 | return *this; 40 | } 41 | 42 | canter::string::operator PWSTR() 43 | { 44 | return _nts.Buffer; 45 | } 46 | 47 | canter::string::operator PUNICODE_STRING() 48 | { 49 | return &_nts; 50 | } 51 | 52 | WCHAR& canter::string::operator[]( 53 | SIZE_T index) 54 | { 55 | return _nts.Buffer[index]; 56 | } 57 | 58 | NTSTATUS canter::string::printf( 59 | IN PCWSTR fmt, 60 | ...) 61 | { 62 | va_list args; 63 | va_start(args, fmt); 64 | auto status = RtlUnicodeStringVPrintf(&_nts, fmt, args); 65 | va_end(args); 66 | return status; 67 | } 68 | 69 | NTSTATUS canter::display( 70 | IN string& str) 71 | { 72 | return NtDisplayString(str); 73 | } 74 | 75 | NTSTATUS canter::display( 76 | IN PCWSTR str) 77 | { 78 | UNICODE_STRING nts; 79 | RtlInitUnicodeString(&nts, const_cast(str)); 80 | return NtDisplayString(&nts); 81 | } 82 | -------------------------------------------------------------------------------- /inc/bootvid.h: -------------------------------------------------------------------------------- 1 | // Vid* (bootvid.dll) prototypes based on ReactOS documentation 2 | #ifndef _DNDK_VID_H_ 3 | #define _DNDK_VID_H_ 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif // __cplusplus 10 | 11 | 12 | #define VGA_COLOR_BLACK 0 13 | #define VGA_COLOR_RED 1 14 | #define VGA_COLOR_GREEN 2 15 | #define VGA_COLOR_GR 3 16 | #define VGA_COLOR_BLUE 4 17 | #define VGA_COLOR_DARK_MAGENTA 5 18 | #define VGA_COLOR_TURQUOISE 6 19 | #define VGA_COLOR_GRAY 7 20 | #define VGA_COLOR_BRIGHT_GRAY 8 21 | #define VGA_COLOR_BRIGHT_RED 9 22 | #define VGA_COLOR_BRIGHT_GREEN 10 23 | #define VGA_COLOR_BRIGHT_YELLOW 11 24 | #define VGA_COLOR_BRIGHT_BLUE 12 25 | #define VGA_COLOR_BRIGHT_PURPLE 13 26 | #define VGA_COLOR_BRIGHT_TURQUOISE 14 27 | #define VGA_COLOR_WHITE 15 28 | 29 | 30 | // 31 | // Installation Functions 32 | // 33 | NTKERNELAPI BOOLEAN NTAPI VidInitialize( 34 | IN BOOLEAN SetMode); 35 | 36 | NTKERNELAPI VOID NTAPI VidCleanUp( 37 | VOID); 38 | 39 | // 40 | // Display Functions 41 | // 42 | NTKERNELAPI VOID NTAPI VidDisplayString( 43 | IN PUCHAR String); 44 | 45 | NTKERNELAPI VOID NTAPI VidDisplayStringXY( 46 | IN PUCHAR String, 47 | IN ULONG Left, 48 | IN ULONG Top, 49 | IN BOOLEAN Transparent); 50 | 51 | NTKERNELAPI VOID NTAPI VidResetDisplay( 52 | IN BOOLEAN HalReset); 53 | 54 | NTKERNELAPI VOID NTAPI VidSetScrollRegion( 55 | IN ULONG Left, 56 | IN ULONG Top, 57 | IN ULONG Right, 58 | IN ULONG Bottom); 59 | 60 | NTKERNELAPI ULONG NTAPI VidSetTextColor( 61 | IN ULONG Color); 62 | 63 | NTKERNELAPI VOID NTAPI VidSolidColorFill( 64 | IN ULONG Left, 65 | IN ULONG Top, 66 | IN ULONG Right, 67 | IN ULONG Bottom, 68 | IN UCHAR Color); 69 | 70 | NTKERNELAPI VOID NTAPI VidBufferToScreenBlt( 71 | IN PUCHAR Buffer, 72 | IN ULONG Left, 73 | IN ULONG Top, 74 | IN ULONG Width, 75 | IN ULONG Height, 76 | IN ULONG Delta); 77 | 78 | NTKERNELAPI VOID NTAPI VidScreenToBufferBlt( 79 | IN PUCHAR Buffer, 80 | IN ULONG Left, 81 | IN ULONG Top, 82 | IN ULONG Width, 83 | IN ULONG Height, 84 | IN ULONG Delta); 85 | 86 | NTKERNELAPI VOID NTAPI VidBitBlt( 87 | IN PUCHAR Buffer, 88 | IN ULONG Left, 89 | IN ULONG Top); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif // __cplusplus 94 | 95 | #endif // _DNDK_VID_H_ 96 | -------------------------------------------------------------------------------- /inc/canter/device.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #define CANTER_FLAG_FIELD(name, value_type) \ 9 | constexpr name operator|( \ 10 | IN name left, \ 11 | IN name right) \ 12 | { \ 13 | return static_cast( \ 14 | static_cast(left) | static_cast(right)); \ 15 | } \ 16 | \ 17 | constexpr name operator&( \ 18 | IN name left, \ 19 | IN name right) \ 20 | { \ 21 | return static_cast( \ 22 | static_cast(left) & static_cast(right)); \ 23 | } \ 24 | struct {} 25 | 26 | 27 | namespace canter 28 | { 29 | enum class access : ULONG 30 | { 31 | none = 0, 32 | read = 0x80000000L, 33 | write = 0x40000000L, 34 | execute = 0x20000000L, 35 | all = 0x10000000L, 36 | remove = 0x00010000L, 37 | read_control = 0x00020000L, 38 | write_dac = 0x00040000L, 39 | write_owner = 0x00080000L 40 | }; 41 | 42 | enum class object_attribute : ULONG 43 | { 44 | none = 0, 45 | inheritable = 0x00000002L, 46 | permament = 0x00000010L, 47 | exclusive = 0x00000020L, 48 | case_insensitive = 0x00000040L, 49 | existent = 0x00000080L, 50 | symlink = 0x00000100L 51 | }; 52 | 53 | enum class share_access : ULONG 54 | { 55 | none = 0, 56 | read = 0x00000001L, 57 | write = 0x00000002L, 58 | remove = 0x00000004L 59 | }; 60 | 61 | enum class synchronous_io : ULONG 62 | { 63 | none = 0, 64 | alert = 0x00000010, 65 | non_alert = 0x00000020 66 | }; 67 | 68 | #pragma warning(push) 69 | #pragma warning(disable : 4094) 70 | CANTER_FLAG_FIELD(access, ULONG); 71 | CANTER_FLAG_FIELD(object_attribute, ULONG); 72 | CANTER_FLAG_FIELD(share_access, ULONG); 73 | #pragma warning(pop) 74 | 75 | 76 | class device 77 | { 78 | UNICODE_STRING _name; 79 | HANDLE _hfile; 80 | OBJECT_ATTRIBUTES _oattrs; 81 | IO_STATUS_BLOCK _iosb; 82 | 83 | public: 84 | device( 85 | IN PCWSTR name, 86 | IN object_attribute attributes = object_attribute::none); 87 | 88 | NTSTATUS open( 89 | IN access access_mask, 90 | IN share_access share_access_mask = share_access::none, 91 | IN synchronous_io sync_io_type = synchronous_io::none); 92 | 93 | NTSTATUS close(); 94 | 95 | NTSTATUS read( 96 | OUT PVOID buffer, 97 | IN ULONG count); 98 | 99 | NTSTATUS write( 100 | IN PVOID buffer, 101 | IN ULONG count); 102 | 103 | NTSTATUS control( 104 | IN ULONG code, 105 | IN PVOID in_buffer, 106 | IN ULONG in_count, 107 | OUT PVOID out_buffer = NULL, 108 | IN ULONG out_count = 0); 109 | }; 110 | } 111 | -------------------------------------------------------------------------------- /inc/canter/process.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace canter 9 | { 10 | struct process { 11 | static NTSTATUS delay( 12 | IN int64_t duration); 13 | 14 | static NTSTATUS terminate( 15 | IN NTSTATUS status); 16 | 17 | static PUNICODE_STRING get_path( 18 | IN PVOID peb); 19 | 20 | static PUNICODE_STRING get_command_line( 21 | IN PVOID peb); 22 | }; 23 | } 24 | 25 | #define CANTER_DURATION_MS(ms) ((ms) * -10000) 26 | -------------------------------------------------------------------------------- /inc/canter/string.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace canter 8 | { 9 | class string 10 | { 11 | UNICODE_STRING _nts; 12 | WCHAR _buff[64]; // TODO : dynamic size 13 | 14 | public: 15 | string(); 16 | 17 | string( 18 | IN PWSTR str); 19 | 20 | string( 21 | IN UNICODE_STRING &nts); 22 | 23 | string& operator=( 24 | IN PWSTR str); 25 | 26 | string& operator=( 27 | IN UNICODE_STRING &nts); 28 | 29 | operator PWSTR(); 30 | 31 | operator PUNICODE_STRING(); 32 | 33 | WCHAR& operator[]( 34 | SIZE_T index); 35 | 36 | NTSTATUS printf( 37 | IN PCWSTR fmt, 38 | ...); 39 | }; 40 | 41 | NTSTATUS display( 42 | IN string& str); 43 | 44 | NTSTATUS display( 45 | IN PCWSTR str); 46 | } 47 | -------------------------------------------------------------------------------- /inc/platform.h: -------------------------------------------------------------------------------- 1 | #ifdef ARCH_x86 2 | #ifndef _X86_ 3 | #define _X86_ 4 | #endif 5 | #endif // ARCH_x86 6 | 7 | #ifdef ARCH_x64 8 | #ifndef _AMD64_ 9 | #define _AMD64_ 10 | #endif 11 | #endif // ARCH_x64 12 | 13 | #define PHNT_NO_INLINE_INIT_STRING 14 | -------------------------------------------------------------------------------- /inc/version.h: -------------------------------------------------------------------------------- 1 | #include "_git.h" 2 | 3 | #define RC_NUM_VERSION_MAJOR 0 4 | #define RC_NUM_VERSION_MINOR 1 5 | #define RC_NUM_VERSION_RELEASE 0 6 | #define RC_NUM_VERSION_BUILD GIT_COMMIT_COUNT 7 | 8 | #define XSTR(s) STR(s) 9 | #define STR(s) #s 10 | 11 | #define RC_STR_VERSION XSTR(RC_NUM_VERSION_MAJOR) \ 12 | "." XSTR(RC_NUM_VERSION_MINOR) \ 13 | "." XSTR(RC_NUM_VERSION_RELEASE) \ 14 | "-" GIT_COMMIT_HASH 15 | -------------------------------------------------------------------------------- /inc/version.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/inc/version.rc -------------------------------------------------------------------------------- /lib/x64/bootvid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/lib/x64/bootvid.lib -------------------------------------------------------------------------------- /lib/x86/bootvid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/lib/x86/bootvid.lib -------------------------------------------------------------------------------- /nt-native.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nthello", "nthello\nthello.vcxproj", "{BAEF69A8-2325-4A0C-83E2-BB8088087B7D}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bvidcelo", "bvidcelo\bvidcelo.vcxproj", "{F7B0F06B-8ED6-4320-8373-2E3406F4C445}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ntkeybin", "ntkeybin\ntkeybin.vcxproj", "{95BD36A4-0B6A-46BF-8D2E-8B9464123C01}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ntgfx", "ntgfx\ntgfx.vcxproj", "{F03AC8F4-86C0-4F84-B531-30FDAEE1453B}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "canter", "canter\canter.vcxproj", "{5F6BFF3B-0A34-4AAF-9030-2720008FF971}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|x64 = Debug|x64 19 | Debug|x86 = Debug|x86 20 | Release|x64 = Release|x64 21 | Release|x86 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Debug|x64.ActiveCfg = Debug|x64 25 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Debug|x64.Build.0 = Debug|x64 26 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Debug|x86.ActiveCfg = Debug|Win32 27 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Debug|x86.Build.0 = Debug|Win32 28 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Release|x64.ActiveCfg = Release|x64 29 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Release|x64.Build.0 = Release|x64 30 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Release|x86.ActiveCfg = Release|Win32 31 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D}.Release|x86.Build.0 = Release|Win32 32 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x64.ActiveCfg = Debug|x64 33 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x64.Build.0 = Debug|x64 34 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x64.Deploy.0 = Debug|x64 35 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x86.ActiveCfg = Debug|Win32 36 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x86.Build.0 = Debug|Win32 37 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Debug|x86.Deploy.0 = Debug|Win32 38 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x64.ActiveCfg = Release|x64 39 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x64.Build.0 = Release|x64 40 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x64.Deploy.0 = Release|x64 41 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x86.ActiveCfg = Release|Win32 42 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x86.Build.0 = Release|Win32 43 | {F7B0F06B-8ED6-4320-8373-2E3406F4C445}.Release|x86.Deploy.0 = Release|Win32 44 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Debug|x64.ActiveCfg = Debug|x64 45 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Debug|x64.Build.0 = Debug|x64 46 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Debug|x86.ActiveCfg = Debug|Win32 47 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Debug|x86.Build.0 = Debug|Win32 48 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Release|x64.ActiveCfg = Release|x64 49 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Release|x64.Build.0 = Release|x64 50 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Release|x86.ActiveCfg = Release|Win32 51 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01}.Release|x86.Build.0 = Release|Win32 52 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Debug|x64.ActiveCfg = Debug|x64 53 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Debug|x64.Build.0 = Debug|x64 54 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Debug|x86.ActiveCfg = Debug|Win32 55 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Debug|x86.Build.0 = Debug|Win32 56 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Release|x64.ActiveCfg = Release|x64 57 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Release|x64.Build.0 = Release|x64 58 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Release|x86.ActiveCfg = Release|Win32 59 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B}.Release|x86.Build.0 = Release|Win32 60 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Debug|x64.ActiveCfg = Debug|x64 61 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Debug|x64.Build.0 = Debug|x64 62 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Debug|x86.ActiveCfg = Debug|Win32 63 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Debug|x86.Build.0 = Debug|Win32 64 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Release|x64.ActiveCfg = Release|x64 65 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Release|x64.Build.0 = Release|x64 66 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Release|x86.ActiveCfg = Release|Win32 67 | {5F6BFF3B-0A34-4AAF-9030-2720008FF971}.Release|x86.Build.0 = Release|Win32 68 | EndGlobalSection 69 | GlobalSection(SolutionProperties) = preSolution 70 | HideSolutionNode = FALSE 71 | EndGlobalSection 72 | GlobalSection(ExtensibilityGlobals) = postSolution 73 | SolutionGuid = {FC9ABB2E-950E-4E6C-B5E6-AD1855F09654} 74 | EndGlobalSection 75 | EndGlobal 76 | -------------------------------------------------------------------------------- /ntgfx/ntgfx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | #define BUFFER_LENGTH 100 6 | 7 | 8 | static VOID UnicodeToAscii7( 9 | IN PUNICODE_STRING unicode, 10 | OUT PSTR ascii7, 11 | IN USHORT length); 12 | 13 | 14 | VOID NTAPI NtProcessStartup( 15 | IN PPEB peb) 16 | { 17 | canter::device vid{ 18 | L"\\Device\\BVidCelo", 19 | canter::object_attribute::existent 20 | }; 21 | 22 | auto status = vid.open( 23 | canter::access::read | canter::access::write); 24 | if (NT_SUCCESS(status)) 25 | { 26 | char msg[] = "Hello World!\nI love programming!\n"; 27 | char nl[] = "\n"; 28 | char buff[BUFFER_LENGTH]; 29 | 30 | vid.write(msg, sizeof(msg)); 31 | canter::process::delay(CANTER_DURATION_MS(1500)); 32 | 33 | UnicodeToAscii7( 34 | canter::process::get_path(peb), 35 | buff, 36 | BUFFER_LENGTH); 37 | vid.write(buff, BUFFER_LENGTH); 38 | vid.write(nl, sizeof(nl)); 39 | canter::process::delay(CANTER_DURATION_MS(1500)); 40 | 41 | UnicodeToAscii7( 42 | canter::process::get_command_line(peb), 43 | buff, 44 | BUFFER_LENGTH); 45 | vid.write(buff, BUFFER_LENGTH); 46 | canter::process::delay(CANTER_DURATION_MS(1500)); 47 | 48 | vid.close(); 49 | 50 | canter::process::terminate(STATUS_SUCCESS); 51 | } 52 | 53 | canter::process::terminate(status); 54 | } 55 | 56 | 57 | VOID UnicodeToAscii7( 58 | IN PUNICODE_STRING unicode, 59 | OUT PSTR ascii7, 60 | IN USHORT length) 61 | { 62 | USHORT i; 63 | for (i = 0; (i < unicode->Length) && (i < length - 1); i++) 64 | { 65 | ascii7[i] = unicode->Buffer[i] > 0x7F ? '?' : (CHAR)unicode->Buffer[i]; 66 | } 67 | ascii7[i] = 0; 68 | } 69 | -------------------------------------------------------------------------------- /ntgfx/ntgfx.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/ntgfx/ntgfx.rc -------------------------------------------------------------------------------- /ntgfx/ntgfx.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {F03AC8F4-86C0-4F84-B531-30FDAEE1453B} 24 | ntgfx 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 73 | false 74 | false 75 | $(LibraryPath) 76 | BuildGenerateSources 77 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 78 | $(PlatformTarget)\$(Configuration)\ 79 | 80 | 81 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 82 | false 83 | false 84 | $(LibraryPath) 85 | BuildGenerateSources 86 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 87 | $(PlatformTarget)\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 91 | false 92 | false 93 | BuildGenerateSources 94 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 95 | $(PlatformTarget)\$(Configuration)\ 96 | 97 | 98 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 99 | false 100 | false 101 | BuildGenerateSources 102 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 103 | $(PlatformTarget)\$(Configuration)\ 104 | 105 | 106 | 107 | Level3 108 | Disabled 109 | 110 | 111 | true 112 | stdcpp17 113 | Default 114 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 115 | ProgramDatabase 116 | false 117 | 118 | 119 | Native 120 | ntdll.lib 121 | true 122 | 123 | 124 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 125 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 126 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 127 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 128 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 129 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 130 | 131 | 132 | 133 | Saving git hash to file 134 | 135 | 136 | $(SolutionDir)inc\_git.h;%(Outputs) 137 | 138 | 139 | 140 | 141 | Level3 142 | Disabled 143 | 144 | 145 | true 146 | stdcpp17 147 | Default 148 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 149 | ProgramDatabase 150 | false 151 | 152 | 153 | Native 154 | ntdll.lib 155 | true 156 | 157 | 158 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 159 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 160 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 161 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 162 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 163 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 164 | 165 | 166 | 167 | Saving git hash to file 168 | 169 | 170 | $(SolutionDir)inc\_git.h;%(Outputs) 171 | 172 | 173 | 174 | 175 | Level3 176 | MaxSpeed 177 | true 178 | true 179 | 180 | 181 | true 182 | stdcpp17 183 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 184 | false 185 | 186 | 187 | Native 188 | true 189 | true 190 | ntdll.lib 191 | true 192 | 193 | 194 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 195 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 196 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 197 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 198 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 199 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 200 | 201 | 202 | 203 | Saving git hash to file 204 | 205 | 206 | $(SolutionDir)inc\_git.h;%(Outputs) 207 | 208 | 209 | 210 | 211 | Level3 212 | MaxSpeed 213 | true 214 | true 215 | 216 | 217 | true 218 | stdcpp17 219 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 220 | false 221 | 222 | 223 | Native 224 | true 225 | true 226 | ntdll.lib 227 | true 228 | 229 | 230 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 231 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 232 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 233 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 234 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 235 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 236 | 237 | 238 | 239 | Saving git hash to file 240 | 241 | 242 | $(SolutionDir)inc\_git.h;%(Outputs) 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | {5f6bff3b-0a34-4aaf-9030-2720008ff971} 254 | 255 | 256 | 257 | 258 | 259 | -------------------------------------------------------------------------------- /ntgfx/ntgfx.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Resource files 20 | 21 | 22 | 23 | 24 | Source files 25 | 26 | 27 | -------------------------------------------------------------------------------- /nthello/nthello.c: -------------------------------------------------------------------------------- 1 | #ifdef ARCH_x86 2 | #ifndef _X86_ 3 | #define _X86_ 4 | #endif 5 | #endif // ARCH_x86 6 | 7 | #ifdef ARCH_x64 8 | #ifndef _AMD64_ 9 | #define _AMD64_ 10 | #endif 11 | #endif // ARCH_x64 12 | 13 | #include 14 | 15 | NTSYSCALLAPI NTSTATUS NTAPI NtDisplayString( 16 | IN PUNICODE_STRING DisplayString); 17 | 18 | NTSYSCALLAPI NTSTATUS NTAPI NtDelayExecution( 19 | IN BOOLEAN Alertable, 20 | IN LARGE_INTEGER* Interval); 21 | 22 | NTSYSCALLAPI NTSTATUS NTAPI NtTerminateProcess( 23 | IN HANDLE ProcessHandle, 24 | IN NTSTATUS ExitStatus); 25 | 26 | 27 | VOID NTAPI NtProcessStartup( 28 | IN PPEB peb) 29 | { 30 | UNICODE_STRING hello; 31 | LARGE_INTEGER delay; 32 | RtlInitUnicodeString(&hello, L"Hello World!"); 33 | NtDisplayString(&hello); 34 | delay.QuadPart = -50000000; 35 | NtDelayExecution(FALSE, &delay); 36 | NtTerminateProcess((HANDLE)-1, STATUS_SUCCESS); 37 | } 38 | -------------------------------------------------------------------------------- /nthello/nthello.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/nthello/nthello.rc -------------------------------------------------------------------------------- /nthello/nthello.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {BAEF69A8-2325-4A0C-83E2-BB8088087B7D} 24 | nthello 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 73 | false 74 | false 75 | $(LibraryPath) 76 | BuildGenerateSources 77 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 78 | $(PlatformTarget)\$(Configuration)\ 79 | 80 | 81 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 82 | false 83 | false 84 | $(LibraryPath) 85 | BuildGenerateSources 86 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 87 | $(PlatformTarget)\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 91 | false 92 | false 93 | BuildGenerateSources 94 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 95 | $(PlatformTarget)\$(Configuration)\ 96 | 97 | 98 | $(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 99 | false 100 | false 101 | BuildGenerateSources 102 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 103 | $(PlatformTarget)\$(Configuration)\ 104 | 105 | 106 | 107 | Level3 108 | Disabled 109 | false 110 | true 111 | stdcpp17 112 | Default 113 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 114 | ProgramDatabase 115 | 116 | 117 | Native 118 | ntdll.lib 119 | true 120 | 121 | 122 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 123 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 124 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 125 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 126 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 127 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 128 | 129 | 130 | 131 | Saving git hash to file 132 | 133 | 134 | $(SolutionDir)inc\_git.h;%(Outputs) 135 | 136 | 137 | 138 | 139 | Level3 140 | Disabled 141 | false 142 | true 143 | stdcpp17 144 | Default 145 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 146 | ProgramDatabase 147 | 148 | 149 | Native 150 | ntdll.lib 151 | true 152 | 153 | 154 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 155 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 156 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 157 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 158 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 159 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 160 | 161 | 162 | 163 | Saving git hash to file 164 | 165 | 166 | $(SolutionDir)inc\_git.h;%(Outputs) 167 | 168 | 169 | 170 | 171 | Level3 172 | MaxSpeed 173 | true 174 | true 175 | false 176 | true 177 | stdcpp17 178 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 179 | 180 | 181 | Native 182 | true 183 | true 184 | ntdll.lib 185 | true 186 | 187 | 188 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 189 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 190 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 191 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 192 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 193 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 194 | 195 | 196 | 197 | Saving git hash to file 198 | 199 | 200 | $(SolutionDir)inc\_git.h;%(Outputs) 201 | 202 | 203 | 204 | 205 | Level3 206 | MaxSpeed 207 | true 208 | true 209 | false 210 | true 211 | stdcpp17 212 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 213 | 214 | 215 | Native 216 | true 217 | true 218 | ntdll.lib 219 | true 220 | 221 | 222 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 223 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 224 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 225 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 226 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 227 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 228 | 229 | 230 | 231 | Saving git hash to file 232 | 233 | 234 | $(SolutionDir)inc\_git.h;%(Outputs) 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /nthello/nthello.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source files 20 | 21 | 22 | 23 | 24 | Resource files 25 | 26 | 27 | -------------------------------------------------------------------------------- /ntkeybin/gs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | uintptr_t __security_cookie = 0xBADBEEF; 6 | #ifdef ARCH_x86 7 | #define __gscall __fastcall 8 | #else 9 | #define __gscall __cdecl 10 | #endif 11 | 12 | void __gscall __security_check_cookie(uintptr_t _StackCookie) { 13 | if (_StackCookie != __security_cookie) NtTerminateProcess((HANDLE)-1, -1); 14 | } 15 | -------------------------------------------------------------------------------- /ntkeybin/ntkeybin.cpp: -------------------------------------------------------------------------------- 1 | #define NTSTRSAFE_LIB 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | using namespace canter; 10 | 11 | VOID NTAPI NtProcessStartup( 12 | IN PPEB peb) 13 | { 14 | display(L"Hello.\r\n"); 15 | process::delay(CANTER_DURATION_MS(1000)); 16 | 17 | device keyb{ 18 | L"\\Device\\KeyboardClass0", 19 | object_attribute::existent 20 | }; 21 | 22 | NTSTATUS status; 23 | status = keyb.open( 24 | access::read | access::write, 25 | share_access::read | share_access::write, 26 | synchronous_io::non_alert); 27 | 28 | if (!NT_SUCCESS(status)) { 29 | display(L"***ZwOpenFile: Unable to create keyboard device 0\r\n"); 30 | 31 | process::delay(CANTER_DURATION_MS(5000)); 32 | process::terminate(status); 33 | } 34 | 35 | display(L"Press some keys and have fun\r\n"); 36 | 37 | KEYBOARD_INPUT_DATA kbdi; 38 | unsigned size{ sizeof(kbdi) }; 39 | string msg{}; 40 | 41 | BOOLEAN still{ TRUE }; 42 | while (still) { 43 | RtlZeroMemory(&kbdi, size); 44 | status = keyb.read(&kbdi, size); 45 | 46 | if (!NT_SUCCESS(status)) { 47 | display(L"***ZwOpenFile: Unable to read keyboard device 0\r\n"); 48 | 49 | msg.printf(L"***Status code %08X\r\n", status); 50 | display(msg); 51 | 52 | process::delay(CANTER_DURATION_MS(5000)); 53 | process::terminate(status); 54 | } 55 | 56 | if (NT_SUCCESS(status)) { 57 | if (kbdi.MakeCode) { 58 | msg.printf( 59 | L"Scan code %02X %s\r\n", 60 | kbdi.MakeCode, 61 | kbdi.Flags & KEY_BREAK ? L"up" : L"down"); 62 | display(msg); 63 | } 64 | still = kbdi.MakeCode != 0x01; // Esc 65 | } 66 | } 67 | 68 | display(L"OK.\r\n"); 69 | 70 | process::delay(CANTER_DURATION_MS(1000)); 71 | 72 | keyb.close(); 73 | process::terminate(STATUS_SUCCESS); 74 | } 75 | -------------------------------------------------------------------------------- /ntkeybin/ntkeybin.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thecatkitty/nt-native/17548a9ad168962eb864d48f57aa2a33a9b5a47e/ntkeybin/ntkeybin.rc -------------------------------------------------------------------------------- /ntkeybin/ntkeybin.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {95BD36A4-0B6A-46BF-8D2E-8B9464123C01} 24 | ntkeybin 25 | 10.0.17763.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 73 | false 74 | false 75 | $(WindowsSDK_LibraryPath)\..\km\x86;$(LibraryPath) 76 | BuildGenerateSources 77 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 78 | $(PlatformTarget)\$(Configuration)\ 79 | 80 | 81 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 82 | false 83 | false 84 | $(WindowsSDK_LibraryPath)\..\km\x86;$(LibraryPath) 85 | BuildGenerateSources 86 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 87 | $(PlatformTarget)\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 91 | false 92 | false 93 | BuildGenerateSources 94 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 95 | $(PlatformTarget)\$(Configuration)\ 96 | $(WindowsSDK_LibraryPath)\..\km\x64;$(LibraryPath) 97 | 98 | 99 | $(SolutionDir)phnt;$(SolutionDir)inc;$(UM_IncludePath)\..\km;$(IncludePath) 100 | false 101 | false 102 | BuildGenerateSources 103 | $(SolutionDir)$(PlatformTarget)\$(Configuration)\ 104 | $(PlatformTarget)\$(Configuration)\ 105 | $(WindowsSDK_LibraryPath)\..\km\x64;$(LibraryPath) 106 | 107 | 108 | 109 | Level3 110 | Disabled 111 | 112 | 113 | true 114 | stdcpp17 115 | Default 116 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 117 | ProgramDatabase 118 | false 119 | true 120 | 121 | 122 | Native 123 | ntdll.lib;ntstrsafe.lib 124 | true 125 | 126 | 127 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 128 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 129 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 130 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 131 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 132 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 133 | 134 | 135 | 136 | Saving git hash to file 137 | 138 | 139 | $(SolutionDir)inc\_git.h;%(Outputs) 140 | 141 | 142 | 143 | 144 | Level3 145 | Disabled 146 | 147 | 148 | true 149 | stdcpp17 150 | Default 151 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 152 | ProgramDatabase 153 | 154 | 155 | true 156 | 157 | 158 | Native 159 | ntdll.lib;ntstrsafe.lib 160 | true 161 | 162 | 163 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 164 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 165 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 166 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 167 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 168 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 169 | 170 | 171 | 172 | Saving git hash to file 173 | 174 | 175 | $(SolutionDir)inc\_git.h;%(Outputs) 176 | 177 | 178 | 179 | 180 | Level3 181 | MaxSpeed 182 | true 183 | true 184 | 185 | 186 | true 187 | stdcpp17 188 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 189 | false 190 | 191 | 192 | Native 193 | true 194 | true 195 | ntdll.lib;ntstrsafe.lib 196 | true 197 | 198 | 199 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 200 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 201 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 202 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 203 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 204 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 205 | 206 | 207 | 208 | Saving git hash to file 209 | 210 | 211 | $(SolutionDir)inc\_git.h;%(Outputs) 212 | 213 | 214 | 215 | 216 | Level3 217 | MaxSpeed 218 | true 219 | true 220 | 221 | 222 | true 223 | stdcpp17 224 | ARCH_$(PlatformTarget);%(PreprocessorDefinitions) 225 | 226 | 227 | 228 | 229 | Native 230 | true 231 | true 232 | ntdll.lib;ntstrsafe.lib 233 | true 234 | 235 | 236 | git rev-parse --short HEAD >"$(IntermediateOutputPath)hash.txt" 237 | set /p CommitHash= <"$(IntermediateOutputPath)hash.txt" 238 | echo #define GIT_COMMIT_HASH "%CommitHash%" >"$(SolutionDir)inc\_git.h" 239 | git rev-list --count HEAD >"$(IntermediateOutputPath)count.txt" 240 | set /p CommitCount= <"$(IntermediateOutputPath)count.txt" 241 | echo #define GIT_COMMIT_COUNT %CommitCount% >>"$(SolutionDir)inc\_git.h" 242 | 243 | 244 | 245 | Saving git hash to file 246 | 247 | 248 | $(SolutionDir)inc\_git.h;%(Outputs) 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | {5f6bff3b-0a34-4aaf-9030-2720008ff971} 261 | 262 | 263 | 264 | 265 | 266 | -------------------------------------------------------------------------------- /ntkeybin/ntkeybin.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source files 20 | 21 | 22 | Source files 23 | 24 | 25 | 26 | 27 | Resource files 28 | 29 | 30 | --------------------------------------------------------------------------------