├── .gitattributes ├── .gitignore ├── Kernel_WDK_Lib.sln ├── Kernel_WDK_Lib ├── CRT │ ├── Ntddk.hpp │ ├── c_alloc.cc │ ├── c_alloc.h │ ├── corecrt.cc │ ├── corecrt.h │ ├── macro.h │ ├── new.cc │ ├── new.h │ ├── stlcrt.cc │ └── stlcrt.h ├── Kernel_WDK_Lib.vcxproj ├── Kernel_WDK_Lib.vcxproj.backup ├── Kernel_WDK_Lib.vcxproj.filters └── main.cc ├── LICENSE └── Readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2050 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kernel_WDK_Lib", "Kernel_WDK_Lib\Kernel_WDK_Lib.vcxproj", "{06A60EED-6612-4D59-B5B7-17DC0E15751F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Win7 Debug|Win32 = Win7 Debug|Win32 11 | Win7 Debug|x64 = Win7 Debug|x64 12 | Win7 Release|Win32 = Win7 Release|Win32 13 | Win7 Release|x64 = Win7 Release|x64 14 | Win8 Debug|Win32 = Win8 Debug|Win32 15 | Win8 Debug|x64 = Win8 Debug|x64 16 | Win8 Release|Win32 = Win8 Release|Win32 17 | Win8 Release|x64 = Win8 Release|x64 18 | Win8.1 Debug|Win32 = Win8.1 Debug|Win32 19 | Win8.1 Debug|x64 = Win8.1 Debug|x64 20 | Win8.1 Release|Win32 = Win8.1 Release|Win32 21 | Win8.1 Release|x64 = Win8.1 Release|x64 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 25 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 26 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|Win32.Deploy.0 = Win7 Debug|Win32 27 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 28 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 29 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Debug|x64.Deploy.0 = Win7 Debug|x64 30 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 31 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 32 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|Win32.Deploy.0 = Win7 Release|Win32 33 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 34 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|x64.Build.0 = Win7 Release|x64 35 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win7 Release|x64.Deploy.0 = Win7 Release|x64 36 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 37 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 38 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 39 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 40 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 41 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Debug|x64.Deploy.0 = Win8 Debug|x64 42 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 43 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 44 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|Win32.Deploy.0 = Win8 Release|Win32 45 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 46 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|x64.Build.0 = Win8 Release|x64 47 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 48 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 49 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 50 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 51 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 52 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 53 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 54 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 55 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 56 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 57 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 58 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 59 | {06A60EED-6612-4D59-B5B7-17DC0E15751F}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | EndGlobal 65 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/Ntddk.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ntddk.h" 3 | 4 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/c_alloc.cc: -------------------------------------------------------------------------------- 1 | #include "Ntddk.hpp" 2 | #include "c_alloc.h" 3 | #include "macro.h" 4 | 5 | 6 | extern unsigned long const DefaultPoolTag = ByteSwap32$('ccrt'); 7 | extern POOL_TYPE DefaultPOOL_TYPE = NonPagedPool; 8 | extern unsigned long DefaultMdlProtection = MdlMappingNoExecute; 9 | #define memory_targe 'ock' 10 | 11 | 12 | extern "C" void __cdecl _initalloc() 13 | { 14 | RTL_OSVERSIONINFOW ver_info{}; 15 | 16 | auto status = RtlGetVersion(&ver_info); 17 | if (!NT_SUCCESS(status)) 18 | { 19 | return; 20 | } 21 | 22 | if ((ver_info.dwMajorVersion < 6) || 23 | (ver_info.dwMajorVersion == 6 && ver_info.dwMinorVersion < 2)) 24 | { 25 | DefaultPOOL_TYPE = POOL_TYPE::NonPagedPool; 26 | DefaultMdlProtection = 0; 27 | } 28 | } 29 | 30 | void* __cdecl __core_allocator(size_t _size, POOL_TYPE _pool_type, unsigned long _tag) 31 | { 32 | return ExAllocatePoolWithTag(_pool_type, _size, _tag); 33 | } 34 | 35 | void __cdecl __core_deletor(void * _ptr, POOL_TYPE /*_pool_type*/, unsigned long _tag) 36 | { 37 | return ExFreePoolWithTag(_ptr, _tag); 38 | } 39 | 40 | extern "C" 41 | { 42 | __declspec(restrict) auto __cdecl malloc(size_t _size) -> void * 43 | { 44 | return __core_allocator(_size, POOL_TYPE::PagedPool, memory_targe); 45 | } 46 | 47 | auto __cdecl free(void * _ptr) -> void 48 | { 49 | return __core_deletor(_ptr, POOL_TYPE::PagedPool, memory_targe); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/c_alloc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Ntddk.hpp" 3 | 4 | 5 | extern unsigned long const DefaultPoolTag; 6 | extern POOL_TYPE DefaultPOOL_TYPE; 7 | extern unsigned long DefaultMdlProtection; 8 | 9 | 10 | void* __cdecl __core_allocator(size_t _size, POOL_TYPE _pool_type, unsigned long _tag); 11 | 12 | void __cdecl __core_deletor(void* _ptr, POOL_TYPE _pool_type, unsigned long _tag); 13 | 14 | 15 | extern "C" 16 | { 17 | #pragma warning(suppress: 4565) 18 | __declspec(restrict) void* __cdecl malloc(size_t _size); 19 | 20 | #pragma warning(suppress: 4565) 21 | void __cdecl free(void * _ptr); 22 | } 23 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/corecrt.cc: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #include "Ntddk.hpp" 29 | #include "corecrt.h" 30 | 31 | 32 | // Need to put the following marker variables into the .CRT section. 33 | // The .CRT section contains arrays of function pointers. 34 | // The compiler creates functions and adds pointers to this section 35 | // for things like C++ global constructors. 36 | // 37 | // The XIA, XCA etc are group names with in the section. 38 | // The compiler sorts the contributions by the group name. 39 | // For example, .CRT$XCA followed by .CRT$XCB, ... .CRT$XCZ. 40 | // The marker variables below let us get pointers 41 | // to the beginning/end of the arrays of function pointers. 42 | // 43 | // For example, standard groups are 44 | // XCA used here, for begin marker 45 | // XCC "compiler" inits 46 | // XCL "library" inits 47 | // XCU "user" inits 48 | // XCZ used here, for end marker 49 | // 50 | 51 | #define _CRTAlloc$(x) __declspec(allocate(x)) 52 | 53 | #pragma section(".CRT$XIA", long, read) // C Initializer 54 | #pragma section(".CRT$XIZ", long, read) 55 | 56 | #pragma section(".CRT$XCA", long, read) // C++ Initializer 57 | #pragma section(".CRT$XCZ", long, read) 58 | 59 | #pragma section(".CRT$XPA", long, read) // C pre-terminators 60 | #pragma section(".CRT$XPZ", long, read) 61 | 62 | #pragma section(".CRT$XTA", long, read) // C terminators 63 | #pragma section(".CRT$XTZ", long, read) 64 | 65 | extern "C" _CRTAlloc$(".CRT$XIA") _PIFV __xi_a[] = { nullptr }; 66 | extern "C" _CRTAlloc$(".CRT$XIZ") _PIFV __xi_z[] = { nullptr }; 67 | extern "C" _CRTAlloc$(".CRT$XCA") _PVFV __xc_a[] = { nullptr }; 68 | extern "C" _CRTAlloc$(".CRT$XCZ") _PVFV __xc_z[] = { nullptr }; 69 | extern "C" _CRTAlloc$(".CRT$XPA") _PVFV __xp_a[] = { nullptr }; 70 | extern "C" _CRTAlloc$(".CRT$XPZ") _PVFV __xp_z[] = { nullptr }; 71 | extern "C" _CRTAlloc$(".CRT$XTA") _PVFV __xt_a[] = { nullptr }; 72 | extern "C" _CRTAlloc$(".CRT$XTZ") _PVFV __xt_z[] = { nullptr }; 73 | 74 | #pragma comment(linker, "/merge:.CRT=.rdata") 75 | 76 | 77 | // Calls each function in [first, last). [first, last) must be a valid range of 78 | // function pointers. Each function is called, in order. 79 | extern "C" static void __cdecl _initterm(_PVFV* const first, _PVFV* const last) 80 | { 81 | for (_PVFV* it = first; it != last; ++it) 82 | { 83 | if (*it == nullptr) 84 | continue; 85 | 86 | (**it)(); 87 | } 88 | } 89 | 90 | // Calls each function in [first, last). [first, last) must be a valid range of 91 | // function pointers. Each function must return zero on success, nonzero on 92 | // failure. If any function returns nonzero, iteration stops immediately and 93 | // the nonzero value is returned. Otherwise all functions are called and zero 94 | // is returned. 95 | // 96 | // If a nonzero value is returned, it is expected to be one of the runtime error 97 | // values (_RT_{NAME}, defined in the internal header files). 98 | extern "C" static int __cdecl _initterm_e(_PIFV* const first, _PIFV* const last) 99 | { 100 | for (_PIFV* it = first; it != last; ++it) 101 | { 102 | if (*it == nullptr) 103 | continue; 104 | 105 | int const result = (**it)(); 106 | if (result != 0) 107 | return result; 108 | } 109 | 110 | return 0; 111 | } 112 | 113 | using $onexit = _PVFV; 114 | 115 | struct onexit_entry 116 | { 117 | onexit_entry* _next = nullptr; 118 | $onexit _destructor = nullptr; 119 | 120 | onexit_entry(onexit_entry* next, $onexit destructor) 121 | : _next { next } 122 | , _destructor { destructor } 123 | { } 124 | 125 | ~onexit_entry() 126 | { 127 | _destructor(); 128 | } 129 | }; 130 | static onexit_entry* s_onexit_table = nullptr; 131 | 132 | static int __cdecl register_onexit(onexit_entry* table, $onexit const function) 133 | { 134 | const auto entry = new onexit_entry(table, function); 135 | if (nullptr == entry) 136 | { 137 | return -1; 138 | } 139 | s_onexit_table = entry; 140 | 141 | return 0; 142 | } 143 | 144 | static int __cdecl execute_onexit(onexit_entry* table) 145 | { 146 | for (auto entry = table; entry;) 147 | { 148 | const auto next = entry->_next; 149 | delete entry; 150 | entry = next; 151 | } 152 | 153 | return 0; 154 | } 155 | 156 | extern "C" int __cdecl atexit(_PVFV const function) 157 | { 158 | return register_onexit(s_onexit_table, reinterpret_cast<$onexit const>(function)); 159 | } 160 | 161 | // This function executes a table of atexit() functions. The Terminators 162 | // are executed in reverse order, to give the required LIFO execution order. 163 | // If the table is uninitialized, this function has no effect. 164 | // After executing the terminators, this function resets the table 165 | // so that it is uninitialized. Returns 0 on success; -1 on failure. 166 | extern "C" int __cdecl onexit() 167 | { 168 | return execute_onexit(s_onexit_table); 169 | } 170 | 171 | extern "C" auto __cdecl _initalloc() 172 | -> void; 173 | 174 | // Call all of the C++ static constructors. 175 | extern "C" int __cdecl doinit(void) 176 | { 177 | // do allocator initializions 178 | _initalloc(); 179 | 180 | // do C initializations 181 | _initterm_e(__xi_a, __xi_z); 182 | 183 | // do C++ initializations 184 | _initterm(__xc_a, __xc_z); 185 | return 0; 186 | } 187 | 188 | extern "C" int __cdecl doexit(void) 189 | { 190 | // do exit() of atexit() 191 | onexit(); 192 | 193 | // do C initializations 194 | _initterm(__xp_a, __xp_z); 195 | 196 | // do C++ terminations 197 | _initterm(__xt_a, __xt_z); 198 | return 0; 199 | } 200 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/corecrt.h: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #pragma once 29 | #include "macro.h" 30 | #include "stlcrt.h" 31 | #include "new.h" 32 | 33 | using _PVFV = void(__cdecl*)(); 34 | using _PIFV = int(__cdecl*)(); 35 | 36 | extern "C" int __cdecl atexit(_PVFV const function); 37 | extern "C" int __cdecl doinit(void); 38 | extern "C" int __cdecl doexit(void); 39 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/macro.h: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #pragma once 29 | 30 | 31 | /* Byte swap*/ 32 | #ifndef ByteSwap16$ 33 | #define ByteSwap16$(x) ( \ 34 | ((unsigned __int16(x) & unsigned __int16(0xFF << 8)) >> 8) | \ 35 | ((unsigned __int16(x) & unsigned __int16(0xFF >> 0)) << 8) \ 36 | ) 37 | #endif 38 | 39 | #ifndef ByteSwap32$ 40 | #define ByteSwap32$(x) ( \ 41 | ((unsigned __int32(x) & unsigned __int32(0xFF << 24)) >> 24) | \ 42 | ((unsigned __int32(x) & unsigned __int32(0xFF << 16)) >> 8) | \ 43 | ((unsigned __int32(x) & unsigned __int32(0xFF << 8)) << 8) | \ 44 | ((unsigned __int32(x) & unsigned __int32(0xFF << 0)) << 24) \ 45 | ) 46 | #endif 47 | 48 | #ifndef ByteSwap64$ 49 | #define ByteSwap64$(x) ( \ 50 | ((unsigned __int64(x) & unsigned __int64(0xFF << 56)) >> 56) | \ 51 | ((unsigned __int64(x) & unsigned __int64(0xFF << 48)) >> 40) | \ 52 | ((unsigned __int64(x) & unsigned __int64(0xFF << 40)) >> 24) | \ 53 | ((unsigned __int64(x) & unsigned __int64(0xFF << 32)) >> 8) | \ 54 | ((unsigned __int64(x) & unsigned __int64(0xFF << 24)) << 8) | \ 55 | ((unsigned __int64(x) & unsigned __int64(0xFF << 16)) << 24) | \ 56 | ((unsigned __int64(x) & unsigned __int64(0xFF << 8)) << 40) | \ 57 | ((unsigned __int64(x) & unsigned __int64(0xFF << 0)) << 56) | \ 58 | ) 59 | #endif 60 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/new.cc: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #include "Ntddk.hpp" 29 | #include "new.h" 30 | 31 | 32 | 33 | void __cdecl CoreSTLRaiseException( 34 | unsigned long _code, 35 | size_t _arg1, 36 | size_t _arg2, 37 | size_t _arg3, 38 | size_t _arg4); 39 | 40 | namespace std 41 | { 42 | void __cdecl _Xbad_alloc(); 43 | } 44 | 45 | 46 | 47 | // replaceable usual deallocation functions 48 | void* __cdecl operator new(size_t _size) 49 | { 50 | if (0 == _size) _size = 1; 51 | 52 | if (auto ptr = __core_allocator(_size, NonPagedPool, DefaultPoolTag)) 53 | { 54 | return ptr; 55 | } 56 | 57 | std::_Xbad_alloc(); 58 | } 59 | 60 | void __cdecl operator delete(void * _ptr) 61 | { 62 | if (nullptr == _ptr) return; 63 | 64 | return __core_deletor(_ptr, NonPagedPool, DefaultPoolTag); 65 | } 66 | 67 | void* __cdecl operator new(size_t _size, POOL_TYPE _pool_type) 68 | { 69 | if (0 == _size) _size = 1; 70 | 71 | if (auto ptr = __core_allocator(_size, _pool_type, DefaultPoolTag)) 72 | { 73 | return ptr; 74 | } 75 | 76 | std::_Xbad_alloc(); 77 | } 78 | 79 | void* __cdecl operator new(size_t _size, POOL_TYPE _pool_type, unsigned long _tag) 80 | { 81 | if (0 == _size) _size = 1; 82 | 83 | if (auto ptr = __core_allocator(_size, _pool_type, _tag)) 84 | { 85 | return ptr; 86 | } 87 | 88 | std::_Xbad_alloc(); 89 | } 90 | 91 | void __cdecl operator delete(void * _ptr, POOL_TYPE _pool_type) 92 | { 93 | if (nullptr == _ptr) return; 94 | 95 | return __core_deletor(_ptr, _pool_type, DefaultPoolTag); 96 | } 97 | 98 | void __cdecl operator delete(void * _ptr, POOL_TYPE _pool_type, unsigned long _tag) 99 | { 100 | if (nullptr == _ptr) return; 101 | 102 | return __core_deletor(_ptr, _pool_type, _tag); 103 | } 104 | 105 | void* __cdecl operator new[](size_t _size) 106 | { 107 | if (0 == _size) _size = 1; 108 | 109 | if (auto ptr = __core_allocator(_size, NonPagedPool, DefaultPoolTag)) 110 | { 111 | return ptr; 112 | } 113 | 114 | std::_Xbad_alloc(); 115 | } 116 | 117 | void __cdecl operator delete[](void * _ptr) 118 | { 119 | if (nullptr == _ptr) return; 120 | 121 | return __core_deletor(_ptr, NonPagedPool, DefaultPoolTag); 122 | } 123 | 124 | void* __cdecl operator new[](size_t _size, POOL_TYPE _pool_type) 125 | { 126 | if (0 == _size) _size = 1; 127 | 128 | if (auto ptr = __core_allocator(_size, _pool_type, DefaultPoolTag)) 129 | { 130 | return ptr; 131 | } 132 | 133 | std::_Xbad_alloc(); 134 | } 135 | 136 | void* __cdecl operator new[](size_t _size, POOL_TYPE _pool_type, unsigned long _tag) 137 | { 138 | if (0 == _size) _size = 1; 139 | 140 | if (auto ptr = __core_allocator(_size, _pool_type, _tag)) 141 | { 142 | return ptr; 143 | } 144 | 145 | std::_Xbad_alloc(); 146 | } 147 | 148 | void __cdecl operator delete[](void * _ptr, POOL_TYPE _pool_type) 149 | { 150 | if (nullptr == _ptr) return; 151 | 152 | return __core_deletor(_ptr, _pool_type, DefaultPoolTag); 153 | } 154 | 155 | void __cdecl operator delete[](void * _ptr, POOL_TYPE _pool_type, unsigned long _tag) 156 | { 157 | if (nullptr == _ptr) return; 158 | 159 | return __core_deletor(_ptr, _pool_type, _tag); 160 | } 161 | 162 | void __cdecl operator delete (void*, void*) 163 | { 164 | return ; 165 | } 166 | 167 | void __cdecl operator delete[](void*, void*) 168 | { 169 | return ; 170 | } 171 | 172 | // sized class - specific deallocation functions 173 | void __cdecl operator delete (void* _ptr, size_t /*_size*/) 174 | { 175 | if (nullptr == _ptr) return; 176 | 177 | return __core_deletor(_ptr, NonPagedPool, DefaultPoolTag); 178 | } 179 | 180 | void __cdecl operator delete[](void* _ptr, size_t /*_size*/) 181 | { 182 | if (nullptr == _ptr) return; 183 | 184 | return __core_deletor(_ptr, NonPagedPool, DefaultPoolTag); 185 | } -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/new.h: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #pragma once 29 | #include "c_alloc.h" 30 | 31 | 32 | // replaceable usual deallocation functions 33 | void* __cdecl operator new (size_t _size); 34 | void __cdecl operator delete (void *_ptr); 35 | 36 | void* __cdecl operator new (size_t _size, POOL_TYPE _pool_type); 37 | void* __cdecl operator new (size_t _size, POOL_TYPE _pool_type, unsigned long _tag); 38 | void __cdecl operator delete (void *_ptr, POOL_TYPE _pool_type); 39 | void __cdecl operator delete (void *_ptr, POOL_TYPE _pool_type, unsigned long _tag); 40 | 41 | void* __cdecl operator new[](size_t _size); 42 | void __cdecl operator delete[](void* _ptr); 43 | 44 | void* __cdecl operator new[](size_t _size, POOL_TYPE _pool_type); 45 | void* __cdecl operator new[](size_t _size, POOL_TYPE _pool_type, unsigned long _tag); 46 | void __cdecl operator delete[](void *_ptr, POOL_TYPE _pool_type); 47 | void __cdecl operator delete[](void *_ptr, POOL_TYPE _pool_type, unsigned long _tag); 48 | 49 | // replaceable placement deallocation functions 50 | void* __cdecl operator new (size_t _size, void* _ptr); 51 | void* __cdecl operator new[](size_t _size, void* _ptr); 52 | 53 | // T::~T() 54 | void __cdecl operator delete (void*, void*); 55 | void __cdecl operator delete[](void*, void*); 56 | 57 | // sized class - specific deallocation functions 58 | void __cdecl operator delete (void* _ptr, size_t _size); 59 | void __cdecl operator delete[](void* _ptr, size_t _size); 60 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/stlcrt.cc: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | #include "Ntddk.hpp" 11 | #include "stlcrt.h" 12 | 13 | extern "C" 14 | { 15 | 16 | void __cdecl CoreSTLRaiseException(unsigned long _code, size_t _arg1, size_t _arg2, size_t _arg3, size_t _arg4) 17 | 18 | { 19 | KdBreakPoint(); 20 | KeBugCheckEx(_code, _arg1, _arg2, _arg3, _arg4); 21 | } 22 | 23 | void __cdecl _invalid_parameter_noinfo_noreturn() 24 | { 25 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 26 | } 27 | 28 | } 29 | 30 | namespace std 31 | { 32 | 33 | void __cdecl _Xbad_alloc() 34 | { 35 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 36 | } 37 | 38 | void __cdecl _Xinvalid_argument(const char * _msg) 39 | { 40 | DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, _msg); 41 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 42 | } 43 | 44 | void __cdecl _Xlength_error(const char * _msg) 45 | { 46 | DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, _msg); 47 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 48 | } 49 | 50 | void __cdecl _Xout_of_range(const char * _msg) 51 | { 52 | DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, _msg); 53 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 54 | } 55 | 56 | void __cdecl _Xoverflow_error(const char * _msg) 57 | { 58 | DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, _msg); 59 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 60 | } 61 | 62 | void __cdecl _Xruntime_error(const char * _msg) 63 | { 64 | DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, _msg); 65 | CoreSTLRaiseException(KMODE_EXCEPTION_NOT_HANDLED); 66 | } 67 | 68 | char const* __cdecl _Syserror_map( int) 69 | { 70 | __debugbreak(); 71 | return nullptr; 72 | } 73 | 74 | char const* 75 | __cdecl 76 | _Winerror_map( 77 | int 78 | ) 79 | { 80 | __debugbreak(); 81 | return nullptr; 82 | } 83 | } -------------------------------------------------------------------------------- /Kernel_WDK_Lib/CRT/stlcrt.h: -------------------------------------------------------------------------------- 1 | // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2 | // 3 | // CoreSTL 4 | // 5 | // Copyright (C) MeeSong. All rights reserved. 6 | // Author : MeeSong 7 | // Email : meesong@live.cn 8 | // Github : https://github.com/meesong 9 | // License: GNU Library General Public License(LGPL) - Version 3 10 | // 11 | // This file is part of Idea 12 | // 13 | // Idea is free software; you can redistribute it and/or modify 14 | // it under the terms of the GNU Library General Public License as published 15 | // by the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // Idea is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU Library General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU Library General Public License 24 | // along with Idea. If not, see . 25 | // 26 | // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 27 | 28 | #pragma once 29 | 30 | extern "C" 31 | { 32 | 33 | void __cdecl CoreSTLRaiseException( 34 | unsigned long _code, 35 | size_t _arg1 = 0, 36 | size_t _arg2 = 0, 37 | size_t _arg3 = 0, 38 | size_t _arg4 = 0); 39 | 40 | //void __cdecl _invalid_parameter_noinfo_noreturn(); 41 | 42 | } 43 | 44 | namespace std 45 | { 46 | 47 | void __cdecl _Xbad_alloc(); 48 | 49 | void __cdecl _Xinvalid_argument(const char* _msg); 50 | 51 | void __cdecl _Xlength_error(const char* _msg); 52 | 53 | void __cdecl _Xout_of_range(const char* _msg); 54 | 55 | void __cdecl _Xoverflow_error(const char* _msg); 56 | 57 | void __cdecl _Xruntime_error(const char* _msg); 58 | 59 | char const* __cdecl _Syserror_map( int); 60 | 61 | char const* 62 | __cdecl 63 | _Winerror_map( 64 | int 65 | ); 66 | 67 | } -------------------------------------------------------------------------------- /Kernel_WDK_Lib/Kernel_WDK_Lib.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8.1 Debug 6 | Win32 7 | 8 | 9 | Win8.1 Release 10 | Win32 11 | 12 | 13 | Win8 Debug 14 | Win32 15 | 16 | 17 | Win8 Release 18 | Win32 19 | 20 | 21 | Win7 Debug 22 | Win32 23 | 24 | 25 | Win7 Release 26 | Win32 27 | 28 | 29 | Win8.1 Debug 30 | x64 31 | 32 | 33 | Win8.1 Release 34 | x64 35 | 36 | 37 | Win8 Debug 38 | x64 39 | 40 | 41 | Win8 Release 42 | x64 43 | 44 | 45 | Win7 Debug 46 | x64 47 | 48 | 49 | Win7 Release 50 | x64 51 | 52 | 53 | 54 | {06A60EED-6612-4D59-B5B7-17DC0E15751F} 55 | {dd38f7fc-d7bd-488b-9242-7d8754cde80d} 56 | v4.5 57 | 11.0 58 | Win8.1 Debug 59 | Win32 60 | Kernel_WDK_Lib 61 | $(LatestTargetPlatformVersion) 62 | 63 | 64 | 65 | WindowsV6.3 66 | true 67 | WindowsKernelModeDriver10.0 68 | Driver 69 | WDM 70 | 71 | 72 | WindowsV6.3 73 | false 74 | WindowsKernelModeDriver10.0 75 | Driver 76 | WDM 77 | 78 | 79 | Windows8 80 | true 81 | WindowsKernelModeDriver10.0 82 | Driver 83 | WDM 84 | 85 | 86 | Windows8 87 | false 88 | WindowsKernelModeDriver10.0 89 | Driver 90 | WDM 91 | 92 | 93 | Windows7 94 | true 95 | WindowsKernelModeDriver10.0 96 | Driver 97 | WDM 98 | 99 | 100 | Windows7 101 | false 102 | WindowsKernelModeDriver10.0 103 | Driver 104 | WDM 105 | 106 | 107 | WindowsV6.3 108 | true 109 | WindowsKernelModeDriver10.0 110 | Driver 111 | WDM 112 | 113 | 114 | WindowsV6.3 115 | false 116 | WindowsKernelModeDriver10.0 117 | Driver 118 | WDM 119 | 120 | 121 | Windows8 122 | true 123 | WindowsKernelModeDriver10.0 124 | Driver 125 | WDM 126 | 127 | 128 | Windows8 129 | false 130 | WindowsKernelModeDriver10.0 131 | Driver 132 | WDM 133 | 134 | 135 | Windows7 136 | true 137 | WindowsKernelModeDriver10.0 138 | Driver 139 | WDM 140 | 141 | 142 | Windows7 143 | false 144 | WindowsKernelModeDriver10.0 145 | Driver 146 | WDM 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | DbgengKernelDebugger 158 | 159 | 160 | DbgengKernelDebugger 161 | 162 | 163 | DbgengKernelDebugger 164 | 165 | 166 | DbgengKernelDebugger 167 | 168 | 169 | DbgengKernelDebugger 170 | 171 | 172 | DbgengKernelDebugger 173 | 174 | 175 | DbgengKernelDebugger 176 | 177 | 178 | DbgengKernelDebugger 179 | 180 | 181 | DbgengKernelDebugger 182 | 183 | 184 | DbgengKernelDebugger 185 | 186 | 187 | DbgengKernelDebugger 188 | $(VC_IncludePath);$(ProjectDir);$(IncludePath) 189 | 190 | 191 | DbgengKernelDebugger 192 | 193 | 194 | 195 | false 196 | true 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/Kernel_WDK_Lib.vcxproj.backup: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Win8.1 Debug 6 | Win32 7 | 8 | 9 | Win8.1 Release 10 | Win32 11 | 12 | 13 | Win8 Debug 14 | Win32 15 | 16 | 17 | Win8 Release 18 | Win32 19 | 20 | 21 | Win7 Debug 22 | Win32 23 | 24 | 25 | Win7 Release 26 | Win32 27 | 28 | 29 | Win8.1 Debug 30 | x64 31 | 32 | 33 | Win8.1 Release 34 | x64 35 | 36 | 37 | Win8 Debug 38 | x64 39 | 40 | 41 | Win8 Release 42 | x64 43 | 44 | 45 | Win7 Debug 46 | x64 47 | 48 | 49 | Win7 Release 50 | x64 51 | 52 | 53 | 54 | {06A60EED-6612-4D59-B5B7-17DC0E15751F} 55 | {dd38f7fc-d7bd-488b-9242-7d8754cde80d} 56 | v4.5 57 | 11.0 58 | Win8.1 Debug 59 | Win32 60 | Kernel_WDK_Lib 61 | $(LatestTargetPlatformVersion) 62 | 63 | 64 | 65 | WindowsV6.3 66 | true 67 | WindowsKernelModeDriver8.1 68 | Driver 69 | WDM 70 | 71 | 72 | WindowsV6.3 73 | false 74 | WindowsKernelModeDriver8.1 75 | Driver 76 | WDM 77 | 78 | 79 | Windows8 80 | true 81 | WindowsKernelModeDriver8.1 82 | Driver 83 | WDM 84 | 85 | 86 | Windows8 87 | false 88 | WindowsKernelModeDriver8.1 89 | Driver 90 | WDM 91 | 92 | 93 | Windows7 94 | true 95 | WindowsKernelModeDriver8.1 96 | Driver 97 | WDM 98 | 99 | 100 | Windows7 101 | false 102 | WindowsKernelModeDriver8.1 103 | Driver 104 | WDM 105 | 106 | 107 | WindowsV6.3 108 | true 109 | WindowsKernelModeDriver8.1 110 | Driver 111 | WDM 112 | 113 | 114 | WindowsV6.3 115 | false 116 | WindowsKernelModeDriver8.1 117 | Driver 118 | WDM 119 | 120 | 121 | Windows8 122 | true 123 | WindowsKernelModeDriver8.1 124 | Driver 125 | WDM 126 | 127 | 128 | Windows8 129 | false 130 | WindowsKernelModeDriver8.1 131 | Driver 132 | WDM 133 | 134 | 135 | Windows7 136 | true 137 | WindowsKernelModeDriver8.1 138 | Driver 139 | WDM 140 | 141 | 142 | Windows7 143 | false 144 | WindowsKernelModeDriver8.1 145 | Driver 146 | WDM 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | DbgengKernelDebugger 158 | 159 | 160 | DbgengKernelDebugger 161 | 162 | 163 | DbgengKernelDebugger 164 | 165 | 166 | DbgengKernelDebugger 167 | 168 | 169 | DbgengKernelDebugger 170 | 171 | 172 | DbgengKernelDebugger 173 | 174 | 175 | DbgengKernelDebugger 176 | 177 | 178 | DbgengKernelDebugger 179 | 180 | 181 | DbgengKernelDebugger 182 | 183 | 184 | DbgengKernelDebugger 185 | 186 | 187 | DbgengKernelDebugger 188 | $(VC_IncludePath);$(ProjectDir);$(IncludePath) 189 | 190 | 191 | DbgengKernelDebugger 192 | 193 | 194 | 195 | false 196 | true 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/Kernel_WDK_Lib.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;hpp;hxx;hm;inl;inc;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 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | {602cc4cc-407a-451f-a721-f198a90a5b10} 22 | 23 | 24 | 25 | 26 | Source Files 27 | 28 | 29 | Header Files\CRT 30 | 31 | 32 | Header Files\CRT 33 | 34 | 35 | Header Files\CRT 36 | 37 | 38 | Header Files\CRT 39 | 40 | 41 | 42 | 43 | Header Files\CRT 44 | 45 | 46 | Header Files\CRT 47 | 48 | 49 | Header Files\CRT 50 | 51 | 52 | Header Files\CRT 53 | 54 | 55 | Header Files\CRT 56 | 57 | 58 | Header Files\CRT 59 | 60 | 61 | -------------------------------------------------------------------------------- /Kernel_WDK_Lib/main.cc: -------------------------------------------------------------------------------- 1 | #include "CRT/Ntddk.hpp" 2 | #undef _HAS_EXCEPTIONS 3 | #define _HAS_EXCEPTIONS 0 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | void DriverUnload(PDRIVER_OBJECT drive_object) 11 | { 12 | DbgPrint("Unload Over!\n"); 13 | } 14 | 15 | extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT drive_object, PUNICODE_STRING path) 16 | { 17 | drive_object->DriverUnload = DriverUnload; 18 | 19 | /*std::string a = "1"; 20 | int b = std::stoi(a); 21 | DbgPrint("%s", a.data());*/ 22 | 23 | std::vector _vector; 24 | _vector.push_back(1); 25 | _vector.push_back(3); 26 | std::sort(_vector.begin(),_vector.end()); 27 | for (auto i:_vector) 28 | { 29 | 30 | } 31 | 32 | 33 | return STATUS_SUCCESS; 34 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. [http://fsf.org/] 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # On VS2015+WDK10 Using C++ STL 2 | 3 | ### Build Win7 Debug x64. 4 | 5 | ## Thanks for this guys 6 | 7 | https://github.com/MeeSong 8 | 9 | https://github.com/tandasat --------------------------------------------------------------------------------