From 5289e5bae3a01fe0add69a253376c2292171db5d Mon Sep 17 00:00:00 2001 From: Ratin Gao Date: Mon, 23 Sep 2024 21:57:07 +0800 Subject: [PATCH] [PACKAGE] Refactor, move "Extension" to "Package" --- README.md | 17 ++++---- README.zh-CN.md | 17 ++++---- Source/Include/KNSoft/NDK/NDK.h | 2 +- .../KNSoft/NDK/NT/Extension/Security.h | 2 +- .../KNSoft/NDK/{Extension => Package}/CPUID.h | 9 +++- .../NDK/{Extension => Package}/Extension.h | 4 +- .../NDK/{Extension => Package}/SMBIOS.h | 3 +- .../NDK/{Extension => Package}/StrSafe.h | 3 +- .../NDK/{UnitTest => Package}/UnitTest.h | 5 ++- .../NDK/{UnitTest => Package}/UnitTest.inl | 4 +- Source/KNSoft.NDK/KNSoft.NDK.vcxproj | 12 +++--- Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters | 43 +++++++++---------- Source/Test/Main.c | 2 +- Source/Test/StrSafe.c | 2 +- Source/Test/Test.h | 2 +- 15 files changed, 67 insertions(+), 60 deletions(-) rename Source/Include/KNSoft/NDK/{Extension => Package}/CPUID.h (97%) rename Source/Include/KNSoft/NDK/{Extension => Package}/Extension.h (94%) rename Source/Include/KNSoft/NDK/{Extension => Package}/SMBIOS.h (97%) rename Source/Include/KNSoft/NDK/{Extension => Package}/StrSafe.h (92%) rename Source/Include/KNSoft/NDK/{UnitTest => Package}/UnitTest.h (93%) rename Source/Include/KNSoft/NDK/{UnitTest => Package}/UnitTest.inl (95%) diff --git a/README.md b/README.md index d1937e9..bcf41d6 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,9 @@ - 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 -- Kits +- Packages + - SMBIOS Specification + - CPUID Specification - Unit Test Framework - StrSafe.h (different from `strsafe.h` in Windows SDK) @@ -41,18 +40,18 @@ NuGet package [KNSoft.NDK](https://www.nuget.org/packages/KNSoft.NDK) includes a 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) + - CPUID: [CPUID.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/CPUID.h) + - SMBIOS: [SMBIOS.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/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/Win32/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) + - [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) - 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) + - [StrSafe.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/StrSafe.h) The following features **are enabled by default**, can be excluded by defining corresponding macro: diff --git a/README.zh-CN.md b/README.zh-CN.md index 2617626..86c2b06 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -16,10 +16,9 @@ - Windows DLL导出项引入库,例如:`KERNEL32.dll!CreateProcessInternalW`、`ntdll.dll!LdrRegisterDllNotification`…… - Windows SDK的补充 - 扩展的宏和定义,例如:`NtCurrentPeb()`、`PEB(64/32)`、`TEB(64/32)`…… -- 规范 - - SMBIOS - - CPUID -- 工具 +- 包 + - SMBIOS规范 + - CPUID规范 - 单元测试框架 - StrSafe.h(与Windows SDK里的`strsafe.h`不同) @@ -41,18 +40,18 @@ 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) + - CPUID: [CPUID.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/CPUID.h) + - SMBIOS: [SMBIOS.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/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/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)生成) - 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) + - [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.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Extension/StrSafe.h) + - [StrSafe.h](https://github.com/KNSoft/KNSoft.NDK/blob/main/Source/Include/KNSoft/NDK/Package/StrSafe.h) 下列功能**默认启用**,定义对应宏可进行排除: diff --git a/Source/Include/KNSoft/NDK/NDK.h b/Source/Include/KNSoft/NDK/NDK.h index 3684883..8d0b6f3 100644 --- a/Source/Include/KNSoft/NDK/NDK.h +++ b/Source/Include/KNSoft/NDK/NDK.h @@ -31,5 +31,5 @@ /* Enable extensions */ #ifndef _KNSOFT_NDK_NO_EXTENSION -#include "Extension/Extension.h" +#include "Package/Extension.h" #endif diff --git a/Source/Include/KNSoft/NDK/NT/Extension/Security.h b/Source/Include/KNSoft/NDK/NT/Extension/Security.h index 6fe7b64..afd43f4 100644 --- a/Source/Include/KNSoft/NDK/NT/Extension/Security.h +++ b/Source/Include/KNSoft/NDK/NT/Extension/Security.h @@ -1,7 +1,7 @@ #pragma once #include "../MinDef.h" -#include "../../Extension/Extension.h" +#include "../../Package/Extension.h" /* Well-known SIDs */ diff --git a/Source/Include/KNSoft/NDK/Extension/CPUID.h b/Source/Include/KNSoft/NDK/Package/CPUID.h similarity index 97% rename from Source/Include/KNSoft/NDK/Extension/CPUID.h rename to Source/Include/KNSoft/NDK/Package/CPUID.h index d46fd36..527c83a 100644 --- a/Source/Include/KNSoft/NDK/Extension/CPUID.h +++ b/Source/Include/KNSoft/NDK/Package/CPUID.h @@ -1,4 +1,11 @@ -#pragma once +/* + * KNSoft.NDK CPUID.h package, licensed under the MIT license. + * Copyright (c) KNSoft.org (https://github.com/KNSoft). All rights reserved. + * + * Intel CPUID Specification. + */ + +#pragma once #define CPUID_INTEL_VERSION_INFO_MASK 0xFFF3FF0 // Extended Family ID | Extended Model ID | Processor Type | Family ID | Model #define CPUID_MAKE_INTEL_VERSION_INFO(ExtendedFamilyId, ExtendedModelId, ProcessorType, FamilyId, Model, SteppingId)\ diff --git a/Source/Include/KNSoft/NDK/Extension/Extension.h b/Source/Include/KNSoft/NDK/Package/Extension.h similarity index 94% rename from Source/Include/KNSoft/NDK/Extension/Extension.h rename to Source/Include/KNSoft/NDK/Package/Extension.h index c1bb7c4..221f237 100644 --- a/Source/Include/KNSoft/NDK/Extension/Extension.h +++ b/Source/Include/KNSoft/NDK/Package/Extension.h @@ -1,4 +1,6 @@ -#pragma once +/* KNSoft.NDK extension package, native addendum */ + +#pragma once #ifdef _KNSOFT_NDK_NO_EXTENSION #pragma message("KNSoft.NDK: Extension.h is included but _KNSOFT_NDK_NO_EXTENSION is defined.") diff --git a/Source/Include/KNSoft/NDK/Extension/SMBIOS.h b/Source/Include/KNSoft/NDK/Package/SMBIOS.h similarity index 97% rename from Source/Include/KNSoft/NDK/Extension/SMBIOS.h rename to Source/Include/KNSoft/NDK/Package/SMBIOS.h index 23d0018..5dc40a9 100644 --- a/Source/Include/KNSoft/NDK/Extension/SMBIOS.h +++ b/Source/Include/KNSoft/NDK/Package/SMBIOS.h @@ -1,5 +1,6 @@ /* - * KNSoft.NDK SMBIOS.h licensed under the MIT license. + * KNSoft.NDK SMBIOS.h package, licensed under the MIT license. + * Copyright (c) KNSoft.org (https://github.com/KNSoft). All rights reserved. * * SMBIOS Specification (https://www.dmtf.org/standards/smbios) * diff --git a/Source/Include/KNSoft/NDK/Extension/StrSafe.h b/Source/Include/KNSoft/NDK/Package/StrSafe.h similarity index 92% rename from Source/Include/KNSoft/NDK/Extension/StrSafe.h rename to Source/Include/KNSoft/NDK/Package/StrSafe.h index d8378cd..93e29b1 100644 --- a/Source/Include/KNSoft/NDK/Extension/StrSafe.h +++ b/Source/Include/KNSoft/NDK/Package/StrSafe.h @@ -1,5 +1,6 @@ /* - * KNSoft.NDK StrSafe.h licensed under the MIT license. + * KNSoft.NDK StrSafe.h package, licensed under the MIT license. + * Copyright (c) KNSoft.org (https://github.com/KNSoft). All rights reserved. * * Make C string routines a bit more safe and easy. * Not equals to the strsafe.h in Windows SDK. diff --git a/Source/Include/KNSoft/NDK/UnitTest/UnitTest.h b/Source/Include/KNSoft/NDK/Package/UnitTest.h similarity index 93% rename from Source/Include/KNSoft/NDK/UnitTest/UnitTest.h rename to Source/Include/KNSoft/NDK/Package/UnitTest.h index e6a4243..67374ee 100644 --- a/Source/Include/KNSoft/NDK/UnitTest/UnitTest.h +++ b/Source/Include/KNSoft/NDK/Package/UnitTest.h @@ -1,7 +1,8 @@ /* - * KNSoft.NDK.UnitTest - Lite weight unit test framework + * KNSoft.NDK UnitTest.h package, licensed under the MIT license. * Copyright (c) KNSoft.org (https://github.com/KNSoft). All rights reserved. - * Licensed under the MIT license. + * + * Lite weight unit test framework. */ #pragma once diff --git a/Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl b/Source/Include/KNSoft/NDK/Package/UnitTest.inl similarity index 95% rename from Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl rename to Source/Include/KNSoft/NDK/Package/UnitTest.inl index 12e83ce..0b2b776 100644 --- a/Source/Include/KNSoft/NDK/UnitTest/UnitTest.inl +++ b/Source/Include/KNSoft/NDK/Package/UnitTest.inl @@ -1,9 +1,9 @@ #pragma once -#include "./UnitTest.h" +#include "UnitTest.h" #include "../NT/NT.h" -#include "../Extension/StrSafe.h" +#include "StrSafe.h" #pragma region Prints diff --git a/Source/KNSoft.NDK/KNSoft.NDK.vcxproj b/Source/KNSoft.NDK/KNSoft.NDK.vcxproj index 5bf4bee..d2c4202 100644 --- a/Source/KNSoft.NDK/KNSoft.NDK.vcxproj +++ b/Source/KNSoft.NDK/KNSoft.NDK.vcxproj @@ -118,10 +118,6 @@ - - - - @@ -234,7 +230,11 @@ - + + + + + @@ -247,7 +247,7 @@ - + diff --git a/Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters b/Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters index 0041221..82a83ca 100644 --- a/Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters +++ b/Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters @@ -1,9 +1,6 @@  - - {0824e6bd-fba8-4ba1-a245-1c0743fc1404} - {3769bb18-ab05-4c44-8684-2ff9124963ae} @@ -16,9 +13,6 @@ {b8cf96b3-56aa-4366-920a-77b5f9d68ee9} - - {a8b5d84e-895c-4b3c-843e-85298108c298} - {a68ed197-518e-4f67-a03c-8742d02e2142} @@ -70,6 +64,9 @@ {958aa1bb-cdb8-44d9-9071-55c0cf230408} + + {a566dc55-3916-4927-ae91-86f02a7a5529} + @@ -79,18 +76,6 @@ NT - - Extension - - - Extension - - - Extension - - - Extension - Win32\Def @@ -109,9 +94,6 @@ Win32\API - - UnitTest - NT\Rtl @@ -451,11 +433,26 @@ NT\Win32K + + Package + + + Package + + + Package + + + Package + + + Package + - - UnitTest + + Package diff --git a/Source/Test/Main.c b/Source/Test/Main.c index 596cee2..103e9b9 100644 --- a/Source/Test/Main.c +++ b/Source/Test/Main.c @@ -1,5 +1,5 @@ #include -#include +#include TEST_DECL_FUNC(UnitTestFramework); TEST_DECL_FUNC(MSToolChain); diff --git a/Source/Test/StrSafe.c b/Source/Test/StrSafe.c index d60f865..d318184 100644 --- a/Source/Test/StrSafe.c +++ b/Source/Test/StrSafe.c @@ -4,7 +4,7 @@ #include "Test.h" -#include +#include #define DEFINE_TEST_STRING(Name, String)\ static const char Name##_A[] = String;\ diff --git a/Source/Test/Test.h b/Source/Test/Test.h index a4aefaa..bdeede6 100644 --- a/Source/Test/Test.h +++ b/Source/Test/Test.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #pragma comment(lib, "KNSoft.NDK.Ntdll.Hash.lib")