Why WdfUsbTargetDeviceCreateWithParameters return STATUS_UNSUCCESSFUL?

Aaron 45 信誉分
2026-05-18T09:41:43.45+00:00

Now I have a USB audio device in my hand. When this device is plugged into the computer, the usbaudio.sys driver will be automatically loaded and the device will operate normally.

But now I need to implement some special functions, so I have to develop a custom driver. According to the information I have currently searched, my current implementation plan is to obtain the audio PCM data from the sysvad sample project provided by Microsoft, and then send the data to my USB device. I'm not sure if this plan is feasible.

So far, I have made the following attempts:

Based on the examples of sysvad and usbsamp, I hope to combine these two examples to achieve the functions I need. Currently, I have modified the driver inf file and mounted sysvad onto my USB device. However, sysvad is based on the WDM/portcls framework while usbsamp is based on the WDF framework. Although the sysvad example also uses the WDF framework for assistance, when I called the WdfUsbTargetDeviceCreateWithParameters function in sysvad, I was unable to create a WDFUSBDEVICE object and received the error code STATUS_UNSUCCESSFUL (0xC00000001). However, in Microsoft's official documentation, the WDFDEVICE object created by the WdfDeviceMiniportCreate function can be used with the WdfUsbTargetDeviceCreateWithParameters function. I don't know what step I did wrong.

//CAdapterCommon::Init function
// ms demo code
    ntStatus = WdfDeviceMiniportCreate( WdfGetDriver(),
                                        WDF_NO_OBJECT_ATTRIBUTES,
                                        DeviceObject,           // FDO
                                        NULL,                   // Next device.
                                        NULL,                   // PDO
                                        &m_WdfDevice);
    IF_FAILED_ACTION_JUMP(
        ntStatus,
        DPF(D_ERROR, ("WdfDeviceMiniportCreate failed, 0x%x", ntStatus)),
        Done);

// my code
    WDF_USB_DEVICE_CREATE_CONFIG config;
    WDFUSBDEVICE WdfUsbTargetDevice;

    WDF_USB_DEVICE_CREATE_CONFIG_INIT(&config,
        USBD_CLIENT_CONTRACT_VERSION_602);

    WdfUsbTargetDeviceCreateWithParameters(
        m_pWdfDevice,
        &config,
        WDF_NO_OBJECT_ATTRIBUTES,
        &WdfUsbTargetDevice
    );


At present, I don't know if the solution is feasible, nor do I know why the WDFDEVICE object cannot be created. I hope someone can help me.

thanks

开发人员技术 | C++
开发人员技术 | C++

一种通用的高级编程语言,作为 C 编程语言的扩展而创建,除了用于低级别内存操作的功能外,还具有面向对象、泛型和功能性等特点。

0 个注释 无注释

你的答案

提问者可以将答案标记为“已接受”,审查方可以将答案标记为“已推荐”,这有助于用户了解答案是否解决了提问者的问题。