ReactOS 0.4.15-dev-8102-g108db8f
framework.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 framework.cpp
8
9Abstract:
10
11Environment:
12
13 User mode only
14
15Revision History:
16
17
18--*/
19
20#include <ntverp.h>
21#include <strsafe.h>
22#include <driverspecs.h>
23
24#include "fxmin.hpp"
25#include "FxFrameworkStubUm.h"
26
27extern "C" {
28#include "FxDynamics.h"
29#include "..\librarycommon\FxLibraryCommon.h"
31
32#if !(NO_UMDF_VERSION_EXPORT)
35
36UMDF_VERSION_DATA Microsoft_WDF_UMDF_Version = {__WUDF_MAJOR_VERSION,
37
38 __WUDF_MINOR_VERSION,
39
40 __WUDF_SERVICE_VERSION};
41
42#endif
43
44//
45// Pointer to the platform interface supplied by the host
46//
47IUMDFPlatform *g_IUMDFPlatform = NULL;
48IWudfHost2 *g_IWudfHost2 = NULL;
49
50
51// ***********************************************************************************
52// DLL Entry Point
53BOOL
57 __in LPVOID lpReserved
58 )
59{
60 UNREFERENCED_PARAMETER(lpReserved);
61
63
65 {
67 }
68 else if (DLL_PROCESS_DETACH == dwReason)
69 {
70 DO_NOTHING();
71 }
72
73 return TRUE;
74}
75
78FxFrameworkEntryUm(
79 __in PWUDF_LOADER_FX_INTERFACE LoaderInterface,
81 )
82{
84
85 //
86 // Basic validation.
87 //
88 if (LoaderInterface == NULL ||
89 LoaderInterface->Size < sizeof(WUDF_LOADER_FX_INTERFACE) ||
90 LoaderInterface->pUMDFPlatform == NULL) {
92 __Print(("Failed to validate loader interface parameters, "
93 "status 0x%x\n", status));
94 goto Done;
95 }
96
97 //
98 // Store platform interface.
99 //
100 g_IUMDFPlatform = LoaderInterface->pUMDFPlatform;
101
102 //
103 // Get the IWudfHost * from LoaderInterface.
104 //
105 FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost));
106 HRESULT hrQI = LoaderInterface->pIWudfHost->QueryInterface(
107 IID_IWudfHost2,
109 );
110
111 FX_VERIFY(INTERNAL, CHECK_QI(hrQI, g_IWudfHost2));
112 g_IWudfHost2->Release();
113
114 //
115 // Do first time init of this v2.x framework module.
116 // In framework v1.x this is done as a side effect of invoking the
117 // IUMDFramework->Initialize method.
118 //
119 status = LoaderInterface->RegisterLibrary(Context, &WdfLibraryInfo);
121 __Print(("RegisterLibrary failed, status 0x%x\n", status));
122 goto Done;
123 }
124
126
127Done:
128
129 return status;
130}
131
132}
LONG NTSTATUS
Definition: precomp.h:26
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:19
#define __in
Definition: dbghelp.h:35
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
status
Definition: framework.cpp:119
DECLSPEC_EXPORT DECLSPEC_SELECTANY UMDF_VERSION_DATA Microsoft_WDF_UMDF_Version
Definition: framework.cpp:36
IUMDFPlatform * g_IUMDFPlatform
Definition: framework.cpp:47
BOOL WINAPI DllMain(__in HINSTANCE hInstance, __in DWORD dwReason, __in LPVOID lpReserved)
Definition: framework.cpp:54
IWudfHost2 * g_IWudfHost2
Definition: framework.cpp:48
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
WDF_LIBRARY_INFO WdfLibraryInfo
Definition: version.cpp:178
HRESULT hrQI
Definition: framework.cpp:106
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define __Print(_x_)
#define __control_entrypoint(category)
Definition: ms_sal.h:2879
#define DO_NOTHING()
Definition: mxgeneral.h:32
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define DECLSPEC_SELECTANY
Definition: guiddef.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define DECLSPEC_EXPORT
Definition: usbdlib.h:4
#define WINAPI
Definition: msvc.h:6