[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 2/5] Move FiltersInstall/FiltersUninstall to xen.sys



Since WHQL will enable Driver Verifier's registry isolation violation
detection on xenbus.sys, move the registry manipulation for inserting
xenfilt.sys into the appropriate device class UpperFilters to xen.sys.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 include/xen.h                 | 14 ++++++++++++++
 src/{xenbus => xen}/filters.c |  4 ++++
 src/{xenbus => xen}/filters.h |  0
 src/xenbus/driver.c           |  2 +-
 vs2019/xen/xen.vcxproj        |  1 +
 vs2019/xenbus/xenbus.vcxproj  |  1 -
 vs2022/xen/xen.vcxproj        |  1 +
 vs2022/xenbus/xenbus.vcxproj  |  1 -
 8 files changed, 21 insertions(+), 3 deletions(-)
 rename src/{xenbus => xen}/filters.c (99%)
 rename src/{xenbus => xen}/filters.h (100%)

diff --git a/include/xen.h b/include/xen.h
index f8721e8..566d9e3 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -526,4 +526,18 @@ VcpuRegisterVcpuInfo(
     IN  ULONG                       Offset
     );
 
+// FILTERS
+
+XEN_API
+VOID
+FiltersInstall(
+     VOID
+     );
+
+XEN_API
+VOID
+FiltersUninstall(
+     VOID
+     );
+
 #endif  // _XEN_H
diff --git a/src/xenbus/filters.c b/src/xen/filters.c
similarity index 99%
rename from src/xenbus/filters.c
rename to src/xen/filters.c
index 5b41e11..36a266f 100644
--- a/src/xenbus/filters.c
+++ b/src/xen/filters.c
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#define XEN_API __declspec(dllexport)
+
 #define INITGUID 1
 
 #include <ntddk.h>
@@ -323,6 +325,7 @@ fail1:
 #define FILTERS_UNINSTALL_CLASS(_ClassGuid, _DriverName) \
         FiltersUninstallClass(#_ClassGuid, &GUID_ ## _ClassGuid, (_DriverName))
 
+XEN_API
 VOID
 FiltersInstall(
     VOID
@@ -332,6 +335,7 @@ FiltersInstall(
     (VOID) FILTERS_INSTALL_CLASS(DEVCLASS_HDC, "XENFILT");
 }
 
+XEN_API
 VOID
 FiltersUninstall(
     VOID
diff --git a/src/xenbus/filters.h b/src/xen/filters.h
similarity index 100%
rename from src/xenbus/filters.h
rename to src/xen/filters.h
diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
index d6efe89..e8d0c1f 100644
--- a/src/xenbus/driver.c
+++ b/src/xenbus/driver.c
@@ -33,6 +33,7 @@
 #include <ntddk.h>
 #include <procgrp.h>
 #include <ntstrsafe.h>
+#include <xen.h>
 
 #include "registry.h"
 #include "fdo.h"
@@ -40,7 +41,6 @@
 #include "driver.h"
 #include "names.h"
 #include "mutex.h"
-#include "filters.h"
 #include "dbg_print.h"
 #include "assert.h"
 #include "util.h"
diff --git a/vs2019/xen/xen.vcxproj b/vs2019/xen/xen.vcxproj
index ca6cef6..ec0f7e1 100644
--- a/vs2019/xen/xen.vcxproj
+++ b/vs2019/xen/xen.vcxproj
@@ -70,6 +70,7 @@
     <ClCompile Include="..\..\src\common\registry.c" />
     <ClCompile Include="..\..\src\xen\driver.c" />
     <ClCompile Include="..\..\src\xen\event_channel.c" />
+    <ClCompile Include="..\..\src\xen\filters.c" />
     <ClCompile Include="..\..\src\xen\grant_table.c" />
     <ClCompile Include="..\..\src\xen\hvm.c" />
     <ClCompile Include="..\..\src\xen\xen_version.c" />
diff --git a/vs2019/xenbus/xenbus.vcxproj b/vs2019/xenbus/xenbus.vcxproj
index 9227e0a..ee43971 100644
--- a/vs2019/xenbus/xenbus.vcxproj
+++ b/vs2019/xenbus/xenbus.vcxproj
@@ -81,7 +81,6 @@
     <ClCompile Include="..\..\src\xenbus\evtchn_2l.c" />
     <ClCompile Include="..\..\src\xenbus\evtchn_fifo.c" />
     <ClCompile Include="..\..\src\xenbus\fdo.c" />
-    <ClCompile Include="..\..\src\xenbus\filters.c" />
     <ClCompile Include="..\..\src\xenbus\gnttab.c" />
     <ClCompile Include="..\..\src\xenbus\pdo.c" />
     <ClCompile Include="..\..\src\xenbus\shared_info.c" />
diff --git a/vs2022/xen/xen.vcxproj b/vs2022/xen/xen.vcxproj
index 2304a4b..7efdce8 100644
--- a/vs2022/xen/xen.vcxproj
+++ b/vs2022/xen/xen.vcxproj
@@ -65,6 +65,7 @@
     <ClCompile Include="..\..\src\common\registry.c" />
     <ClCompile Include="..\..\src\xen\driver.c" />
     <ClCompile Include="..\..\src\xen\event_channel.c" />
+    <ClCompile Include="..\..\src\xen\filters.c" />
     <ClCompile Include="..\..\src\xen\grant_table.c" />
     <ClCompile Include="..\..\src\xen\hvm.c" />
     <ClCompile Include="..\..\src\xen\xen_version.c" />
diff --git a/vs2022/xenbus/xenbus.vcxproj b/vs2022/xenbus/xenbus.vcxproj
index 422f610..939654a 100644
--- a/vs2022/xenbus/xenbus.vcxproj
+++ b/vs2022/xenbus/xenbus.vcxproj
@@ -73,7 +73,6 @@
     <ClCompile Include="..\..\src\xenbus\evtchn_2l.c" />
     <ClCompile Include="..\..\src\xenbus\evtchn_fifo.c" />
     <ClCompile Include="..\..\src\xenbus\fdo.c" />
-    <ClCompile Include="..\..\src\xenbus\filters.c" />
     <ClCompile Include="..\..\src\xenbus\gnttab.c" />
     <ClCompile Include="..\..\src\xenbus\pdo.c" />
     <ClCompile Include="..\..\src\xenbus\shared_info.c" />
-- 
2.44.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.