Skip to content

Commit

Permalink
Merge pull request #25 from ntoskrnl7/env/WDK_10.0.22621.0_and_MSVC_1…
Browse files Browse the repository at this point in the history
…4.33.31629

Env/wdk 10.0.22621.0 and msvc 14.33.31629
  • Loading branch information
ntoskrnl7 authored Aug 25, 2022
2 parents b345fc3 + 64236c2 commit dc562c8
Show file tree
Hide file tree
Showing 26 changed files with 1,159 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else()
set(LDK_USE_RAISE_EXCEPTION OFF)
set(LDK_USE_RTL_RAISE_EXCEPTION OFF)
endif()
CPMAddPackage("gh:ntoskrnl7/[email protected].4")
CPMAddPackage("gh:ntoskrnl7/[email protected].5")

CPMAddPackage("gh:ntoskrnl7/FindWDK#master")
list(APPEND CMAKE_MODULE_PATH "${FindWDK_SOURCE_DIR}/cmake")
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,25 @@ Provides features to support a better development environment in the kernel.
* ntl::rpc::client [(tested)](./test/app/src/main.cpp#L4) [(tested)](./test/common/rpc.hpp)
* I did not have enough time to implement the data serialization part myself, so I referred to the contents of the project below. thank you! :-)
* [Eyal Z/zpp serializer](https://github.com/eyalz800/serializer)
* ntl::irql
* Class for KIRQL
* Classes
* ntl::irql [(tested)](./test/driver/src/ntl.cpp#L46)
* Functions
* ntl::raise_irql [(tested)](./test/driver/src/ntl.cpp#L49)
* raise_irql_to_dpc_level [(tested)](./test/driver/src/ntl.cpp#L62)
* raise_irql_to_synch_level [(tested)](./test/driver/src/ntl.cpp#L71)
* ntl::spin_lock
* Class for KSPIN_LOCK
* Classes
* ntl::spin_lock [(tested)](./test/driver/src/ntl.cpp#L80)
* ntl::unique_lock [(tested)](./test/driver/src/ntl.cpp#L99)
* ntl::resource
* Class for ERESOURCE
* Classes
* ntl::resource [(tested)](./test/driver/src/ntl.cpp#L117)
* ntl::unique_lock [(tested)](./test/driver/src/ntl.cpp#L156)
* ntl::shared_lock [(tested)](./test/driver/src/ntl.cpp#L179)

## Requirements

Expand All @@ -187,10 +206,12 @@ Provides features to support a better development environment in the kernel.
* 14.26.28801
* 14.29.30133
* 14.31.31103
* Windows Kit (SDK, WDK)
* 14.33.31629
* Windows Kits (SDK, WDK)
* 10.0.17763.0
* 10.0.18362.0
* 10.0.22000.0
* 10.0.22621.0

If the SDK and WDK versions are different, builds are more likely to fail. **If possible, it is recommended to build in the same environment as the SDK and WDK versions.**

Expand Down Expand Up @@ -281,7 +302,7 @@ If the SDK and WDK versions are different, builds are more likely to fail. **If
include(cmake/CPM.cmake)
set(CRTSYS_NTL_MAIN ON) # use ntl::main
CPMAddPackage("gh:ntoskrnl7/[email protected].8")
CPMAddPackage("gh:ntoskrnl7/[email protected].10")
include(${crtsys_SOURCE_DIR}/cmake/CrtSys.cmake)
# add driver
Expand Down
27 changes: 24 additions & 3 deletions docs/ko-kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ crtsys의 장점은 아래와 같습니다.
* [x] Create device [(tested)](../test/driver/src/main.cpp#L44)
* ntl::device
* DEVICE_OBJECT에 대한 클래스
* Features
* 기능
* [x] Device Extension [(tested)](../test/driver/src/main.cpp#L33)
* [ ] IRP_MJ_CREATE
* [ ] IRP_MJ_CLOSE
Expand All @@ -161,6 +161,25 @@ crtsys의 장점은 아래와 같습니다.
* ntl::rpc::client [(tested)](../test/app/src/main.cpp#L4) [(tested)](../test/common/rpc.hpp)
* 데이터 직렬화 부분을 직접 구현하기에는 시간이 부족하여 아래 프로젝트 내용을 참고했습니다. 감사합니다! :-)
* [Eyal Z/zpp serializer](https://github.com/eyalz800/serializer)
* ntl::irql
* KIRQL에 대한 클래스
* 클래스
* ntl::irql [(tested)](../test/driver/src/ntl.cpp#L46)
* 함수
* ntl::raise_irql [(tested)](../test/driver/src/ntl.cpp#L49)
* raise_irql_to_dpc_level [(tested)](../test/driver/src/ntl.cpp#L62)
* raise_irql_to_synch_level [(tested)](../test/driver/src/ntl.cpp#L71)
* ntl::spin_lock
* KSPIN_LOCK에 대한 클래스
* 클래스
* ntl::spin_lock [(tested)](../test/driver/src/ntl.cpp#L80)
* ntl::unique_lock [(tested)](../test/driver/src/ntl.cpp#L99)
* ntl::resource
* ERESOURCE에 대한 클래스
* 클래스
* ntl::resource [(tested)](../test/driver/src/ntl.cpp#L117)
* ntl::unique_lock [(tested)](../test/driver/src/ntl.cpp#L156)
* ntl::shared_lock [(tested)](../test/driver/src/ntl.cpp#L179)

## Requirements

Expand All @@ -187,10 +206,12 @@ crtsys의 장점은 아래와 같습니다.
* 14.26.28801
* 14.29.30133
* 14.31.31103
* Windows Kit (SDK, WDK)
* 14.33.31629
* Windows Kits (SDK, WDK)
* 10.0.17763.0
* 10.0.18362.0
* 10.0.22000.0
* 10.0.22621.0

SDK와 WDK의 버전이 다르면 빌드가 실패할 가능성이 높으므로 **가능하다면 SDK와 WDK의 버전이 같은 환경에서 빌드하는것을 권장합니다.**

Expand Down Expand Up @@ -281,7 +302,7 @@ SDK와 WDK의 버전이 다르면 빌드가 실패할 가능성이 높으므로
include(cmake/CPM.cmake)
set(CRTSYS_NTL_MAIN ON) # use ntl::main
CPMAddPackage("gh:ntoskrnl7/[email protected].8")
CPMAddPackage("gh:ntoskrnl7/[email protected].10")
include(${crtsys_SOURCE_DIR}/cmake/CrtSys.cmake)
# add driver
Expand Down
2 changes: 1 addition & 1 deletion include/.internal/version
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ Environment:

#define CRTSYS_VERSION_MAJOR 0
#define CRTSYS_VERSION_MINOR 1
#define CRTSYS_VERSION_PATCH 8
#define CRTSYS_VERSION_PATCH 10

#endif // _CRTSYS_VERSION_
75 changes: 75 additions & 0 deletions include/ntl/irql
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* @file irql
* @author jungkwang.lee ([email protected])
* @brief KIRQL Helper features.
*
* @copyright Copyright (c) 2022 NT Template Library Authoers.
*
*/

#ifndef _NTDDK_
#include <wdm.h>
#endif

namespace ntl {
enum irql : KIRQL {
passive = PASSIVE_LEVEL,
low = passive,
apc = APC_LEVEL,
dispatch = DISPATCH_LEVEL,
dpc = dispatch,
#if defined(_X86_) || defined(_AMD64_)
cmci = CMCI_LEVEL,
#endif
clock = CLOCK_LEVEL,
ipi = IPI_LEVEL,
#if !defined(_X86_)
drs = DRS_LEVEL,
#endif
power = POWER_LEVEL,
profile = PROFILE_LEVEL,
#if defined(_X86_)
clock1 = CLOCK1_LEVEL,
clock2 = CLOCK2_LEVEL,
#endif
high = HIGH_LEVEL
};

struct to_dpc_level_t {
explicit to_dpc_level_t() = default;
};

struct to_synch_level_t {
explicit to_synch_level_t() = default;
};

_INLINE_VAR constexpr to_dpc_level_t to_dpc_level{};
_INLINE_VAR constexpr to_synch_level_t to_synch_level{};

class raised_irql {
public:
raised_irql(to_dpc_level_t) : old_irql_(KeRaiseIrqlToDpcLevel()) {}
raised_irql(to_synch_level_t) : old_irql_(KeRaiseIrqlToSynchLevel()) {}
raised_irql(irql irql) { KeRaiseIrql(static_cast<KIRQL>(irql), &old_irql_); }

~raised_irql() { KeLowerIrql(old_irql_); }

raised_irql(const raised_irql &) = delete;
raised_irql &operator=(const raised_irql &) = delete;

irql old() const { return static_cast<irql>(old_irql_); }

private:
KIRQL old_irql_;
};

raised_irql raise_irql(KIRQL irql) {
return raised_irql{static_cast<ntl::irql>(irql)};
}

raised_irql raise_irql_to_dpc_level() { return raised_irql{to_dpc_level}; }

raised_irql raise_irql_to_synch_level() { return raised_irql{to_synch_level}; }

ntl::irql current_irql() { return static_cast<ntl::irql>(KeGetCurrentIrql()); }
} // namespace ntl
Loading

0 comments on commit dc562c8

Please sign in to comment.