35#pragma alloc_text(INIT, DriverEntry)
36#pragma alloc_text(PAGE, FreeBT_DriverUnload)
53 FreeBT_DbgPrint(1, (
"FBTUSB: Failed to allocate memory for registryPath\n"));
55 goto DriverEntry_Exit;
116 WCHAR wszDeviceName[255]={0};
118 LONG instanceNumber=0;
124 swprintf(wszDeviceName,
L"\\Device\\FbtUsb%02d", instanceNumber);
127 while (instanceNumber<99 && !
NT_SUCCESS(ntStatus))
129 swprintf(wszDeviceName,
L"\\Device\\FbtUsb%02d", instanceNumber);
131 FreeBT_DbgPrint(1, (
"FBTUSB: Attempting to create device %ws\n", wszDeviceName));
160 swprintf(deviceExtension->wszDosDeviceName,
L"\\DosDevices\\FbtUsb%02d", instanceNumber);
165 FreeBT_DbgPrint(1, (
"FBTUSB: Failed to create symbolic link %ws to %ws, status=0x%08x\n", deviceExtension->wszDosDeviceName, wszDeviceName, ntStatus));
171 FreeBT_DbgPrint(1, (
"FBTUSB: Created symbolic link %ws\n", deviceExtension->wszDosDeviceName));
177 deviceExtension->OpenHandleCount = 0;
181 deviceExtension->IdleReqPend = 0;
182 deviceExtension->PendingIdleIrp =
NULL;
201 deviceExtension->OutStandingIO = 1;
209 FreeBT_DbgPrint(1, (
"FBTUSB: FreeBT_WmiRegistration failed with %X\n", ntStatus));
239 if (
NULL == deviceExtension->TopOfStackDeviceObject)
252 &GUID_CLASS_FREEBT_USB,
254 &deviceExtension->InterfaceName);
291 deviceExtension->SSRegistryEnable = 0;
292 deviceExtension->SSEnable = 0;
300 (
PULONG)(&deviceExtension->SSRegistryEnable));
301 if (deviceExtension->SSRegistryEnable)
#define InterlockedIncrement
PDEVICE_OBJECT PhysicalDeviceObject
#define NT_SUCCESS(StatCode)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
DRIVER_INITIALIZE DriverEntry
#define KeInitializeEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
NTSTATUS NTAPI FreeBT_DispatchCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_DispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_DispatchDevCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_DispatchPnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_GetRegistryDword(IN PWCHAR RegPath, IN PWCHAR ValueName, IN OUT PULONG Value)
NTSTATUS NTAPI FreeBT_DispatchClean(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID NTAPI DpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
NTSTATUS NTAPI FreeBT_DispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_DispatchWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_DispatchRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI FreeBT_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
VOID NTAPI FreeBT_DriverUnload(IN PDRIVER_OBJECT DriverObject)
#define FreeBT_DbgPrint(level, _x_)
#define FREEBT_REGISTRY_PARAMETERS_PATH
#define INITIALIZE_PNP_STATE(_Data_)
#define ExAllocatePool(type, size)
NTSTATUS NTAPI FreeBT_WmiRegistration(IN OUT PDEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI FreeBT_WmiDeRegistration(IN OUT PDEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI FreeBT_DispatchSysCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
MxDeviceObject deviceObject
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
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 IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
NTSTATUS NTAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
BOOLEAN NTAPI IoIsWdmVersionAvailable(IN UCHAR MajorVersion, IN UCHAR MinorVersion)
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
#define FILE_DEVICE_UNKNOWN
#define IRP_MJ_DEVICE_CONTROL
UNICODE_STRING FreeBT_RegistryPath
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_NO_SUCH_DEVICE
#define STATUS_OBJECT_NAME_COLLISION
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
DRIVER_ADD_DEVICE * PDRIVER_ADD_DEVICE
#define IRP_MJ_SYSTEM_CONTROL