1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxCxDeviceInit.cpp
8 
9 Abstract:
10     Internals for WDFCXDEVICE_INIT
11 
12 Author:
13 
14 
15 
16 Environment:
17 
18     Both kernel and user mode
19 
20 Revision History:
21 
22 
23 
24 --*/
25 
26 #include "coreprivshared.hpp"
27 
28 extern "C" {
29 #include "FxCxDeviceInit.tmh"
30 }
31 
32 WDFCXDEVICE_INIT::WDFCXDEVICE_INIT()
33 {
34     InitializeListHead(&ListEntry);
35 
36     ClientDriverGlobals = NULL;
37     CxDriverGlobals = NULL;
38     PreprocessInfo = NULL;
39     IoInCallerContextCallback = NULL;
40     RtlZeroMemory(&RequestAttributes, sizeof(RequestAttributes));
41     RtlZeroMemory(&FileObject, sizeof(FileObject));
42     FileObject.AutoForwardCleanupClose = WdfUseDefault;
43     CxDeviceInfo = NULL;
44 }
45 
46 WDFCXDEVICE_INIT::~WDFCXDEVICE_INIT()
47 {
48     ASSERT(IsListEmpty(&ListEntry));
49 
50     if (PreprocessInfo != NULL) {
51         delete PreprocessInfo;
52     }
53 }
54 
55 _Must_inspect_result_
56 PWDFCXDEVICE_INIT
57 WDFCXDEVICE_INIT::_AllocateCxDeviceInit(
58     __in PWDFDEVICE_INIT DeviceInit
59     )
60 {
61     PFX_DRIVER_GLOBALS  fxDriverGlobals;
62     PWDFCXDEVICE_INIT   init;
63 
64     fxDriverGlobals = DeviceInit->DriverGlobals;
65 
66     init = new(fxDriverGlobals) WDFCXDEVICE_INIT();
67     if (init == NULL) {
68         DoTraceLevelMessage(fxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
69                         "WDFDRIVER 0x%p  couldn't allocate WDFCXDEVICE_INIT",
70                         DeviceInit->Driver);
71         return NULL;
72     }
73 
74     DeviceInit->AddCxDeviceInit(init);
75 
76     return init;
77 }
78 
79