On 2016-08-10 00:10, gedmurphy(a)svn.reactos.org wrote:
+ /* Calc and allocate a buffer to hold our filter
name */
+ BufferLength = wcslen(lpFilterName) * sizeof(WCHAR);
+ FilterName = RtlAllocateHeap(GetProcessHeap(),
+ 0,
+ BufferLength + sizeof(UNICODE_STRING));
+ 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);
+
+ /* 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));
+
+ /* Cleaup and bail*/
+ CloseHandle(hFltMgr);
+ return HRESULT_FROM_WIN32(dwError);
}
You're leaking this allocation.
+// Hack - our SDK reports NTDDI_VERSION as 0x05020100
(from _WIN32_WINNT 0x502)
+// which doesn't pass the FLT_MGR_BASELINE check in fltkernel.h
+#define NTDDI_VERSION NTDDI_WS03SP1
We typically set this kind of thing in CMakeLists.txt.. however maybe
we should define it this way by default