-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 419e920
Showing
90 changed files
with
11,850 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: MSBuild | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
SOLUTION_FILE_PATH: .\Source\KNSoft.NDK.sln | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
platform: [x64, x86, ARM64] | ||
config: [Debug, Release] | ||
fail-fast: false | ||
runs-on: windows-latest | ||
steps: | ||
- name: Source checkout | ||
uses: actions/checkout@main | ||
with: | ||
submodules: recursive | ||
- name: Prepare MSBuild | ||
uses: microsoft/setup-msbuild@main | ||
- name: Build | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: msbuild ${{env.SOLUTION_FILE_PATH}} /restore /m /p:Configuration=${{matrix.config}} /p:Platform=${{matrix.platform}} /p:RestorePackagesConfig=true | ||
- name: Run Unit Test (x64, x86) | ||
if: ${{ matrix.platform == 'x64' || matrix.platform == 'x86' }} | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: .\Source\OutDir\${{matrix.platform}}\${{matrix.config}}\Test.exe -Run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) KNSoft.org | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# KNSoft.NDK | ||
|
||
[![NuGet Downloads](https://img.shields.io/nuget/dt/KNSoft.NDK)](https://www.nuget.org/packages/KNSoft.NDK) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/KNSoft/KNSoft.NDK/msbuild.yml)](https://github.com/KNSoft/KNSoft.NDK/actions/workflows/msbuild.yml) ![PR Welcome](https://img.shields.io/badge/PR-welcome-0688CB.svg) [![GitHub License](https://img.shields.io/github/license/KNSoft/KNSoft.NDK)](./LICENSE) | ||
|
||
KNSoft.NDK provides native C/C++ definitions and import libraries for Windows NT and some specifications development. | ||
|
||
## Feature | ||
|
||
- Windows NT | ||
- Undocumented type definitions, e.g. `PEB`, `TEB`, `LDR_*`, ... | ||
- Undocumented API declarations, e.g. `Nt/Zw*`, `Ldr*`, ... | ||
- Definitions in public sources but not in Windows SDK, e.g. `winsta.h`, `KUSER_SHARED_DATA`, ... | ||
- Import library for Windows DLL exports, e.g. `KERNEL32.dll!CreateProcessInternalW`, `ntdll.dll!LdrRegisterDllNotification`, ... | ||
- Addendum to Windows SDK | ||
- Extension macros and definitions, e.g. `NtCurrentPeb()`, `PEB(64/32)`, `TEB(64/32)`, ... | ||
- Specifications | ||
- SMBIOS | ||
- CPUID | ||
- MSVC | ||
- Kits | ||
- Unit Test Framework | ||
- StrSafe.h (different from `strsafe.h` in Windows SDK) | ||
|
||
## Usage | ||
|
||
[![NuGet Downloads](https://img.shields.io/nuget/dt/KNSoft.NDK)](https://www.nuget.org/packages/KNSoft.NDK) | ||
|
||
### TL;DR | ||
|
||
Include [NDK.h](./Source/Include/KNSoft/NDK/NDK.h) instead of (or **BEFORE**) `Windows.h` will do. | ||
```C | ||
#include <KNSoft/NDK/NDK.h> | ||
``` | ||
|
||
NuGet package [KNSoft.NDK](https://www.nuget.org/packages/KNSoft.NDK) includes all the headers and compiled libraries. | ||
|
||
### Details | ||
|
||
The following features are not enabled by default, reference corresponding headers and libraries on demand: | ||
|
||
- Specifications | ||
- CPUID: [CPUID.h](./Source/Include/KNSoft/NDK/Extension/CPUID.h) | ||
- SMBIOS: [SMBIOS.h](./Source/Include/KNSoft/NDK/Extension/SMBIOS.h) | ||
- Ntdll Hash API (`(A_SHA/MD4/MD5)(Init/Update/Final)`) | ||
- [Ntdll.Hash.h](./Source/Include/KNSoft/NDK/WinDef/API/Ntdll.Hash.h) | ||
- KNSoft.NDK.Ntdll.Hash.lib (Generated from [KNSoft.NDK.Ntdll.Hash.xml](./Source/KNSoft.NDK/WinAPI/KNSoft.NDK.Ntdll.Hash.xml)) | ||
- Windows API import library addendum | ||
- KNSoft.NDK.WinAPI.lib (Generated from [KNSoft.NDK.WinAPI.xml](./Source/KNSoft.NDK/WinAPI/KNSoft.NDK.WinAPI.xml)) | ||
- Unit Test Framework | ||
- [UnitTest.h](./Source/Include/KNSoft/NDK/UnitTest/UnitTest.h) | ||
- [UnitTest.inl](./Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl) | ||
- Safe string functions (different from `strsafe.h` in Windows SDK) | ||
- [StrSafe.h](./Source/Include/KNSoft/NDK/Extension/StrSafe.h) | ||
|
||
The following features are enabled by default, can be excluded by defining corresponding macro: | ||
|
||
| Macro | Exclude feature | | ||
| ---- | ---- | | ||
| _KNSOFT_NDK_NO_EXTENSION | Addendum or extension macros and definitions | | ||
| _KNSOFT_NDK_NO_EXTENSION_MSTOOLCHAIN | Microsoft Tool Chain Specification | | ||
| _KNSOFT_NDK_NO_INLINE | Use inline implementation instead of function call | | ||
|
||
## Compatibility | ||
|
||
![PR Welcome](https://img.shields.io/badge/PR-welcome-0688CB.svg) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/KNSoft/KNSoft.NDK/msbuild.yml)](https://github.com/KNSoft/KNSoft.NDK/actions/workflows/msbuild.yml) | ||
|
||
KNSoft.NDK always keep up with trends, keep up the latest Windows NT and specifications, targets to x86, x64 and ARM64 platforms. | ||
|
||
For project building, only support for the latest MSVC generation tools and SDKs is considered, but it is generally more widely backward compatible. | ||
|
||
For using, it is compatible with VS2015 and above with corresponding SDK. | ||
|
||
> [!CAUTION] | ||
> In beta stage, should be used with caution. | ||
## License | ||
|
||
[![GitHub License](https://img.shields.io/github/license/KNSoft/KNSoft.NDK)](./LICENSE) | ||
|
||
KNSoft.NDK is licensed under the [MIT](./LICENSE) license. | ||
|
||
The content from the following public sources were used: | ||
- Microsoft WDK/DDK/SDK | ||
- Microsoft Public Symbolic Data | ||
- Microsoft Learning | ||
- Microsoft Windows Protocols | ||
|
||
And public projects: | ||
- [winsiderss/phnt](https://github.com/winsiderss/phnt) - MIT | ||
|
||
KNSoft.NDK also uses [KNSoft/Precomp4C](https://github.com/KNSoft/Precomp4C) to generate DLL import libraries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Visual Studio generated .editorconfig file with C++ settings. | ||
root = true | ||
|
||
[*.{c,c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}] | ||
|
||
charset = utf-8-bom | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = crlf | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
|
||
# Visual C++ Code Style settings | ||
|
||
cpp_generate_documentation_comments = xml | ||
|
||
# Visual C++ Formatting settings | ||
|
||
cpp_indent_braces = false | ||
cpp_indent_multi_line_relative_to = innermost_parenthesis | ||
cpp_indent_within_parentheses = align_to_parenthesis | ||
cpp_indent_preserve_within_parentheses = true | ||
cpp_indent_case_contents = true | ||
cpp_indent_case_labels = true | ||
cpp_indent_case_contents_when_block = false | ||
cpp_indent_lambda_braces_when_parameter = false | ||
cpp_indent_goto_labels = leftmost_column | ||
cpp_indent_preprocessor = leftmost_column | ||
cpp_indent_access_specifiers = false | ||
cpp_indent_namespace_contents = true | ||
cpp_indent_preserve_comments = true | ||
cpp_new_line_before_open_brace_namespace = new_line | ||
cpp_new_line_before_open_brace_type = new_line | ||
cpp_new_line_before_open_brace_function = new_line | ||
cpp_new_line_before_open_brace_block = new_line | ||
cpp_new_line_before_open_brace_lambda = new_line | ||
cpp_new_line_scope_braces_on_separate_lines = true | ||
cpp_new_line_close_brace_same_line_empty_type = true | ||
cpp_new_line_close_brace_same_line_empty_function = true | ||
cpp_new_line_before_catch = false | ||
cpp_new_line_before_else = false | ||
cpp_new_line_before_while_in_do_while = false | ||
cpp_space_before_function_open_parenthesis = remove | ||
cpp_space_within_parameter_list_parentheses = false | ||
cpp_space_between_empty_parameter_list_parentheses = false | ||
cpp_space_after_keywords_in_control_flow_statements = true | ||
cpp_space_within_control_flow_statement_parentheses = false | ||
cpp_space_before_lambda_open_parenthesis = false | ||
cpp_space_within_cast_parentheses = false | ||
cpp_space_after_cast_close_parenthesis = false | ||
cpp_space_within_expression_parentheses = false | ||
cpp_space_before_block_open_brace = true | ||
cpp_space_between_empty_braces = false | ||
cpp_space_before_initializer_list_open_brace = false | ||
cpp_space_within_initializer_list_braces = true | ||
cpp_space_preserve_in_initializer_list = true | ||
cpp_space_before_open_square_bracket = false | ||
cpp_space_within_square_brackets = false | ||
cpp_space_before_empty_square_brackets = false | ||
cpp_space_between_empty_square_brackets = false | ||
cpp_space_group_square_brackets = true | ||
cpp_space_within_lambda_brackets = false | ||
cpp_space_between_empty_lambda_brackets = false | ||
cpp_space_before_comma = false | ||
cpp_space_after_comma = true | ||
cpp_space_remove_around_member_operators = true | ||
cpp_space_before_inheritance_colon = true | ||
cpp_space_before_constructor_colon = true | ||
cpp_space_remove_before_semicolon = true | ||
cpp_space_after_semicolon = true | ||
cpp_space_remove_around_unary_operator = true | ||
cpp_space_around_binary_operator = insert | ||
cpp_space_around_assignment_operator = insert | ||
cpp_space_pointer_reference_alignment = ignore | ||
cpp_space_around_ternary_operator = insert | ||
cpp_use_unreal_engine_macro_formatting = true | ||
cpp_wrap_preserve_blocks = all_one_line_scopes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vs | ||
*.user | ||
|
||
/Compatibility | ||
/packages | ||
/OutDir | ||
IntDir | ||
|
||
/*.nupkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> | ||
<OutDir>$(SolutionDir)OutDir\$(PlatformTarget)\$(Configuration)\</OutDir> | ||
<IntDir>IntDir\$(PlatformTarget)\$(Configuration)\</IntDir> | ||
</PropertyGroup> | ||
<PropertyGroup Label="Configuration"> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<Project> | ||
<!-- Customize builds --> | ||
<PropertyGroup> | ||
<ForceImportAfterCppDefaultProps>$(MsbuildThisFileDirectory)\Directory.Build.AfterCppDefault.props</ForceImportAfterCppDefaultProps> | ||
</PropertyGroup> | ||
|
||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<LanguageStandard>stdcpplatest</LanguageStandard> | ||
<LanguageStandard_C>stdc17</LanguageStandard_C> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- MSBuild variable to C/C++ macro --> | ||
<ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'Application'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>MSB_CONFIGURATIONTYPE_EXE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'DynamicLibrary'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>MSB_CONFIGURATIONTYPE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'StaticLibrary'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>MSB_CONFIGURATIONTYPE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(ConfigurationType)' == 'Utility'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>MSB_CONFIGURATIONTYPE_UTILITY;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- Use static default libraries --> | ||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> | ||
<ClCompile> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> | ||
<ClCompile> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- Import $(ProjectName).Build.props if exists --> | ||
<PropertyGroup> | ||
<ProjectNameBuildPropsPath>$(MSBuildProjectDirectory)\$(ProjectName).Build.props</ProjectNameBuildPropsPath> | ||
</PropertyGroup> | ||
<Import Project="$(ProjectNameBuildPropsPath)" Condition="Exists('$(ProjectNameBuildPropsPath)')"/> | ||
|
||
<!-- Import outer Directory.Build.props if exists --> | ||
<PropertyGroup> | ||
<OuterDirectoryBuildPropsPath>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</OuterDirectoryBuildPropsPath> | ||
</PropertyGroup> | ||
<Import Project="$(OuterDirectoryBuildPropsPath)" Condition="'$(OuterDirectoryBuildPropsPath)' != ''"/> | ||
</Project> |
Oops, something went wrong.