DriverLoader: Minor fixes.

This commit is contained in:
Nodir Temirkhodjaev 2021-11-04 10:59:56 +03:00
parent ba810a1ae3
commit 4fcaea6c50
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,6 @@ static void fortdl_init(PDRIVER_OBJECT driver, PVOID context, ULONG count)
{ {
NTSTATUS status; NTSTATUS status;
UNUSED(context);
UNUSED(count); UNUSED(count);
DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, "FORT: Loader Init: %d\n", count); DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, "FORT: Loader Init: %d\n", count);
@ -23,7 +22,7 @@ static void fortdl_init(PDRIVER_OBJECT driver, PVOID context, ULONG count)
status = fort_file_open(context, &fileHandle); status = fort_file_open(context, &fileHandle);
DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,
"FORT: Loader File Load: %w status=%d\n", (PCWSTR) context, status); "FORT: Loader File Open: %w status=%d\n", (PCWSTR) context, status);
if (NT_SUCCESS(status)) { if (NT_SUCCESS(status)) {
status = fort_file_read(fileHandle, FORT_LOADER_POOL_TAG, &data, &dataSize); status = fort_file_read(fileHandle, FORT_LOADER_POOL_TAG, &data, &dataSize);
@ -38,10 +37,11 @@ static void fortdl_init(PDRIVER_OBJECT driver, PVOID context, ULONG count)
ExFreePool(context); ExFreePool(context);
} }
// Prepare the driver image /* Prepare the driver image */
PUCHAR image = NULL; PUCHAR image = NULL;
DWORD imageSize = 0;
if (NT_SUCCESS(status)) { if (NT_SUCCESS(status)) {
status = fort_image_load(data, dataSize, &image); status = fort_image_load(data, dataSize, &image, &imageSize);
/* Free the driver file's allocated data */ /* Free the driver file's allocated data */
fort_mem_free(data, FORT_LOADER_POOL_TAG); fort_mem_free(data, FORT_LOADER_POOL_TAG);

View File

@ -2,7 +2,7 @@
#include "fortimg.h" #include "fortimg.h"
FORT_API NTSTATUS fort_image_load(const PUCHAR data, DWORD dataSize, PUCHAR *image) FORT_API NTSTATUS fort_image_load(const PUCHAR data, DWORD dataSize, PUCHAR *image, DWORD *outSize)
{ {
NTSTATUS status; NTSTATUS status;

View File

@ -7,7 +7,7 @@
extern "C" { extern "C" {
#endif #endif
FORT_API NTSTATUS fort_image_load(const PUCHAR data, DWORD dataSize, PUCHAR *image); FORT_API NTSTATUS fort_image_load(const PUCHAR data, DWORD dataSize, PUCHAR *image, DWORD *outSize);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"