Author: gedmurphy
Date: Tue Sep 6 15:52:38 2016
New Revision: 72591
URL:
http://svn.reactos.org/svn/reactos?rev=72591&view=rev
Log:
[FLTLIB]
- On load, open a handle to fltmgr, not the target driver...
- Fixup the load data we send to the fltmgr to be the same Windows layout. We need to copy
this interface to allow component sharing between windows and ros.
- Move IOCTLs to shared header
Modified:
trunk/reactos/dll/win32/fltlib/CMakeLists.txt
trunk/reactos/dll/win32/fltlib/fltlib.c
Modified: trunk/reactos/dll/win32/fltlib/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fltlib/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/fltlib/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/fltlib/CMakeLists.txt [iso-8859-1] Tue Sep 6 15:52:38 2016
@@ -1,7 +1,11 @@
add_definitions(-D__WINESRC__)
-include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(fltlib.dll fltlib.spec ADD_IMPORTLIB)
+
+include_directories(
+ ${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers/fltmgr
+ ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine
+ includes)
list(APPEND SOURCE
fltlib.c
Modified: trunk/reactos/dll/win32/fltlib/fltlib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fltlib/fltlib.c?…
==============================================================================
--- trunk/reactos/dll/win32/fltlib/fltlib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/fltlib/fltlib.c [iso-8859-1] Tue Sep 6 15:52:38 2016
@@ -17,6 +17,7 @@
#include <ndk/iofuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
+#include <fltmgr_shared.h>
#include "wine/debug.h"
@@ -24,11 +25,6 @@
/* DATA ****************************************************************************/
WINE_DEFAULT_DEBUG_CHANNEL(fltlib);
-
-//MOVEME
-#define IOCTL_LOAD_FILTER CTL_CODE(FILE_DEVICE_DISK_FILE_SYSTEM, 0x01, 0,
FILE_WRITE_DATA) //88004
-#define IOCTL_UNLOAD_FILTER CTL_CODE(FILE_DEVICE_DISK_FILE_SYSTEM, 0x02, 0,
FILE_WRITE_DATA) //88008
-#define IOCTL_CREATE_FILTER CTL_CODE(FILE_DEVICE_DISK_FILE_SYSTEM, 0x03, 0,
FILE_READ_DATA) //8400c
static
HRESULT
@@ -69,14 +65,15 @@
FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
_In_ BOOL Load)
{
- PUNICODE_STRING FilterName;
+ PFILTER_NAME FilterName;
HANDLE hFltMgr;
+ DWORD StringLength;
DWORD BufferLength;
DWORD dwError;
/* Get a handle to the filter manager */
- hFltMgr = CreateFileW(lpFilterName,
- GENERIC_READ,
+ hFltMgr = CreateFileW(L"\\\\.\\fltmgr",
+ GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
@@ -89,30 +86,31 @@
}
/* Calc and allocate a buffer to hold our filter name */
- BufferLength = wcslen(lpFilterName) * sizeof(WCHAR);
+ StringLength = wcslen(lpFilterName) * sizeof(WCHAR);
+ BufferLength = StringLength + sizeof(FILTER_NAME);
FilterName = RtlAllocateHeap(GetProcessHeap(),
0,
- BufferLength + sizeof(UNICODE_STRING));
+ BufferLength);
if (FilterName == NULL)
{
CloseHandle(hFltMgr);
return HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
}
- /* Build up the filter name into a real life string */
- FilterName->Buffer = (PWCH)(FilterName + 1);
- FilterName->Length = BufferLength;
- FilterName->MaximumLength = BufferLength;
- RtlCopyMemory(FilterName->Buffer, lpFilterName, BufferLength);
+ /* Build up the filter name */
+ FilterName->Length = StringLength;
+ CopyMemory(FilterName->FilterName, lpFilterName, StringLength);
/* Tell the filter manager to load the filter for us */
dwError = SendIoctl(hFltMgr,
Load ? IOCTL_LOAD_FILTER : IOCTL_UNLOAD_FILTER,
FilterName,
- BufferLength + sizeof(UNICODE_STRING));
+ BufferLength);
/* Cleaup and bail*/
+ RtlFreeHeap(GetProcessHeap(), 0, FilterName);
CloseHandle(hFltMgr);
+
return HRESULT_FROM_WIN32(dwError);
}