IWDFUsbTargetPipe::SetPipePolicy method
The SetPipePolicy method sets the WinUsb pipe policy.
Syntax
HRESULT SetPipePolicy( [in] ULONG PolicyType, [in] ULONG ValueLength, [in] PVOID Value );
Parameters
- PolicyType [in]
- 
The type of WinUsb pipe policy that the UMDF driver sets. 
- ValueLength [in]
- 
The size, in bytes, of the buffer that SetPipePolicy supplies for Value. 
- Value [in]
- 
A pointer to the buffer that contains the WinUsb pipe policy. 
Return value
SetPipePolicy returns one of the following values:
| Return code | Description | 
|---|---|
| 
 | SetPipePolicy successfully set the WinUsb pipe policy. | 
| 
 | SetPipePolicy encountered an allocation failure. | 
| 
 | This value corresponds to the error code that the WinUsb API returned. | 
Remarks
Pipe policy controls the behavior of the USB pipe (for example, time-outs, handling short packets, and so on).
For more information about valid policy types and values that a UMDF driver can pass for the PolicyType and Value parameters, see the WinUsb_SetPipePolicy function.
For information about the behavior of the pipe policies, see WinUSB Functions for Pipe Policy Modification.
The SetPipePolicy method generates a UMDF request and synchronously sends the request to the I/O target.
Examples
The following code example sets policy for input and output pipes.
HRESULT
CMyDevice::ConfigureUsbIoTargets(
    )
{
    HRESULT                 hr;
    USB_INTERFACE_DESCRIPTOR pInterface;
    WINUSB_PIPE_INFORMATION pipe;
    BOOL                    policy;
    DWORD                   err;
    BOOL                    result;
    LONG                    i;
    LONG                    timeout;
    ULONG                   length;
    length = sizeof(UCHAR);
    hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED, 
                                                        &length,
                                                        &m_Speed);
    if (FAILED(hr)) {
        // Print out error.
    }
    if (SUCCEEDED(hr)) {
        // Print out device speed.
    }
    //
    // Set timeout policies for input and output pipes.
    //
    if (SUCCEEDED(hr))  {
       timeout = ENDPOINT_TIMEOUT;
       hr = m_pIUsbInputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
                                            sizeof(timeout),
                                            &timeout);
       if (FAILED(hr)) {
            // Print out cannot set timeout policy for input pipe.
       }
    }
    if (SUCCEEDED(hr))  {
       timeout = ENDPOINT_TIMEOUT;
       hr = m_pIUsbOutputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
                                             sizeof(timeout),
                                             &timeout);
       if (FAILED(hr))  {
            // Print out cannot set timeout policy for output pipe.
       }
    }
 return hr;
}
Requirements
| End of support | Unavailable in UMDF 2.0 and later. | 
|---|---|
| Minimum UMDF version | 1.5 | 
| Header | 
 | 
| DLL | 
 | 
See also

