hidd_freepreparseddata (hid)
Last changed: -217.132.111.188

.
Summary
The routine releases the resources that the HID class driver allocated to hold a top-level collection's preparsed data.

C# Signature:

[DllImport("hid.dll", SetLastError=true)]
static extern Boolean HidD_FreePreparsedData(IntPtr PreparsedData);

VB Signature:

Declare Function HidD_FreePreparsedData Lib "hid.dll" (ByRef PreparsedData As Integer) As Boolean

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Return Value - Returns TRUE if the routine succeeds. Otherwise, it returns FALSE if the buffer was not a preparsed data buffer.

Tips & Tricks:

Please add some!

Sample Code:

Code In C#:

    internal HIDP_CAPS GetDeviceCapabilities( SafeFileHandle hidHandle )
    {        
        Byte[] preparsedDataBytes = new Byte[ 30 ];
        String preparsedDataString = null;
        IntPtr preparsedDataPointer = new System.IntPtr();
        Int32 result = 0;
        Boolean success = false;
        Byte[] valueCaps = new Byte[ 1024 ]; // (the array size is a guess)

        try
        {        

        success = HidD_GetPreparsedData( hidHandle, ref preparsedDataPointer );

        //  Copy the data at PreparsedDataPointer into a byte array.

        preparsedDataString = Convert.ToBase64String( preparsedDataBytes );

        result = HidP_GetCaps( preparsedDataPointer, ref Capabilities );
        if ( ( result != 0 ) )
        {            
            result = HidP_GetValueCaps(HidP_Input, ref valueCaps[0], ref Capabilities.NumberInputValueCaps, preparsedDataPointer);

            success = HidD_FreePreparsedData( ref preparsedDataPointer );            
        }        
        }
        catch ( Exception ex )
        {
        DisplayException( MODULE_NAME, ex );
        throw ;
        }

        return Capabilities;        
    }

Documentation