https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5617ba98418628cb1cb312e1c61b06ddfab39642

commit 5617ba98418628cb1cb312e1c61b06ddfab39642
Author:     Ged Murphy <[email protected]>
AuthorDate: Sun Nov 11 15:41:23 2018 +0000
Commit:     Ged Murphy <[email protected]>
CommitDate: Sun Nov 11 17:58:38 2018 +0000

    [FLTMC] Support displaying legacy FS filters
---
 base/applications/fltmc/fltmc.cpp | 51 +++++++++++++++++++++++++++------------
 1 file changed, 36 insertions(+), 15 deletions(-)

diff --git a/base/applications/fltmc/fltmc.cpp 
b/base/applications/fltmc/fltmc.cpp
index 7d9f052148..1aca074499 100644
--- a/base/applications/fltmc/fltmc.cpp
+++ b/base/applications/fltmc/fltmc.cpp
@@ -18,6 +18,7 @@
 #endif
 #include <fltuser.h>
 #include <atlstr.h>
+#include <strsafe.h>
 #include "resource.h"
 
 EXTERN_C int wmain(int argc, WCHAR *argv[]);
@@ -131,34 +132,55 @@ PrintFilterInfo(_In_ PVOID Buffer,
                 _In_ BOOL IsNewStyle)
 {
     WCHAR FilterName[128] = { 0 };
+    WCHAR NumOfInstances[16] = { 0 };
     WCHAR Altitude[64] = { 0 };
+    WCHAR Frame[16] = { 0 };
 
     if (IsNewStyle)
     {
         PFILTER_AGGREGATE_STANDARD_INFORMATION FilterAggInfo;
         FilterAggInfo = (PFILTER_AGGREGATE_STANDARD_INFORMATION)Buffer;
 
-        if (FilterAggInfo->Type.MiniFilter.FilterNameLength < 128)
+        if (FilterAggInfo->Flags & FLTFL_ASI_IS_MINIFILTER)
         {
-            CopyMemory(FilterName,
-                (PCHAR)FilterAggInfo + 
FilterAggInfo->Type.MiniFilter.FilterNameBufferOffset,
-                       FilterAggInfo->Type.MiniFilter.FilterNameLength);
-            FilterName[FilterAggInfo->Type.MiniFilter.FilterNameLength] = 
UNICODE_NULL;
-        }
+            if (FilterAggInfo->Type.MiniFilter.FilterNameLength < 128)
+            {
+                CopyMemory(FilterName,
+                           (PCHAR)FilterAggInfo + 
FilterAggInfo->Type.MiniFilter.FilterNameBufferOffset,
+                           FilterAggInfo->Type.MiniFilter.FilterNameLength);
+                FilterName[FilterAggInfo->Type.MiniFilter.FilterNameLength] = 
UNICODE_NULL;
+            }
+
+            StringCchPrintfW(NumOfInstances, 16, L"%lu", 
FilterAggInfo->Type.MiniFilter.NumberOfInstances);
+
+            if (FilterAggInfo->Type.MiniFilter.FilterAltitudeLength < 64)
+            {
+                CopyMemory(Altitude,
+                           (PCHAR)FilterAggInfo + 
FilterAggInfo->Type.MiniFilter.FilterAltitudeBufferOffset,
+                           
FilterAggInfo->Type.MiniFilter.FilterAltitudeLength);
+                
FilterName[FilterAggInfo->Type.MiniFilter.FilterAltitudeLength] = UNICODE_NULL;
+            }
 
-        if (FilterAggInfo->Type.MiniFilter.FilterNameLength < 64)
+            StringCchPrintfW(Frame, 16, L"%lu", 
FilterAggInfo->Type.MiniFilter.FrameID);
+        }
+        else if (FilterAggInfo->Flags & FLTFL_ASI_IS_LEGACYFILTER)
         {
-            CopyMemory(Altitude,
-                (PCHAR)FilterAggInfo + 
FilterAggInfo->Type.MiniFilter.FilterAltitudeBufferOffset,
-                       FilterAggInfo->Type.MiniFilter.FilterAltitudeLength);
-            FilterName[FilterAggInfo->Type.MiniFilter.FilterAltitudeLength] = 
UNICODE_NULL;
+            if (FilterAggInfo->Type.LegacyFilter.FilterNameLength < 128)
+            {
+                CopyMemory(FilterName,
+                           (PCHAR)FilterAggInfo + 
FilterAggInfo->Type.LegacyFilter.FilterNameBufferOffset,
+                           FilterAggInfo->Type.LegacyFilter.FilterNameLength);
+                FilterName[FilterAggInfo->Type.LegacyFilter.FilterNameLength] 
= UNICODE_NULL;
+            }
+
+            StringCchCopyW(Frame, 16, L"<Legacy>"); //Fixme: is this localized?
         }
 
-        wprintf(L"%-38s %-10lu %-10s %-10lu\n",
+        wprintf(L"%-38s %-10s %-10s %3s\n",
                 FilterName,
-                FilterAggInfo->Type.MiniFilter.NumberOfInstances,
+                NumOfInstances,
                 Altitude,
-                FilterAggInfo->Type.MiniFilter.FrameID);
+                Frame);
     }
     else
     {
@@ -287,7 +309,6 @@ int wmain(int argc, WCHAR *argv[])
             wprintf(L"fltmc.exe unload [name]\n\n");
         }
     }
-    else 
 
     return 0;
 }

Reply via email to