Skip to content

Commit

Permalink
[PACKAGE] Refactor, move "Extension" to "Package"
Browse files Browse the repository at this point in the history
  • Loading branch information
RatinCN committed Sep 23, 2024
1 parent 8a97cb8 commit 5289e5b
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 60 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:

Expand Down
17 changes: 8 additions & 9 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`不同)

Expand All @@ -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)

下列功能**默认启用**,定义对应宏可进行排除:

Expand Down
2 changes: 1 addition & 1 deletion Source/Include/KNSoft/NDK/NDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
/* Enable extensions */

#ifndef _KNSOFT_NDK_NO_EXTENSION
#include "Extension/Extension.h"
#include "Package/Extension.h"
#endif
2 changes: 1 addition & 1 deletion Source/Include/KNSoft/NDK/NT/Extension/Security.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../MinDef.h"
#include "../../Extension/Extension.h"
#include "../../Package/Extension.h"

/* Well-known SIDs */

Expand Down
Original file line number Diff line number Diff line change
@@ -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)\
Expand Down
Original file line number Diff line number Diff line change
@@ -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.")
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 6 additions & 6 deletions Source/KNSoft.NDK/KNSoft.NDK.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Include\KNSoft\NDK\Extension\CPUID.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Extension\Extension.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Extension\SMBIOS.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Extension\StrSafe.h" />
<ClInclude Include="..\Include\KNSoft\NDK\NT\Bcd.h" />
<ClInclude Include="..\Include\KNSoft\NDK\NT\Cm\Cm.h" />
<ClInclude Include="..\Include\KNSoft\NDK\NT\Cm\Reg.h" />
Expand Down Expand Up @@ -234,7 +230,11 @@
<ClInclude Include="..\Include\KNSoft\NDK\NT\Wow\Wow.h" />
<ClInclude Include="..\Include\KNSoft\NDK\NT\Wow\WowApi.h" />
<ClInclude Include="..\Include\KNSoft\NDK\NT\ZwApi.h" />
<ClInclude Include="..\Include\KNSoft\NDK\UnitTest\UnitTest.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Package\CPUID.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Package\Extension.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Package\SMBIOS.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Package\StrSafe.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Package\UnitTest.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Win32\API\Kernel32.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Win32\API\Ntdll.h" />
<ClInclude Include="..\Include\KNSoft\NDK\Win32\API\Ntdll.Hash.h" />
Expand All @@ -247,7 +247,7 @@
<ClInclude Include="..\Include\KNSoft\NDK\NDK.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\Include\KNSoft\NDK\UnitTest\UnitTest.inl" />
<None Include="..\Include\KNSoft\NDK\Package\UnitTest.inl" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
43 changes: 20 additions & 23 deletions Source/KNSoft.NDK/KNSoft.NDK.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Extension">
<UniqueIdentifier>{0824e6bd-fba8-4ba1-a245-1c0743fc1404}</UniqueIdentifier>
</Filter>
<Filter Include="NT">
<UniqueIdentifier>{3769bb18-ab05-4c44-8684-2ff9124963ae}</UniqueIdentifier>
</Filter>
Expand All @@ -16,9 +13,6 @@
<Filter Include="Win32\API">
<UniqueIdentifier>{b8cf96b3-56aa-4366-920a-77b5f9d68ee9}</UniqueIdentifier>
</Filter>
<Filter Include="UnitTest">
<UniqueIdentifier>{a8b5d84e-895c-4b3c-843e-85298108c298}</UniqueIdentifier>
</Filter>
<Filter Include="NT\Rtl">
<UniqueIdentifier>{a68ed197-518e-4f67-a03c-8742d02e2142}</UniqueIdentifier>
</Filter>
Expand Down Expand Up @@ -70,6 +64,9 @@
<Filter Include="NT\Lpc">
<UniqueIdentifier>{958aa1bb-cdb8-44d9-9071-55c0cf230408}</UniqueIdentifier>
</Filter>
<Filter Include="Package">
<UniqueIdentifier>{a566dc55-3916-4927-ae91-86f02a7a5529}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Include\KNSoft\NDK\NDK.h" />
Expand All @@ -79,18 +76,6 @@
<ClInclude Include="..\Include\KNSoft\NDK\NT\NT.h">
<Filter>NT</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Extension\CPUID.h">
<Filter>Extension</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Extension\Extension.h">
<Filter>Extension</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Extension\SMBIOS.h">
<Filter>Extension</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Extension\StrSafe.h">
<Filter>Extension</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Win32\Def\CommCtrl.h">
<Filter>Win32\Def</Filter>
</ClInclude>
Expand All @@ -109,9 +94,6 @@
<ClInclude Include="..\Include\KNSoft\NDK\Win32\API\User32.h">
<Filter>Win32\API</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\UnitTest\UnitTest.h">
<Filter>UnitTest</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\NT\Rtl\Memory.h">
<Filter>NT\Rtl</Filter>
</ClInclude>
Expand Down Expand Up @@ -451,11 +433,26 @@
<ClInclude Include="..\Include\KNSoft\NDK\NT\Win32K\Misc.h">
<Filter>NT\Win32K</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Package\CPUID.h">
<Filter>Package</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Package\Extension.h">
<Filter>Package</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Package\SMBIOS.h">
<Filter>Package</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Package\StrSafe.h">
<Filter>Package</Filter>
</ClInclude>
<ClInclude Include="..\Include\KNSoft\NDK\Package\UnitTest.h">
<Filter>Package</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="..\Include\KNSoft\NDK\UnitTest\UnitTest.inl">
<Filter>UnitTest</Filter>
<None Include="..\Include\KNSoft\NDK\Package\UnitTest.inl">
<Filter>Package</Filter>
</None>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <KNSoft/NDK/NDK.h>
#include <KNSoft/NDK/UnitTest/UnitTest.inl>
#include <KNSoft/NDK/Package/UnitTest.inl>

TEST_DECL_FUNC(UnitTestFramework);
TEST_DECL_FUNC(MSToolChain);
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/StrSafe.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Test.h"

#include <KNSoft/NDK/Extension/StrSafe.h>
#include <KNSoft/NDK/Package/StrSafe.h>

#define DEFINE_TEST_STRING(Name, String)\
static const char Name##_A[] = String;\
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Test.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <KNSoft/NDK/NDK.h>
#include <KNSoft/NDK/UnitTest/UnitTest.h>
#include <KNSoft/NDK/Package/UnitTest.h>
#include <KNSoft/NDK/Win32/API/Ntdll.Hash.h>

#pragma comment(lib, "KNSoft.NDK.Ntdll.Hash.lib")
Expand Down

0 comments on commit 5289e5b

Please sign in to comment.