ReactOS 0.4.15-dev-8235-gcd88a97
fxuserobject.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxUserObject.cpp
8
9Abstract:
10
11 This module implements the user object that device
12 driver writers can use to take advantage of the
13 driver frameworks infrastructure.
14
15Author:
16
17
18
19
20Environment:
21
22 Both kernel and user mode
23
24Revision History:
25
26
27
28
29
30
31--*/
32
33#include "fxobjectpch.hpp"
34
35#include "fxuserobject.hpp"
36
37// Tracing support
38extern "C" {
39#if defined(EVENT_TRACING)
40#include "FxUserObject.tmh"
41#endif
42}
43
47 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
50 )
51{
54 USHORT wrapperSize = 0;
56
57#ifdef INLINE_WRAPPER_ALLOCATION
58#if FX_CORE_MODE==FX_CORE_USER_MODE
59 wrapperSize = FxUserObject::GetWrapperSize();
60#endif
61#endif
62
63 pObject = new(FxDriverGlobals, Attributes, wrapperSize)
64 FxUserObject(FxDriverGlobals);
65
66
67 if (pObject == NULL) {
69 "Memory allocation failed");
71 }
72
74
75 if (!NT_SUCCESS(status)) {
78 "FxObject::Commit failed %!STATUS!", status);
79 }
80
81 if (NT_SUCCESS(status)) {
83 }
84 else {
86 }
87
88 return status;
89}
90
91//
92// Public constructors
93//
94
96 __in PFX_DRIVER_GLOBALS FxDriverGlobals
97 ) :
98#ifdef INLINE_WRAPPER_ALLOCATION
99 FxNonPagedObject(FX_TYPE_USEROBJECT, sizeof(FxUserObject) + GetWrapperSize(), FxDriverGlobals)
100#else
102#endif
103{
104 return;
105}
106
LONG NTSTATUS
Definition: precomp.h:26
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxUserObject **Object)
FxUserObject(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define TRACINGOBJECT
Definition: dbgtrace.h:59
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObject * pObject
@ FX_TYPE_USEROBJECT
Definition: fxtypes.h:57
FxUserObject * pUserObject
#define _Must_inspect_result_
Definition: ms_sal.h:558
unsigned short USHORT
Definition: pedump.c:61
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
else
Definition: tritemp.h:161
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList