27 DPRINT(
"CreateSoundBlaster() called - extension 0x%x\n", sb_device);
33 Irp->IoStatus.Information = 0;
47 DPRINT(
"CloseSoundBlaster() called\n");
50 Irp->IoStatus.Information = 0;
64 DPRINT(
"CleanupSoundBlaster() called\n");
67 Irp->IoStatus.Information = 0;
82 DPRINT(
"ControlSoundBlaster() called\n");
86 switch (
stack->Parameters.DeviceIoControl.IoControlCode)
92 Irp->IoStatus.Information = 0;
106 DPRINT(
"WriteSoundBlaster() called\n");
109 Irp->IoStatus.Information = 0;
120 DPRINT(
"Sound Blaster driver unload\n");
175 DPRINT(
"Allocating memory for path info\n");
205#define FreeRegistryPathInfo(ptr) \
209#define TAG_REG_INFO 'RegI'
210#define TAG_REG_NAME 'RegN'
221 HANDLE devices_key_handle;
238 status = ZwEnumerateKey(devices_key_handle,
254 DPRINT(
"Out of memory\n");
259 status = ZwEnumerateKey(devices_key_handle,
268 DPRINT(
"Unable to enumerate keys\n");
281 DPRINT(
"Out of memory\n");
296 DPRINT(
"Callback FAILED\n");
305 DPRINT(
"Found %d subkey entries\n", key_index);
316#define EnumerateDeviceKeys(path, callback, driver_obj) \
317 EnumerateSubkey(path, L"Devices", callback, driver_obj)
328 WCHAR number_buffer[5];
338 sizeof(number_buffer) +
352 number.Buffer = number_buffer;
353 number.MaximumLength =
sizeof(number_buffer);
375 UCHAR device_index = 0;
377 DPRINT(
"Initializing a Sound Blaster device\n");
381 L"\\Device\\WaveOut",
389 L"\\Device\\WaveOut" +
wcslen(
L"\\Device\\"),
400 DPRINT(
"Symlink: %wZ\n", &dos_device_name);
428 device_object =
NULL;
449 DPRINT(
"Port %x IRQ %d DMA %d\n", parameters->
port, parameters->
irq, parameters->
dma);
451 DPRINT(
"Resetting the sound card\n");
475 DPRINT(
"Sound Blaster driver 0.1 by Silver Blade\n");
485 DPRINT(
"Beginning device key enumeration\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define NT_SUCCESS(StatCode)
DRIVER_INITIALIZE DriverEntry
static const WCHAR device_name[]
NTSTATUS NTAPI WriteSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI OpenSubkey(PUNICODE_STRING RegistryPath, PWSTR Subkey, ACCESS_MASK DesiredAccess, OUT HANDLE *DevicesKeyHandle)
NTSTATUS NTAPI ControlSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
#define EnumerateDeviceKeys(path, callback, driver_obj)
#define FreeRegistryPathInfo(ptr)
NTSTATUS NTAPI CreateSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI EnumerateSubkey(PUNICODE_STRING RegistryPath, PWSTR Subkey, PREGISTRY_CALLBACK_ROUTINE Callback, PDRIVER_OBJECT DriverObject)
NTSTATUS NTAPI CleanupSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS CreateDeviceName(PCWSTR PrePrefix, PCWSTR Prefix, UCHAR Index, PUNICODE_STRING DeviceName)
NTSTATUS NTAPI InitializeSoundBlaster(PDRIVER_OBJECT DriverObject, PWSTR RegistryPath)
VOID NTAPI UnloadSoundBlaster(PDRIVER_OBJECT DriverObject)
PWSTR NTAPI AllocateRegistryPathInfo(PUNICODE_STRING BasePath, PUNICODE_STRING ParametersPath, PKEY_BASIC_INFORMATION KeyInfo)
NTSTATUS NTAPI CloseSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define ExAllocatePool(type, size)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
#define ExFreePoolWithTag(_P, _T)
static unsigned int number
#define InitializeObjectAttributes(p, n, a, r, s)
REGISTRY_CALLBACK_ROUTINE * PREGISTRY_CALLBACK_ROUTINE
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _KEY_BASIC_INFORMATION * PKEY_BASIC_INFORMATION
#define KEY_ENUMERATE_SUB_KEYS
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
#define FILE_BYTE_ALIGNMENT
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)
#define IoCompleteRequest
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
#define STATUS_INTERNAL_ERROR
#define STATUS_NO_MORE_ENTRIES
#define STATUS_DEVICE_CONFIGURATION_ERROR
#define FILE_DEVICE_SOUND
#define IRP_MJ_DEVICE_CONTROL
#define DEFAULT_BUFFER_SIZE
ULONG AlignmentRequirement
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_In_ __drv_aliasesMem PSTRING Prefix