Skip to content

Commit

Permalink
Now framework functioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
markfsanderson committed Apr 18, 2018
1 parent c0fe38d commit 75c9fa0
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 19 deletions.
6 changes: 2 additions & 4 deletions control/win-kernel/WinVirtUE/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ DriverEntry(
OBJECT_ATTRIBUTES WVUThdObjAttr = { 0,0,0,0,0,0 };
OBJECT_ATTRIBUTES WVUPortObjAttr = { 0,0,0,0,0,0 };
PSECURITY_DESCRIPTOR pWVUPortSecDsc = NULL;
#if MFS
HANDLE ThreadHandle = (HANDLE)-1;
#endif

CLIENT_ID ClientId = { (HANDLE)-1,(HANDLE)-1 };
UNICODE_STRING usPortName = { 0,0,NULL };

Expand Down Expand Up @@ -199,7 +198,7 @@ DriverEntry(
}
}

#if MFS

InitializeObjectAttributes(&WVUThdObjAttr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
// create thread, register stuff and etc
Status = PsCreateSystemThread(&ThreadHandle, GENERIC_ALL, &WVUThdObjAttr, NULL, &ClientId, WVUMainThreadStart, &Globals.WVUThreadStartEvent);
Expand Down Expand Up @@ -235,7 +234,6 @@ DriverEntry(
goto ErrorExit;
break;
}
#endif

goto Exit; // normal non-error return

Expand Down
1 change: 1 addition & 0 deletions control/win-kernel/WinVirtUE/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once
#include "common.h"
#include "PortMsgTrans.h"
#include "WinVirtUE.h"
#include "externs.h"

#define DEVICE_TYPE_SHUTDOWN 0xDEADBEEF
Expand Down
10 changes: 7 additions & 3 deletions control/win-kernel/WinVirtUE/FltMgrCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
#include "FltMgrCallbacks.h"
#define COMMON_POOL_TAG FLTMGR_OP_CALLBACK_POOL_TAG

static ULONG_PTR OperationStatusCtx = 1;

#pragma region Operation Registration Data

//
// The data below is all discardable and pageable.
//

#pragma data_seg( "INIT" )
#pragma const_seg( "INIT" )

static ULONG_PTR OperationStatusCtx = 1;


//
// operation registration
//
Expand Down Expand Up @@ -300,6 +302,8 @@ CONST FLT_OPERATION_REGISTRATION OperationCallbacks[] = {
#pragma data_seg()
#pragma const_seg()

#pragma endregion

/*************************************************************************
MiniFilter callback routines.
*************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion control/win-kernel/WinVirtUE/FltMgrCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#pragma once
#include "common.h"

#include "externs.h"

/**
** Operation Callbacks
Expand Down
2 changes: 1 addition & 1 deletion control/win-kernel/WinVirtUE/FltMgrReg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CONST FLT_REGISTRATION FilterRegistration = {
#endif

ContextRegistrationData, // ContextRegistration
NULL, // Operation callbacks
OperationCallbacks, // Operation callbacks

(PFLT_FILTER_UNLOAD_CALLBACK)WVUUnload, // MiniFilterUnload

Expand Down
9 changes: 0 additions & 9 deletions control/win-kernel/WinVirtUE/WinVirtUE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ WVUMainThreadStart(PVOID StartContext)
goto ErrorExit;
}

Status = PsSetCreateProcessNotifyRoutineEx(ProcessNotifyCallbackEx, FALSE);
if (FALSE == NT_SUCCESS(Status))
{
WVU_DEBUG_PRINT(LOG_WVU_MAINTHREAD, ERROR_LEVEL_ID, "PsSetCreateProcessNotifyRoutineEx(ProcessNotifyCallbackEx, FALSE) "
"Add Failed! Status=%08x\n", Status);
goto ErrorExit;
}

Status = PsSetCreateThreadNotifyRoutine(ThreadCreateCallback);
if (FALSE == NT_SUCCESS(Status))
{
Expand All @@ -66,7 +58,6 @@ WVUMainThreadStart(PVOID StartContext)
goto ErrorExit;
}


WVU_DEBUG_PRINT(LOG_WVU_MAINTHREAD, TRACE_LEVEL_ID, "Calling KeSetEvent(WVUMainThreadStartEvt, IO_NO_INCREMENT, TRUE) . . .\n");
#pragma warning(suppress: 28160) // stupid warning about the wait arg TRUE . . . sheesh
Signaled = KeSetEvent(WVUMainThreadStartEvt, IO_NO_INCREMENT, TRUE);
Expand Down
2 changes: 2 additions & 0 deletions control/win-kernel/WinVirtUE/WinVirtUE.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions>
</Link>
<Inf>
<EnableVerbose>true</EnableVerbose>
Expand All @@ -185,6 +186,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<AdditionalDependencies>fltmgr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions>
</Link>
<Inf>
<EnableVerbose>true</EnableVerbose>
Expand Down
3 changes: 2 additions & 1 deletion control/win-kernel/WinVirtUE/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/
//#define LOG_MODULES LOG_NONE
//#define LOG_MODULES (LOG_CORE|LOG_WVU_MAIN|LOG_NOTIFY_PROCS|LOG_WVU_MAINTHREAD|LOG_WVU_CONTAINER|LOG_WVU_IOCTL)
#define LOG_MODULES (LOG_WVU_MAINTHREAD|LOG_FILE_CREATE|LOG_FILE_OP|LOG_CTX)
//#define LOG_MODULES (LOG_WVU_MAINTHREAD|LOG_FILE_CREATE|LOG_FILE_OP|LOG_CTX)
#define LOG_MODULES LOG_ALL

/*
* If enabled, attaching a kernel debugger to the machine will BSOD the system.
Expand Down

0 comments on commit 75c9fa0

Please sign in to comment.