KNSoft/KNSoft.NDK
GitHub: KNSoft/KNSoft.NDK
为 Windows NT 提供原生 C/C++ 定义与导入库,填补未公开 API 与 SDK 补充的空白。
Stars: 22 | Forks: 6
| **English (en-US)** | [简体中文 (zh-CN)](https://github.com/KNSoft/KNSoft.NDK/blob/main/README.zh-CN.md) |
| --- | --- |
# KNSoft.NDK
[](https://www.nuget.org/packages/KNSoft.NDK) [](https://github.com/KNSoft/KNSoft.NDK/actions/workflows/Build_Publish.yml)  [](https://github.com/KNSoft/KNSoft.NDK/blob/main/LICENSE)
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK) 为 Windows NT 开发提供原生 C/C++ 定义和导入库。
## 功能
- 未记录的 API 声明和类型定义,例如 `Nt/Zw*`、`Ldr*`、`PEB`、`TEB`、`LDR_*` 等
- Windows DLL 导出的导入库补充,例如 `KERNEL32.dll!CreateProcessInternalW`、`ntdll.dll!LdrRegisterDllNotification` 等
- Windows SDK 补充
- 扩展宏和定义,例如 `NtCurrentPeb()`、`PEB(64/32)`、`TEB(64/32)` 等
- 使用原生方法实现的函数包,例如单元测试框架、安全字符串函数、命令行解析、随机数生成等
## 用法
[](https://www.nuget.org/packages/KNSoft.NDK)
### TL;DR
包含 [NDK.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/NDK.h) 即可(替代或**在 `Windows.h` 之前**引入)。
NuGet 包 [KNSoft.NDK](https://www.nuget.org/packages/KNSoft.NDK) 包含了所有头文件和导入库。
### 详细说明
以下功能**默认未启用**,按需引用对应的头文件和库:
- Ntdll 哈希 API(`(A_SHA/MD4/MD5)(Init/Update/Final)`)
- [Ntdll.Hash.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Win32/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) 生成)
- Ntdll CRT
- KNSoft.NDK.Ntdll.CRT.lib(由 [KNSoft.NDK.Ntdll.CRT.xml](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/KNSoft.NDK/WinAPI/KNSoft.NDK.Ntdll.CRT.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/Package/UnitTest.h)
- [UnitTest.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/UnitTest.inl)
- 安全字符串函数(与 Windows SDK 中的 `strsafe.h` 不同)
- [StrSafe.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/StrSafe.inl)
- 命令行解析函数
- [ArgParse.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/ArgParse.inl)
- 随机数生成函数
- [RandGen.inl](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/RandGen.inl)
以下功能**默认启用**,可通过定义对应宏来排除:
| 宏 | 排除的功能 |
| ---- | ---- |
| _KNSOFT_NDK_NO_EXTENSION | 补充或扩展宏与定义 |
## 兼容性
 [](https://github.com/KNSoft/KNSoft.NDK/actions/workflows/Build_Publish.yml)
[KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK) 始终跟进最新的 Windows NT 和规范,目标是支持 x86、x64、ARM64 和 ARM64EC 平台。
**仅支持最新的 MSVC 生成工具和 SDK。**
## 许可证
[](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) 许可证授权。
以下公共项目的内容:
- phnt(来自 [winsiderss/systeminformer](https://github.com/winsiderss/systeminformer/tree/master/phnt))- [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE)
并合法使用了以下公共来源:
- Microsoft WDK/DDK/SDK
- Microsoft Public Symbolic Data
- Microsoft Learning
- Microsoft Windows Protocols
- Windows Internals
- [Microsoft.Windows.SDK.CRTSource](https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource)
以及 [KNSoft/Precomp4C](https://github.com/KNSoft/Precomp4C) 用于生成 DLL 导入库。
标签:API定义, C/C++, CreateProcessInternalW, KERNEL32, LDR_*, LdrRegisterDllNotification, Native method, NDK, NtCurrentPeb, ntdll, NuGet包, PEB, TEB, UML, Undocumented API, Windows NT, Windows NT开发, Windows SDK扩展, Windows开发, Windows驱动开发, 事务性I/O, 内核开发, 单元测试框架, 原生开发, 命令行解析, 安全字符串函数, 安全意识培训, 宏定义, 客户端加密, 导入库, 开源库, 搜索引擎爬虫, 系统编程, 随机数生成