Skip to content

KTL Issues. CH 12 PG 424-426 #25

Description

@Allevon412

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();

PFLT_FILTER filter;
*********Vector<WString<PoolType::NonPaged>, PoolType::NonPaged> Files;** <- issue here
ExecutiveResource Lock;
PDRIVER_OBJECT DriverObject;

};

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions