ReactOS 0.4.15-dev-8344-g0574987
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
14extern "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//
39typedef 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}
49DEVICE_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//
63{
66}
68
69//
70// device extension for Virtual FD device
71//
72typedef 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//
126NTAPI
130
131VOID
132NTAPI
135
137NTAPI
140 IN PIRP Irp);
141
143NTAPI
146 IN PIRP Irp);
147
149NTAPI
152 IN PIRP Irp);
153
154#ifdef VFD_PNP
155
157NTAPI
158VfdPlugAndPlay(
160 IN PIRP Irp);
161
163NTAPI
164VfdPowerControl(
166 IN PIRP Irp);
167
169NTAPI
170VfdSystemControl(
172 IN PIRP Irp);
173
175NTAPI
176VfdAddDevice(
179
180#endif // VFD_PNP
181
182//
183// Prototypes for private routines
184//
185
186//
187// vfddrv.c
188//
189extern ULONG OsMajorVersion;
190extern ULONG OsMinorVersion;
191extern ULONG OsBuildNumber;
192
193VOID
194NTAPI
196 IN PVOID ThreadContext);
197
198PWSTR
202
203VOID
206
207//
208// vfddev.c
209//
214
215VOID
218
219//
220// vfdioctl.c
221//
222VOID
224 IN PDEVICE_EXTENSION DeviceExtension,
225 IN PIRP Irp,
227
228//
229// vfdimg.c
230//
233 IN PDEVICE_EXTENSION DeviceExtension,
234 IN PVFD_IMAGE_INFO ImageInfo,
235 IN ULONG InputLength);
236
239 IN PDEVICE_EXTENSION DeviceExtension,
240 IN PVFD_IMAGE_INFO ImageInfo);
241
242VOID
244 IN PDEVICE_EXTENSION DeviceExtension);
245
248 IN PDEVICE_EXTENSION DeviceExtension,
249 OUT PVFD_IMAGE_INFO ImageInfo,
251#ifndef __REACTOS__
253#else
255#endif
256
257//
258// vfdrdwr.c
259//
260VOID
262 IN PDEVICE_EXTENSION DeviceExtension,
263 IN OUT PIRP Irp,
266
267VOID
269 IN PDEVICE_EXTENSION DeviceExtension,
270 IN OUT PIRP Irp,
273
274//
275// vfdlink.c
276//
279 IN PDEVICE_EXTENSION DeviceExtension,
280 IN CHAR DriveLetter);
281
284 IN PDEVICE_EXTENSION DeviceExtension);
285
288 IN PDEVICE_EXTENSION DeviceExtension,
290
291//
292// vfdfmt.c
293//
295
298 IN PDEVICE_EXTENSION DeviceExtension,
299 IN PFORMAT_PARAMETERS FormatParams,
300 IN ULONG InputLength,
302
305 IN PDEVICE_EXTENSION DeviceExtension,
306 IN PFORMAT_PARAMETERS FormatParams);
307
308//
309// vfdmnt.c
310//
311#ifdef VFD_MOUNT_MANAGER
312/*
313NTSTATUS
314VfdRegisterMountManager(
315 IN PDEVICE_EXTENSION DeviceExtension);
316*/
317
319VfdMountMgrNotifyVolume(
320 IN PDEVICE_EXTENSION DeviceExtension);
321
323VfdMountMgrMountPoint(
324 IN PDEVICE_EXTENSION DeviceExtension,
325 IN CHAR DriveLetter);
326
328VfdMountDevUniqueId(
329 IN PDEVICE_EXTENSION DeviceExtension,
330 OUT PMOUNTDEV_UNIQUE_ID UniqueId,
331 IN ULONG OutputLength,
333
335VfdMountDevDeviceName(
336 IN PDEVICE_EXTENSION DeviceExtension,
338 IN ULONG OutputLength,
340
342VfdMountDevSuggestedLink(
343 IN PDEVICE_EXTENSION DeviceExtension,
345 IN ULONG OutputLength,
347
349VfdMountDevLinkModified(
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_
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
DEVICE_STATE
Definition: i8042prt.h:15
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
const WCHAR * str
ANSI_STRING FileName
Definition: vfddrv.h:102
const DISK_GEOMETRY * Geometry
Definition: vfddrv.h:104
PUCHAR FileBuffer
Definition: vfddrv.h:108
PDEVICE_OBJECT DeviceObject
Definition: processr.h:16
PVFD_DRIVER_EXTENSION DriverExtension
Definition: vfddrv.h:117
ULONG MediaChangeCount
Definition: vfddrv.h:95
VFD_FILETYPE FileType
Definition: vfddrv.h:100
KSPIN_LOCK ListLock
Definition: vfddrv.h:87
CHAR DriveLetter
Definition: vfddrv.h:80
ULONG ImageSize
Definition: vfddrv.h:101
VFD_MEDIA MediaType
Definition: vfddrv.h:98
LIST_ENTRY ListHead
Definition: vfddrv.h:86
BOOLEAN TerminateThread
Definition: vfddrv.h:92
KEVENT RequestEvent
Definition: vfddrv.h:90
UNICODE_STRING InterfaceName
Definition: fbtusb.h:145
DEVSTATE DeviceState
Definition: fbtusb.h:162
PSECURITY_CLIENT_CONTEXT SecurityContext
Definition: vfddrv.h:83
HANDLE FileHandle
Definition: vfddrv.h:107
ULONG DeviceNumber
Definition: vfddrv.h:79
PVOID ThreadPointer
Definition: vfddrv.h:91
UNICODE_STRING DeviceName
Definition: vfddrv.h:78
VFD_FLAGS MediaFlags
Definition: vfddrv.h:99
Definition: typedefs.h:120
UNICODE_STRING RegistryPath
Definition: vfddrv.h:64
ULONG NumberOfDevices
Definition: vfddrv.h:65
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
NTSTATUS VfdFormatTrack(IN PDEVICE_EXTENSION DeviceExtension, IN PFORMAT_PARAMETERS FormatParams)
Definition: vfdfmt.c:153
struct _VFD_DRIVER_EXTENSION VFD_DRIVER_EXTENSION
struct _VFD_DRIVER_EXTENSION * PVFD_DRIVER_EXTENSION
VOID NTAPI VfdDeviceThread(IN PVOID ThreadContext)
Definition: vfddrv.c:404
struct _DEVICE_EXTENSION DEVICE_EXTENSION
VOID VfdDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: vfddev.c:296
NTSTATUS VfdFormatCheck(IN PDEVICE_EXTENSION DeviceExtension, IN PFORMAT_PARAMETERS FormatParams, IN ULONG InputLength, IN ULONG ControlCode)
ULONG OsBuildNumber
NTSTATUS NTAPI VfdDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfdioctl.c:29
NTSTATUS VfdQueryImage(IN PDEVICE_EXTENSION DeviceExtension, OUT PVFD_IMAGE_INFO ImageInfo, IN ULONG BufferLength, OUT PULONG ReturnLength)
Definition: vfdimg.c:466
VOID NTAPI VfdUnloadDriver(IN PDRIVER_OBJECT DriverObject)
Definition: vfddrv.c:250
VOID VfdReadData(IN PDEVICE_EXTENSION DeviceExtension, IN OUT PIRP Irp, IN ULONG Length, IN PLARGE_INTEGER Offset)
Definition: vfdrdwr.c:217
VOID VfdFreeUnicode(IN OUT PUNICODE_STRING str)
NTSTATUS VfdLoadLink(IN PDEVICE_EXTENSION DeviceExtension, IN PWSTR RegistryPath)
Definition: vfdlink.c:135
NTSTATUS NTAPI VfdReadWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfdrdwr.c:24
PWSTR VfdCopyUnicode(OUT PUNICODE_STRING dst, IN PUNICODE_STRING src)
VOID VfdCloseImage(IN PDEVICE_EXTENSION DeviceExtension)
Definition: vfdimg.c:435
NTSTATUS NTAPI VfdCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: vfddrv.c:312
NTSTATUS VfdCreateDevice(IN PDRIVER_OBJECT DriverObject, OUT PVOID Parameter)
Definition: vfddev.c:23
const DISK_GEOMETRY geom_tbl[VFD_MEDIA_MAX]
NTSTATUS VfdStoreLink(IN PDEVICE_EXTENSION DeviceExtension)
Definition: vfdlink.c:190
NTSTATUS VfdSetLink(IN PDEVICE_EXTENSION DeviceExtension, IN CHAR DriveLetter)
Definition: vfdlink.c:24
ULONG OsMajorVersion
NTSTATUS VfdOpenImage(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo)
Definition: vfdimg.c:104
struct _DEVICE_EXTENSION * PDEVICE_EXTENSION
VOID VfdIoCtlThread(IN PDEVICE_EXTENSION DeviceExtension, IN PIRP Irp, IN ULONG ControlCode)
Definition: vfdioctl.c:542
VOID VfdWriteData(IN PDEVICE_EXTENSION DeviceExtension, IN OUT PIRP Irp, IN ULONG Length, IN PLARGE_INTEGER Offset)
Definition: vfdrdwr.c:287
ULONG OsMinorVersion
NTSTATUS VfdOpenCheck(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo, IN ULONG InputLength)
UCHAR VFD_FILETYPE
Definition: vfdtypes.h:62
UCHAR VFD_MEDIA
Definition: vfdtypes.h:61
@ VFD_MEDIA_MAX
Definition: vfdtypes.h:43
UCHAR VFD_FLAGS
Definition: vfdtypes.h:63
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ PDEVICE_OBJECT PhysicalDevice
Definition: wdfdevice.h:2323
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:691
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336
char CHAR
Definition: xmlstorage.h:175