15#pragma alloc_text(PAGE, VfdCreateDevice)
16#pragma alloc_text(PAGE, VfdDeleteDevice)
31 WCHAR name_buffer[40];
38 VFDTRACE(VFDINFO | VFDDEV, (
"[VFD] VfdCreateDevice - IN\n"));
53 if (driver_extension ==
NULL) {
54 VFDTRACE(VFDERR, (
"[VFD] Failed to get the driver extension\n"));
68 _snwprintf(name_buffer,
sizeof(name_buffer) - 1,
69 L"\\Device\\Floppy%lu", physical_num);
74 L"\\Device\\Floppy%lu", physical_num);
93 while (++physical_num < 100);
97 (
"[VFD] IoCreateDevice() %s\n",
105 (
"[VFD] Created a device object %ws\n", name_buffer));
129 (
"[VFD] Failed to allocate device name buffer\n"));
143 _snwprintf(name_buffer,
sizeof(name_buffer) - 1,
161 (
"[VFD] IoCreateSymbolicLink(%ws) %s\n",
162 name_buffer, GetStatusName(
status)));
167 (
"[VFD] Created a symbolic link %ws\n", name_buffer));
195 (
"[VFD] PsCreateSystemThread() %s\n",
214 (
"[VFD] ObReferenceObjectByHandle() %s\n",
234 device_object->
Flags &= ~DO_DEVICE_INITIALIZING;
246 VFDTRACE(VFDINFO | VFDDEV, (
"[VFD] VfdCreateDevice - OK\n"));
271 (
"[VFD] Deleting symbolic link %ws\n", name_buffer));
276 VFDTRACE(VFDINFO|VFDDEV, (
"[VFD] Deleting device %ws\n",
286 (
"[VFD] VfdCreateDevice - %s\n",
302 WCHAR name_buffer[40];
304 VFDTRACE(VFDINFO|VFDDEV, (
"[VFD] VfdDeleteDevice - IN\n"));
318 if (driver_extension) {
373 _snwprintf(name_buffer,
sizeof(name_buffer) - 1,
387 (
"[VFD] Deleting link %ws\n", name_buffer));
394#ifdef VFD_MOUNT_MANAGER
415 (
"[VFD] Deleting device %ws\n",
427 (
"[VFD] VfdDeleteDevice - OUT\n"));
struct _device_extension device_extension
#define FILE_DEVICE_SECURE_OPEN
#define NT_SUCCESS(StatCode)
static void cleanup(void)
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
#define SeDeleteClientSecurity(C)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_FLOPPY_DISKETTE
#define FILE_REMOVABLE_MEDIA
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
NTSTATUS NTAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
#define STATUS_OBJECT_NAME_EXISTS
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
UNICODE_STRING RegistryPath
#define RtlZeroMemory(Destination, Length)
#define STATUS_DRIVER_INTERNAL_ERROR
#define STATUS_OBJECT_NAME_COLLISION
#define STATUS_INSUFFICIENT_RESOURCES
#define VFDTRACE(LEVEL, STRING)
VOID VfdDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS VfdCreateDevice(IN PDRIVER_OBJECT DriverObject, OUT PVOID Parameter)
VOID NTAPI VfdDeviceThread(IN PVOID ThreadContext)
PWSTR VfdCopyUnicode(PUNICODE_STRING dst, PUNICODE_STRING src)
struct _VFD_DRIVER_EXTENSION * PVFD_DRIVER_EXTENSION
NTSTATUS VfdLoadLink(IN PDEVICE_EXTENSION DeviceExtension, IN PWSTR RegistryPath)
const DISK_GEOMETRY geom_tbl[VFD_MEDIA_MAX]
NTSTATUS VfdSetLink(IN PDEVICE_EXTENSION DeviceExtension, IN CHAR DriveLetter)
#define VFD_DEVICE_BASENAME
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
#define ObDereferenceObject
_Inout_opt_ PVOID Parameter