Skip to content

Commit

Permalink
phlib nativeflt
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s committed Nov 13, 2024
1 parent 5f2d516 commit 38f88f9
Show file tree
Hide file tree
Showing 8 changed files with 508 additions and 440 deletions.
5 changes: 0 additions & 5 deletions phlib/include/kphcomms.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@

#include <kphmsg.h>

NTSTATUS KphFilterLoadUnload(
_In_ PPH_STRINGREF ServiceName,
_In_ BOOLEAN LoadDriver
);

/**
* \brief Callback for handling messages from the kernel.
*
Expand Down
51 changes: 51 additions & 0 deletions phlib/include/phnative.h
Original file line number Diff line number Diff line change
Expand Up @@ -3775,6 +3775,57 @@ PhFlushProcessHeapsRemote(
_In_opt_ PLARGE_INTEGER Timeout
);

PHLIBAPI
NTSTATUS
NTAPI
PhFilterLoadUnload(
_In_ PPH_STRINGREF ServiceName,
_In_ BOOLEAN LoadDriver
);

PHLIBAPI
NTSTATUS
NTAPI
PhFilterSendMessage(
_In_ HANDLE Port,
_In_reads_bytes_(InBufferSize) PVOID InBuffer,
_In_ ULONG InBufferSize,
_Out_writes_bytes_to_opt_(OutputBufferSize, *BytesReturned) PVOID OutputBuffer,
_In_ ULONG OutputBufferSize,
_Out_ PULONG BytesReturned
);

PHLIBAPI
NTSTATUS
NTAPI
PhFilterGetMessage(
_In_ HANDLE Port,
_Out_writes_bytes_(MessageBufferSize) PFILTER_MESSAGE_HEADER MessageBuffer,
_In_ ULONG MessageBufferSize,
_Inout_ LPOVERLAPPED Overlapped
);

PHLIBAPI
NTSTATUS
NTAPI
PhFilterReplyMessage(
_In_ HANDLE Port,
_In_reads_bytes_(ReplyBufferSize) PFILTER_REPLY_HEADER ReplyBuffer,
_In_ ULONG ReplyBufferSize
);

PHLIBAPI
NTSTATUS
NTAPI
PhFilterConnectCommunicationPort(
_In_ PPH_STRINGREF PortName,
_In_ ULONG Options,
_In_reads_bytes_opt_(SizeOfContext) PVOID ConnectionContext,
_In_ USHORT SizeOfContext,
_In_opt_ PSECURITY_ATTRIBUTES SecurityAttributes,
_Outptr_ PHANDLE Port
);

EXTERN_C_END

#endif
4 changes: 2 additions & 2 deletions phlib/kph.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ NTSTATUS KsiLoadUnloadService(
}

if (Config->EnableFilterLoad)
status = KphFilterLoadUnload(Config->ServiceName, TRUE);
status = PhFilterLoadUnload(Config->ServiceName, TRUE);
else
status = NtLoadDriver(&driverServiceKeyName);
}
else
{
if (Config->EnableFilterLoad)
status = KphFilterLoadUnload(Config->ServiceName, FALSE);
status = PhFilterLoadUnload(Config->ServiceName, FALSE);
else
status = NtUnloadDriver(&driverServiceKeyName);
}
Expand Down
Loading

0 comments on commit 38f88f9

Please sign in to comment.