mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:13:06 +00:00
[WDF] Add Windows Driver Framework files
Takern from Microsoft GitHub repo:
d9c6040fe9
Licensed under MIT
This commit is contained in:
parent
545df81502
commit
8a978a179f
475 changed files with 285099 additions and 0 deletions
106
sdk/lib/drivers/wdf/shared/inc/private/common/fxuserobject.hpp
Normal file
106
sdk/lib/drivers/wdf/shared/inc/private/common/fxuserobject.hpp
Normal file
|
@ -0,0 +1,106 @@
|
|||
|
||||
/*++
|
||||
|
||||
Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
|
||||
FxUserObject.hpp
|
||||
|
||||
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:
|
||||
|
||||
|
||||
Made mode agnostic
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _FXUSEROBJECT_H_
|
||||
#define _FXUSEROBJECT_H_
|
||||
|
||||
class FxUserObject : public FxNonPagedObject {
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
virtual
|
||||
NTSTATUS
|
||||
QueryInterface(
|
||||
__in FxQueryInterfaceParams* Params
|
||||
)
|
||||
{
|
||||
switch (Params->Type) {
|
||||
case FX_TYPE_USEROBJECT:
|
||||
*Params->Object = (FxUserObject*) this;
|
||||
break;
|
||||
|
||||
default:
|
||||
return __super::QueryInterface(Params);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
__inline
|
||||
WDFOBJECT
|
||||
GetHandle(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return (WDFOBJECT) GetObjectHandle();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#ifdef INLINE_WRAPPER_ALLOCATION
|
||||
#if (FX_CORE_MODE==FX_CORE_USER_MODE)
|
||||
static
|
||||
USHORT
|
||||
GetWrapperSize(
|
||||
VOID
|
||||
);
|
||||
|
||||
public:
|
||||
FORCEINLINE
|
||||
PVOID
|
||||
GetCOMWrapper(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
PBYTE ptr = (PBYTE) this;
|
||||
return (ptr + (USHORT) WDF_ALIGN_SIZE_UP(sizeof(*this), MEMORY_ALLOCATION_ALIGNMENT));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _FXUSEROBJECT_H_
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue