1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     corepriv.hpp
8 
9 Abstract:
10 
11     This is the main driver framework.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19     Both kernel and user mode
20 
21 Revision History:
22 
23 --*/
24 
25 #pragma once
26 
27 #if ((FX_CORE_MODE)==(FX_CORE_USER_MODE))
28 #define FX_IS_USER_MODE (TRUE)
29 #define FX_IS_KERNEL_MODE (FALSE)
30 #elif ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
31 #define FX_IS_USER_MODE (FALSE)
32 #define FX_IS_KERNEL_MODE (TRUE)
33 #endif
34 
35 extern "C" {
36 #include "mx.h"
37 }
38 
39 #include "fxmin.hpp"
40 
41 
42 
43 #include "wdfmemory.h"
44 #include "wdfrequest.h"
45 #include "wdfdevice.h"
46 #include "wdfwmi.h"
47 #include "wdfchildlist.h"
48 #include "wdfpdo.h"
49 #include "wdffdo.h"
50 #include "wdfiotarget.h"
51 #include "wdfcontrol.h"
52 #include "wdfcx.h"
53 #include "wdfio.h"
54 #include "wdfqueryinterface.h"
55 
56 #include "fxirpqueue.hpp"
57 #include "fxcallback.hpp"
58 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
59 #include "fxirpum.hpp"
60 #elif ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
61 #include "fxirpkm.hpp"
62 #endif
63 #include "fxtransactionedlist.hpp"
64 
65 #include "fxcollection.hpp"
66 #include "fxdeviceinitshared.hpp"
67 #include "fxdevicetomxinterface.hpp"
68 #include "fxrequestcontext.hpp"
69 #include "fxrequestcontexttypes.h"
70 #include "fxrequestbase.hpp"
71 #include "fxrequestbuffer.hpp"
72 #include "ifxmemory.hpp"
73 #include "fxiotarget.hpp"
74 #include "fxiotargetremote.hpp"
75 #include "fxiotargetself.hpp"
76 
77 
78 
79 
80 
81 
82 
83 //
84 // Versioning of structures for wdfIoTarget.h
85 //
86 typedef struct _WDF_IO_TARGET_OPEN_PARAMS_V1_11 {
87     //
88     // Size of this structure in bytes
89     //
90     ULONG Size;
91 
92     //
93     // Indicates which fields of this structure are going to be used in
94     // creating the WDFIOTARGET.
95     //
96     WDF_IO_TARGET_OPEN_TYPE Type;
97 
98     //
99     // Notification when the target is being queried for removal.
100     // If !NT_SUCCESS is returned, the query will fail and the target will
101     // remain opened.
102     //
103     PFN_WDF_IO_TARGET_QUERY_REMOVE EvtIoTargetQueryRemove;
104 
105     //
106     // The previous query remove has been canceled and the target can now be
107     // reopened.
108     //
109     PFN_WDF_IO_TARGET_REMOVE_CANCELED EvtIoTargetRemoveCanceled;
110 
111     //
112     // The query remove has succeeded and the target is now removed from the
113     // system.
114     //
115     PFN_WDF_IO_TARGET_REMOVE_COMPLETE EvtIoTargetRemoveComplete;
116 
117     // ========== WdfIoTargetOpenUseExistingDevice begin ==========
118     //
119     // The device object to send requests to
120     //
121     PDEVICE_OBJECT TargetDeviceObject;
122 
123     //
124     // File object representing the TargetDeviceObject.  The PFILE_OBJECT will
125     // be passed as a parameter in all requests sent to the resulting
126     // WDFIOTARGET.
127     //
128     PFILE_OBJECT TargetFileObject;
129 
130     // ========== WdfIoTargetOpenUseExistingDevice end ==========
131     //
132     // ========== WdfIoTargetOpenByName begin ==========
133     //
134     // Name of the device to open.
135     //
136     UNICODE_STRING TargetDeviceName;
137 
138     //
139     // The access desired on the device being opened up, ie WDM FILE_XXX_ACCESS
140     // such as FILE_ANY_ACCESS, FILE_SPECIAL_ACCESS, FILE_READ_ACCESS, or
141     // FILE_WRITE_ACCESS or you can use values such as GENERIC_READ,
142     // GENERIC_WRITE, or GENERIC_ALL.
143     //
144     ACCESS_MASK DesiredAccess;
145 
146     //
147     // Share access desired on the target being opened, ie WDM FILE_SHARE_XXX
148     // values such as FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE.
149     //
150     // A zero value means exclusive access to the target.
151     //
152     ULONG ShareAccess;
153 
154     //
155     // File  attributes, see ZwCreateFile in the DDK for a list of valid
156     // values and their meaning.
157     //
158     ULONG FileAttributes;
159 
160     //
161     // Create disposition, see ZwCreateFile in the DDK for a list of valid
162     // values and their meaning.
163     //
164     ULONG CreateDisposition;
165 
166     //
167     // Options for opening the device, see CreateOptions for ZwCreateFile in the
168     // DDK for a list of valid values and their meaning.
169     //
170     ULONG CreateOptions;
171 
172     PVOID EaBuffer;
173 
174     ULONG EaBufferLength;
175 
176     PLONGLONG AllocationSize;
177 
178     // ========== WdfIoTargetOpenByName end ==========
179     //
180     //
181     // On return for a create by name, this will contain one of the following
182     // values:  FILE_CREATED, FILE_OPENED, FILE_OVERWRITTEN, FILE_SUPERSEDED,
183     // FILE_EXISTS, FILE_DOES_NOT_EXIST
184     //
185     ULONG FileInformation;
186 
187 } WDF_IO_TARGET_OPEN_PARAMS_V1_11, *PWDF_IO_TARGET_OPEN_PARAMS_V1_11;
188