-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the BUG that functions in intrin.h cannot be used even if it is i… (
#33) * Fix the BUG that functions in intrin.h cannot be used even if it is introduced * add demonstrate
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
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
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
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,4 @@ | ||
wdk_add_driver(WdmIntrinsicFunctions | ||
Main.cpp | ||
) | ||
target_link_libraries(WdmIntrinsicFunctions WdmCppLib) |
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,25 @@ | ||
#include <wdm.h> | ||
#include <intrin.h> | ||
|
||
DRIVER_UNLOAD driverUnload; | ||
VOID driverUnload(_In_ PDRIVER_OBJECT driverObject) | ||
{ | ||
UNREFERENCED_PARAMETER(driverObject); | ||
|
||
DbgPrint("Driver unloaded\n"); | ||
} | ||
|
||
EXTERN_C NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT driverObject, _In_ PUNICODE_STRING registryPath) | ||
{ | ||
UNREFERENCED_PARAMETER(registryPath); | ||
|
||
DbgPrint("Driver loaded\n"); | ||
|
||
_disable(); //use intrinsic function | ||
ULONG64 cr3 = __readcr3(); //use intrinsic function | ||
_enable(); //use intrinsic function | ||
|
||
DbgPrint("CR3: %p\n", cr3); | ||
driverObject->DriverUnload = driverUnload; | ||
return STATUS_SUCCESS; | ||
} |