Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Sysdriver: How to capture Input data and play user audio application data

245

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    By the way, if "CS_Frame" is a class member variable, then you should think about using the m_ prefix. That's the only remnant of Hungarian notation that I still cling to, just because otherwise it's not clear where the variable is defined.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Yes sir, Now Sysvad's fake mic and speaker is able to communicate with the processing application. I want to get Digital signature for driver in order to avoid test-sign, sir.

    As you suggested earlier, there are two ways to get certification from Microsoft.
    1. WHQL
    2.Attestation signing

    Which service is preferable, sir?. I am completely new to this,sir. And I am learning about this.

    So far :
    I am understanding about HLK installations and tests.
    If the driver has passed all the test cases which are provided by HLK, will it get digital signature,sir?
    Else, I have to submit the package after test to dashboard.

     Can you guide me the way to get certification!!!!! Or Please paste any reference link about certification
    

    Thank you

  • DineshDinesh Member Posts: 31

    Yes Peter, thanks for the link.

                  Thank you very much for you support till now, @Tim_Roberts. 
                  Sysvad is working fine with less delay ~60ms delay. But, while installing in some PCs(Windows 10), blue screen error is coming  and not able to load the actual PC. I can able resolve but it should not happen.
    
                    1.Can you please suggest me the test cases to pass for sysvad to confirm whether sysvad is working properly or not. So that I can able to test that on multiple PCs. If any document or link available. Please paste here.
    
                   2.I could able to remove unnecessary mic and speaker pairs. But I am not able to figure out, how to remove APO?
    
    
                     Please post your suggestions for the above!!
    

    Thanks,
    Dinesh

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    ... blue screen error is coming ... I can able resolve but it should not happen.

    No, it shouldn't happen. Are you saying you fixed this, or are you asking for assistance?

    Can you please suggest me the test cases to pass?

    Do you have a test program that routes data through your sysvad and forwards it to/from the system microphone and speakers? If you're getting sound, that's means a lot of stuff is working. Does your device look like a real device in the sound control panel? There are WHQL tests for audio devices, if you want to go that far. They have some very picky requirements for latency and response time.

    I could able to remove unnecessary mic and speaker pairs. But I am not able to figure out, how to remove APO?

    Why do you have to remove anything? Where did these come from? Are you saying you don't know how to eliminate the APO from the sysvad installation package? APOs are all about the registry. If you remove their registration parts from the INF, then they won't be installed.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31
    Thanks sir,

    No, it shouldn't happen. Are you saying you fixed this, or are you asking for assistance?

    Doing some efforts after blue screen, I could able to load my os. But, my question was how to avoid blue screen. As of now, it is working fine.


    As per attestation signing:
    I have read documents about it and got to know the steps. I want to know about the validity of signature of driver. Once the driver got signature, can I use the driver for a life time or renew the digital sign of driver after some period of time.

    If I am not wrong, driver signature time validity does not depend on EV certificate validity. And, we have to renew the ev certificate after it has expired.

    Can you tell me about it sir!!! I dont have any prior experience.
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,113

    driver signature time validity does not depend on EV certificate validity

    This is correct.

    The EV Cert only has to be valid at the time it was used to sign the driver (package). That's one reason you time-stamp your signature. If the cert later expires, that's fine. The signature on the driver demonstrates that the owner of the EV Cert created/signed the driver on the specified date, and as of that date, the certificate was valid and therefore (as of that date) the owner of the EV Cert was known and "trusted" (within the limits of the word "trust" that apply to EV Certs... let's not debate this fellows, OK?)

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • DineshDinesh Member Posts: 31

    Thank you for your explanation,sir

  • DineshDinesh Member Posts: 31

    Hi Sir,

    I am able to configure sysvad fake mic and speaker for multiple audio applications. For example, In VLC media player I can adjust the volume at volume control. But I am not able to adjust the volume in control panel. Since we cannot adjust volume in all audio applications, I want to adjust the volume from control panel. To get that, anything to be added to driver, sir.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    Are you handling volume controls in your fake microphone and speaker? Sysvad advertises support for volume and mute, but it doesn't do anything with them. The EASIEST thing to do is to remove the volume and mute nodes from your topology entirely. If a device does not advertise mute and volume, then the Audio Engine will provide them and handle it automatically.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Yes sir, But, nodes are already NULL in given topology. Is below function you were suggesting me delete?Otherwise, can you paste here the function name, which needs to be deleted

    //=============================================================================
    static
    PCFILTER_DESCRIPTOR SpeakerTopoMiniportFilterDescriptor =
    {
    0, // Version
    &AutomationSpeakerTopoFilter, // AutomationTable
    sizeof(PCPIN_DESCRIPTOR), // PinSize
    SIZEOF_ARRAY(SpeakerTopoMiniportPins), // PinCount
    SpeakerTopoMiniportPins, // Pins
    sizeof(PCNODE_DESCRIPTOR), // NodeSize
    0, // NodeCount
    NULL, // Nodes
    SIZEOF_ARRAY(SpeakerTopoMiniportConnections), // ConnectionCount
    SpeakerTopoMiniportConnections, // Connections
    0, // CategoryCount
    NULL // Categories
    };

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    Sigh. Do you know how KS properties work? The client asks, "do you support this?," and if you say yes, it know it can use the property. So, you need to find where it is responding to KSPROPERTY_AUDIO_VOLUMELEVEL and stop it from doing so.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Thank You sir for helping me out,

         All voulme controls are working fine. I got the attestation signing for the driver and it is getting installed in few win10 x64 laptops and working properly. But in few systems, even it is installed, virtual audio driver is not visible in Volume control.
    

    My Virtual Driver name is ClearVoiceMvns
    In device manager the under** sound&Volume&cgame controller** . It is in yellow mark. And in details of the driver, it is error number 52. And it is not able to recognize the digital signature.

    Windows cannot verify the digital signature for the drivers required for this device. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. (Code 52)

    As I searched in net, it is because of windows software updates. After disabling secure boot, it is working properly.
    Can you suggest me any way, so that it can able to recognize the digital sign without disabling the secure boot?

    Advance Thanks

  • DineshDinesh Member Posts: 31

    HI sir, I could able to resolve that signing problem by referring some forums.

    Can we change sysvad speaker and mic icon using programically or inf file? or Any other is way has to be followed. can you suggest me,sir

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    Nope. That's assigned per device class.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Nope. That's assigned per device class

    Yes, Can we create some dll for icon so that it will appear with our device after installation? I am trying, but not able to get any idea how to get an icon for my device. Can you give me some insights?

    In the installation time itself I wanted to use my .ico file instead of default device's icon. I don't have idea how dll can interact with our driver for icon. If you have any procedure,please share with us.

    Advance Thanks

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    The answer is still "nope".

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Yeah..Got that after referring some forums ....

    we installed on many build versions of windows and running successfully but
    while installing in windows which is having Portcls.sys of 10.0.10240.16384.
    Build Version - 10240
    Even original sysvad is not getting installed in this version.

    we are getting this error
    IID_IPortClsStreamResourceManager2 - failed what could be the reason?

    can it be solved by upgrading ? or Any other solution..

    Thanks

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    10240 is the original release of Windows 10. It is extremely unlikely that you will find any of those in the wild. Microsoft's aggressive upgrade policy ensures that.

    Remember, when you build a driver, you specify in the project file which version you're targeting. If you targeted a later version, it's possible you're using an API that isn't exposed yet. I always build for Windows 8.1 or even Windows 7.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,113

    (not to quibble, but something I myself just discovered: The Enterprise SKU of Windows 1507 — build 10240 — is an LTSB, and is supported through some time in 2025. I kid you not.)

    Peter Viscarola
    OSR
    @OSRDrivers

  • DineshDinesh Member Posts: 31
    edited July 2020

    Yes sir, Sysvad is not getting build for target 10240 version...

    Audio Gain Problem creating By Audio Engine:
    We have given Volume control to the Audio engine by removing mic node as you suggested. Volume controls are working fine.

    My Observations are:
    As we have given volume control to audio engine, it is boosting up the Audio signal after audio is fed to sysvad? Even we record silence, we are able to hear some noise through speakers since some gain is being applied on data. So I assume that audio engine is applying some gain over our audio.

       We captured audio by Inbuilt mic 
       Again, The same data we feed to Virtual Driver using some application(We are not using any gain). Now, Audio gain of both Inbuilt and Virtual Device is not same.
    
    
       How to Bypass gain controller with sysvad or how to set dB  range minimum -96db and maximum 0 db? 
    

    Advance Thanks,
    Dinesh

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    I can't tell what you mean. If you don't supply a volume control, the Audio Engine supplies one, as you say. For a speaker, that volume control is applied before you receive the data. For a microphone, that volume control is supplied after you send the data. It has to be that way.

    If you don't want the system to adjust your microphone output, then add the microphone node back in and ignore the setting.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    If you don't want the system to adjust your microphone output, then add the microphone node back in and ignore the setting

     We added the microphone node back in and controlling the volume by Processing application with wasapi. Its working fine.
    
     Do we need to clean the registry, every time we uninstall the driver? Because we observing the blue screens if we try to install the driver which is uninstalled previously.And if we clean the registry we are getting normal. Or anything is effecting these installation files?,sir
    

    Advance Thanks
    Dinesh

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    You shouldn't need to "clean the registry", whatever that means. If you get a blue screen on a second install, then you have a bug, and you should investigate.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • DineshDinesh Member Posts: 31

    Otherwise in one case:
    If we install without uninstalling previous version, it is crashing ..Whether we can take care this scenario i.e system should not crash and it should throw error like already installed ..in case someone trying this once

    we added in the installation script before installation steps------devcon.exe remove =MEDIA Driver_NAME
    still it is crashing.

    After crash, we cleaned registry then it is working fine, so,any alternative to this case sir. Or,only any bug in driver code is creating this problem?.

  • JackalJackal Member Posts: 3

    Hi Dinesh,

    Sorry for bothering, I'm facing the same problem that you had deal with that I always get error code -2 after calling CreateFile with the audio driver path obtain from CM_Get_Device_Interface_List.
    Would you please share how you resolve this problem? And if possible would you please also share the IOCTL scenes that you use?
    Thanks in advance for your help.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    I always get error code -2

    Windows does not use negative error numbers. Do you mean error code 2, ERROR_FILE_NOT_FOUND? One common newbie mistake that can lead to that is to fetch the file name as Unicode and try to pass it to CreateFileA, or vice versa. Perhaps you should show us the code where you call CM_Get_Device_Interface_List and CreateFile.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • JackalJackal Member Posts: 3

    Hi Tim,

    Yes, you are right, that is a mistake and I mean error code 2 ERROR_FILE_NOT_FOUND as you mention, thanks for you correction.

    And here is the code pieces I use to get the file name and attempt to open it.

    int FindAndOpenDevice(void)
    {
        GUID guid = { 0x96b4c8f2L, 0xeb14, 0x4a80, 0xa6, 0x11, 0x07, 0xfa, 0xc1, 0x07, 0x29, 0xa8 };
        CONFIGRET cr;
        PWSTR DeviceInterfaceList = NULL;
        ULONG DeviceInterfaceListLength = 0;
    
        cr = CM_Get_Device_Interface_List_Size(
            &DeviceInterfaceListLength,
            &guid,
            NULL,
            CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES
        );
    
        if (cr != CR_SUCCESS) {
            wprintf(L"fail to get interface list size\n");
            return -1;
        }
    
        DeviceInterfaceList = (PWSTR)HeapAlloc(
            GetProcessHeap(),
            HEAP_ZERO_MEMORY,
            DeviceInterfaceListLength * sizeof(WCHAR));
    
        if (DeviceInterfaceList == NULL) {
            wprintf(L"allocate interface list buffer fail\n");
            return -2;
        }
    
        cr = CM_Get_Device_Interface_List(
            &guid,
            NULL,
            DeviceInterfaceList,
            DeviceInterfaceListLength,
            CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES);
    
        if (cr != CR_SUCCESS) {
            wprintf(L"fail to get interface list\n");
            return -3;
        }
    
        wprintf(L"%s\n", DeviceInterfaceList);
    
        HANDLE hDev = INVALID_HANDLE_VALUE;
    
        hDev = CreateFile(
            DeviceInterfaceList,
            FILE_GENERIC_READ,
            0,
            NULL,
            OPEN_EXISTING,
            0,
            NULL
        );
    
        if (hDev == INVALID_HANDLE_VALUE) {
            wprintf(L"fail to open device (0x%X)\n", GetLastError());
            return -4;
        }
    
        CloseHandle(hDev);
    }
    

    Through above function, I will get the console output (compiled with Unicode character set)

    \\?\ROOT#MEDIA#0001#{96b4c8f2-eb14-4a80-a611-07fac10729a8}
    fail to open device (0x2)

    I also try to execute the program as administrator, but it looks no difference.
    Please advise me if there are anything need to check, thank you.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

    Did you call IoSetDeviceInterfaceState in your driver to make the interface active? Are you intercepting IRP_MJ_CREATE in your driver so you can handle these opens? The default Port Class handler expects other information after the file name and won't know what to do with this.

    You probably want to pass FILE_GENERIC_READ|FILE_GENERIC_WRITE, assuming you'll need to send data in both directions.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • JackalJackal Member Posts: 3

    Hi Tim,

    I did call IoSetDeviceInterfaceState to activate the interface right after calling IoRegisterDeviceInterface.
    But i guess i had missing the intercepting IRP_MJ_CREATE part, I will make this part up and check whether the issue gone.
    Thank you very much for your valuable advice.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online
Internals & Software Drivers 4-8 Dec 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online