ReactOS  0.4.13-dev-242-g611e6d7
vfddrv.h
Go to the documentation of this file.
1 /*
2  vfddrv.h
3 
4  Virtual Floppy Drive for Windows NT platform
5  Kernel mode driver: local header
6 
7  Copyright(C) 2003-2005 Ken Kato
8 */
9 
10 #ifndef _VFDDRV_H_
11 #define _VFDDRV_H_
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #pragma message("Compiled as C++ for testing purpose.")
16 #endif // __cplusplus
17 
18 #include "vfdtypes.h"
19 #include "vfdio.h"
20 #include "vfdver.h"
21 
22 //
23 // Tag used for ExAllocatePoolWithTag
24 //
25 #define VFD_POOL_TAG 'DFVx'
26 
27 //
28 // PnP driver specific stuff
29 //
30 #ifdef VFD_PNP
31 
32 #if (VER_PRODUCTBUILD < 2195)
33 #error Cannot build a PnP version with the Windows NT DDK
34 #endif // (VER_PRODUCTBUILD < 2195)
35 
36 //
37 // device state enumeration
38 //
39 typedef enum _DEVICE_STATE
40 {
41  VFD_STOPPED, // Dvice stopped
42  VFD_WORKING, // Started and working
43  VFD_PENDINGSTOP, // Stop pending
44  VFD_PENDINGREMOVE, // Remove pending
45  VFD_SURPRISEREMOVED, // Surprise removed
46  VFD_REMOVED, // Removed
47  VFD_MAX_STATE // Unknown state -Some error
48 }
49 DEVICE_STATE, *PDEVICE_STATE;
50 
51 //
52 // use the address of the DriverEntry functions as the
53 // driver extension identifier
54 //
55 #define VFD_DRIVER_EXTENSION_ID ((PVOID)DriverEntry)
56 
57 #endif // VFD_PNP
58 
59 //
60 // driver extension for the VFD driver
61 //
62 typedef struct _VFD_DRIVER_EXTENSION
63 {
66 }
68 
69 //
70 // device extension for Virtual FD device
71 //
72 typedef struct _DEVICE_EXTENSION
73 {
74  // back pointer to the device object
76 
77  // device information
78  UNICODE_STRING DeviceName; // \Device\Floppy<n>
79  ULONG DeviceNumber; // \??\VirtualFD<n>
80  CHAR DriveLetter; // \DosDevices<x>:
81 
82  // Security context to access files on network drive
84 
85  // IRP queue list
88 
89  // device thread
93 
94  // drive information
96 
97  // media information
103 
106 
109 
110 #ifdef VFD_PNP
111  DEVICE_STATE DeviceState; // Current device state
112  IO_REMOVE_LOCK RemoveLock; // avoid abnormal removal
116 #else // VFD_PNP
118 #endif // VFD_PNP
119 }
121 
122 //
123 // Stanard driver routines
124 //
125 NTSTATUS
126 NTAPI
130 
131 VOID
132 NTAPI
135 
136 NTSTATUS
137 NTAPI
140  IN PIRP Irp);
141 
142 NTSTATUS
143 NTAPI
146  IN PIRP Irp);
147 
148 NTSTATUS
149 NTAPI
152  IN PIRP Irp);
153 
154 #ifdef VFD_PNP
155 
156 NTSTATUS
157 NTAPI
158 VfdPlugAndPlay(
160  IN PIRP Irp);
161 
162 NTSTATUS
163 NTAPI
164 VfdPowerControl(
166  IN PIRP Irp);
167 
168 NTSTATUS
169 NTAPI
170 VfdSystemControl(
172  IN PIRP Irp);
173 
174 NTSTATUS
175 NTAPI
176 VfdAddDevice(
178  IN OUT PDEVICE_OBJECT PhysicalDevice);
179 
180 #endif // VFD_PNP
181 
182 //
183 // Prototypes for private routines
184 //
185 
186 //
187 // vfddrv.c
188 //
189 extern ULONG OsMajorVersion;
190 extern ULONG OsMinorVersion;
191 extern ULONG OsBuildNumber;
192 
193 VOID
194 NTAPI
196  IN PVOID ThreadContext);
197 
198 PWSTR
202 
203 VOID
206 
207 //
208 // vfddev.c
209 //
210 NTSTATUS
214 
215 VOID
218 
219 //
220 // vfdioctl.c
221 //
222 VOID
224  IN PDEVICE_EXTENSION DeviceExtension,
225  IN PIRP Irp,
227 
228 //
229 // vfdimg.c
230 //
231 NTSTATUS
233  IN PDEVICE_EXTENSION DeviceExtension,
234  IN PVFD_IMAGE_INFO ImageInfo,
235  IN ULONG InputLength);
236 
237 NTSTATUS
239  IN PDEVICE_EXTENSION DeviceExtension,
240  IN PVFD_IMAGE_INFO ImageInfo);
241 
242 VOID
244  IN PDEVICE_EXTENSION DeviceExtension);
245 
246 NTSTATUS
248  IN PDEVICE_EXTENSION DeviceExtension,
249  OUT PVFD_IMAGE_INFO ImageInfo,
251 #ifndef __REACTOS__
253 #else
255 #endif
256 
257 //
258 // vfdrdwr.c
259 //
260 VOID
262  IN PDEVICE_EXTENSION DeviceExtension,
263  IN OUT PIRP Irp,
264  IN ULONG Length,
266 
267 VOID
269  IN PDEVICE_EXTENSION DeviceExtension,
270  IN OUT PIRP Irp,
271  IN ULONG Length,
273 
274 //
275 // vfdlink.c
276 //
277 NTSTATUS
278 VfdSetLink(
279  IN PDEVICE_EXTENSION DeviceExtension,
280  IN CHAR DriveLetter);
281 
282 NTSTATUS
284  IN PDEVICE_EXTENSION DeviceExtension);
285 
286 NTSTATUS
288  IN PDEVICE_EXTENSION DeviceExtension,
290 
291 //
292 // vfdfmt.c
293 //
294 extern const DISK_GEOMETRY geom_tbl[VFD_MEDIA_MAX];
295 
296 NTSTATUS
298  IN PDEVICE_EXTENSION DeviceExtension,
299  IN PFORMAT_PARAMETERS FormatParams,
300  IN ULONG InputLength,
302 
303 NTSTATUS
305  IN PDEVICE_EXTENSION DeviceExtension,
306  IN PFORMAT_PARAMETERS FormatParams);
307 
308 //
309 // vfdmnt.c
310 //
311 #ifdef VFD_MOUNT_MANAGER
312 /*
313 NTSTATUS
314 VfdRegisterMountManager(
315  IN PDEVICE_EXTENSION DeviceExtension);
316 */
317 
318 NTSTATUS
319 VfdMountMgrNotifyVolume(
320  IN PDEVICE_EXTENSION DeviceExtension);
321 
322 NTSTATUS
323 VfdMountMgrMountPoint(
324  IN PDEVICE_EXTENSION DeviceExtension,
325  IN CHAR DriveLetter);
326 
327 NTSTATUS
328 VfdMountDevUniqueId(
329  IN PDEVICE_EXTENSION DeviceExtension,
330  OUT PMOUNTDEV_UNIQUE_ID UniqueId,
331  IN ULONG OutputLength,
333 
334 NTSTATUS
335 VfdMountDevDeviceName(
336  IN PDEVICE_EXTENSION DeviceExtension,
338  IN ULONG OutputLength,
340 
341 NTSTATUS
342 VfdMountDevSuggestedLink(
343  IN PDEVICE_EXTENSION DeviceExtension,
345  IN ULONG OutputLength,
347 
348 NTSTATUS
349 VfdMountDevLinkModified(
350  IN PDEVICE_EXTENSION DeviceExtension,
351  IN PMOUNTDEV_NAME LinkName,
352  IN ULONG InputLength,
354 
355 #endif // VFD_MOUNT_MANAGER
356 
357 #ifdef __cplusplus
358 }
359 #endif // __cplusplus
360 
361 #endif // _VFDDRV_H_
PVOID ThreadPointer
Definition: vfddrv.h:91
DEVICE_STATE
Definition: i8042prt.h:14
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define IN
Definition: typedefs.h:38
VFD_FLAGS MediaFlags
Definition: vfddrv.h:99
BOOLEAN TerminateThread
Definition: vfddrv.h:92
LIST_ENTRY ListHead
Definition: vfddrv.h:86
VFD_MEDIA MediaType
Definition: vfddrv.h:98
PUCHAR FileBuffer
Definition: vfddrv.h:108
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:688
PVFD_DRIVER_EXTENSION DriverExtension
Definition: vfddrv.h:117
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI VfdUnloadDriver(IN PDRIVER_OBJECT DriverObject)
Definition: vfddrv.c:250
NTSTATUS VfdLoadLink(IN PDEVICE_EXTENSION DeviceExtension, IN PWSTR RegistryPath)
Definition: vfdlink.c:135
KSPIN_LOCK ListLock
Definition: vfddrv.h:87
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS NTAPI VfdDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfdioctl.c:29
CHAR DriveLetter
Definition: vfddrv.h:80
unsigned char * PUCHAR
Definition: retypes.h:3
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
VOID VfdFreeUnicode(IN OUT PUNICODE_STRING str)
NTSTATUS VfdQueryImage(IN PDEVICE_EXTENSION DeviceExtension, OUT PVFD_IMAGE_INFO ImageInfo, IN ULONG BufferLength, OUT PULONG ReturnLength)
Definition: vfdimg.c:466
ULONG OsBuildNumber
VOID VfdReadData(IN PDEVICE_EXTENSION DeviceExtension, IN OUT PIRP Irp, IN ULONG Length, IN PLARGE_INTEGER Offset)
Definition: vfdrdwr.c:217
NTSTATUS VfdStoreLink(IN PDEVICE_EXTENSION DeviceExtension)
Definition: vfdlink.c:190
NTSTATUS VfdCreateDevice(IN PDRIVER_OBJECT DriverObject, OUT PVOID Parameter)
Definition: vfddev.c:23
UCHAR VFD_FLAGS
Definition: vfdtypes.h:63
KEVENT RequestEvent
Definition: vfddrv.h:90
WCHAR DeviceName[]
Definition: adapter.cpp:21
_In_ PVOID Parameter
Definition: ldrtypes.h:240
UNICODE_STRING DeviceName
Definition: class2.h:135
ULONG NumberOfDevices
Definition: vfddrv.h:65
ANSI_STRING FileName
Definition: vfddrv.h:102
const DISK_GEOMETRY * Geometry
Definition: vfddrv.h:104
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG BufferLength
Definition: usbdlib.h:225
const WCHAR * str
unsigned char BOOLEAN
DEVSTATE DeviceState
Definition: fbtusb.h:162
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
PWSTR VfdCopyUnicode(OUT PUNICODE_STRING dst, IN PUNICODE_STRING src)
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
VOID VfdIoCtlThread(IN PDEVICE_EXTENSION DeviceExtension, IN PIRP Irp, IN ULONG ControlCode)
Definition: vfdioctl.c:542
ULONG MediaChangeCount
Definition: class2.h:134
NTSTATUS VfdFormatTrack(IN PDEVICE_EXTENSION DeviceExtension, IN PFORMAT_PARAMETERS FormatParams)
Definition: vfdfmt.c:153
VOID NTAPI VfdDeviceThread(IN PVOID ThreadContext)
Definition: vfddrv.c:404
NTSTATUS VfdFormatCheck(IN PDEVICE_EXTENSION DeviceExtension, IN PFORMAT_PARAMETERS FormatParams, IN ULONG InputLength, IN ULONG ControlCode)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID VfdWriteData(IN PDEVICE_EXTENSION DeviceExtension, IN OUT PIRP Irp, IN ULONG Length, IN PLARGE_INTEGER Offset)
Definition: vfdrdwr.c:287
ULONG ImageSize
Definition: vfddrv.h:101
UCHAR VFD_FILETYPE
Definition: vfdtypes.h:62
NTSTATUS VfdSetLink(IN PDEVICE_EXTENSION DeviceExtension, IN CHAR DriveLetter)
Definition: vfdlink.c:24
const DISK_GEOMETRY geom_tbl[VFD_MEDIA_MAX]
VOID VfdCloseImage(IN PDEVICE_EXTENSION DeviceExtension)
Definition: vfdimg.c:435
PSECURITY_CLIENT_CONTEXT SecurityContext
Definition: vfddrv.h:83
UNICODE_STRING InterfaceName
Definition: fbtusb.h:145
Definition: typedefs.h:117
GLenum src
Definition: glext.h:6340
struct _DEVICE_EXTENSION DEVICE_EXTENSION
VOID VfdDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: vfddev.c:296
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG OsMajorVersion
NTSTATUS NTAPI VfdReadWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfdrdwr.c:24
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
ULONG OsMinorVersion
PDEVICE_OBJECT DeviceObject
Definition: mntmgr.h:15
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
GLenum GLenum dst
Definition: glext.h:6340
NTSTATUS VfdOpenImage(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo)
Definition: vfdimg.c:104
unsigned int * PULONG
Definition: retypes.h:1
UNICODE_STRING RegistryPath
Definition: vfddrv.h:64
HANDLE FileHandle
Definition: vfddrv.h:107
#define OUT
Definition: typedefs.h:39
struct _VFD_DRIVER_EXTENSION * PVFD_DRIVER_EXTENSION
unsigned int ULONG
Definition: retypes.h:1
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
PDEVICE_OBJECT PhysicalDevice
Definition: class2.h:115
ULONG DeviceNumber
Definition: class2.h:118
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
NTSTATUS VfdOpenCheck(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo, IN ULONG InputLength)
VFD_FILETYPE FileType
Definition: vfddrv.h:100
struct _DEVICE_EXTENSION * PDEVICE_EXTENSION
struct _VFD_DRIVER_EXTENSION VFD_DRIVER_EXTENSION
NTSTATUS NTAPI VfdCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfddrv.c:312