Skip to content

Commit

Permalink
Handle driver runtime list
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Rahmad Shaputra authored and MmMapIoSpace committed Sep 12, 2023
1 parent 83da56b commit 685e920
Show file tree
Hide file tree
Showing 20 changed files with 2,500 additions and 1,109 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
ColumnLimit: 256
ColumnLimit: 160
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerIndentWidth: 2
Expand Down Expand Up @@ -141,7 +141,7 @@ Language: Cpp
LineEnding: DeriveCRLF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
Expand Down
19 changes: 0 additions & 19 deletions UCDummy/UCDummy.vcxproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
Expand All @@ -20,13 +16,6 @@
<RootNamespace>UCDummy</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
Expand All @@ -42,17 +31,9 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DriverSign>
<FileDigestAlgorithm>sha256</FileDigestAlgorithm>
Expand Down
6 changes: 0 additions & 6 deletions UCMapper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UCDummy", "UCDummy\UCDummy.
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88FB186E-9662-4DB3-BBB1-E12A23522EA3}.Debug|x64.ActiveCfg = Release|x64
{88FB186E-9662-4DB3-BBB1-E12A23522EA3}.Debug|x64.Build.0 = Release|x64
{88FB186E-9662-4DB3-BBB1-E12A23522EA3}.Release|x64.ActiveCfg = Release|x64
{88FB186E-9662-4DB3-BBB1-E12A23522EA3}.Release|x64.Build.0 = Release|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Debug|x64.ActiveCfg = Debug|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Debug|x64.Build.0 = Debug|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Debug|x64.Deploy.0 = Debug|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Release|x64.ActiveCfg = Release|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Release|x64.Build.0 = Release|x64
{4896E9CA-882E-46C6-9A9F-1F2A1CC439FB}.Release|x64.Deploy.0 = Release|x64
Expand Down
14 changes: 13 additions & 1 deletion UCMapper/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,25 @@ NTSTATUS LoadDriver(_Out_ PHANDLE DeviceHandle, _In_ LPCWSTR DriverFullPath, _In

LdrUnloadDll(NvAudioLibrary);
UnloadDriver(*DeviceHandle, ServiceName);
return STATUS_FAILED_DRIVER_ENTRY;
return STATUS_INVALID_ADDRESS;
}

//
// Remove Driver RuntimeList.
//

DEVICE_DRIVER_OBJECT Driver;
Driver.DeviceHandle = *DeviceHandle;
Driver.ReadMemory = ReadSystemMemory;
Driver.WriteMemory = WriteSystemMemory;
if (RemoveDriverRuntimeList(&Driver, L"nvaudio.sys", RtlImageNtHeader(NvAudioLibrary)->FileHeader.TimeDateStamp) == FALSE) {
PRINT_ERROR_STATUS(RtlNtStatusToDosError(STATUS_ACCESS_DENIED));

LdrUnloadDll(NvAudioLibrary);
UnloadDriver(*DeviceHandle, ServiceName);
return STATUS_ACCESS_DENIED;
}

return Status;
}

Expand Down
1,249 changes: 789 additions & 460 deletions UCMapper/driverbuf.c

Large diffs are not rendered by default.

Loading

0 comments on commit 685e920

Please sign in to comment.