VOID EventCleanupDeviceObject(_In_ WDFOBJECT deviceObject) { #if DBG DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_INFO_LEVEL, " ---> EventCleanupDeviceObject()\n"); #endif /// DBG UNREFERENCED_PARAMETER(deviceObject); KrnlHlprExposedCalloutsUnregister(); if(g_WFPSamplerDeviceData.pOutboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pOutboundInjectionHandles)); if(g_WFPSamplerDeviceData.pInboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pInboundInjectionHandles)); if(g_WFPSamplerDeviceData.pIPv6OutboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pIPv6OutboundInjectionHandles)); if(g_WFPSamplerDeviceData.pIPv6InboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pIPv6InboundInjectionHandles)); if(g_WFPSamplerDeviceData.pIPv4OutboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pIPv4OutboundInjectionHandles)); if(g_WFPSamplerDeviceData.pIPv4InboundInjectionHandles) KrnlHlprInjectionHandleDataDestroy(&(g_WFPSamplerDeviceData.pIPv4InboundInjectionHandles)); if(g_WFPSamplerDeviceData.pEngineHandle) KrnlHlprFwpmSessionDestroyEngineHandle(&(g_WFPSamplerDeviceData.pEngineHandle)); FwpmBfeStateUnsubscribeChanges(g_bfeSubscriptionHandle); UnregisterPowerStateChangeCallback(&g_deviceExtension); if(g_pNDISPoolData) KrnlHlprNDISPoolDataDestroy(&g_pNDISPoolData); #if DBG DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_INFO_LEVEL, " <--- EventCleanupDeviceObject()\n"); #endif /// DBG return; }
NTSTATUS KrnlHlprNDISPoolDataCreate(_Outptr_ NDIS_POOL_DATA** ppNDISPoolData, _In_opt_ UINT32 memoryTag) /* WFPSAMPLER_NDIS_POOL_TAG */ { #if DBG DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_INFO_LEVEL, " ---> KrnlHlprNDISPoolDataCreate()\n"); #endif /// DBG NT_ASSERT(ppNDISPoolData); NTSTATUS status = STATUS_SUCCESS; HLPR_NEW(*ppNDISPoolData, NDIS_POOL_DATA, WFPSAMPLER_SYSLIB_TAG); HLPR_BAIL_ON_ALLOC_FAILURE(*ppNDISPoolData, status); status = KrnlHlprNDISPoolDataPopulate(*ppNDISPoolData, memoryTag); HLPR_BAIL_LABEL: #pragma warning(push) #pragma warning(disable: 6001) /// *ppNDISPoolData initialized with calls to HLPR_NEW & KrnlHlprNDISPoolDataPopulate if(status != STATUS_SUCCESS && *ppNDISPoolData) KrnlHlprNDISPoolDataDestroy(ppNDISPoolData); #pragma warning(pop) #if DBG DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_INFO_LEVEL, " <--- KrnlHlprNDISPoolDataCreate() [status: %#x]\n", status); #endif /// DBG return status; }