Discussion in 'Windows Vista Drivers' started by Tom Udale, Dec 15, 2003.

  1. Tom Udale

    Tom Udale Guest

    I am trying to use KSPROPERTY_TYPE_BASICSUPPORT in a ksproxy plugin to
    retrieve the full KSPROPERTY_MEMBERSLIST information I set in the
    driver. The driver sets two member list items, each with one member.
    The first is a KSPROPERTY_STEPPING_LONG with the range for the
    parameter, the second is a default value.

    In the plugin, I call IKsControl->KsProperty twice. The first time to
    get the full KSPROPERTY_DESCRIPTION size, the second time to get the
    KSPROPERTY_DESCRIPTION.MembersListCount value is coming back as two, but
    I am running out of data before I get to the second
    the following KSPROPERTY_STEPPING_LONG but that is it.

    I could understand if they are going to filter out the default values
    since I think there is a second method of getting those, but should they
    not set KSPROPERTY_DESCRIPTION.MembersListCount value to 1 in that case?

    Perhaps there is some trouble in the code (which would not surprise me
    since I can find only the most cursory documentation for

    I included the code below.

    Tom Udale

    ULONG sz;

    cmd.Set = PROPSETID_VI80U_CTRL;
    cmd.Id = prpID;

    size_t buffSz=desc.DescriptionSize;
    unsigned char* buff=(unsigned char*)malloc(buffSz);

    Tom Udale, Dec 15, 2003
    1. Advertisements

  2. Tom Udale

    Max Paklin Guest


    I am too lazy to check all details of your message and code. They appear to
    be fine, but there could be a little problem somewhere that I missed.

    Below I put the code that I used some time ago. I remember it was working
    fine. It might be of some help to you.

    KSIDENTIFIER ksIdentifier;
    ksIdentifier.Set = gGet;
    ksIdentifier.Id = dwPropId;

    BYTE btOutBuffer[512];
    DWORD dwReturned;
    hResult = KsSynchronousDeviceControl(
    sizeof( ksIdentifier ),
    sizeof( btOutBuffer ),
    &dwReturned );

    if( SUCCEEDED( hResult ) )
    PBYTE pPointer;

    // Output buffer will contain data of KSPROPERTY_DESCRIPTION
    pPropDesc = reinterpret_cast< PKSPROPERTY_DESCRIPTION >(
    btOutBuffer );

    // KSPROPERTY_DESCRIPTION is followed by
    // structure(s) and each of this KSPROPERTY_MEMBERSHEADER may in
    // be followed by a number of values structure(s). If the
    // then it's our guy of a type KSPROPERTY_STEPPING_LONG
    pPointer = &btOutBuffer[sizeof( KSPROPERTY_DESCRIPTION )];
    pHeader = reinterpret_cast< PKSPROPERTY_MEMBERSHEADER >(
    pPointer );

    for( UINT i = 0; i < pPropDesc->MembersListCount; i++ )
    BOOL bFound = FALSE;

    for( UINT j = 0; j < pHeader->MembersCount; j++ )
    if( pHeader->MembersFlags !=

    pPointer = reinterpret_cast< PBYTE >( pHeader+1 ) +
    pBounds = reinterpret_cast< PKSPROPERTY_STEPPING_LONG
    *pMin = pBounds->Bounds.SignedMinimum;
    *pMax = pBounds->Bounds.SignedMaximum;

    bFound = TRUE;

    if( bFound )

    // Take the size of structures of values
    int nSize = pHeader->MembersCount*pHeader->MembersSize;
    // Skip current header

    // Skip all the value structures after header
    pPointer = reinterpret_cast< PBYTE >( pHeader ) + nSize;
    pHeader = reinterpret_cast< PKSPROPERTY_MEMBERSHEADER >(
    pPointer );

    -- Max.
    Max Paklin, Dec 15, 2003
    1. Advertisements

  3. Tom Udale

    Tom Udale Guest


    Thanks alot for the code. You did the same thing as me. Ironically,
    your code would run without complaint in my situation.

    You are not checking if the values in pHeader make any sense if
    pHeader->MembersFlags !=KSPROPERTY_MEMBER_STEPPEDRANGES, which makes
    sense in this application . Since your 512 buffer is pretty huge, you
    would never notice (due to a GP fault, for example) if you were chewing
    through more than dwReturned worth of data.

    Since yours works one of two things must be happening

    a) your KSPROPERTY_MEMBER_STEPPEDRANGES as the first member list item in
    the driver (which I get the sense is common). Thus your search it
    always found it on the first time through the i loop or

    b) whoever is implementing KSPROPERTY_TYPE_BASICSUPPORT is doing a
    better job than in my case and is actually returning
    pPropDesc->MembersListCount worth of data after the
    Was this a stream or avstream driver?

    So, unfortunately, I still cannot tell if the problem I am having is due
    to my driver or the stream class code. I looked over the
    KSPROPERTY_VALUES for these properties and they look fine.

    I will keep looking (try multiple ranges KSPROPERTY_MEMBER_STEPPEDRANGES
    and what-not).



    (BTW it looks like there is something odd going on in your j loop. The
    conditional is a loop invarient....)

    Tom Udale, Dec 16, 2003
  4. Tom Udale

    Max Paklin Guest

    Tom, see my comments inline.

    That's why my quick look at your code did not reveal anything obvious.

    Sure, it never intended to be as production quality stuff. Actually even
    more, this code has never been shipped. I just used it in one of internal
    test applications. It worked fine with our driver, therefore I never
    bothered to check if the code was good enough in general.

    Yep. It was always the first one.

    That was for Stream Class based minidriver.
    However these services should be provided by KS, not Stream Class, so it
    should make no difference if AVStream were to be used.

    If you haven't check yet, see TestCap sample in the DDK. I think it uses
    XXX_STEPPEDRANGES. Also check ATI samples for All-in-Wonder.

    -- Max.

    Max Paklin, Dec 16, 2003
  5. Tom Udale

    Tom Udale Guest

    I see. I will putter around with it tomorrow and see how things behave
    with multiple ranges or perhaps I will try some values. It is either a
    bug in my code (likely) or some oddity in KS with either multiple member
    range items (hard to believe) or when one of the member range items is a
    default value.

    BTW, it took me a million years to figure this out and it still confuses
    the hell out of me: avstream is often described as a layer on top of ks
    (like stream class to which it is often compared and contrasted), but it
    seems that all the delclarations are in ks.h and it is served up from
    ks.sys. If it is a new layer, why in the world did they not make it
    have its own header (avstrmini.h??) like the stream class got? It
    baffles me when I try to decide what is part of ks, what is part of
    avstream, etc. It is even worse since the functions are not even
    differentiated (eg KsInitializeDriver sounds like ks to me). It is
    almost like some marketing guys got a hold of things and decided to call
    it AVStream instead of KS2 or KS mini-driver extensions or something
    like that. Or am I still completely confused?
    Will do.

    Thanks again,
    Tom Udale, Dec 16, 2003
  6. Tom Udale

    Max Paklin Guest

    BTW, it took me a million years to figure this out and it still confuses
    AVStream is KS 2.0.
    I remember it was KS 2.0 and then somebody came up with that name. I guess
    it was some sort of a marketing trick.
    Max Paklin, Dec 16, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.