Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107/*++
Copyright (c) Microsoft Corporation
Module Name:
FxUserObject.cpp
Abstract:
This module implements the user object that device driver writers can use to take advantage of the driver frameworks infrastructure.
Author:
Environment:
Both kernel and user mode
Revision History:
--*/
#include "fxobjectpch.hpp"
#include "fxuserobject.hpp"
// Tracing supportextern "C" {#if defined(EVENT_TRACING)#include "FxUserObject.tmh"#endif}
_Must_inspect_result_NTSTATUSFxUserObject::_Create( __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxUserObject** pUserObject ){ FxUserObject* pObject = NULL; NTSTATUS status; USHORT wrapperSize = 0; WDFOBJECT handle;
#ifdef INLINE_WRAPPER_ALLOCATION#if FX_CORE_MODE==FX_CORE_USER_MODE wrapperSize = FxUserObject::GetWrapperSize();#endif#endif
pObject = new(FxDriverGlobals, Attributes, wrapperSize) FxUserObject(FxDriverGlobals);
if (pObject == NULL) { DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGOBJECT, "Memory allocation failed"); return STATUS_INSUFFICIENT_RESOURCES; }
status = pObject->Commit(Attributes, &handle);
if (!NT_SUCCESS(status)) { DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGOBJECT, "FxObject::Commit failed %!STATUS!", status); }
if (NT_SUCCESS(status)) { *pUserObject = pObject; } else { pObject->DeleteFromFailedCreate(); }
return status;}
//// Public constructors//
FxUserObject::FxUserObject( __in PFX_DRIVER_GLOBALS FxDriverGlobals ) :#ifdef INLINE_WRAPPER_ALLOCATION FxNonPagedObject(FX_TYPE_USEROBJECT, sizeof(FxUserObject) + GetWrapperSize(), FxDriverGlobals)#else FxNonPagedObject(FX_TYPE_USEROBJECT, sizeof(FxUserObject), FxDriverGlobals)#endif{ return;}