From 9b8a7805e62eda5a5b660a367985483877b71ac5 Mon Sep 17 00:00:00 2001 From: drvexplorer Date: Thu, 27 Jul 2023 13:02:27 +0300 Subject: [PATCH] Use IoCreateDeviceSecure(); Change .inf file --- WinRing0Sys/OpenLibSys.c | 5 ++++- WinRing0Sys/WinRing0Sys.inf | 4 ++-- WinRing0Sys/WinRing0Sys.vcxproj | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WinRing0Sys/OpenLibSys.c b/WinRing0Sys/OpenLibSys.c index 4a2f54a..a0f0d45 100644 --- a/WinRing0Sys/OpenLibSys.c +++ b/WinRing0Sys/OpenLibSys.c @@ -8,6 +8,7 @@ //----------------------------------------------------------------------------- #include "OpenLibSys.h" +#include static ULONG refCount; @@ -24,13 +25,15 @@ NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING Registry RtlInitUnicodeString(&ntDeviceName, NT_DEVICE_NAME); - NTSTATUS status = IoCreateDevice( + NTSTATUS status = IoCreateDeviceSecure( DriverObject, // Our Driver Object 0, // We don't use a device extension &ntDeviceName, // Device name OLS_TYPE, // Device type FILE_DEVICE_SECURE_OPEN, // Device characteristics FALSE, // Not an exclusive device + &SDDL_DEVOBJ_SYS_ALL_ADM_ALL, + NULL, &deviceObject); // Returned ptr to Device Object if (!NT_SUCCESS(status)) diff --git a/WinRing0Sys/WinRing0Sys.inf b/WinRing0Sys/WinRing0Sys.inf index ad6a3fe..06eac93 100644 --- a/WinRing0Sys/WinRing0Sys.inf +++ b/WinRing0Sys/WinRing0Sys.inf @@ -19,7 +19,7 @@ WinRing0Sys_Device_CoInstaller_CopyFiles = 11 1 = %DiskName%,,,"" [SourceDisksFiles] -WinRing0Sys.sys = 1,, +WinRing0x64.sys = 1,, WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames ;***************************************** @@ -36,7 +36,7 @@ WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with CopyFiles=Drivers_Dir [Drivers_Dir] -WinRing0Sys.sys +WinRing0x64.sys ;-------------- Service installation [WinRing0Sys_Device.NT.Services] diff --git a/WinRing0Sys/WinRing0Sys.vcxproj b/WinRing0Sys/WinRing0Sys.vcxproj index 01121c4..5cffa3d 100644 --- a/WinRing0Sys/WinRing0Sys.vcxproj +++ b/WinRing0Sys/WinRing0Sys.vcxproj @@ -63,6 +63,9 @@ false + + Wdmsec.lib;%(AdditionalDependencies) + @@ -71,6 +74,9 @@ false + + Wdmsec.lib;%(AdditionalDependencies) +