Windows: Restrict the Service IOCTLS to the service process
[openafs.git] / src / WINNT / afsrdr / kernel / fs / AFSProcessSupport.cpp
index a815724..b8b5797 100644 (file)
@@ -38,6 +38,8 @@
 
 #include "AFSCommon.h"
 
+static HANDLE AFSServicePid = NULL;
+
 void
 AFSProcessNotify( IN HANDLE  ParentId,
                   IN HANDLE  ProcessId,
@@ -966,3 +968,21 @@ AFSIsUser( IN PSID Sid)
     SeReleaseSubjectContext( &subjectContext);
     return retVal;
 }
+
+VOID
+AFSRegisterService( void)
+{
+    AFSServicePid = PsGetCurrentProcessId();
+}
+
+VOID
+AFSDeregisterService( void)
+{
+    AFSServicePid = NULL;
+}
+
+BOOLEAN
+AFSIsService( void)
+{
+    return PsGetCurrentProcessId() == AFSServicePid;
+}