ReactOS  0.4.15-dev-1397-g19779b3
main.c File Reference
#include <sndblst.h>
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define FreeRegistryPathInfo(ptr)   ExFreePool(ptr)
 
#define TAG_REG_INFO   'RegI'
 
#define TAG_REG_NAME   'RegN'
 
#define EnumerateDeviceKeys(path, callback, driver_obj)   EnumerateSubkey(path, L"Devices", callback, driver_obj)
 

Functions

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)
 

Macro Definition Documentation

◆ EnumerateDeviceKeys

#define EnumerateDeviceKeys (   path,
  callback,
  driver_obj 
)    EnumerateSubkey(path, L"Devices", callback, driver_obj)

Definition at line 316 of file main.c.

◆ FreeRegistryPathInfo

#define FreeRegistryPathInfo (   ptr)    ExFreePool(ptr)

Definition at line 205 of file main.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file main.c.

◆ TAG_REG_INFO

#define TAG_REG_INFO   'RegI'

Definition at line 209 of file main.c.

◆ TAG_REG_NAME

#define TAG_REG_NAME   'RegN'

Definition at line 210 of file main.c.

Function Documentation

◆ AllocateRegistryPathInfo()

PWSTR NTAPI AllocateRegistryPathInfo ( PUNICODE_STRING  BasePath,
PUNICODE_STRING  ParametersPath,
PKEY_BASIC_INFORMATION  KeyInfo 
)

Definition at line 167 of file main.c.

171 {
172  PWSTR name;
173  PWSTR pos;
174 
175  DPRINT("Allocating memory for path info\n");
177  BasePath->Length + sizeof(WCHAR) +
178  ParametersPath->Length + sizeof(WCHAR) +
179  KeyInfo->NameLength + sizeof(UNICODE_NULL));
180 
181  if ( ! name )
182  return NULL;
183 
184  DPRINT("Copying info\n");
185  pos = name;
186 
187  RtlCopyMemory((PVOID)Pos, (PVOID)BasePath->Buffer, BasePath->Length);
188  pos += BasePath->Length / sizeof(WCHAR);
189  pos[0] = '\\';
190  pos ++;
191 
192  RtlCopyMemory((PVOID)Pos, (PVOID)ParametersPath->Buffer, ParametersPath->Length);
193  pos += ParametersPath->Length / sizeof(WCHAR);
194  pos[0] = '\\';
195  pos ++;
196 
197  RtlCopyMemory((PVOID)Pos, (PVOID)ParametersPath->Buffer, ParametersPath->Length);
198  pos += KeyInfo->NameLength / sizeof(WCHAR);
199  pos[0] = UNICODE_NULL;
200 
201  DPRINT("All OK\n");
202  return name;
203 }
uint16_t * PWSTR
Definition: typedefs.h:56
ush Pos
Definition: deflate.h:92
const char * name
Definition: main.c:224
#define UNICODE_NULL
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define NULL
Definition: types.h:112
Definition: name.c:38
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by EnumerateSubkey().

◆ CleanupSoundBlaster()

NTSTATUS NTAPI CleanupSoundBlaster ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 58 of file main.c.

61 {
62  //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
63 
64  DPRINT("CleanupSoundBlaster() called\n");
65 
66  Irp->IoStatus.Status = STATUS_SUCCESS;
67  Irp->IoStatus.Information = 0;
68 
70 
71  return STATUS_SUCCESS;
72 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ CloseSoundBlaster()

NTSTATUS NTAPI CloseSoundBlaster ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 41 of file main.c.

44 {
45  //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
46 
47  DPRINT("CloseSoundBlaster() called\n");
48 
49  Irp->IoStatus.Status = STATUS_SUCCESS;
50  Irp->IoStatus.Information = 0;
51 
53 
54  return STATUS_SUCCESS;
55 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ ControlSoundBlaster()

NTSTATUS NTAPI ControlSoundBlaster ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 75 of file main.c.

78 {
80  //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
81 
82  DPRINT("ControlSoundBlaster() called\n");
83 
85 
86  switch ( stack->Parameters.DeviceIoControl.IoControlCode)
87  {
88  /* TODO */
89  };
90 
91  Irp->IoStatus.Status = STATUS_SUCCESS;
92  Irp->IoStatus.Information = 0;
93 
95 
96  return STATUS_SUCCESS;
97 }
static stack_node_t * stack
Definition: rpn_ieee.c:37
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
Definition: _stack.h:47
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ CreateDeviceName()

NTSTATUS CreateDeviceName ( PCWSTR  PrePrefix,
PCWSTR  Prefix,
UCHAR  Index,
PUNICODE_STRING  DeviceName 
)

Definition at line 321 of file main.c.

326 {
328  WCHAR number_buffer[5];
329  UNICODE_STRING unicode_pre_prefix;
330  UNICODE_STRING unicode_prefix;
331  ULONG size;
332 
333  RtlInitUnicodeString(&unicode_pre_prefix, PrePrefix);
334  RtlInitUnicodeString(&unicode_prefix, Prefix);
335 
336  size = unicode_pre_prefix.Length +
337  unicode_prefix.Length +
338  sizeof(number_buffer) +
339  sizeof(UNICODE_NULL);
340 
342  DeviceName->MaximumLength = (USHORT) size;
343 
344  if ( ! DeviceName->Buffer )
346 
347  RtlCopyUnicodeString(DeviceName, &unicode_pre_prefix);
348  RtlAppendUnicodeStringToString(DeviceName, &unicode_prefix);
349 
350  if ( Index != 255 )
351  {
352  number.Buffer = number_buffer;
353  number.MaximumLength = sizeof(number_buffer);
354 
357  }
358 
359  DeviceName->Buffer[DeviceName->Length / sizeof(UNICODE_NULL)] = UNICODE_NULL;
360 
361  return STATUS_SUCCESS;
362 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define UNICODE_NULL
static size_t double number
Definition: printf.c:69
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ WDFCOLLECTION _In_ ULONG Index
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by InitializeSoundBlaster().

◆ CreateSoundBlaster()

NTSTATUS NTAPI CreateSoundBlaster ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 21 of file main.c.

24 {
25  PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
26 
27  DPRINT("CreateSoundBlaster() called - extension 0x%x\n", sb_device);
28 
29  EnableSpeaker(sb_device);
30  /*SetOutputSampleRate(sb_device, 22*/
31 
32  Irp->IoStatus.Status = STATUS_SUCCESS;
33  Irp->IoStatus.Information = 0;
34 
36 
37  return STATUS_SUCCESS;
38 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN EnableSpeaker(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:158
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 469 of file main.c.

472 {
474 
475  DPRINT("Sound Blaster driver 0.1 by Silver Blade\n");
476 
477  DriverObject->Flags = 0;
479  DriverObject->MajorFunction[IRP_MJ_CLOSE] = CloseSoundBlaster;
482  DriverObject->MajorFunction[IRP_MJ_WRITE] = WriteSoundBlaster;
483  DriverObject->DriverUnload = UnloadSoundBlaster;
484 
485  DPRINT("Beginning device key enumeration\n");
486 
488 
489  return status;
490 }
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI UnloadSoundBlaster(PDRIVER_OBJECT DriverObject)
Definition: main.c:117
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
NTSTATUS NTAPI ControlSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: main.c:75
NTSTATUS NTAPI CloseSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: main.c:41
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
NTSTATUS NTAPI CleanupSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: main.c:58
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define EnumerateDeviceKeys(path, callback, driver_obj)
Definition: main.c:316
NTSTATUS NTAPI CreateSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: main.c:21
NTSTATUS NTAPI WriteSoundBlaster(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: main.c:100
#define IRP_MJ_CLEANUP
NTSTATUS NTAPI InitializeSoundBlaster(PDRIVER_OBJECT DriverObject, PWSTR RegistryPath)
Definition: main.c:365
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
static SERVICE_STATUS status
Definition: service.c:31
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
Definition: ps.c:97

◆ EnumerateSubkey()

NTSTATUS NTAPI EnumerateSubkey ( PUNICODE_STRING  RegistryPath,
PWSTR  Subkey,
PREGISTRY_CALLBACK_ROUTINE  Callback,
PDRIVER_OBJECT  DriverObject 
)

Definition at line 213 of file main.c.

218 {
220  UNICODE_STRING subkey_name;
221  HANDLE devices_key_handle;
222 
223  ULONG key_index = 0;
224  ULONG result_length;
225 
226  status = OpenSubkey(RegistryPath, Subkey, KEY_ENUMERATE_SUB_KEYS, &devices_key_handle);
227 
228  if ( ! NT_SUCCESS(status) )
229  return status;
230 
231  while ( TRUE )
232  {
235  ULONG size;
236  PWSTR name;
237 
238  status = ZwEnumerateKey(devices_key_handle,
239  key_index,
241  &test_info,
242  sizeof(test_info),
243  &result_length);
244 
246  break;
247 
248  size = result_length + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
249 
251 
252  if ( ! info )
253  {
254  DPRINT("Out of memory\n");
256  break;
257  }
258 
259  status = ZwEnumerateKey(devices_key_handle,
260  key_index,
262  info,
263  size,
264  &result_length);
265 
266  if ( ! NT_SUCCESS(status) )
267  {
268  DPRINT("Unable to enumerate keys\n");
271  break;
272  }
273 
274  /* Is this ok? */
275  RtlInitUnicodeString(&subkey_name, Subkey);
276 
278 
279  if ( ! name )
280  {
281  DPRINT("Out of memory\n");
284  break;
285  }
286 
288 
289  /* Call the callback */
291 
293 
294  if ( ! NT_SUCCESS(status) )
295  {
296  DPRINT("Callback FAILED\n");
297  break;
298  }
299 
300  key_index ++;
301  }
302 
303  ZwClose(devices_key_handle);
304 
305  DPRINT("Found %d subkey entries\n", key_index);
306 
307  if ( ( key_index == 0 ) && ( status == STATUS_NO_MORE_ENTRIES ) )
309 
312 
313  return status;
314 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
const char * name
Definition: main.c:224
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define FreeRegistryPathInfo(ptr)
Definition: main.c:205
struct _KEY_BASIC_INFORMATION * PKEY_BASIC_INFORMATION
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
GLsizeiptr size
Definition: glext.h:5919
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PWSTR NTAPI AllocateRegistryPathInfo(PUNICODE_STRING BasePath, PUNICODE_STRING ParametersPath, PKEY_BASIC_INFORMATION KeyInfo)
Definition: main.c:167
struct _test_info info[]
Definition: SetCursorPos.c:19
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define TAG_REG_INFO
Definition: main.c:209
static void test_info(void)
Definition: eventlog.c:131
NTSTATUS NTAPI OpenSubkey(PUNICODE_STRING RegistryPath, PWSTR Subkey, ACCESS_MASK DesiredAccess, OUT HANDLE *DevicesKeyHandle)
Definition: main.c:124
Definition: name.c:38
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:619
static SERVICE_STATUS status
Definition: service.c:31
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
Definition: ps.c:97

◆ InitializeSoundBlaster()

NTSTATUS NTAPI InitializeSoundBlaster ( PDRIVER_OBJECT  DriverObject,
PWSTR  RegistryPath 
)

Definition at line 365 of file main.c.

368 {
370  PDEVICE_OBJECT device_object;
371  PSOUND_BLASTER_PARAMETERS parameters = NULL;
373  UNICODE_STRING dos_device_name;
374 
375  UCHAR device_index = 0;
376 
377  DPRINT("Initializing a Sound Blaster device\n");
378 
379  /* Change these later */
381  L"\\Device\\WaveOut",
382  device_index,
383  &device_name);
384 
385  if ( ! NT_SUCCESS(status) )
386  return status;
387 
388  status = CreateDeviceName(L"\\DosDevices\\",
389  L"\\Device\\WaveOut" + wcslen(L"\\Device\\"),
390  device_index,
391  &dos_device_name);
392 
393  if ( ! NT_SUCCESS(status) )
394  {
395  /* TODO */
396  return status;
397  }
398 
399  DPRINT("Device: %wZ\n", &device_name);
400  DPRINT("Symlink: %wZ\n", &dos_device_name);
401 
402  /*
403  Create the device and DOS symlink
404  */
405 
407  sizeof(SOUND_BLASTER_PARAMETERS),
408  &device_name,
410  0,
411  FALSE,
412  &device_object);
413 
414  if ( ! NT_SUCCESS(status) )
415  return status;
416 
417  DPRINT("Created a device extension at 0x%x\n", device_object->DeviceExtension);
418  parameters = device_object->DeviceExtension;
419 
420  status = IoCreateSymbolicLink(&dos_device_name, &device_name);
421 
422  ExFreePool(dos_device_name.Buffer);
423  ExFreePool(device_name.Buffer);
424 
425  if ( ! NT_SUCCESS(status) )
426  {
427  IoDeleteDevice(device_object);
428  device_object = NULL;
429  return status;
430  }
431 
432  /* IoRegisterShutdownNotification( */
433 
434  /*
435  Settings
436  */
437 
438  device_object->AlignmentRequirement = FILE_BYTE_ALIGNMENT;
439 
440  parameters->driver = DriverObject;
441  parameters->registry_path = RegistryPath;
442  parameters->port = DEFAULT_PORT;
443  parameters->irq = DEFAULT_IRQ;
444  parameters->dma = DEFAULT_DMA;
445  parameters->buffer_size = DEFAULT_BUFFER_SIZE;
446 
447  /* TODO: Load the settings from the registry */
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 
453  if ( ! ResetSoundBlaster(parameters) )
454  {
455  /* TODO */
456  return STATUS_UNSUCCESSFUL;
457  }
458 
459  /*
460  DPRINT("What kind of SB card is this?\n");
461  GetSoundBlasterModel(parameters);
462  */
463 
464  return STATUS_SUCCESS;
465 }
#define FILE_BYTE_ALIGNMENT
Definition: nt_native.h:786
#define DEFAULT_PORT
Definition: mpu401.h:19
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
static const WCHAR device_name[]
Definition: btrfs.c:63
NTSTATUS CreateDeviceName(PCWSTR PrePrefix, PCWSTR Prefix, UCHAR Index, PUNICODE_STRING DeviceName)
Definition: main.c:321
#define FALSE
Definition: types.h:117
#define DEFAULT_DMA
Definition: sndblst.h:14
BOOLEAN ResetSoundBlaster(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:59
PVOID DeviceExtension
Definition: env_spec_w32.h:418
void DPRINT(...)
Definition: polytest.cpp:61
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
#define FILE_DEVICE_SOUND
Definition: winioctl.h:134
#define DEFAULT_BUFFER_SIZE
Definition: sndblst.h:15
PDRIVER_OBJECT driver
Definition: sndblst.h:58
ULONG AlignmentRequirement
Definition: env_spec_w32.h:420
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define DEFAULT_IRQ
Definition: mpu401.h:20
#define NULL
Definition: types.h:112
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)
Definition: device.c:1031
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
Definition: ps.c:97

Referenced by DriverEntry().

◆ OpenSubkey()

NTSTATUS NTAPI OpenSubkey ( PUNICODE_STRING  RegistryPath,
PWSTR  Subkey,
ACCESS_MASK  DesiredAccess,
OUT HANDLE DevicesKeyHandle 
)

Definition at line 124 of file main.c.

129 {
132  UNICODE_STRING subkey_name;
133  HANDLE key_handle;
134 
135  /* TODO: Check for NULL ptr in DevicesKeyHandle */
136 
138  RegistryPath,
140  NULL,
142 
143  status = ZwOpenKey(&key_handle, KEY_READ, &attribs);
144 
145  if ( ! NT_SUCCESS(status) )
146  {
147  DPRINT("Couldn't open key %wZ\n", RegistryPath);
148  return status;
149  }
150 
151  RtlInitUnicodeString(&subkey_name, Subkey);
152 
154  &subkey_name,
156  key_handle,
158 
159  status = ZwOpenKey(*DevicesKeyHandle, DesiredAccess, &attribs);
160  ZwClose(key_handle);
161 
162  return status;
163 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
const GLint * attribs
Definition: glext.h:10538
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NULL
Definition: types.h:112
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by EnumerateSubkey().

◆ UnloadSoundBlaster()

VOID NTAPI UnloadSoundBlaster ( PDRIVER_OBJECT  DriverObject)

Definition at line 117 of file main.c.

119 {
120  DPRINT("Sound Blaster driver unload\n");
121 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by DriverEntry().

◆ WriteSoundBlaster()

NTSTATUS NTAPI WriteSoundBlaster ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 100 of file main.c.

103 {
104  //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
105 
106  DPRINT("WriteSoundBlaster() called\n");
107 
108  Irp->IoStatus.Status = STATUS_SUCCESS;
109  Irp->IoStatus.Information = 0;
110 
112 
113  return STATUS_SUCCESS;
114 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().