ReactOS 0.4.15-dev-7934-g1dc8d80
fxuserobjectapi.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxUserObjectApi.cpp
8
9Abstract:
10
11 This modules implements the C API's for the FxUserObject.
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23--*/
24
25#include "fxobjectpch.hpp"
26
27#include "fxuserobject.hpp"
28
29// Tracing support
30extern "C" {
31#if defined(EVENT_TRACING)
32#include "FxUserObjectApi.tmh"
33#endif
34}
35
36
37extern "C" {
38
43WDFEXPORT(WdfObjectCreate)(
44 __in
48 __out
50 )
51
52/*++
53
54Routine Description:
55
56 This creates a general WDF object for use by the device driver.
57
58 It participates in general framework object contracts in that it:
59
60 - Has a handle and a reference count
61 - Has Cleanup and Destroy callbacks
62 - Supports driver context memory and type
63 - Can have child objects
64 - Can optionally have a parent object and automatically delete with it
65
66 It is intended to allow a WDF device driver to use this object to
67 create its own structures that can participate in frameworks lifetime
68 management.
69
70 The device driver can use the objects context memory and type to
71 represent its own internal data structures, and can further assign
72 device driver specific resources and release them by registering
73 for EvtObjectCleanup, and EvtObjectDestroy callbacks.
74
75 The object may be deleted by using the WdfObjectDelete API.
76
77 Since the object is represented by a frameworks handle, it can be
78 reference counted, and validated.
79
80 Class drivers may use this object to define framework object handles
81 for their types.
82
83Arguments:
84
85 Attributes - WDF_OBJECT_ATTRIBUTES to define a parent object, context memory,
86 Cleanup and Destroy handlers.
87
88Return Value:
89
90 NTSTATUS
91
92--*/
93
94{
95 DDI_ENTRY();
96
101
104
105 //
106 // Get the parent's globals if it is present
107 //
109 Attributes))) {
111
113 Attributes->ParentObject,
115 (PVOID*)&pParent,
117 }
118
120
124 );
126 return status;
127 }
128
129 //
130 // Create the FxObject.
131 //
135 *Object = handle;
136
139 "Created UserObject Handle 0x%p",
140 handle);
141 }
142
143 return status;
144}
145
146} // extern "C" the entire file
LONG NTSTATUS
Definition: precomp.h:26
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxUserObject **Object)
__inline WDFOBJECT GetHandle(VOID)
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define TRACINGUSEROBJECT
Definition: dbgtrace.h:64
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define __drv_maxIRQL(irql)
Definition: driverspecs.h:291
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *)&pDevice, &pFxDriverGlobals)
FxObject * pParent
Definition: fxdpcapi.cpp:86
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
_Must_inspect_result_ __in_opt PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFOBJECT * Object
NTSTATUS status
FxUserObject * pUserObject
WDFOBJECT handle
PFX_DRIVER_GLOBALS pFxDriverGlobals
@ FX_VALIDATE_OPTION_EXECUTION_LEVEL_ALLOWED
_Must_inspect_result_ NTSTATUS __inline FxValidateObjectAttributesForParentHandle(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
Definition: ps.c:97
#define STDCALL
Definition: wdf.h:45
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes