4 Virtual Floppy Drive for Windows NT platform
5 Kernel mode driver: local header
7 Copyright(C) 2003-2005 Ken Kato
15 #pragma message("Compiled as C++ for testing purpose.")
23 // Tag used for ExAllocatePoolWithTag
25 #define VFD_POOL_TAG 'DFVx'
28 // PnP driver specific stuff
32 #if (VER_PRODUCTBUILD < 2195)
33 #error Cannot build a PnP version with the Windows NT DDK
34 #endif // (VER_PRODUCTBUILD < 2195)
37 // device state enumeration
39 typedef enum _DEVICE_STATE
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
49 DEVICE_STATE
, *PDEVICE_STATE
;
52 // use the address of the DriverEntry functions as the
53 // driver extension identifier
55 #define VFD_DRIVER_EXTENSION_ID ((PVOID)DriverEntry)
60 // driver extension for the VFD driver
62 typedef struct _VFD_DRIVER_EXTENSION
64 UNICODE_STRING RegistryPath
;
65 ULONG NumberOfDevices
;
67 VFD_DRIVER_EXTENSION
, *PVFD_DRIVER_EXTENSION
;
70 // device extension for Virtual FD device
72 typedef struct _DEVICE_EXTENSION
74 // back pointer to the device object
75 PDEVICE_OBJECT DeviceObject
;
78 UNICODE_STRING DeviceName
; // \Device\Floppy<n>
79 ULONG DeviceNumber
; // \??\VirtualFD<n>
80 CHAR DriveLetter
; // \DosDevices\<x>:
82 // Security context to access files on network drive
83 PSECURITY_CLIENT_CONTEXT SecurityContext
;
92 BOOLEAN TerminateThread
;
95 ULONG MediaChangeCount
;
100 VFD_FILETYPE FileType
;
102 ANSI_STRING FileName
;
104 const DISK_GEOMETRY
*Geometry
;
111 DEVICE_STATE DeviceState
; // Current device state
112 IO_REMOVE_LOCK RemoveLock
; // avoid abnormal removal
113 PDEVICE_OBJECT PhysicalDevice
;
114 PDEVICE_OBJECT TargetDevice
;
115 UNICODE_STRING InterfaceName
;
117 PVFD_DRIVER_EXTENSION DriverExtension
;
120 DEVICE_EXTENSION
, *PDEVICE_EXTENSION
;
123 // Stanard driver routines
128 IN PDRIVER_OBJECT DriverObject
,
129 IN PUNICODE_STRING RegistryPath
);
134 IN PDRIVER_OBJECT DriverObject
);
139 IN PDEVICE_OBJECT DeviceObject
,
145 IN PDEVICE_OBJECT DeviceObject
,
151 IN PDEVICE_OBJECT DeviceObject
,
159 IN PDEVICE_OBJECT DeviceObject
,
165 IN PDEVICE_OBJECT DeviceObject
,
171 IN PDEVICE_OBJECT DeviceObject
,
177 IN PDRIVER_OBJECT DriverObject
,
178 IN OUT PDEVICE_OBJECT PhysicalDevice
);
183 // Prototypes for private routines
189 extern ULONG OsMajorVersion
;
190 extern ULONG OsMinorVersion
;
191 extern ULONG OsBuildNumber
;
196 IN PVOID ThreadContext
);
200 OUT PUNICODE_STRING dst
,
201 IN PUNICODE_STRING src
);
205 IN OUT PUNICODE_STRING str
);
212 IN PDRIVER_OBJECT DriverObject
,
213 OUT PVOID Parameter
);
217 IN PDEVICE_OBJECT DeviceObject
);
224 IN PDEVICE_EXTENSION DeviceExtension
,
226 IN ULONG ControlCode
);
233 IN PDEVICE_EXTENSION DeviceExtension
,
234 IN PVFD_IMAGE_INFO ImageInfo
,
235 IN ULONG InputLength
);
239 IN PDEVICE_EXTENSION DeviceExtension
,
240 IN PVFD_IMAGE_INFO ImageInfo
);
244 IN PDEVICE_EXTENSION DeviceExtension
);
248 IN PDEVICE_EXTENSION DeviceExtension
,
249 OUT PVFD_IMAGE_INFO ImageInfo
,
250 IN ULONG BufferLength
,
251 OUT PULONG ReturnLength
);
258 IN PDEVICE_EXTENSION DeviceExtension
,
261 IN PLARGE_INTEGER Offset
);
265 IN PDEVICE_EXTENSION DeviceExtension
,
268 IN PLARGE_INTEGER Offset
);
275 IN PDEVICE_EXTENSION DeviceExtension
,
276 IN CHAR DriveLetter
);
280 IN PDEVICE_EXTENSION DeviceExtension
);
284 IN PDEVICE_EXTENSION DeviceExtension
,
285 IN PWSTR RegistryPath
);
290 extern const DISK_GEOMETRY geom_tbl
[VFD_MEDIA_MAX
];
294 IN PDEVICE_EXTENSION DeviceExtension
,
295 IN PFORMAT_PARAMETERS FormatParams
,
296 IN ULONG InputLength
,
297 IN ULONG ControlCode
);
301 IN PDEVICE_EXTENSION DeviceExtension
,
302 IN PFORMAT_PARAMETERS FormatParams
);
307 #ifdef VFD_MOUNT_MANAGER
310 VfdRegisterMountManager(
311 IN PDEVICE_EXTENSION DeviceExtension);
315 VfdMountMgrNotifyVolume(
316 IN PDEVICE_EXTENSION DeviceExtension
);
319 VfdMountMgrMountPoint(
320 IN PDEVICE_EXTENSION DeviceExtension
,
321 IN CHAR DriveLetter
);
325 IN PDEVICE_EXTENSION DeviceExtension
,
326 OUT PMOUNTDEV_UNIQUE_ID UniqueId
,
327 IN ULONG OutputLength
,
328 OUT PIO_STATUS_BLOCK IoStatus
);
331 VfdMountDevDeviceName(
332 IN PDEVICE_EXTENSION DeviceExtension
,
333 OUT PMOUNTDEV_NAME DeviceName
,
334 IN ULONG OutputLength
,
335 OUT PIO_STATUS_BLOCK IoStatus
);
338 VfdMountDevSuggestedLink(
339 IN PDEVICE_EXTENSION DeviceExtension
,
340 OUT PMOUNTDEV_SUGGESTED_LINK_NAME LinkName
,
341 IN ULONG OutputLength
,
342 OUT PIO_STATUS_BLOCK IoStatus
);
345 VfdMountDevLinkModified(
346 IN PDEVICE_EXTENSION DeviceExtension
,
347 IN PMOUNTDEV_NAME LinkName
,
348 IN ULONG InputLength
,
349 IN ULONG ControlCode
);
351 #endif // VFD_MOUNT_MANAGER
355 #endif // __cplusplus