[wdmaudiodev] regedit does not show entries even though ZwCreateKey returns success

  • From: Surabhi Ghaisas <ghaisas.surabhi@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Wed, 7 Mar 2012 09:03:16 +0530

Hi,

I am working on a wavert miniport driver . I need to register for Friendly
name and pull mode event notification from driver instead of inf. I have
written code below for the same. All the calls are returning status
success, but if i search for guid corresponding to pull mode or even the
friendly name i have registered in registry (opened with regedit) i am not
finding any entries. Same thing when done for inf, i see entries in
registry. Have i missed any setting in code below?


WCHAR PKEY_AudioEndpoint_Supports_EventDriven_Mode[] = L
"{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},7";

WCHAR PKEY_AudioEndpoint_Association[] = L
"{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2";

RtlInitUnicodeString (&ValueName, L"CLSID");

RtlInitUnicodeString (&ValueName1, L"FriendlyName");

RtlInitUnicodeString (&ValueName2, PKEY_AudioEndpoint_Association);

RtlInitUnicodeString (&ValueName3,
PKEY_AudioEndpoint_Supports_EventDriven_Mode);

ntStatus = IoRegisterDeviceInterface(pSstPdo,

&KSCATEGORY_AUDIO,

&FriendlyName,

&ustrTopoAudio);

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "Failed to register topology miniport
under KSCATEGORY_AUDIO\n");

ASSERT(FALSE);

}

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ustrTopoAudio %wZ\n",&ustrTopoAudio);

 ntStatus = IoOpenDeviceInterfaceRegistryKey (&ustrTopoAudio,
KEY_ALL_ACCESS, &hKey);

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "IoOpenDeviceInterfaceRegistryKey failed
0x%x\n",ntStatus);

ASSERT(FALSE);

}

 ntStatus = ZwSetValueKey (hKey, &ValueName, 0, REG_SZ, strCLSIDProxy,
sizeof(strCLSIDProxy));

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwSetValueKey failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

ntStatus = ZwSetValueKey (hKey, &ValueName1, 0, REG_SZ,
FriendlyName.Buffer, FriendlyName.Length + sizeof(UNICODE_NULL));

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwSetValueKey failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

RtlInitUnicodeString (&ObjectName, L"MSFEP");

InitializeObjectAttributes(&InitializedAttributes,

&ObjectName,

OBJ_OPENIF|OBJ_CASE_INSENSITIVE,

hKey,

NULL);

ntStatus = ZwCreateKey(&KeyHandle,

KEY_ALL_ACCESS,

&InitializedAttributes,

0,

NULL,

REG_OPTION_NON_VOLATILE,

&Disposition);

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwCreateKey failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

RtlInitUnicodeString (&ObjectName1, L"0");

InitializeObjectAttributes(&InitializedAttributes,

&ObjectName1,

OBJ_OPENIF|OBJ_CASE_INSENSITIVE,

KeyHandle,

NULL);

ntStatus =ZwCreateKey(&KeyHandle1,

KEY_ALL_ACCESS,

&InitializedAttributes,

0,

NULL,

REG_OPTION_NON_VOLATILE,

&Disposition);

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwCreateKey failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

ntStatus = ZwSetValueKey(KeyHandle1, &ValueName2, 0, REG_NONE,
&strKSNODETYPE_ANY, sizeof(strKSNODETYPE_ANY));

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwSetValueKey for endpoint association
failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

ntStatus = ZwSetValueKey(KeyHandle1, &ValueName3, 0, REG_DWORD, &value,
sizeof(value));

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "ZwSetValueKey for event driven support
failed 0x%x\n",ntStatus);

ASSERT(FALSE);

}

ntStatus = IoSetDeviceInterfaceState(&ustrTopoAudio,TRUE);

if(!NT_SUCCESS(ntStatus))

{

DbgPrintEx( DPFLTR_IHVAUDIO_ID, 0, "IoSetDeviceInterfaceState failed 0x%x\n"
,ntStatus);

ASSERT(FALSE);

}

if(KeyHandle)

ZwClose (KeyHandle);

if(KeyHandle1)

ZwClose (KeyHandle1);

if(hKey)

ZwClose (hKey);



Appreciat your response.



Regards,

Sag

Other related posts: