ReactOS  0.4.15-dev-3303-g1ade494
fxuserobject.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxUserObject.cpp
8 
9 Abstract:
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 
15 Author:
16 
17 
18 
19 
20 Environment:
21 
22  Both kernel and user mode
23 
24 Revision History:
25 
26 
27 
28 
29 
30 
31 --*/
32 
33 #include "fxobjectpch.hpp"
34 
35 #include "fxuserobject.hpp"
36 
37 // Tracing support
38 extern "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)) {
76  DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR,
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 
FxObject * pObject
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_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
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define __in_opt
Definition: dbghelp.h:38
LONG NTSTATUS
Definition: precomp.h:26
else
Definition: tritemp.h:161
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
FxUserObject * pUserObject
#define __out
Definition: dbghelp.h:62
#define TRACINGOBJECT
Definition: dbgtrace.h:59
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
unsigned short USHORT
Definition: pedump.c:61
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxUserObject **Object)
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
FxUserObject(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
#define __in
Definition: dbghelp.h:35
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97