ReactOS  0.4.15-dev-2700-g4b4ffa9
framework.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  framework.cpp
8 
9 Abstract:
10 
11 Environment:
12 
13  User mode only
14 
15 Revision 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 
27 extern "C" {
28 #include "FxDynamics.h"
29 #include "..\librarycommon\FxLibraryCommon.h"
31 
32 #if !(NO_UMDF_VERSION_EXPORT)
35 
36 UMDF_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 //
47 IUMDFPlatform *g_IUMDFPlatform = NULL;
48 IWudfHost2 *g_IWudfHost2 = NULL;
49 
50 
51 // ***********************************************************************************
52 // DLL Entry Point
53 BOOL
57  __in LPVOID lpReserved
58  )
59 {
60  UNREFERENCED_PARAMETER(lpReserved);
61 
62  hInstance;
63 
65  {
67  }
68  else if (DLL_PROCESS_DETACH == dwReason)
69  {
70  DO_NOTHING();
71  }
72 
73  return TRUE;
74 }
75 
76 __control_entrypoint(DllExport)
78 FxFrameworkEntryUm(
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 
127 Done:
128 
129  return status;
130 }
131 
132 }
BOOL WINAPI DllMain(__in HINSTANCE hInstance, __in DWORD dwReason, __in LPVOID lpReserved)
Definition: framework.cpp:54
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DECLSPEC_SELECTANY
Definition: guiddef.h:40
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT hrQI
Definition: framework.cpp:106
#define DLL_PROCESS_DETACH
Definition: compat.h:130
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG HRESULT
Definition: typedefs.h:79
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
IWudfHost2 * g_IWudfHost2
Definition: framework.cpp:48
#define DECLSPEC_EXPORT
Definition: usbdlib.h:4
status
Definition: framework.cpp:119
DECLSPEC_EXPORT DECLSPEC_SELECTANY UMDF_VERSION_DATA Microsoft_WDF_UMDF_Version
Definition: framework.cpp:36
#define NULL
Definition: types.h:112
__control_entrypoint(DllExport) NTSTATUS FxFrameworkEntryUm(__in PWUDF_LOADER_FX_INTERFACE LoaderInterface
IUMDFPlatform * g_IUMDFPlatform
Definition: framework.cpp:47
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __in
Definition: dbghelp.h:35
WDF_LIBRARY_INFO WdfLibraryInfo
Definition: version.cpp:178
#define __Print(_x_)
#define DO_NOTHING()
Definition: mxgeneral.h:32
Definition: ps.c:97