-
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 b77914e
Showing
65 changed files
with
7,451 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,3 @@ | ||
[submodule "Source/Include/KNSoft/NDK/3rdParty/phnt"] | ||
path = Source/Include/KNSoft/NDK/3rdParty/phnt | ||
url = https://github.com/RatinCN/phnt.git |
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,92 @@ | ||
| **English (en-US)** | [简体中文 (zh-CN)](https://github.com/KNSoft/KNSoft.NDK/blob/main/README.zh-CN.md) | | ||
| --- | --- | | ||
|
||
<br> | ||
|
||
# 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)](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK) provides native C/C++ definitions and import libraries for Windows NT development. | ||
|
||
## Feature | ||
|
||
- Windows NT | ||
- Undocumented API declarations and type definitions, e.g. `Nt/Zw*`, `Ldr*`, `PEB`, `TEB`, `LDR_*`, ... | ||
- 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](https://github.com/KNSoft/KNSoft.NDK/blob/main/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 import libraries. | ||
|
||
### Details | ||
|
||
The following features **are not enabled by default**, reference corresponding headers and libraries on demand: | ||
|
||
- Specifications | ||
- CPUID: [CPUID.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/CPUID.h) | ||
- SMBIOS: [SMBIOS.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/SMBIOS.h) | ||
- Ntdll Hash API (`(A_SHA/MD4/MD5)(Init/Update/Final)`) | ||
- [Ntdll.Hash.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/WinDef/API/Ntdll.Hash.h) | ||
- KNSoft.NDK.Ntdll.Hash.lib (Generated from [KNSoft.NDK.Ntdll.Hash.xml](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/KNSoft.NDK/WinAPI/KNSoft.NDK.Ntdll.Hash.xml)) | ||
- Windows API import library addendum | ||
- KNSoft.NDK.WinAPI.lib (Generated from [KNSoft.NDK.WinAPI.xml](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/KNSoft.NDK/WinAPI/KNSoft.NDK.WinAPI.xml)) | ||
- Unit Test Framework | ||
- [UnitTest.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/UnitTest/UnitTest.h) | ||
- [UnitTest.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl) | ||
- Safe string functions (different from `strsafe.h` in Windows SDK) | ||
- [StrSafe.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/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 specific extension | | ||
|
||
## 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](https://github.com/KNSoft/KNSoft.NDK) always follow up the latest Windows NT and specifications, targets to x86, x64 and ARM64 platforms. | ||
|
||
**Only support the latest MSVC generation tools and SDKs.** | ||
|
||
> [!CAUTION] | ||
> In beta stage, should be used with caution. | ||
## License | ||
|
||
[![GitHub License](https://img.shields.io/github/license/KNSoft/KNSoft.NDK)](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK) is licensed under the [MIT](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE) license. | ||
|
||
The content from the following public sources were lawfully used: | ||
- Microsoft WDK/DDK/SDK | ||
- Microsoft Public Symbolic Data | ||
- Microsoft Learning | ||
- Microsoft Windows Protocols | ||
- Windows Internals | ||
|
||
And public projects: | ||
- [winsiderss/phnt](https://github.com/winsiderss/phnt) - [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) ([RatinCN/phnt](https://github.com/RatinCN/phnt) fork is used) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/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,92 @@ | ||
| [English (en-US)](https://github.com/KNSoft/KNSoft.NDK/blob/main/README.md) | **简体中文 (zh-CN)** | | ||
| --- | --- | | ||
|
||
<br> | ||
|
||
# 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)](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK)提供了原始C/C++定义和引入库供Windows NT开发。 | ||
|
||
## 功能 | ||
|
||
- Windows NT | ||
- 未公开的API声明和类型定义,例如:`Nt/Zw*`、`Ldr*`、`PEB`、`TEB`、`LDR_*`…… | ||
- Windows DLL导出项引入库,例如:`KERNEL32.dll!CreateProcessInternalW`、`ntdll.dll!LdrRegisterDllNotification`…… | ||
- Windows SDK的补充 | ||
- 扩展的宏和定义,例如:`NtCurrentPeb()`、`PEB(64/32)`、`TEB(64/32)`…… | ||
- 规范 | ||
- SMBIOS | ||
- CPUID | ||
- MSVC | ||
- 工具 | ||
- 单元测试框架 | ||
- StrSafe.h(与Windows SDK里的`strsafe.h`不同) | ||
|
||
## 用法 | ||
|
||
[![NuGet Downloads](https://img.shields.io/nuget/dt/KNSoft.NDK)](https://www.nuget.org/packages/KNSoft.NDK) | ||
|
||
### 提要 | ||
|
||
包含[NDK.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/NDK.h)代替(或先于)`Windows.h`即可。 | ||
```C | ||
#include <KNSoft/NDK/NDK.h> | ||
``` | ||
|
||
NuGet包[KNSoft.NDK](https://www.nuget.org/packages/KNSoft.NDK)包含所有头文件和引入库。 | ||
|
||
### 详细说明 | ||
|
||
下列功能**默认没有启用**,按需引用对应的头文件和库: | ||
|
||
- 规范 | ||
- CPUID: [CPUID.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/CPUID.h) | ||
- SMBIOS: [SMBIOS.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/SMBIOS.h) | ||
- Ntdll Hash API (`(A_SHA/MD4/MD5)(Init/Update/Final)`) | ||
- [Ntdll.Hash.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/WinDef/API/Ntdll.Hash.h) | ||
- KNSoft.NDK.Ntdll.Hash.lib (由[KNSoft.NDK.Ntdll.Hash.xml](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/KNSoft.NDK/WinAPI/KNSoft.NDK.Ntdll.Hash.xml)生成) | ||
- Windows API 引入库补充 | ||
- KNSoft.NDK.WinAPI.lib (由[KNSoft.NDK.WinAPI.xml](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/KNSoft.NDK/WinAPI/KNSoft.NDK.WinAPI.xml)生成) | ||
- 单元测试框架 | ||
- [UnitTest.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/UnitTest/UnitTest.h) | ||
- [UnitTest.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl) | ||
- 安全字符串函数(与Windows SDK里的`strsafe.h`不同) | ||
- [StrSafe.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/StrSafe.h) | ||
|
||
下列功能**默认启用**,定义对应宏可进行排除: | ||
|
||
| 宏 | 排除功能 | | ||
| ---- | ---- | | ||
| _KNSOFT_NDK_NO_EXTENSION | 补充或扩展的宏和定义 | | ||
| _KNSOFT_NDK_NO_EXTENSION_MSTOOLCHAIN | Microsoft工具链专有扩展 | | ||
|
||
## 兼容性 | ||
|
||
![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](https://github.com/KNSoft/KNSoft.NDK)始终跟进最新的Windows NT和规范,目标x86、x64和ARM64平台。 | ||
|
||
**仅支持最新的MSVC生成工具和SDK。** | ||
|
||
> [!CAUTION] | ||
> 处于beta阶段,应小心使用。 | ||
## 协议 | ||
|
||
[![GitHub License](https://img.shields.io/github/license/KNSoft/KNSoft.NDK)](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK)根据[MIT](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE)协议进行许可。 | ||
|
||
合法使用了来自下列公开源的内容: | ||
- Microsoft WDK/DDK/SDK | ||
- Microsoft Public Symbolic Data | ||
- Microsoft Learning | ||
- Microsoft Windows Protocols | ||
- Windows Internals | ||
|
||
和公开项目: | ||
- [winsiderss/phnt](https://github.com/winsiderss/phnt) - [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) ([RatinCN/phnt](https://github.com/RatinCN/phnt) fork is used) | ||
|
||
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK)也使用了[KNSoft/Precomp4C](https://github.com/KNSoft/Precomp4C)来生成DLL引入库。 |
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,8 @@ | ||
.vs | ||
*.user | ||
|
||
/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> |
Oops, something went wrong.