mirror of
https://github.com/reactos/reactos.git
synced 2025-05-27 21:18:15 +00:00
[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 svn path=/trunk/; revision=72591
This commit is contained in:
parent
6cc00bad38
commit
e37e1f59d3
2 changed files with 19 additions and 17 deletions
|
@ -1,8 +1,12 @@
|
||||||
|
|
||||||
add_definitions(-D__WINESRC__)
|
add_definitions(-D__WINESRC__)
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
|
||||||
spec2def(fltlib.dll fltlib.spec ADD_IMPORTLIB)
|
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
|
list(APPEND SOURCE
|
||||||
fltlib.c
|
fltlib.c
|
||||||
stubs.c
|
stubs.c
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <ndk/iofuncs.h>
|
#include <ndk/iofuncs.h>
|
||||||
#include <ndk/obfuncs.h>
|
#include <ndk/obfuncs.h>
|
||||||
#include <ndk/rtlfuncs.h>
|
#include <ndk/rtlfuncs.h>
|
||||||
|
#include <fltmgr_shared.h>
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
@ -25,11 +26,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(fltlib);
|
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
|
static
|
||||||
HRESULT
|
HRESULT
|
||||||
FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
|
FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
|
||||||
|
@ -69,14 +65,15 @@ HRESULT
|
||||||
FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
|
FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
|
||||||
_In_ BOOL Load)
|
_In_ BOOL Load)
|
||||||
{
|
{
|
||||||
PUNICODE_STRING FilterName;
|
PFILTER_NAME FilterName;
|
||||||
HANDLE hFltMgr;
|
HANDLE hFltMgr;
|
||||||
|
DWORD StringLength;
|
||||||
DWORD BufferLength;
|
DWORD BufferLength;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
/* Get a handle to the filter manager */
|
/* Get a handle to the filter manager */
|
||||||
hFltMgr = CreateFileW(lpFilterName,
|
hFltMgr = CreateFileW(L"\\\\.\\fltmgr",
|
||||||
GENERIC_READ,
|
GENERIC_WRITE,
|
||||||
FILE_SHARE_WRITE,
|
FILE_SHARE_WRITE,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
|
@ -89,30 +86,31 @@ FilterLoadUnload(_In_z_ LPCWSTR lpFilterName,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calc and allocate a buffer to hold our filter name */
|
/* 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(),
|
FilterName = RtlAllocateHeap(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
BufferLength + sizeof(UNICODE_STRING));
|
BufferLength);
|
||||||
if (FilterName == NULL)
|
if (FilterName == NULL)
|
||||||
{
|
{
|
||||||
CloseHandle(hFltMgr);
|
CloseHandle(hFltMgr);
|
||||||
return HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
return HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build up the filter name into a real life string */
|
/* Build up the filter name */
|
||||||
FilterName->Buffer = (PWCH)(FilterName + 1);
|
FilterName->Length = StringLength;
|
||||||
FilterName->Length = BufferLength;
|
CopyMemory(FilterName->FilterName, lpFilterName, StringLength);
|
||||||
FilterName->MaximumLength = BufferLength;
|
|
||||||
RtlCopyMemory(FilterName->Buffer, lpFilterName, BufferLength);
|
|
||||||
|
|
||||||
/* Tell the filter manager to load the filter for us */
|
/* Tell the filter manager to load the filter for us */
|
||||||
dwError = SendIoctl(hFltMgr,
|
dwError = SendIoctl(hFltMgr,
|
||||||
Load ? IOCTL_LOAD_FILTER : IOCTL_UNLOAD_FILTER,
|
Load ? IOCTL_LOAD_FILTER : IOCTL_UNLOAD_FILTER,
|
||||||
FilterName,
|
FilterName,
|
||||||
BufferLength + sizeof(UNICODE_STRING));
|
BufferLength);
|
||||||
|
|
||||||
/* Cleaup and bail*/
|
/* Cleaup and bail*/
|
||||||
|
RtlFreeHeap(GetProcessHeap(), 0, FilterName);
|
||||||
CloseHandle(hFltMgr);
|
CloseHandle(hFltMgr);
|
||||||
|
|
||||||
return HRESULT_FROM_WIN32(dwError);
|
return HRESULT_FROM_WIN32(dwError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue