Go to the source code of this file.
|
NTSTATUS NTAPI | CreateSoundBlaster (PDEVICE_OBJECT DeviceObject, PIRP Irp) |
|
NTSTATUS NTAPI | CloseSoundBlaster (PDEVICE_OBJECT DeviceObject, PIRP Irp) |
|
NTSTATUS NTAPI | CleanupSoundBlaster (PDEVICE_OBJECT DeviceObject, PIRP Irp) |
|
NTSTATUS NTAPI | ControlSoundBlaster (PDEVICE_OBJECT DeviceObject, PIRP Irp) |
|
NTSTATUS NTAPI | WriteSoundBlaster (PDEVICE_OBJECT DeviceObject, PIRP Irp) |
|
VOID NTAPI | UnloadSoundBlaster (PDRIVER_OBJECT DriverObject) |
|
NTSTATUS NTAPI | OpenSubkey (PUNICODE_STRING RegistryPath, PWSTR Subkey, ACCESS_MASK DesiredAccess, OUT HANDLE *DevicesKeyHandle) |
|
PWSTR NTAPI | AllocateRegistryPathInfo (PUNICODE_STRING BasePath, PUNICODE_STRING ParametersPath, PKEY_BASIC_INFORMATION KeyInfo) |
|
NTSTATUS NTAPI | EnumerateSubkey (PUNICODE_STRING RegistryPath, PWSTR Subkey, PREGISTRY_CALLBACK_ROUTINE Callback, PDRIVER_OBJECT DriverObject) |
|
NTSTATUS | CreateDeviceName (PCWSTR PrePrefix, PCWSTR Prefix, UCHAR Index, PUNICODE_STRING DeviceName) |
|
NTSTATUS NTAPI | InitializeSoundBlaster (PDRIVER_OBJECT DriverObject, PWSTR RegistryPath) |
|
NTSTATUS NTAPI | DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) |
|
◆ EnumerateDeviceKeys
◆ FreeRegistryPathInfo
◆ NDEBUG
◆ TAG_REG_INFO
◆ TAG_REG_NAME
◆ AllocateRegistryPathInfo()
Definition at line 167 of file main.c.
171{
174
175 DPRINT(
"Allocating memory for path info\n");
180
183
186
191
196
200
203}
#define ExAllocatePool(type, size)
#define RtlCopyMemory(Destination, Source, Length)
Referenced by EnumerateSubkey().
◆ CleanupSoundBlaster()
Definition at line 58 of file main.c.
61{
62
63
64 DPRINT(
"CleanupSoundBlaster() called\n");
65
67 Irp->IoStatus.Information = 0;
68
70
72}
#define IoCompleteRequest
Referenced by DriverEntry().
◆ CloseSoundBlaster()
Definition at line 41 of file main.c.
44{
45
46
47 DPRINT(
"CloseSoundBlaster() called\n");
48
50 Irp->IoStatus.Information = 0;
51
53
55}
Referenced by DriverEntry().
◆ ControlSoundBlaster()
Definition at line 75 of file main.c.
78{
80
81
82 DPRINT(
"ControlSoundBlaster() called\n");
83
85
86 switch (
stack->Parameters.DeviceIoControl.IoControlCode)
87 {
88
89 };
90
92 Irp->IoStatus.Information = 0;
93
95
97}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
Referenced by DriverEntry().
◆ CreateDeviceName()
Definition at line 321 of file main.c.
326{
328 WCHAR number_buffer[5];
332
335
338 sizeof(number_buffer) +
340
343
346
349
351 {
352 number.Buffer = number_buffer;
353 number.MaximumLength =
sizeof(number_buffer);
354
357 }
358
360
362}
static unsigned int number
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)
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ __drv_aliasesMem PSTRING Prefix
Referenced by InitializeSoundBlaster().
◆ CreateSoundBlaster()
Definition at line 21 of file main.c.
24{
26
27 DPRINT(
"CreateSoundBlaster() called - extension 0x%x\n", sb_device);
28
30
31
33 Irp->IoStatus.Information = 0;
34
36
38}
_In_ PDEVICE_OBJECT DeviceObject
Referenced by DriverEntry().
◆ DriverEntry()
Definition at line 469 of file main.c.
472{
474
475 DPRINT(
"Sound Blaster driver 0.1 by Silver Blade\n");
476
484
485 DPRINT(
"Beginning device key enumeration\n");
486
488
490}
NTSTATUS NTAPI WriteSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI ControlSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
#define EnumerateDeviceKeys(path, callback, driver_obj)
NTSTATUS NTAPI CreateSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI CleanupSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTAPI InitializeSoundBlaster(PDRIVER_OBJECT DriverObject, PWSTR RegistryPath)
VOID NTAPI UnloadSoundBlaster(PDRIVER_OBJECT DriverObject)
NTSTATUS NTAPI CloseSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
#define IRP_MJ_DEVICE_CONTROL
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
◆ EnumerateSubkey()
Definition at line 213 of file main.c.
218{
221 HANDLE devices_key_handle;
222
225
227
230
232 {
237
238 status = ZwEnumerateKey(devices_key_handle,
239 key_index,
243 &result_length);
244
246 break;
247
249
251
253 {
254 DPRINT(
"Out of memory\n");
256 break;
257 }
258
259 status = ZwEnumerateKey(devices_key_handle,
260 key_index,
264 &result_length);
265
267 {
268 DPRINT(
"Unable to enumerate keys\n");
271 break;
272 }
273
274
276
278
280 {
281 DPRINT(
"Out of memory\n");
284 break;
285 }
286
288
289
291
293
295 {
296 DPRINT(
"Callback FAILED\n");
297 break;
298 }
299
300 key_index ++;
301 }
302
304
305 DPRINT(
"Found %d subkey entries\n", key_index);
306
309
312
314}
#define NT_SUCCESS(StatCode)
NTSTATUS NTAPI OpenSubkey(PUNICODE_STRING RegistryPath, PWSTR Subkey, ACCESS_MASK DesiredAccess, OUT HANDLE *DevicesKeyHandle)
#define FreeRegistryPathInfo(ptr)
PWSTR NTAPI AllocateRegistryPathInfo(PUNICODE_STRING BasePath, PUNICODE_STRING ParametersPath, PKEY_BASIC_INFORMATION KeyInfo)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define ExFreePoolWithTag(_P, _T)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
struct _KEY_BASIC_INFORMATION * PKEY_BASIC_INFORMATION
#define KEY_ENUMERATE_SUB_KEYS
#define STATUS_INTERNAL_ERROR
#define STATUS_NO_MORE_ENTRIES
#define STATUS_DEVICE_CONFIGURATION_ERROR
#define FIELD_OFFSET(t, f)
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
◆ InitializeSoundBlaster()
Definition at line 365 of file main.c.
368{
374
375 UCHAR device_index = 0;
376
377 DPRINT(
"Initializing a Sound Blaster device\n");
378
379
381 L"\\Device\\WaveOut",
382 device_index,
384
387
389 L"\\Device\\WaveOut" +
wcslen(
L"\\Device\\"),
390 device_index,
391 &dos_device_name);
392
394 {
395
397 }
398
400 DPRINT(
"Symlink: %wZ\n", &dos_device_name);
401
402
403
404
405
410 0,
412 &device_object);
413
416
419
421
424
426 {
428 device_object =
NULL;
430 }
431
432
433
434
435
436
437
439
446
447
448
449 DPRINT(
"Port %x IRQ %d DMA %d\n", parameters->
port, parameters->
irq, parameters->
dma);
450
451 DPRINT(
"Resetting the sound card\n");
452
454 {
455
457 }
458
459
460
461
462
463
465}
static const WCHAR device_name[]
NTSTATUS CreateDeviceName(PCWSTR PrePrefix, PCWSTR Prefix, UCHAR Index, PUNICODE_STRING DeviceName)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
#define FILE_DEVICE_SOUND
#define DEFAULT_BUFFER_SIZE
ULONG AlignmentRequirement
#define STATUS_UNSUCCESSFUL
Referenced by DriverEntry().
◆ OpenSubkey()
Definition at line 124 of file main.c.
129{
134
135
136
142
144
146 {
149 }
150
152
154 &subkey_name,
156 key_handle,
158
161
163}
#define OBJ_CASE_INSENSITIVE
#define InitializeObjectAttributes(p, n, a, r, s)
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Referenced by EnumerateSubkey().
◆ UnloadSoundBlaster()
◆ WriteSoundBlaster()
Definition at line 100 of file main.c.
103{
104
105
106 DPRINT(
"WriteSoundBlaster() called\n");
107
109 Irp->IoStatus.Information = 0;
110
112
114}
Referenced by DriverEntry().