Open Allevon412 opened 1 year ago
Indeed, the correct way to work is to add your Tag as part of the field. I'll check why GetUnicodeString fails to compile. I did some improvements to KTL that I may have not pushed yet.
Pushed updates to KTL. See if that resolves the compiler error.
Pavel,
I am reaching out to you because I am getting an error with the following code:
Main.cpp
include "pch.h"
include "DriverMain.h"
include "MiniFilter.h"
NTSTATUS OnCreateClose(PDEVICE_OBJECT, PIRP Irp); void UnloadFunc(PDRIVER_OBJECT DriverObject); NTSTATUS InitMiniFilter(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
extern "C" NTSTATUS DriverEntry(In PDRIVER_OBJECT DriverObject, In PUNICODE_STRING) { **g_State = new (PoolType::NonPaged, DRIVER_TAG) FilterState;** <- issue here
MiniFilter.h
pragma once
include <D:\Training\windowskernelprogrammingbook2e\ktl\ktl\ktl.h>
struct FilterState { FilterState(); ~FilterState();
};
It appears that the overloading functions are generating errors that I am giving the functions the wrong inputs when I try to use them: For WString it's saying I am giving it too few arguments.
For new it says no instance of overloaded function matches the argument list unsigned long long, PoolType.
I was able to overcome these issues by calling functions like so: Vector<WString<PoolType::NonPaged, DRIVER_TAG>, PoolType::NonPaged, DRIVER_TAG> Files; g_State = new (PoolType::NonPaged, DRIVER_TAG) FilterState;
However, now when i try to follow along with the book I have a new problem entirely!
in MiniFilter.h UNICODE_STRING path; auto status = FLT_PREOP_SUCCESS_WITH_CALLBACK; { SharedLocker locker(g_State->Lock);
for (auto& name : g_State->Files)
{
*****name.GetUnicodeString(path);** <- issue here
}
}
no instance of overloaded function "BasicString<T, Pool, Tag>::GetUnicodeString [with T=wchar_t, Pool=PoolType::NonPaged, Tag=69UL]" matches the argument list and object (the object has type qualifiers that prevent a match) DirectoryHider DriverProjects\DirectoryHider\DirectoryHider\MiniFilter.cpp