From fdf62587a63415face2b15979690e42aec760e6a Mon Sep 17 00:00:00 2001 From: gmh5225 <2315157@qq.com> Date: Fri, 10 Nov 2023 22:43:53 +0800 Subject: [PATCH] Update --- src/crt/libwindrv.crt.cpp | 4 +++- src/libwindrv.cpp | 10 +++++----- test/testdrv1/main.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/crt/libwindrv.crt.cpp b/src/crt/libwindrv.crt.cpp index 43a6860..1499422 100644 --- a/src/crt/libwindrv.crt.cpp +++ b/src/crt/libwindrv.crt.cpp @@ -29,6 +29,8 @@ extern "C" int __cdecl dprintf(const char *format, ...) extern "C" int __cdecl puts(const char *_Str) { - char Temp[] = {'%', 's', 0}; + char Temp[] = {117, 23, 0}; + Temp[0] ^= 80; + Temp[1] ^= 100; return printf(Temp, _Str); } diff --git a/src/libwindrv.cpp b/src/libwindrv.cpp index d3046d1..0d304fb 100644 --- a/src/libwindrv.cpp +++ b/src/libwindrv.cpp @@ -28,11 +28,11 @@ typedef struct _KLDR_DATA_TABLE_ENTRY_COMMON PVOID PatchInformation; } KLDR_DATA_TABLE_ENTRY_COMMON, *PKLDR_DATA_TABLE_ENTRY_COMMON; -PDRIVER_OBJECT LibWinDrvDriverObject = nullptr; -wchar_t LibWinDrvRegistryKey[_MAX_PATH]; -wchar_t LibWinDrvServiceKeyName[_MAX_PATH]; -PVOID LibWinDrvImageBase = nullptr; -SIZE_T LibWinDrvImageSize = 0; +extern "C" PDRIVER_OBJECT LibWinDrvDriverObject = nullptr; +extern "C" wchar_t LibWinDrvRegistryKey[_MAX_PATH]; +extern "C" wchar_t LibWinDrvServiceKeyName[_MAX_PATH]; +extern "C" PVOID LibWinDrvImageBase = nullptr; +extern "C" SIZE_T LibWinDrvImageSize = 0; VOID DriverUnload(__in DRIVER_OBJECT *DriverObject) diff --git a/test/testdrv1/main.cpp b/test/testdrv1/main.cpp index 69fdce3..d603249 100644 --- a/test/testdrv1/main.cpp +++ b/test/testdrv1/main.cpp @@ -5,7 +5,7 @@ VOID LibWinDrvDriverUnLoad(__in DRIVER_OBJECT *DriverObject) { UNREFERENCED_PARAMETER(DriverObject); - dprintf("world hello\n"); + printf("world hello\n"); } // ULONG_PTR g_addr = 0; @@ -42,7 +42,7 @@ KCETBSOD() } __except (EXCEPTION_EXECUTE_HANDLER) { - dprintf("except in KCETBSOD\n"); + printf("except in KCETBSOD\n"); } } @@ -53,14 +53,14 @@ LibWinDrvDriverEntry(__in DRIVER_OBJECT *DriverObject, __in UNICODE_STRING *Regi UNREFERENCED_PARAMETER(DriverObject); UNREFERENCED_PARAMETER(RegistryPath); - dprintf("hello world\n"); + printf("hello world\n"); /*myfunc1((void *)myfunc2); _asm { nop nop nop } - dprintf("hello world2\n");*/ + printf("hello world2\n");*/ // KCETBSOD(); return STATUS_SUCCESS;