diff options
Diffstat (limited to 'audio/sysvad/adapter.cpp')
| -rw-r--r-- | audio/sysvad/adapter.cpp | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/audio/sysvad/adapter.cpp b/audio/sysvad/adapter.cpp index ef48e5f4..0f44c593 100644 --- a/audio/sysvad/adapter.cpp +++ b/audio/sysvad/adapter.cpp @@ -246,10 +246,10 @@ _Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH PnpHandler; // -// Rendering streams are saved to a file by default. Use the registry value -// DoNotCreateDataFiles (DWORD) > 0 to override this default. +// Rendering streams are not saved to a file by default. Use the registry value +// DoNotCreateDataFiles (DWORD) = 0 to override this default. // -DWORD g_DoNotCreateDataFiles = 0; // default is off. +DWORD g_DoNotCreateDataFiles = 1; // default is off. DWORD g_DisableToneGenerator = 0; // default is to generate tones. UNICODE_STRING g_RegistryPath; // This is used to store the registry settings path for the driver @@ -425,7 +425,8 @@ Returns: { NTSTATUS ntStatus; - UNICODE_STRING parametersPath; + PDRIVER_OBJECT DriverObject; + HANDLE DriverKey; RTL_QUERY_REGISTRY_TABLE paramTable[] = { // QueryRoutine Flags Name EntryContext DefaultType DefaultData DefaultLength { NULL, RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK, L"DoNotCreateDataFiles", &g_DoNotCreateDataFiles, (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_DWORD, &g_DoNotCreateDataFiles, sizeof(ULONG)}, @@ -441,29 +442,27 @@ Returns: DPF(D_TERSE, ("[GetRegistrySettings]")); - PAGED_CODE(); - - RtlInitUnicodeString(¶metersPath, NULL); + PAGED_CODE(); + UNREFERENCED_PARAMETER(RegistryPath); - parametersPath.MaximumLength = - RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(WCHAR); + DriverObject = WdfDriverWdmGetDriverObject(WdfGetDriver()); + DriverKey = NULL; + ntStatus = IoOpenDriverRegistryKey(DriverObject, + DriverRegKeyParameters, + KEY_READ, + 0, + &DriverKey); - parametersPath.Buffer = (PWCH) ExAllocatePool2(POOL_FLAG_PAGED, parametersPath.MaximumLength, MINADAPTER_POOLTAG); - if (parametersPath.Buffer == NULL) + if (!NT_SUCCESS(ntStatus)) { - return STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; } - RtlAppendUnicodeToString(¶metersPath, RegistryPath->Buffer); - RtlAppendUnicodeToString(¶metersPath, L"\\Parameters"); - - ntStatus = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL, - parametersPath.Buffer, - ¶mTable[0], - NULL, - NULL - ); + ntStatus = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR) DriverKey, + ¶mTable[0], + NULL, + NULL); if (!NT_SUCCESS(ntStatus)) { @@ -485,10 +484,10 @@ Returns: DPF(D_VERBOSE, ("DisableUsbSideband: %u", g_DisableUsbSideband)); #endif // SYSVAD_USB_SIDEBAND - // - // Cleanup. - // - ExFreePool(parametersPath.Buffer); + if (DriverKey) + { + ZwClose(DriverKey); + } return STATUS_SUCCESS; } @@ -537,15 +536,6 @@ Return Value: ntStatus, DPF(D_ERROR, ("Registry path copy error 0x%x", ntStatus)), Done); - - // - // Get registry configuration. - // - ntStatus = GetRegistrySettings(RegistryPathName); - IF_FAILED_ACTION_JUMP( - ntStatus, - DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), - Done); WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK); // @@ -569,6 +559,15 @@ Return Value: Done); // + // Get registry configuration. + // + ntStatus = GetRegistrySettings(RegistryPathName); + IF_FAILED_ACTION_JUMP( + ntStatus, + DPF(D_ERROR, ("Registry Configuration error 0x%x", ntStatus)), + Done); + + // // Tell the class driver to initialize the driver. // ntStatus = PcInitializeAdapterDriver(DriverObject, |
